diff mbox series

[06/10] drm/gem-framebuffer: Test for imported buffers with drm_gem_is_imported()

Message ID 20250226172457.217725-7-tzimmermann@suse.de (mailing list archive)
State New
Headers show
Series drm: Hide import_attach from GEM code and helpers | expand

Commit Message

Thomas Zimmermann Feb. 26, 2025, 5:03 p.m. UTC
Instead of testing import_attach for imported GEM buffers, invoke
drm_gem_is_imported() to do the test.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_gem_framebuffer_helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Anusha Srivatsa Feb. 28, 2025, 4:17 p.m. UTC | #1
Reviewed-by: Anusha Srivatsa <asrivats@redhat.com>

On Wed, Feb 26, 2025 at 12:28 PM Thomas Zimmermann <tzimmermann@suse.de>
wrote:

> Instead of testing import_attach for imported GEM buffers, invoke
> drm_gem_is_imported() to do the test.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/drm_gem_framebuffer_helper.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_gem_framebuffer_helper.c
> b/drivers/gpu/drm/drm_gem_framebuffer_helper.c
> index 185534f56bab..2bf606ba24cd 100644
> --- a/drivers/gpu/drm/drm_gem_framebuffer_helper.c
> +++ b/drivers/gpu/drm/drm_gem_framebuffer_helper.c
> @@ -429,7 +429,7 @@ static void __drm_gem_fb_end_cpu_access(struct
> drm_framebuffer *fb, enum dma_dat
>                 if (!obj)
>                         continue;
>                 import_attach = obj->import_attach;
> -               if (!import_attach)
> +               if (!drm_gem_is_imported(obj))
>                         continue;
>                 ret = dma_buf_end_cpu_access(import_attach->dmabuf, dir);
>                 if (ret)
> @@ -466,7 +466,7 @@ int drm_gem_fb_begin_cpu_access(struct drm_framebuffer
> *fb, enum dma_data_direct
>                         goto err___drm_gem_fb_end_cpu_access;
>                 }
>                 import_attach = obj->import_attach;
> -               if (!import_attach)
> +               if (!drm_gem_is_imported(obj))
>                         continue;
>                 ret = dma_buf_begin_cpu_access(import_attach->dmabuf, dir);
>                 if (ret)
> --
> 2.48.1
>
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_gem_framebuffer_helper.c b/drivers/gpu/drm/drm_gem_framebuffer_helper.c
index 185534f56bab..2bf606ba24cd 100644
--- a/drivers/gpu/drm/drm_gem_framebuffer_helper.c
+++ b/drivers/gpu/drm/drm_gem_framebuffer_helper.c
@@ -429,7 +429,7 @@  static void __drm_gem_fb_end_cpu_access(struct drm_framebuffer *fb, enum dma_dat
 		if (!obj)
 			continue;
 		import_attach = obj->import_attach;
-		if (!import_attach)
+		if (!drm_gem_is_imported(obj))
 			continue;
 		ret = dma_buf_end_cpu_access(import_attach->dmabuf, dir);
 		if (ret)
@@ -466,7 +466,7 @@  int drm_gem_fb_begin_cpu_access(struct drm_framebuffer *fb, enum dma_data_direct
 			goto err___drm_gem_fb_end_cpu_access;
 		}
 		import_attach = obj->import_attach;
-		if (!import_attach)
+		if (!drm_gem_is_imported(obj))
 			continue;
 		ret = dma_buf_begin_cpu_access(import_attach->dmabuf, dir);
 		if (ret)