]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
accel/ivpu: Test for imported buffers with drm_gem_is_imported()
authorThomas Zimmermann <tzimmermann@suse.de>
Tue, 8 Apr 2025 11:31:26 +0000 (13:31 +0200)
committerJacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Thu, 10 Apr 2025 13:13:24 +0000 (15:13 +0200)
Instead of testing import_attach for imported GEM buffers, invoke
drm_gem_is_imported() to do the test. The helper tests the dma_buf
itself while import_attach is just an artifact of the import. Prepares
to make import_attach optional.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Link: https://lore.kernel.org/r/20250408113247.418007-1-tzimmermann@suse.de
drivers/accel/ivpu/ivpu_gem.c

index 212d21ad2bbd026b28396d7d3c7c4709d0626d62..e0d242d9f3e506bd37c33c9549507cf43f18ef6f 100644 (file)
@@ -30,7 +30,7 @@ static inline void ivpu_dbg_bo(struct ivpu_device *vdev, struct ivpu_bo *bo, con
                 "%6s: bo %8p vpu_addr %9llx size %8zu ctx %d has_pages %d dma_mapped %d mmu_mapped %d wc %d imported %d\n",
                 action, bo, bo->vpu_addr, ivpu_bo_size(bo), bo->ctx ? bo->ctx->id : 0,
                 (bool)bo->base.pages, (bool)bo->base.sgt, bo->mmu_mapped, bo->base.map_wc,
-                (bool)bo->base.base.import_attach);
+                (bool)drm_gem_is_imported(&bo->base.base));
 }
 
 /*
@@ -122,7 +122,7 @@ static void ivpu_bo_unbind_locked(struct ivpu_bo *bo)
                bo->ctx = NULL;
        }
 
-       if (bo->base.base.import_attach)
+       if (drm_gem_is_imported(&bo->base.base))
                return;
 
        dma_resv_lock(bo->base.base.resv, NULL);
@@ -461,7 +461,7 @@ static void ivpu_bo_print_info(struct ivpu_bo *bo, struct drm_printer *p)
        if (bo->mmu_mapped)
                drm_printf(p, " mmu_mapped");
 
-       if (bo->base.base.import_attach)
+       if (drm_gem_is_imported(&bo->base.base))
                drm_printf(p, " imported");
 
        drm_printf(p, "\n");