Commit f2877656 authored by Harry Wentland's avatar Harry Wentland Committed by Alex Deucher

drm/amd/display: Disallow enabling CRTC without primary plane with FB

The below commit

    "drm/atomic: Try to preserve the crtc enabled state in drm_atomic_remove_fb, v2"

introduces a slight behavioral change to rmfb. Instead of disabling a crtc
when the primary plane is disabled, it now preserves it.

Since DC is currently not equipped to handle this we need to fail such
a commit, otherwise we might see a corrupted screen.

This is based on Shirish's previous approach but avoids adding all
planes to the new atomic state which leads to a full update in DC for
any commit, and is not what we intend.

Theoretically DM should be able to deal with states with fully populated planes,
even for simple updates, such as cursor updates. This should still be
addressed in the future.
Signed-off-by: default avatarHarry Wentland <harry.wentland@amd.com>
Tested-by: default avatarMichel Dänzer <michel.daenzer@amd.com>
Reviewed-by: default avatarTony Cheng <Tony.Cheng@amd.com>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent ad64dc01
...@@ -4557,6 +4557,7 @@ static int dm_update_crtcs_state(struct dc *dc, ...@@ -4557,6 +4557,7 @@ static int dm_update_crtcs_state(struct dc *dc,
struct amdgpu_dm_connector *aconnector = NULL; struct amdgpu_dm_connector *aconnector = NULL;
struct drm_connector_state *new_con_state = NULL; struct drm_connector_state *new_con_state = NULL;
struct dm_connector_state *dm_conn_state = NULL; struct dm_connector_state *dm_conn_state = NULL;
struct drm_plane_state *new_plane_state = NULL;
new_stream = NULL; new_stream = NULL;
...@@ -4564,6 +4565,13 @@ static int dm_update_crtcs_state(struct dc *dc, ...@@ -4564,6 +4565,13 @@ static int dm_update_crtcs_state(struct dc *dc,
dm_new_crtc_state = to_dm_crtc_state(new_crtc_state); dm_new_crtc_state = to_dm_crtc_state(new_crtc_state);
acrtc = to_amdgpu_crtc(crtc); acrtc = to_amdgpu_crtc(crtc);
new_plane_state = drm_atomic_get_new_plane_state(state, new_crtc_state->crtc->primary);
if (new_crtc_state->enable && new_plane_state && !new_plane_state->fb) {
ret = -EINVAL;
goto fail;
}
aconnector = amdgpu_dm_find_first_crtc_matching_connector(state, crtc); aconnector = amdgpu_dm_find_first_crtc_matching_connector(state, crtc);
/* TODO This hack should go away */ /* TODO This hack should go away */
...@@ -4760,7 +4768,7 @@ static int dm_update_planes_state(struct dc *dc, ...@@ -4760,7 +4768,7 @@ static int dm_update_planes_state(struct dc *dc,
if (!dm_old_crtc_state->stream) if (!dm_old_crtc_state->stream)
continue; continue;
DRM_DEBUG_DRIVER("Disabling DRM plane: %d on DRM crtc %d\n", DRM_DEBUG_ATOMIC("Disabling DRM plane: %d on DRM crtc %d\n",
plane->base.id, old_plane_crtc->base.id); plane->base.id, old_plane_crtc->base.id);
if (!dc_remove_plane_from_context( if (!dc_remove_plane_from_context(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment