The enable field needs to be kept in sync with the mode_blob field. Call
drm_atomic_set_mode_prop_for_crtc() instead of setting enable to false
in order to dereference the mode blob correctly.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas at ideasonboard.com>
---
 drivers/gpu/drm/drm_atomic_helper.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Another option would be to open-code the mode blob unreference in
update_output_state(). I'm not sure what's best.

diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index 536ae4da4665..64c75af1c088 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1554,6 +1554,8 @@ static int update_output_state(struct drm_atomic_state 
*state,
        }

        for_each_crtc_in_state(state, crtc, crtc_state, i) {
+               unsigned int num_connectors;
+
                /* Don't update ->enable for the CRTC in the set_config request,
                 * since a mismatch would indicate a bug in the upper layers.
                 * The actual modeset code later on will catch any
@@ -1561,10 +1563,12 @@ static int update_output_state(struct drm_atomic_state 
*state,
                if (crtc == set->crtc)
                        continue;

-               crtc_state->enable =
-                       drm_atomic_connectors_for_crtc(state, crtc);
-               if (!crtc_state->enable)
+               num_connectors = drm_atomic_connectors_for_crtc(state, crtc);
+               if (!num_connectors) {
+                       ret = drm_atomic_set_mode_prop_for_crtc(crtc_state,
+                                                               NULL);
                        crtc_state->active = false;
+               }
        }

        return 0;
-- 
Regards,

Laurent Pinchart

Reply via email to