[PATCH] drm/amd/display: Disable CRTC if primary plane has no FB

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This commit teaches DM to deal with a change of behavior with drm_atomic_remove_fb.
It no longer disable CRTC with NULL FB on their primary plane:
	(846c7dfc1193
	 drm/atomic: Try to preserve the crtc enabled state in drm_atomic_remove_fb, v2.)

DC/DM is currently not fully setup to simply stop scanout from the
primary plane (and blank the crtc), so we'll disable the CRTC in this
case.

Signed-off-by: Harry Wentland <harry.wentland@xxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 6f92a19bebd6..c1b1c5931a01 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -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;
 
@@ -4736,6 +4737,11 @@ static int dm_update_crtcs_state(struct amdgpu_display_manager *dm,
 		if (dm_old_crtc_state->freesync_enabled != dm_new_crtc_state->freesync_enabled)
 			new_crtc_state->mode_changed = true;
 
+		new_plane_state = drm_atomic_get_new_plane_state(state, new_crtc_state->crtc->primary);
+
+		if (new_plane_state && !new_plane_state->fb)
+			new_crtc_state->mode_changed = true;
+
 		if (!drm_atomic_crtc_needs_modeset(new_crtc_state))
 			goto next_crtc;
 
@@ -4783,6 +4789,9 @@ static int dm_update_crtcs_state(struct amdgpu_display_manager *dm,
 			if (!aconnector || (!aconnector->dc_sink && aconnector->mst_port))
 				goto next_crtc;
 
+			if (new_plane_state && !new_plane_state->fb)
+				goto next_crtc;
+
 			if (modereset_required(new_crtc_state))
 				goto next_crtc;
 
@@ -4894,7 +4903,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(
-- 
2.17.0




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]