summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_atomic.c
diff options
context:
space:
mode:
authorDave Airlie2016-04-27 03:27:39 +0200
committerDave Airlie2016-05-05 04:52:05 +0200
commitd2307dea14a4f14a4b5db01b6d40a30fa6117e6c (patch)
treee9aa6cf0376a35ab1f19fd4c0e31aa4491433cd5 /drivers/gpu/drm/drm_atomic.c
parentdrm/crtc: take references to connectors used in a modeset. (v2) (diff)
downloadkernel-qcow2-linux-d2307dea14a4f14a4b5db01b6d40a30fa6117e6c.tar.gz
kernel-qcow2-linux-d2307dea14a4f14a4b5db01b6d40a30fa6117e6c.tar.xz
kernel-qcow2-linux-d2307dea14a4f14a4b5db01b6d40a30fa6117e6c.zip
drm/atomic: use connector references (v3)
Take a reference when setting a crtc on a connecter, also take one when duplicating if a crtc is set, and drop one on destroy if a crtc is set. v2: take Daniel Stone's advice and simplify the ref/unref dances, also take care of NULL as connector to state reset. v3: remove need for connector NULL check. Reviewed-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_atomic.c')
-rw-r--r--drivers/gpu/drm/drm_atomic.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index e4879d34c280..86e89db02ed7 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -144,15 +144,7 @@ void drm_atomic_state_default_clear(struct drm_atomic_state *state)
if (!connector)
continue;
- /*
- * FIXME: Nonblocking commits can race with connector unplugging and
- * there's currently nothing that prevents cleanup up state for
- * deleted connectors. As long as the callback doesn't look at
- * the connector we'll be fine though, so make sure that's the
- * case by setting all connector pointers to NULL.
- */
- state->connector_states[i]->connector = NULL;
- connector->funcs->atomic_destroy_state(NULL,
+ connector->funcs->atomic_destroy_state(connector,
state->connector_states[i]);
state->connectors[i] = NULL;
state->connector_states[i] = NULL;
@@ -1168,6 +1160,8 @@ drm_atomic_set_crtc_for_connector(struct drm_connector_state *conn_state,
{
struct drm_crtc_state *crtc_state;
+ if (crtc)
+ drm_connector_reference(conn_state->connector);
if (conn_state->crtc && conn_state->crtc != crtc) {
crtc_state = drm_atomic_get_existing_crtc_state(conn_state->state,
conn_state->crtc);
@@ -1185,6 +1179,8 @@ drm_atomic_set_crtc_for_connector(struct drm_connector_state *conn_state,
1 << drm_connector_index(conn_state->connector);
}
+ if (conn_state->crtc)
+ drm_connector_unreference(conn_state->connector);
conn_state->crtc = crtc;
if (crtc)