[PATCH 1/2] drm: mxsfb: Fix format changes for primary plane

Laurent Pinchart laurent.pinchart at ideasonboard.com
Mon Oct 12 23:28:39 UTC 2020


The primary plane's format is configured in registers that have no
shadow support for live updates. They require the display to be fully
reconfigured in order to be updated. Force a mode set when the primary
plane format changes to ensure this.

Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
 drivers/gpu/drm/mxsfb/mxsfb_kms.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/mxsfb/mxsfb_kms.c b/drivers/gpu/drm/mxsfb/mxsfb_kms.c
index 6d512f346918..7a69d9f3a875 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_kms.c
+++ b/drivers/gpu/drm/mxsfb/mxsfb_kms.c
@@ -407,14 +407,28 @@ static int mxsfb_plane_atomic_check(struct drm_plane *plane,
 {
 	struct mxsfb_drm_private *mxsfb = to_mxsfb_drm_private(plane->dev);
 	struct drm_crtc_state *crtc_state;
+	int ret;
 
 	crtc_state = drm_atomic_get_new_crtc_state(plane_state->state,
 						   &mxsfb->crtc);
 
-	return drm_atomic_helper_check_plane_state(plane_state, crtc_state,
-						   DRM_PLANE_HELPER_NO_SCALING,
-						   DRM_PLANE_HELPER_NO_SCALING,
-						   false, true);
+	ret = drm_atomic_helper_check_plane_state(plane_state, crtc_state,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  false, true);
+	if (ret < 0)
+		return ret;
+
+	/*
+	 * Changing the primary plane format requires stopping the display
+	 * controller first. Force a full mode set to do so.
+	 */
+	if (plane == mxsfb->crtc.primary &&
+	    plane_state->visible && plane->state->visible &&
+	    plane_state->fb->format != plane->state->fb->format)
+		crtc_state->mode_changed = true;
+
+	return 0;
 }
 
 static void mxsfb_plane_primary_atomic_update(struct drm_plane *plane,
-- 
Regards,

Laurent Pinchart



More information about the dri-devel mailing list