Commit ca659e0e authored by Daniel Vetter's avatar Daniel Vetter

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: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170403083304.9083-12-daniel.vetter@ffwll.ch
parent 9c79e0b1
...@@ -218,28 +218,29 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev, ...@@ -218,28 +218,29 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev,
struct drm_crtc *crtc; struct drm_crtc *crtc;
void *r_base, *g_base, *b_base; void *r_base, *g_base, *b_base;
int size; int size;
struct drm_modeset_acquire_ctx ctx;
int ret = 0; int ret = 0;
if (!drm_core_check_feature(dev, DRIVER_MODESET)) if (!drm_core_check_feature(dev, DRIVER_MODESET))
return -EINVAL; return -EINVAL;
drm_modeset_lock_all(dev);
crtc = drm_crtc_find(dev, crtc_lut->crtc_id); crtc = drm_crtc_find(dev, crtc_lut->crtc_id);
if (!crtc) { if (!crtc)
ret = -ENOENT; return -ENOENT;
goto out;
}
if (crtc->funcs->gamma_set == NULL) { if (crtc->funcs->gamma_set == NULL)
ret = -ENOSYS; return -ENOSYS;
goto out;
}
/* memcpy into gamma store */ /* memcpy into gamma store */
if (crtc_lut->gamma_size != crtc->gamma_size) { if (crtc_lut->gamma_size != crtc->gamma_size)
ret = -EINVAL; return -EINVAL;
drm_modeset_acquire_init(&ctx, 0);
dev->mode_config.acquire_ctx = &ctx;
retry:
ret = drm_modeset_lock_all_ctx(dev, &ctx);
if (ret)
goto out; goto out;
}
size = crtc_lut->gamma_size * (sizeof(uint16_t)); size = crtc_lut->gamma_size * (sizeof(uint16_t));
r_base = crtc->gamma_store; r_base = crtc->gamma_store;
...@@ -263,7 +264,13 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev, ...@@ -263,7 +264,13 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev,
ret = crtc->funcs->gamma_set(crtc, r_base, g_base, b_base, crtc->gamma_size); ret = crtc->funcs->gamma_set(crtc, r_base, g_base, b_base, crtc->gamma_size);
out: out:
drm_modeset_unlock_all(dev); if (ret == -EDEADLK) {
drm_modeset_backoff(&ctx);
goto retry;
}
drm_modeset_drop_locks(&ctx);
drm_modeset_acquire_fini(&ctx);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment