@@ -290,14 +290,18 @@ static int udl_handle_damage(struct drm_framebuffer *fb, int x, int y,
else if ((clip.x2 > fb->width) || (clip.y2 > fb->height))
return -EINVAL;
+ ret = dma_resv_lock(fb->obj[0]->resv, NULL);
+ if (ret)
+ return ret;
+
if (import_attach) {
ret = dma_buf_begin_cpu_access(import_attach->dmabuf,
DMA_FROM_DEVICE);
if (ret)
- return ret;
+ goto out_dma_resv_unlock;
}
- ret = drm_gem_shmem_vmap(fb->obj[0], &map);
+ ret = drm_gem_shmem_vmap_local(fb->obj[0], &map);
if (ret) {
DRM_ERROR("failed to vmap fb\n");
goto out_dma_buf_end_cpu_access;
@@ -307,7 +311,7 @@ static int udl_handle_damage(struct drm_framebuffer *fb, int x, int y,
urb = udl_get_urb(dev);
if (!urb) {
ret = -ENOMEM;
- goto out_drm_gem_shmem_vunmap;
+ goto out_drm_gem_shmem_vunmap_local;
}
cmd = urb->transfer_buffer;
@@ -320,7 +324,7 @@ static int udl_handle_damage(struct drm_framebuffer *fb, int x, int y,
&cmd, byte_offset, dev_byte_offset,
byte_width);
if (ret)
- goto out_drm_gem_shmem_vunmap;
+ goto out_drm_gem_shmem_vunmap_local;
}
if (cmd > (char *)urb->transfer_buffer) {
@@ -336,8 +340,8 @@ static int udl_handle_damage(struct drm_framebuffer *fb, int x, int y,
ret = 0;
-out_drm_gem_shmem_vunmap:
- drm_gem_shmem_vunmap(fb->obj[0], &map);
+out_drm_gem_shmem_vunmap_local:
+ drm_gem_shmem_vunmap_local(fb->obj[0], &map);
out_dma_buf_end_cpu_access:
if (import_attach) {
tmp_ret = dma_buf_end_cpu_access(import_attach->dmabuf,
@@ -345,6 +349,8 @@ static int udl_handle_damage(struct drm_framebuffer *fb, int x, int y,
if (tmp_ret && !ret)
ret = tmp_ret; /* only update ret if not set yet */
}
+out_dma_resv_unlock:
+ dma_resv_unlock(fb->obj[0]->resv);
return ret;
}
Damage handling in udl requires a short-term mapping of the source BO. Use drm_gem_shmem_vmap_local(). Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> --- drivers/gpu/drm/udl/udl_modeset.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)