drm/atomic: add connector mask to drm_crtc_state.
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Mon, 4 Jan 2016 11:53:18 +0000 (12:53 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 5 Jan 2016 08:43:33 +0000 (09:43 +0100)
It can be useful to iterate over connectors without grabbing
connection_mutex. It can also be used to see how many connectors
are on a crtc without iterating over the list.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1451908400-25147-4-git-send-email-maarten.lankhorst@linux.intel.com
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/drm_atomic.c
include/drm/drm_crtc.h

index 6a21e5c378c1a2e5daa2d0197f0a304aa5336b10..14b32158051717e210b983bdea123a977f9c1b7c 100644 (file)
@@ -1063,10 +1063,21 @@ drm_atomic_set_crtc_for_connector(struct drm_connector_state *conn_state,
 {
        struct drm_crtc_state *crtc_state;
 
+       if (conn_state->crtc && conn_state->crtc != crtc) {
+               crtc_state = drm_atomic_get_existing_crtc_state(conn_state->state,
+                                                               conn_state->crtc);
+
+               crtc_state->connector_mask &=
+                       ~(1 << drm_connector_index(conn_state->connector));
+       }
+
        if (crtc) {
                crtc_state = drm_atomic_get_crtc_state(conn_state->state, crtc);
                if (IS_ERR(crtc_state))
                        return PTR_ERR(crtc_state);
+
+               crtc_state->connector_mask |=
+                       1 << drm_connector_index(conn_state->connector);
        }
 
        conn_state->crtc = crtc;
index 3b040b3554726e25132b8c11b42588743816e576..e3c4d486e1af853a44422620be736823102c2a8a 100644 (file)
@@ -306,6 +306,7 @@ struct drm_plane_helper_funcs;
  * @active_changed: crtc_state->active has been toggled.
  * @connectors_changed: connectors to this crtc have been updated
  * @plane_mask: bitmask of (1 << drm_plane_index(plane)) of attached planes
+ * @connector_mask: bitmask of (1 << drm_connector_index(connector)) of attached connectors
  * @last_vblank_count: for helpers and drivers to capture the vblank of the
  *     update to ensure framebuffer cleanup isn't done too early
  * @adjusted_mode: for use by helpers and drivers to compute adjusted mode timings
@@ -339,6 +340,8 @@ struct drm_crtc_state {
         */
        u32 plane_mask;
 
+       u32 connector_mask;
+
        /* last_vblank_count: for vblank waits before cleanup */
        u32 last_vblank_count;