Commit 9200454c authored by Thomas Zimmermann's avatar Thomas Zimmermann

drm/st7586: Use framebuffer dma-buf helpers

Replace dma_buf_begin_cpu_access() with drm_gem_fb_begin_cpu_access();
same for _end_cpu_access(). Remove some boiler-plate code. No functional
changes.
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarNoralf Trønnes <noralf@tronnes.org>
Acked-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: default avatarDavid Lechner <david@lechnology.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210716140801.1215-8-tzimmermann@suse.de
parent baf6c24b
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
*/ */
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/dma-buf.h>
#include <linux/gpio/consumer.h> #include <linux/gpio/consumer.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/property.h> #include <linux/property.h>
...@@ -21,6 +20,7 @@ ...@@ -21,6 +20,7 @@
#include <drm/drm_format_helper.h> #include <drm/drm_format_helper.h>
#include <drm/drm_gem_atomic_helper.h> #include <drm/drm_gem_atomic_helper.h>
#include <drm/drm_gem_cma_helper.h> #include <drm/drm_gem_cma_helper.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_managed.h> #include <drm/drm_managed.h>
#include <drm/drm_mipi_dbi.h> #include <drm/drm_mipi_dbi.h>
#include <drm/drm_rect.h> #include <drm/drm_rect.h>
...@@ -92,24 +92,18 @@ static int st7586_buf_copy(void *dst, struct drm_framebuffer *fb, ...@@ -92,24 +92,18 @@ static int st7586_buf_copy(void *dst, struct drm_framebuffer *fb,
struct drm_rect *clip) struct drm_rect *clip)
{ {
struct drm_gem_cma_object *cma_obj = drm_fb_cma_get_gem_obj(fb, 0); struct drm_gem_cma_object *cma_obj = drm_fb_cma_get_gem_obj(fb, 0);
struct dma_buf_attachment *import_attach = cma_obj->base.import_attach;
void *src = cma_obj->vaddr; void *src = cma_obj->vaddr;
int ret = 0; int ret = 0;
if (import_attach) { ret = drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE);
ret = dma_buf_begin_cpu_access(import_attach->dmabuf, if (ret)
DMA_FROM_DEVICE); return ret;
if (ret)
return ret;
}
st7586_xrgb8888_to_gray332(dst, src, fb, clip); st7586_xrgb8888_to_gray332(dst, src, fb, clip);
if (import_attach) drm_gem_fb_end_cpu_access(fb, DMA_FROM_DEVICE);
ret = dma_buf_end_cpu_access(import_attach->dmabuf,
DMA_FROM_DEVICE);
return ret; return 0;
} }
static void st7586_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect) static void st7586_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect)
......
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