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>
This commit is contained in:
@@ -2762,6 +2762,8 @@ __drm_atomic_helper_connector_duplicate_state(struct drm_connector *connector,
|
||||
struct drm_connector_state *state)
|
||||
{
|
||||
memcpy(state, connector->state, sizeof(*state));
|
||||
if (state->crtc)
|
||||
drm_connector_reference(connector);
|
||||
}
|
||||
EXPORT_SYMBOL(__drm_atomic_helper_connector_duplicate_state);
|
||||
|
||||
@@ -2889,6 +2891,8 @@ __drm_atomic_helper_connector_destroy_state(struct drm_connector *connector,
|
||||
* state will automatically do the right thing if code is ever added
|
||||
* to this function.
|
||||
*/
|
||||
if (state->crtc)
|
||||
drm_connector_unreference(state->connector);
|
||||
}
|
||||
EXPORT_SYMBOL(__drm_atomic_helper_connector_destroy_state);
|
||||
|
||||
|
Reference in New Issue
Block a user