On Fri, Jul 16, 2021 at 04:07:57PM +0200, Thomas Zimmermann wrote: > 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. > > There's one left-over reference to the imported attachment that we > keep. GEM BOs with imported attachment are considered uncached and > enables special handling within the drm_fb_swab(). > > Signed-off-by: Thomas Zimmermann <tzimmermann@xxxxxxx> > --- > drivers/gpu/drm/drm_mipi_dbi.c | 20 +++++++------------- > 1 file changed, 7 insertions(+), 13 deletions(-) > > diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c > index 10b4e59384ae..71b646c4131f 100644 > --- a/drivers/gpu/drm/drm_mipi_dbi.c > +++ b/drivers/gpu/drm/drm_mipi_dbi.c > @@ -7,7 +7,6 @@ > > #include <linux/debugfs.h> > #include <linux/delay.h> > -#include <linux/dma-buf.h> > #include <linux/gpio/consumer.h> > #include <linux/module.h> > #include <linux/regulator/consumer.h> > @@ -202,21 +201,17 @@ int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb, > { > struct drm_gem_object *gem = drm_gem_fb_get_obj(fb, 0); > struct drm_gem_cma_object *cma_obj = to_drm_gem_cma_obj(gem); > - struct dma_buf_attachment *import_attach = gem->import_attach; > void *src = cma_obj->vaddr; > - int ret = 0; > + int ret; > > - if (import_attach) { > - ret = dma_buf_begin_cpu_access(import_attach->dmabuf, > - DMA_FROM_DEVICE); > - if (ret) > - return ret; > - } > + ret = drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE); > + if (ret) > + return ret; > > switch (fb->format->format) { > case DRM_FORMAT_RGB565: > if (swap) > - drm_fb_swab(dst, src, fb, clip, !import_attach); > + drm_fb_swab(dst, src, fb, clip, !gem->import_attach); I freaked out about this because for dma-buf WC vs WB is undefined, but it's purely a perf optimization. So it's fine. Plus we're not even bothering with the iomem vs normal memory distinction here. Anyway, that aside, all looks good. On the series: Acked-by: Daniel Vetter <daniel.vetter@xxxxxxxx> > else > drm_fb_memcpy(dst, src, fb, clip); > break; > @@ -229,9 +224,8 @@ int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb, > return -EINVAL; > } > > - if (import_attach) > - ret = dma_buf_end_cpu_access(import_attach->dmabuf, > - DMA_FROM_DEVICE); > + drm_gem_fb_end_cpu_access(fb, DMA_FROM_DEVICE); > + > return ret; > } > EXPORT_SYMBOL(mipi_dbi_buf_copy); > -- > 2.32.0 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch