diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2017-04-03 04:33:00 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2017-04-06 04:21:43 -0400 |
commit | ca659e0e3cda69c5e8bbb7038adad30442a8ce39 (patch) | |
tree | 775d2cb0e17d3d49d2b005ed7409e2fe3a3e6ff6 /drivers/gpu | |
parent | 9c79e0b1d096c06e4b012a32dddb04be0ce9716e (diff) |
drm: Add explicit acquire ctx handling around ->gamma_set
Just the groundwork to prepare for adding the acquire cxt parameter to
the ->gamma_set hook. Again we need a temporary hack to fill out
mode_config.acquire_ctx until the atomic helpers are switched over.
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170403083304.9083-12-daniel.vetter@ffwll.ch
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/drm_color_mgmt.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/drivers/gpu/drm/drm_color_mgmt.c b/drivers/gpu/drm/drm_color_mgmt.c index a32be59a72d1..e1b4084c3d16 100644 --- a/drivers/gpu/drm/drm_color_mgmt.c +++ b/drivers/gpu/drm/drm_color_mgmt.c | |||
@@ -218,28 +218,29 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev, | |||
218 | struct drm_crtc *crtc; | 218 | struct drm_crtc *crtc; |
219 | void *r_base, *g_base, *b_base; | 219 | void *r_base, *g_base, *b_base; |
220 | int size; | 220 | int size; |
221 | struct drm_modeset_acquire_ctx ctx; | ||
221 | int ret = 0; | 222 | int ret = 0; |
222 | 223 | ||
223 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) | 224 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) |
224 | return -EINVAL; | 225 | return -EINVAL; |
225 | 226 | ||
226 | drm_modeset_lock_all(dev); | ||
227 | crtc = drm_crtc_find(dev, crtc_lut->crtc_id); | 227 | crtc = drm_crtc_find(dev, crtc_lut->crtc_id); |
228 | if (!crtc) { | 228 | if (!crtc) |
229 | ret = -ENOENT; | 229 | return -ENOENT; |
230 | goto out; | ||
231 | } | ||
232 | 230 | ||
233 | if (crtc->funcs->gamma_set == NULL) { | 231 | if (crtc->funcs->gamma_set == NULL) |
234 | ret = -ENOSYS; | 232 | return -ENOSYS; |
235 | goto out; | ||
236 | } | ||
237 | 233 | ||
238 | /* memcpy into gamma store */ | 234 | /* memcpy into gamma store */ |
239 | if (crtc_lut->gamma_size != crtc->gamma_size) { | 235 | if (crtc_lut->gamma_size != crtc->gamma_size) |
240 | ret = -EINVAL; | 236 | return -EINVAL; |
237 | |||
238 | drm_modeset_acquire_init(&ctx, 0); | ||
239 | dev->mode_config.acquire_ctx = &ctx; | ||
240 | retry: | ||
241 | ret = drm_modeset_lock_all_ctx(dev, &ctx); | ||
242 | if (ret) | ||
241 | goto out; | 243 | goto out; |
242 | } | ||
243 | 244 | ||
244 | size = crtc_lut->gamma_size * (sizeof(uint16_t)); | 245 | size = crtc_lut->gamma_size * (sizeof(uint16_t)); |
245 | r_base = crtc->gamma_store; | 246 | r_base = crtc->gamma_store; |
@@ -263,7 +264,13 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev, | |||
263 | ret = crtc->funcs->gamma_set(crtc, r_base, g_base, b_base, crtc->gamma_size); | 264 | ret = crtc->funcs->gamma_set(crtc, r_base, g_base, b_base, crtc->gamma_size); |
264 | 265 | ||
265 | out: | 266 | out: |
266 | drm_modeset_unlock_all(dev); | 267 | if (ret == -EDEADLK) { |
268 | drm_modeset_backoff(&ctx); | ||
269 | goto retry; | ||
270 | } | ||
271 | drm_modeset_drop_locks(&ctx); | ||
272 | drm_modeset_acquire_fini(&ctx); | ||
273 | |||
267 | return ret; | 274 | return ret; |
268 | 275 | ||
269 | } | 276 | } |