Commit 329e2c42 authored by Thomas Zimmermann's avatar Thomas Zimmermann
Browse files

drm/gm12u320: 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>
Link: https://patchwork.freedesktop.org/patch/msgid/20210716140801.1215-6-tzimmermann@suse.de
parent 08b7ef05
Loading
Loading
Loading
Loading
+5 −14
Original line number Diff line number Diff line
@@ -3,7 +3,6 @@
 * Copyright 2019 Hans de Goede <hdegoede@redhat.com>
 */

#include <linux/dma-buf.h>
#include <linux/module.h>
#include <linux/usb.h>

@@ -268,14 +267,11 @@ static void gm12u320_copy_fb_to_blocks(struct gm12u320_device *gm12u320)
	y2 = gm12u320->fb_update.rect.y2;
	vaddr = gm12u320->fb_update.src_map.vaddr; /* TODO: Use mapping abstraction properly */

	if (fb->obj[0]->import_attach) {
		ret = dma_buf_begin_cpu_access(
			fb->obj[0]->import_attach->dmabuf, DMA_FROM_DEVICE);
	ret = drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE);
	if (ret) {
			GM12U320_ERR("dma_buf_begin_cpu_access err: %d\n", ret);
		GM12U320_ERR("drm_gem_fb_begin_cpu_access err: %d\n", ret);
		goto put_fb;
	}
	}

	src = vaddr + y1 * fb->pitches[0] + x1 * 4;

@@ -311,12 +307,7 @@ static void gm12u320_copy_fb_to_blocks(struct gm12u320_device *gm12u320)
		src += fb->pitches[0];
	}

	if (fb->obj[0]->import_attach) {
		ret = dma_buf_end_cpu_access(fb->obj[0]->import_attach->dmabuf,
					     DMA_FROM_DEVICE);
		if (ret)
			GM12U320_ERR("dma_buf_end_cpu_access err: %d\n", ret);
	}
	drm_gem_fb_end_cpu_access(fb, DMA_FROM_DEVICE);
put_fb:
	drm_framebuffer_put(fb);
	gm12u320->fb_update.fb = NULL;