[PATCH 08/11] drm/i915: Test for imported buffers with drm_gem_is_imported()
Thomas Zimmermann
tzimmermann at suse.de
Mon Apr 14 13:48:15 UTC 2025
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 at suse.de>
Cc: Jani Nikula <jani.nikula at linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
Cc: Tvrtko Ursulin <tursulin at ursulin.net>
Cc: intel-gfx at lists.freedesktop.org
Cc: dri-devel at lists.freedesktop.org
---
drivers/gpu/drm/i915/gem/i915_gem_object.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.c b/drivers/gpu/drm/i915/gem/i915_gem_object.c
index 1f38e367c60b..27f5351f046a 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_object.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_object.c
@@ -371,12 +371,12 @@ void __i915_gem_object_pages_fini(struct drm_i915_gem_object *obj)
* and ttm_bo_cleanup_memtype_use() shouldn't be invoked for
* dma-buf, so it's safe to take the lock.
*/
- if (obj->base.import_attach)
+ if (drm_gem_is_imported(&obj->base))
i915_gem_object_lock(obj, NULL);
__i915_gem_object_put_pages(obj);
- if (obj->base.import_attach)
+ if (drm_gem_is_imported(&obj->base))
i915_gem_object_unlock(obj);
GEM_BUG_ON(i915_gem_object_has_pages(obj));
@@ -390,7 +390,7 @@ void __i915_gem_free_object(struct drm_i915_gem_object *obj)
bitmap_free(obj->bit_17);
- if (obj->base.import_attach)
+ if (drm_gem_is_imported(&obj->base))
drm_prime_gem_destroy(&obj->base, NULL);
drm_gem_free_mmap_offset(&obj->base);
--
2.49.0
More information about the dri-devel
mailing list