Skip to contentSkip to conversation

accel/ivpu: Test for imported buffers with drm_gem_is_imported()

PATCH In review Karol Wachowski 2 participants 3 messages Mar 9

Subsystems (2)
lore
Share & tools
lore

Karol Wachowski

author maintainer
#0 lore raw

PATCH 1/1 accel/ivpu: 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 test itself does not change.

---
 drivers/accel/ivpu/ivpu_gem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/accel/ivpu/ivpu_gem.c +2 -2
index 98b9ce26962b..8009965286e0 100644
@@ -48,7 +48,7 @@ static struct sg_table *ivpu_bo_map_attachment(struct ivpu_device *vdev, struct
 {
 	struct sg_table *sgt;
 
-	drm_WARN_ON(&vdev->drm, !bo->base.base.import_attach);
+	drm_WARN_ON(&vdev->drm, !drm_gem_is_imported(&bo->base.base));
 
 	ivpu_bo_lock(bo);
 
@@ -157,7 +157,7 @@ static void ivpu_bo_unbind_locked(struct ivpu_bo *bo)
 	}
 
 	if (bo->base.sgt) {
-		if (bo->base.base.import_attach) {
+		if (drm_gem_is_imported(&bo->base.base)) {
 			dma_buf_unmap_attachment(bo->base.base.import_attach,
 						 bo->base.sgt, DMA_BIDIRECTIONAL);
 		} else {
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw

Hi

Am 09.03.26 um 10:27 schrieb Karol Wachowski:

Quoted 2 lines

Instead of testing import_attach for imported GEM buffers, invoke drm_gem_is_imported() to do the test. The test itself does not change.

Thanks a lot!

Quoted 3 lines
Quoted 26 lines
---
  drivers/accel/ivpu/ivpu_gem.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/accel/ivpu/ivpu_gem.c +2 -2
index 98b9ce26962b..8009965286e0 100644
@@ -48,7 +48,7 @@ static struct sg_table *ivpu_bo_map_attachment(struct ivpu_device *vdev, struct
  {
  	struct sg_table *sgt;
 
-	drm_WARN_ON(&vdev->drm, !bo->base.base.import_attach);
+	drm_WARN_ON(&vdev->drm, !drm_gem_is_imported(&bo->base.base));
 
  	ivpu_bo_lock(bo);
 
@@ -157,7 +157,7 @@ static void ivpu_bo_unbind_locked(struct ivpu_bo *bo)
  	}
 
  	if (bo->base.sgt) {
-		if (bo->base.base.import_attach) {
+		if (drm_gem_is_imported(&bo->base.base)) {
  			dma_buf_unmap_attachment(bo->base.base.import_attach,
  						 bo->base.sgt, DMA_BIDIRECTIONAL);
  		} else {
Signature · 6 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)
author maintainer Applied
#2 lore raw
Quoted 6 lines · Thomas Zimmermann

Hi

Am 09.03.26 um 10:27 schrieb Karol Wachowski:

Quoted 2 lines

Instead of testing import_attach for imported GEM buffers, invoke drm_gem_is_imported() to do the test. The test itself does not change.

Quoted 7 lines

Thanks a lot!

Quoted 3 lines

Thank you, applied to drm-misc-next.

Quoted 18 lines
Quoted 18 lines

---
  drivers/accel/ivpu/ivpu_gem.c | 4 ++--

  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/accel/ivpu/ renamed from drivers/accel/ivpu/ivpu_gem.c +0 -0

ivpu_gem.c
index 98b9ce26962b..8009965286e0 100644

drivers/accel/ivpu/ivpu_gem.c +1 -0
@@ -48,7 +48,7 @@ static struct sg_table
 *ivpu_bo_map_attachment(struct ivpu_device *vdev, struct
   {
       struct sg_table *sgt;
   -    drm_WARN_ON(&vdev->drm, !bo->base.base.import_attach);
+    drm_WARN_ON(&vdev->drm, !drm_gem_is_imported(&bo->base.base));
         ivpu_bo_lock(bo);

  @@ -157,7 +157,7 @@ static void ivpu_bo_unbind_locked(struct ivpu_bo

Quoted 9 lines
Quoted 8 lines

*bo)
      }
        if (bo->base.sgt) {
-        if (bo->base.base.import_attach) {
+        if (drm_gem_is_imported(&bo->base.base)) { dma_buf_unmap_attachment(bo->base.base.import_attach, bo->base.sgt, DMA_BIDIRECTIONAL); } else {

Karol