drm/amd/display: Disallow enabling CRTC without primary plane with FB
PATCH 1/1 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.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +9 -1
@@ -4683,6 +4683,7 @@ static int dm_update_crtcs_state(struct amdgpu_display_manager *dm,struct amdgpu_dm_connector *aconnector =NULL ;struct drm_connector_state *new_con_state =NULL ;struct dm_connector_state *dm_conn_state =NULL ; +struct drm_plane_state *new_plane_state =NULL ; new_stream =NULL ;
@@ -4690,6 +4691,13 @@ static int dm_update_crtcs_state(struct amdgpu_display_manager *dm, dm_new_crtc_state =to_dm_crtc_state (new_crtc_state); 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);/* TODO This hack should go away */
@@ -4894,7 +4902,7 @@ static int dm_update_planes_state(struct dc *dc,if (!dm_old_crtc_state->stream)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); if (!dc_remove_plane_from_context(
Signature · 6 lines
2.17.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20180418202647.25532-1-harry.wentland-5C7GfCeVMHo@public.gmane.org
[ Dropping stable@ (fixes with Cc: stable are picked up for stable branches once they land in Linus' tree, there's no point sending them to stable@ during review), adding dri-devel ]
Quoted 9 lines · Harry Wentland
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.
How does the caller react to failing such a commit?
Quoted 50 lines
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 Harry Wentland <[email protected]>--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +9
-1@@ -4683,6 +4683,7 @@ static int dm_update_crtcs_state(struct amdgpu_display_manager *dm,struct amdgpu_dm_connector *aconnector =NULL ;struct drm_connector_state *new_con_state =NULL ;struct dm_connector_state *dm_conn_state =NULL ; +struct drm_plane_state *new_plane_state =NULL ; new_stream =NULL ;@@ -4690,6 +4691,13 @@ static int dm_update_crtcs_state(struct amdgpu_display_manager *dm, dm_new_crtc_state =to_dm_crtc_state (new_crtc_state); 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);/* TODO This hack should go away */ @@ -4894,7 +4902,7 @@ static int dm_update_planes_state(struct dc *dc,if (!dm_old_crtc_state->stream)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); if (!dc_remove_plane_from_context(
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Harry Wentland
maintainerQuoted 10 lines · Michel Dänzer
[ Dropping stable@ (fixes with Cc: stable are picked up for stable branches once they land in Linus' tree, there's no point sending them to stable@ during review), adding dri-devel ]
Quoted 4 lines · Harry Wentland
The below commit
"drm/atomic: Try to preserve the crtc enabled state in
drm_atomic_remove_fb, v2"
Quoted 7 lines
Quoted 5 lines
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.
How does the caller react to failing such a commit?
The caller (drm_atomic_remove_fb in this case) will retry with the old behavior and disable the CRTC.
Harry
Quoted 46 lines
Quoted 46 lines
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 Harry Wentland <[email protected]>--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +8
-0@@ -4683,6 +4683,7 @@ static int dm_update_crtcs_state(struct amdgpu_display_manager *dm,struct amdgpu_dm_connector *aconnector =NULL ;struct drm_connector_state *new_con_state =NULL ;struct dm_connector_state *dm_conn_state =NULL ; +struct drm_plane_state *new_plane_state =NULL ; new_stream =NULL ;@@ -4690,6 +4691,13 @@ static int dm_update_crtcs_state(struct amdgpu_display_manager *dm, dm_new_crtc_state =to_dm_crtc_state (new_crtc_state); 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);/* TODO This hack should go away */ @@ -4894,7 +4902,7 @@ static int dm_update_planes_state(struct dc *dc,if (!dm_old_crtc_state->stream)continue ;
Quoted 8 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static int dm_update_planes_state(struct dc *dc, · line 4908
Quoted 6 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1
-1-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); if (!dc_remove_plane_from_context(
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
A message that is not in the archive (sent off-list or not yet received): 3c912b9f-6756-e585-c7a7-63170e752688-5C7GfCeVMHo@public.gmane.org
Michel Dänzer
Tested-byQuoted 9 lines · Harry Wentland
Quoted 8 lines · Michel Dänzer
Quoted 7 lines · Harry Wentland
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.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Since DC is currently not equipped to handle this we need to fail such a commit, otherwise we might see a corrupted screen.
How does the caller react to failing such a commit?
The caller (
drm_atomic_remove_fbin this case) will retry with the old behavior and disable the CRTC.
I see, thanks.
FWIW, stopping gdm3 works fine with this patch as well.
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 13 lines · Harry Wentland
Quoted 12 lines · Michel Dänzer
[ Dropping stable@ (fixes with Cc: stable are picked up for stable branches once they land in Linus' tree, there's no point sending them to stable@ during review), adding dri-devel ]
Quoted 7 lines · Harry Wentland
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.
Quoted 6 lines
Quoted 3 lines
Quoted 2 lines
Since DC is currently not equipped to handle this we need to fail such a commit, otherwise we might see a corrupted screen.
How does the caller react to failing such a commit?
The caller (
drm_atomic_remove_fbin this case) will retry with the old behavior and disable the CRTC.Harry
That's the fall back logic suggested in the patch that caused this issue.
This patch is Reviewed-by: Shirish S <[email protected] <mailto:[email protected]>>
Regards,
Shirish S
Quoted 45 lines
Quoted 45 lines
Quoted 45 lines
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 Harry Wentland <[email protected]>--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +8
-0@@ -4683,6 +4683,7 @@ static int dm_update_crtcs_state(struct amdgpu_display_manager *dm,struct amdgpu_dm_connector *aconnector =NULL ;struct drm_connector_state *new_con_state =NULL ;struct dm_connector_state *dm_conn_state =NULL ; +struct drm_plane_state *new_plane_state =NULL ; new_stream =NULL ;@@ -4690,6 +4691,13 @@ static int dm_update_crtcs_state(struct amdgpu_display_manager *dm, dm_new_crtc_state =to_dm_crtc_state (new_crtc_state); 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);/* TODO This hack should go away */ @@ -4894,7 +4902,7 @@ static int dm_update_planes_state(struct dc *dc,if (!dm_old_crtc_state->stream)continue ;
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static int dm_update_planes_state(struct dc *dc, · line 4908
Quoted 6 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1
-1-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); if (!dc_remove_plane_from_context(
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel