diff options
author | Thomas Zimmermann <tzimmermann@suse.de> | 2019-12-06 09:59:50 +0100 |
---|---|---|
committer | Thomas Zimmermann <tzimmermann@suse.de> | 2019-12-06 13:51:32 +0100 |
commit | 2d2bebb8332317551ef6fe168396b09337af67df (patch) | |
tree | fa73b1677c5632fb7f5f1288541dafedcfa5a0ab /drivers/gpu/drm/udl | |
parent | d15e35dafb1e8f246e86963c22f1dfca01851ba8 (diff) | |
download | linux-2d2bebb8332317551ef6fe168396b09337af67df.tar.bz2 |
drm/udl: Vmap framebuffer after all tests succeeded in damage handling
We now do the fast tests before the potentially expensive vmap operation.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191206085954.9697-4-tzimmermann@suse.de
Diffstat (limited to 'drivers/gpu/drm/udl')
-rw-r--r-- | drivers/gpu/drm/udl/udl_fb.c | 19 | ||||
-rw-r--r-- | drivers/gpu/drm/udl/udl_transfer.c | 1 |
2 files changed, 7 insertions, 13 deletions
diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c index ed6d9476b25b..dd7ba7f63214 100644 --- a/drivers/gpu/drm/udl/udl_fb.c +++ b/drivers/gpu/drm/udl/udl_fb.c @@ -85,12 +85,6 @@ int udl_handle_damage(struct drm_framebuffer *fb, int x, int y, } spin_unlock(&udl->active_fb_16_lock); - vaddr = drm_gem_shmem_vmap(fb->obj[0]); - if (IS_ERR(vaddr)) { - DRM_ERROR("failed to vmap fb\n"); - return 0; - } - aligned_x = DL_ALIGN_DOWN(x, sizeof(unsigned long)); width = DL_ALIGN_UP(width + (x-aligned_x), sizeof(unsigned long)); x = aligned_x; @@ -98,8 +92,13 @@ int udl_handle_damage(struct drm_framebuffer *fb, int x, int y, if ((width <= 0) || (x + width > fb->width) || (y + height > fb->height)) { - ret = -EINVAL; - goto err_drm_gem_shmem_vunmap; + return -EINVAL; + } + + vaddr = drm_gem_shmem_vmap(fb->obj[0]); + if (IS_ERR(vaddr)) { + DRM_ERROR("failed to vmap fb\n"); + return 0; } urb = udl_get_urb(dev); @@ -131,10 +130,6 @@ out: drm_gem_shmem_vunmap(fb->obj[0], vaddr); return 0; - -err_drm_gem_shmem_vunmap: - drm_gem_shmem_vunmap(fb->obj[0], vaddr); - return ret; } static int udl_user_framebuffer_dirty(struct drm_framebuffer *fb, diff --git a/drivers/gpu/drm/udl/udl_transfer.c b/drivers/gpu/drm/udl/udl_transfer.c index 686358d1f669..5fae48723286 100644 --- a/drivers/gpu/drm/udl/udl_transfer.c +++ b/drivers/gpu/drm/udl/udl_transfer.c @@ -249,4 +249,3 @@ int udl_render_hline(struct drm_device *dev, int log_bpp, struct urb **urb_ptr, return 0; } - |