提交 d26f96c7 编写于 作者: D Daniel Vetter

drm/atomic-helper: remove backoff hack from disable/update_plane

We can now properly retry at the top level, yay!

v2: Also remove the temporary acquire_ctx hack again, no longer
needed!
Reviewed-by: NHarry Wentland <harry.wentland@amd.com>
Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170322215058.8671-6-daniel.vetter@ffwll.ch
上级 19315294
...@@ -2101,8 +2101,7 @@ int drm_atomic_helper_update_plane(struct drm_plane *plane, ...@@ -2101,8 +2101,7 @@ int drm_atomic_helper_update_plane(struct drm_plane *plane,
if (!state) if (!state)
return -ENOMEM; return -ENOMEM;
state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc); state->acquire_ctx = ctx;
retry:
plane_state = drm_atomic_get_plane_state(state, plane); plane_state = drm_atomic_get_plane_state(state, plane);
if (IS_ERR(plane_state)) { if (IS_ERR(plane_state)) {
ret = PTR_ERR(plane_state); ret = PTR_ERR(plane_state);
...@@ -2127,24 +2126,8 @@ int drm_atomic_helper_update_plane(struct drm_plane *plane, ...@@ -2127,24 +2126,8 @@ int drm_atomic_helper_update_plane(struct drm_plane *plane,
ret = drm_atomic_commit(state); ret = drm_atomic_commit(state);
fail: fail:
if (ret == -EDEADLK)
goto backoff;
drm_atomic_state_put(state); drm_atomic_state_put(state);
return ret; return ret;
backoff:
drm_atomic_state_clear(state);
drm_atomic_legacy_backoff(state);
/*
* Someone might have exchanged the framebuffer while we dropped locks
* in the backoff code. We need to fix up the fb refcount tracking the
* core does for us.
*/
plane->old_fb = plane->fb;
goto retry;
} }
EXPORT_SYMBOL(drm_atomic_helper_update_plane); EXPORT_SYMBOL(drm_atomic_helper_update_plane);
...@@ -2165,23 +2148,11 @@ int drm_atomic_helper_disable_plane(struct drm_plane *plane, ...@@ -2165,23 +2148,11 @@ int drm_atomic_helper_disable_plane(struct drm_plane *plane,
struct drm_plane_state *plane_state; struct drm_plane_state *plane_state;
int ret = 0; int ret = 0;
/*
* FIXME: Without plane->crtc set we can't get at the implicit legacy
* acquire context. The real fix will be to wire the acquire ctx through
* everywhere we need it, but meanwhile prevent chaos by just skipping
* this noop. The critical case is the cursor ioctls which a) only grab
* crtc/cursor-plane locks (so we need the crtc to get at the right
* acquire context) and b) can try to disable the plane multiple times.
*/
if (!plane->crtc)
return 0;
state = drm_atomic_state_alloc(plane->dev); state = drm_atomic_state_alloc(plane->dev);
if (!state) if (!state)
return -ENOMEM; return -ENOMEM;
state->acquire_ctx = drm_modeset_legacy_acquire_ctx(plane->crtc); state->acquire_ctx = ctx;
retry:
plane_state = drm_atomic_get_plane_state(state, plane); plane_state = drm_atomic_get_plane_state(state, plane);
if (IS_ERR(plane_state)) { if (IS_ERR(plane_state)) {
ret = PTR_ERR(plane_state); ret = PTR_ERR(plane_state);
...@@ -2197,24 +2168,8 @@ int drm_atomic_helper_disable_plane(struct drm_plane *plane, ...@@ -2197,24 +2168,8 @@ int drm_atomic_helper_disable_plane(struct drm_plane *plane,
ret = drm_atomic_commit(state); ret = drm_atomic_commit(state);
fail: fail:
if (ret == -EDEADLK)
goto backoff;
drm_atomic_state_put(state); drm_atomic_state_put(state);
return ret; return ret;
backoff:
drm_atomic_state_clear(state);
drm_atomic_legacy_backoff(state);
/*
* Someone might have exchanged the framebuffer while we dropped locks
* in the backoff code. We need to fix up the fb refcount tracking the
* core does for us.
*/
plane->old_fb = plane->fb;
goto retry;
} }
EXPORT_SYMBOL(drm_atomic_helper_disable_plane); EXPORT_SYMBOL(drm_atomic_helper_disable_plane);
......
...@@ -554,7 +554,6 @@ static int setplane_internal(struct drm_plane *plane, ...@@ -554,7 +554,6 @@ static int setplane_internal(struct drm_plane *plane,
ret = drm_modeset_lock_all_ctx(plane->dev, &ctx); ret = drm_modeset_lock_all_ctx(plane->dev, &ctx);
if (ret) if (ret)
goto fail; goto fail;
plane->dev->mode_config.acquire_ctx = &ctx;
ret = __setplane_internal(plane, crtc, fb, ret = __setplane_internal(plane, crtc, fb,
crtc_x, crtc_y, crtc_w, crtc_h, crtc_x, crtc_y, crtc_w, crtc_h,
src_x, src_y, src_w, src_h, &ctx); src_x, src_y, src_w, src_h, &ctx);
...@@ -649,7 +648,6 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc, ...@@ -649,7 +648,6 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc,
ret = drm_modeset_lock(&crtc->cursor->mutex, &ctx); ret = drm_modeset_lock(&crtc->cursor->mutex, &ctx);
if (ret) if (ret)
goto fail; goto fail;
crtc->acquire_ctx = &ctx;
/* /*
* Obtain fb we'll be using (either new or existing) and take an extra * Obtain fb we'll be using (either new or existing) and take an extra
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册