drm: Add reference counting to drm_atomic_state
drm_atomic_state has a complicated single owner model that tracks the single reference from allocation through to destruction on another thread - or perhaps on a local error path. We can simplify this tracking by using reference counting (at a cost of a few more atomics). This is even more beneficial when the lifetime of the state becomes more convoluted than being passed to a single worker thread for the commit. v2: Double check !intel atomic_commit functions for missing gets v3: Update kerneldocs Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: dri-devel@lists.freedesktop.org Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> Reviewed-by: Sean Paul <seanpaul@chromium.org> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/20161014121833.439-27-chris@chris-wilson.co.uk
This commit is contained in:

committed by
Daniel Vetter

parent
1dfdb0ed34
commit
0853695c3b
@@ -105,7 +105,7 @@ static void omap_atomic_complete(struct omap_atomic_state_commit *commit)
|
||||
|
||||
dispc_runtime_put();
|
||||
|
||||
drm_atomic_state_free(old_state);
|
||||
drm_atomic_state_put(old_state);
|
||||
|
||||
/* Complete the commit, wake up any waiter. */
|
||||
spin_lock(&priv->commit.lock);
|
||||
@@ -176,6 +176,7 @@ static int omap_atomic_commit(struct drm_device *dev,
|
||||
/* Swap the state, this is the point of no return. */
|
||||
drm_atomic_helper_swap_state(state, true);
|
||||
|
||||
drm_atomic_state_get(state);
|
||||
if (nonblock)
|
||||
schedule_work(&commit->work);
|
||||
else
|
||||
|
Reference in New Issue
Block a user