drm/etnaviv: Test for imported buffers with drm_gem_is_imported()
authorThomas Zimmermann <tzimmermann@suse.de>
Mon, 17 Mar 2025 13:06:40 +0000 (14:06 +0100)
committerThomas Zimmermann <tzimmermann@suse.de>
Mon, 14 Apr 2025 08:53:11 +0000 (10:53 +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>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Russell King <linux+etnaviv@armlinux.org.uk>
Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: etnaviv@lists.freedesktop.org
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Link: https://lore.kernel.org/r/20250317131923.238374-3-tzimmermann@suse.de
drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c

index 42e57d1425540ad4838ab415c2ffd6699ed141f7..40a50c60dfff761a5e57a3eb03d42d7fba24c32a 100644 (file)
@@ -39,7 +39,7 @@ int etnaviv_gem_prime_vmap(struct drm_gem_object *obj, struct iosys_map *map)
 
 int etnaviv_gem_prime_pin(struct drm_gem_object *obj)
 {
-       if (!obj->import_attach) {
+       if (!drm_gem_is_imported(obj)) {
                struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj);
 
                mutex_lock(&etnaviv_obj->lock);
@@ -51,7 +51,7 @@ int etnaviv_gem_prime_pin(struct drm_gem_object *obj)
 
 void etnaviv_gem_prime_unpin(struct drm_gem_object *obj)
 {
-       if (!obj->import_attach) {
+       if (!drm_gem_is_imported(obj)) {
                struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj);
 
                mutex_lock(&etnaviv_obj->lock);