Commit 2d2bebb8 authored by Thomas Zimmermann's avatar Thomas Zimmermann

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: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarEmil Velikov <emil.velikov@collabora.com>
Acked-by: default avatarGerd Hoffmann <kraxel@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191206085954.9697-4-tzimmermann@suse.de
parent d15e35da
...@@ -85,12 +85,6 @@ int udl_handle_damage(struct drm_framebuffer *fb, int x, int y, ...@@ -85,12 +85,6 @@ int udl_handle_damage(struct drm_framebuffer *fb, int x, int y,
} }
spin_unlock(&udl->active_fb_16_lock); 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)); aligned_x = DL_ALIGN_DOWN(x, sizeof(unsigned long));
width = DL_ALIGN_UP(width + (x-aligned_x), sizeof(unsigned long)); width = DL_ALIGN_UP(width + (x-aligned_x), sizeof(unsigned long));
x = aligned_x; x = aligned_x;
...@@ -98,8 +92,13 @@ int udl_handle_damage(struct drm_framebuffer *fb, int x, int y, ...@@ -98,8 +92,13 @@ int udl_handle_damage(struct drm_framebuffer *fb, int x, int y,
if ((width <= 0) || if ((width <= 0) ||
(x + width > fb->width) || (x + width > fb->width) ||
(y + height > fb->height)) { (y + height > fb->height)) {
ret = -EINVAL; return -EINVAL;
goto err_drm_gem_shmem_vunmap; }
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); urb = udl_get_urb(dev);
...@@ -131,10 +130,6 @@ int udl_handle_damage(struct drm_framebuffer *fb, int x, int y, ...@@ -131,10 +130,6 @@ int udl_handle_damage(struct drm_framebuffer *fb, int x, int y,
drm_gem_shmem_vunmap(fb->obj[0], vaddr); drm_gem_shmem_vunmap(fb->obj[0], vaddr);
return 0; 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, static int udl_user_framebuffer_dirty(struct drm_framebuffer *fb,
......
...@@ -249,4 +249,3 @@ int udl_render_hline(struct drm_device *dev, int log_bpp, struct urb **urb_ptr, ...@@ -249,4 +249,3 @@ int udl_render_hline(struct drm_device *dev, int log_bpp, struct urb **urb_ptr,
return 0; return 0;
} }
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