diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2017-03-22 17:50:44 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2017-03-29 03:15:06 -0400 |
commit | d26f96c74dd027caf14713ae736b4d174535412d (patch) | |
tree | df3fb6cc0aa8ab0f87b51c134f5d6e1fa5ae6ec8 | |
parent | 1931529448bca3e0e77fb526baad20935c9cabaf (diff) |
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: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170322215058.8671-6-daniel.vetter@ffwll.ch
-rw-r--r-- | drivers/gpu/drm/drm_atomic_helper.c | 49 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_plane.c | 2 |
2 files changed, 2 insertions, 49 deletions
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 6096233a740c..cc6e2772b32f 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c | |||
@@ -2101,8 +2101,7 @@ int drm_atomic_helper_update_plane(struct drm_plane *plane, | |||
2101 | if (!state) | 2101 | if (!state) |
2102 | return -ENOMEM; | 2102 | return -ENOMEM; |
2103 | 2103 | ||
2104 | state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc); | 2104 | state->acquire_ctx = ctx; |
2105 | retry: | ||
2106 | plane_state = drm_atomic_get_plane_state(state, plane); | 2105 | plane_state = drm_atomic_get_plane_state(state, plane); |
2107 | if (IS_ERR(plane_state)) { | 2106 | if (IS_ERR(plane_state)) { |
2108 | ret = PTR_ERR(plane_state); | 2107 | ret = PTR_ERR(plane_state); |
@@ -2127,24 +2126,8 @@ retry: | |||
2127 | 2126 | ||
2128 | ret = drm_atomic_commit(state); | 2127 | ret = drm_atomic_commit(state); |
2129 | fail: | 2128 | fail: |
2130 | if (ret == -EDEADLK) | ||
2131 | goto backoff; | ||
2132 | |||
2133 | drm_atomic_state_put(state); | 2129 | drm_atomic_state_put(state); |
2134 | return ret; | 2130 | return ret; |
2135 | |||
2136 | backoff: | ||
2137 | drm_atomic_state_clear(state); | ||
2138 | drm_atomic_legacy_backoff(state); | ||
2139 | |||
2140 | /* | ||
2141 | * Someone might have exchanged the framebuffer while we dropped locks | ||
2142 | * in the backoff code. We need to fix up the fb refcount tracking the | ||
2143 | * core does for us. | ||
2144 | */ | ||
2145 | plane->old_fb = plane->fb; | ||
2146 | |||
2147 | goto retry; | ||
2148 | } | 2131 | } |
2149 | EXPORT_SYMBOL(drm_atomic_helper_update_plane); | 2132 | EXPORT_SYMBOL(drm_atomic_helper_update_plane); |
2150 | 2133 | ||
@@ -2165,23 +2148,11 @@ int drm_atomic_helper_disable_plane(struct drm_plane *plane, | |||
2165 | struct drm_plane_state *plane_state; | 2148 | struct drm_plane_state *plane_state; |
2166 | int ret = 0; | 2149 | int ret = 0; |
2167 | 2150 | ||
2168 | /* | ||
2169 | * FIXME: Without plane->crtc set we can't get at the implicit legacy | ||
2170 | * acquire context. The real fix will be to wire the acquire ctx through | ||
2171 | * everywhere we need it, but meanwhile prevent chaos by just skipping | ||
2172 | * this noop. The critical case is the cursor ioctls which a) only grab | ||
2173 | * crtc/cursor-plane locks (so we need the crtc to get at the right | ||
2174 | * acquire context) and b) can try to disable the plane multiple times. | ||
2175 | */ | ||
2176 | if (!plane->crtc) | ||
2177 | return 0; | ||
2178 | |||
2179 | state = drm_atomic_state_alloc(plane->dev); | 2151 | state = drm_atomic_state_alloc(plane->dev); |
2180 | if (!state) | 2152 | if (!state) |
2181 | return -ENOMEM; | 2153 | return -ENOMEM; |
2182 | 2154 | ||
2183 | state->acquire_ctx = drm_modeset_legacy_acquire_ctx(plane->crtc); | 2155 | state->acquire_ctx = ctx; |
2184 | retry: | ||
2185 | plane_state = drm_atomic_get_plane_state(state, plane); | 2156 | plane_state = drm_atomic_get_plane_state(state, plane); |
2186 | if (IS_ERR(plane_state)) { | 2157 | if (IS_ERR(plane_state)) { |
2187 | ret = PTR_ERR(plane_state); | 2158 | ret = PTR_ERR(plane_state); |
@@ -2197,24 +2168,8 @@ retry: | |||
2197 | 2168 | ||
2198 | ret = drm_atomic_commit(state); | 2169 | ret = drm_atomic_commit(state); |
2199 | fail: | 2170 | fail: |
2200 | if (ret == -EDEADLK) | ||
2201 | goto backoff; | ||
2202 | |||
2203 | drm_atomic_state_put(state); | 2171 | drm_atomic_state_put(state); |
2204 | return ret; | 2172 | return ret; |
2205 | |||
2206 | backoff: | ||
2207 | drm_atomic_state_clear(state); | ||
2208 | drm_atomic_legacy_backoff(state); | ||
2209 | |||
2210 | /* | ||
2211 | * Someone might have exchanged the framebuffer while we dropped locks | ||
2212 | * in the backoff code. We need to fix up the fb refcount tracking the | ||
2213 | * core does for us. | ||
2214 | */ | ||
2215 | plane->old_fb = plane->fb; | ||
2216 | |||
2217 | goto retry; | ||
2218 | } | 2173 | } |
2219 | EXPORT_SYMBOL(drm_atomic_helper_disable_plane); | 2174 | EXPORT_SYMBOL(drm_atomic_helper_disable_plane); |
2220 | 2175 | ||
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 526e74b548b2..8535dc17db7e 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c | |||
@@ -554,7 +554,6 @@ retry: | |||
554 | ret = drm_modeset_lock_all_ctx(plane->dev, &ctx); | 554 | ret = drm_modeset_lock_all_ctx(plane->dev, &ctx); |
555 | if (ret) | 555 | if (ret) |
556 | goto fail; | 556 | goto fail; |
557 | plane->dev->mode_config.acquire_ctx = &ctx; | ||
558 | ret = __setplane_internal(plane, crtc, fb, | 557 | ret = __setplane_internal(plane, crtc, fb, |
559 | crtc_x, crtc_y, crtc_w, crtc_h, | 558 | crtc_x, crtc_y, crtc_w, crtc_h, |
560 | src_x, src_y, src_w, src_h, &ctx); | 559 | src_x, src_y, src_w, src_h, &ctx); |
@@ -649,7 +648,6 @@ retry: | |||
649 | ret = drm_modeset_lock(&crtc->cursor->mutex, &ctx); | 648 | ret = drm_modeset_lock(&crtc->cursor->mutex, &ctx); |
650 | if (ret) | 649 | if (ret) |
651 | goto fail; | 650 | goto fail; |
652 | crtc->acquire_ctx = &ctx; | ||
653 | 651 | ||
654 | /* | 652 | /* |
655 | * Obtain fb we'll be using (either new or existing) and take an extra | 653 | * Obtain fb we'll be using (either new or existing) and take an extra |