[Intel-gfx] [PATCH 3/5] drm/crtc: take references to connectors used in a modeset.

Dave Airlie airlied at gmail.com
Wed Apr 27 02:03:27 UTC 2016


From: Dave Airlie <airlied at redhat.com>

This just takes a reference on the connector when we set a mode
in the non-atomic paths.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 drivers/gpu/drm/drm_crtc_helper.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index 66ca313..29b7835 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -456,6 +456,9 @@ drm_crtc_helper_disable(struct drm_crtc *crtc)
 			 * between them is henceforth no longer available.
 			 */
 			connector->dpms = DRM_MODE_DPMS_OFF;
+
+			/* we keep a reference while the encoder is bound */
+			drm_connector_unreference(connector);
 		}
 	}
 
@@ -635,9 +638,12 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
 			mode_changed = true;
 			/* If the encoder is reused for another connector, then
 			 * the appropriate crtc will be set later.
+			 * take a reference only if we haven't had an encoder before.
 			 */
 			if (connector->encoder)
 				connector->encoder->crtc = NULL;
+			else
+				drm_connector_reference(connector);
 			connector->encoder = new_encoder;
 		}
 	}
-- 
2.5.5



More information about the Intel-gfx mailing list