Skip to contentSkip to conversation

drm/armada: Test for imported buffers with drm_gem_is_imported()

PATCH In review Thomas Zimmermann 1 participant 1 message Apr 14, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/11 drm/armada: Test for imported buffers with drm_gem_is_imported()

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.

---
 drivers/gpu/drm/armada/armada_fb.c  | 2 +-
 drivers/gpu/drm/armada/armada_gem.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/armada/armada_fb.c +1 -1
index cf2e88218dc0..67af4bd8797f 100644
@@ -110,7 +110,7 @@ struct drm_framebuffer *armada_fb_create(struct drm_device *dev,
 		goto err;
 	}
 
-	if (obj->obj.import_attach && !obj->sgt) {
+	if (drm_gem_is_imported(&obj->obj) && !obj->sgt) {
 		ret = armada_gem_map_import(obj);
 		if (ret)
 			goto err_unref;
drivers/gpu/drm/armada/armada_gem.c +1 -1
index 1a1680d71486..bd4209b6a893 100644
@@ -63,7 +63,7 @@ void armada_gem_free_object(struct drm_gem_object *obj)
 			iounmap(dobj->addr);
 	}
 
-	if (dobj->obj.import_attach) {
+	if (drm_gem_is_imported(&dobj->obj)) {
 		/* We only ever display imported data */
 		if (dobj->sgt)
 			dma_buf_unmap_attachment_unlocked(dobj->obj.import_attach,
Signature · 1 line
2.49.0