mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-28 20:37:27 +00:00
drm: Push dirtyfb ioctl kms locking down to drivers
Not all drivers will need take all the modeset locks for dirtyfb, so push the locking down to the drivers. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Jakob Bornecrantz <jakob@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
parent
ee61c7303f
commit
73e9efd4bd
@ -2767,10 +2767,8 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fb->funcs->dirty) {
|
if (fb->funcs->dirty) {
|
||||||
drm_modeset_lock_all(dev);
|
|
||||||
ret = fb->funcs->dirty(fb, file_priv, flags, r->color,
|
ret = fb->funcs->dirty(fb, file_priv, flags, r->color,
|
||||||
clips, num_clips);
|
clips, num_clips);
|
||||||
drm_modeset_unlock_all(dev);
|
|
||||||
} else {
|
} else {
|
||||||
ret = -ENOSYS;
|
ret = -ENOSYS;
|
||||||
}
|
}
|
||||||
|
@ -123,12 +123,16 @@ static int omap_framebuffer_dirty(struct drm_framebuffer *fb,
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
drm_modeset_lock_all(fb->dev);
|
||||||
|
|
||||||
for (i = 0; i < num_clips; i++) {
|
for (i = 0; i < num_clips; i++) {
|
||||||
omap_framebuffer_flush(fb, clips[i].x1, clips[i].y1,
|
omap_framebuffer_flush(fb, clips[i].x1, clips[i].y1,
|
||||||
clips[i].x2 - clips[i].x1,
|
clips[i].x2 - clips[i].x1,
|
||||||
clips[i].y2 - clips[i].y1);
|
clips[i].y2 - clips[i].y1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
drm_modeset_unlock_all(fb->dev);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -399,10 +399,14 @@ static int qxl_framebuffer_surface_dirty(struct drm_framebuffer *fb,
|
|||||||
struct qxl_bo *qobj;
|
struct qxl_bo *qobj;
|
||||||
int inc = 1;
|
int inc = 1;
|
||||||
|
|
||||||
|
drm_modeset_lock_all(fb->dev);
|
||||||
|
|
||||||
qobj = gem_to_qxl_bo(qxl_fb->obj);
|
qobj = gem_to_qxl_bo(qxl_fb->obj);
|
||||||
/* if we aren't primary surface ignore this */
|
/* if we aren't primary surface ignore this */
|
||||||
if (!qobj->is_primary)
|
if (!qobj->is_primary) {
|
||||||
|
drm_modeset_unlock_all(fb->dev);
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!num_clips) {
|
if (!num_clips) {
|
||||||
num_clips = 1;
|
num_clips = 1;
|
||||||
@ -417,6 +421,9 @@ static int qxl_framebuffer_surface_dirty(struct drm_framebuffer *fb,
|
|||||||
|
|
||||||
qxl_draw_dirty_fb(qdev, qxl_fb, qobj, flags, color,
|
qxl_draw_dirty_fb(qdev, qxl_fb, qobj, flags, color,
|
||||||
clips, num_clips, inc);
|
clips, num_clips, inc);
|
||||||
|
|
||||||
|
drm_modeset_unlock_all(fb->dev);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -403,15 +403,17 @@ static int udl_user_framebuffer_dirty(struct drm_framebuffer *fb,
|
|||||||
int i;
|
int i;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
drm_modeset_lock_all(fb->dev);
|
||||||
|
|
||||||
if (!ufb->active_16)
|
if (!ufb->active_16)
|
||||||
return 0;
|
goto unlock;
|
||||||
|
|
||||||
if (ufb->obj->base.import_attach) {
|
if (ufb->obj->base.import_attach) {
|
||||||
ret = dma_buf_begin_cpu_access(ufb->obj->base.import_attach->dmabuf,
|
ret = dma_buf_begin_cpu_access(ufb->obj->base.import_attach->dmabuf,
|
||||||
0, ufb->obj->base.size,
|
0, ufb->obj->base.size,
|
||||||
DMA_FROM_DEVICE);
|
DMA_FROM_DEVICE);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
goto unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < num_clips; i++) {
|
for (i = 0; i < num_clips; i++) {
|
||||||
@ -419,7 +421,7 @@ static int udl_user_framebuffer_dirty(struct drm_framebuffer *fb,
|
|||||||
clips[i].x2 - clips[i].x1,
|
clips[i].x2 - clips[i].x1,
|
||||||
clips[i].y2 - clips[i].y1);
|
clips[i].y2 - clips[i].y1);
|
||||||
if (ret)
|
if (ret)
|
||||||
break;
|
goto unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ufb->obj->base.import_attach) {
|
if (ufb->obj->base.import_attach) {
|
||||||
@ -427,6 +429,10 @@ static int udl_user_framebuffer_dirty(struct drm_framebuffer *fb,
|
|||||||
0, ufb->obj->base.size,
|
0, ufb->obj->base.size,
|
||||||
DMA_FROM_DEVICE);
|
DMA_FROM_DEVICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unlock:
|
||||||
|
drm_modeset_unlock_all(fb->dev);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -609,9 +609,13 @@ int vmw_framebuffer_surface_dirty(struct drm_framebuffer *framebuffer,
|
|||||||
if (!dev_priv->sou_priv)
|
if (!dev_priv->sou_priv)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
drm_modeset_lock_all(dev_priv->dev);
|
||||||
|
|
||||||
ret = ttm_read_lock(&vmaster->lock, true);
|
ret = ttm_read_lock(&vmaster->lock, true);
|
||||||
if (unlikely(ret != 0))
|
if (unlikely(ret != 0)) {
|
||||||
|
drm_modeset_unlock_all(dev_priv->dev);
|
||||||
return ret;
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
if (!num_clips) {
|
if (!num_clips) {
|
||||||
num_clips = 1;
|
num_clips = 1;
|
||||||
@ -629,6 +633,9 @@ int vmw_framebuffer_surface_dirty(struct drm_framebuffer *framebuffer,
|
|||||||
clips, num_clips, inc, NULL);
|
clips, num_clips, inc, NULL);
|
||||||
|
|
||||||
ttm_read_unlock(&vmaster->lock);
|
ttm_read_unlock(&vmaster->lock);
|
||||||
|
|
||||||
|
drm_modeset_unlock_all(dev_priv->dev);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -953,9 +960,13 @@ int vmw_framebuffer_dmabuf_dirty(struct drm_framebuffer *framebuffer,
|
|||||||
struct drm_clip_rect norect;
|
struct drm_clip_rect norect;
|
||||||
int ret, increment = 1;
|
int ret, increment = 1;
|
||||||
|
|
||||||
|
drm_modeset_lock_all(dev_priv->dev);
|
||||||
|
|
||||||
ret = ttm_read_lock(&vmaster->lock, true);
|
ret = ttm_read_lock(&vmaster->lock, true);
|
||||||
if (unlikely(ret != 0))
|
if (unlikely(ret != 0)) {
|
||||||
|
drm_modeset_unlock_all(dev_priv->dev);
|
||||||
return ret;
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
if (!num_clips) {
|
if (!num_clips) {
|
||||||
num_clips = 1;
|
num_clips = 1;
|
||||||
@ -979,6 +990,9 @@ int vmw_framebuffer_dmabuf_dirty(struct drm_framebuffer *framebuffer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ttm_read_unlock(&vmaster->lock);
|
ttm_read_unlock(&vmaster->lock);
|
||||||
|
|
||||||
|
drm_modeset_unlock_all(dev_priv->dev);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user