Commit 0029d318 authored by Thomas Zimmermann's avatar Thomas Zimmermann

drm/gud: Map framebuffer BOs with drm_gem_fb_vmap()

Abstract the framebuffer details by mapping its BOs with a call
to drm_gem_fb_vmap(). Unmap with drm_gem_fb_vunmap().

The call to drm_gem_fb_vmap() ensures that all BOs are mapped
correctly. Gud still only supports single-plane formats.

No functional changes.
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Acked-by: default avatarNoralf Trønnes <noralf@tronnes.org>
Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210730183511.20080-5-tzimmermann@suse.de
parent 0ec77bd9
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
#include <drm/drm_format_helper.h> #include <drm/drm_format_helper.h>
#include <drm/drm_fourcc.h> #include <drm/drm_fourcc.h>
#include <drm/drm_framebuffer.h> #include <drm/drm_framebuffer.h>
#include <drm/drm_gem.h>
#include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_gem_shmem_helper.h>
#include <drm/drm_print.h> #include <drm/drm_print.h>
#include <drm/drm_rect.h> #include <drm/drm_rect.h>
#include <drm/drm_simple_kms_helper.h> #include <drm/drm_simple_kms_helper.h>
...@@ -152,7 +152,7 @@ static int gud_prep_flush(struct gud_device *gdrm, struct drm_framebuffer *fb, ...@@ -152,7 +152,7 @@ static int gud_prep_flush(struct gud_device *gdrm, struct drm_framebuffer *fb,
{ {
struct dma_buf_attachment *import_attach = fb->obj[0]->import_attach; struct dma_buf_attachment *import_attach = fb->obj[0]->import_attach;
u8 compression = gdrm->compression; u8 compression = gdrm->compression;
struct dma_buf_map map; struct dma_buf_map map[DRM_FORMAT_MAX_PLANES];
void *vaddr, *buf; void *vaddr, *buf;
size_t pitch, len; size_t pitch, len;
int ret = 0; int ret = 0;
...@@ -162,11 +162,11 @@ static int gud_prep_flush(struct gud_device *gdrm, struct drm_framebuffer *fb, ...@@ -162,11 +162,11 @@ static int gud_prep_flush(struct gud_device *gdrm, struct drm_framebuffer *fb,
if (len > gdrm->bulk_len) if (len > gdrm->bulk_len)
return -E2BIG; return -E2BIG;
ret = drm_gem_shmem_vmap(fb->obj[0], &map); ret = drm_gem_fb_vmap(fb, map);
if (ret) if (ret)
return ret; return ret;
vaddr = map.vaddr + fb->offsets[0]; vaddr = map[0].vaddr + fb->offsets[0];
ret = drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE); ret = drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE);
if (ret) if (ret)
...@@ -225,7 +225,7 @@ static int gud_prep_flush(struct gud_device *gdrm, struct drm_framebuffer *fb, ...@@ -225,7 +225,7 @@ static int gud_prep_flush(struct gud_device *gdrm, struct drm_framebuffer *fb,
end_cpu_access: end_cpu_access:
drm_gem_fb_end_cpu_access(fb, DMA_FROM_DEVICE); drm_gem_fb_end_cpu_access(fb, DMA_FROM_DEVICE);
vunmap: vunmap:
drm_gem_shmem_vunmap(fb->obj[0], &map); drm_gem_fb_vunmap(fb, map);
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