public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] accel/ivpu: Test for imported buffers with drm_gem_is_imported()
@ 2026-03-09  9:27 Karol Wachowski
  2026-03-09  9:39 ` Thomas Zimmermann
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Karol Wachowski @ 2026-03-09  9:27 UTC (permalink / raw)
  To: dri-devel
  Cc: oded.gabbay, jeff.hugo, maciej.falkowski, lizhi.hou,
	andrzej.kacprowski, tzimmermann, Karol Wachowski

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

Suggested-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Karol Wachowski <karol.wachowski@linux.intel.com>
---
 drivers/accel/ivpu/ivpu_gem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/accel/ivpu/ivpu_gem.c b/drivers/accel/ivpu/ivpu_gem.c
index 98b9ce26962b..8009965286e0 100644
--- a/drivers/accel/ivpu/ivpu_gem.c
+++ b/drivers/accel/ivpu/ivpu_gem.c
@@ -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 {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] accel/ivpu: Test for imported buffers with drm_gem_is_imported()
  2026-03-09  9:27 [PATCH] accel/ivpu: Test for imported buffers with drm_gem_is_imported() Karol Wachowski
@ 2026-03-09  9:39 ` Thomas Zimmermann
  2026-03-09  9:50   ` Karol Wachowski
  2026-03-10  2:33 ` Claude review: " Claude Code Review Bot
  2026-03-10  2:33 ` Claude Code Review Bot
  2 siblings, 1 reply; 5+ messages in thread
From: Thomas Zimmermann @ 2026-03-09  9:39 UTC (permalink / raw)
  To: Karol Wachowski, dri-devel
  Cc: oded.gabbay, jeff.hugo, maciej.falkowski, lizhi.hou,
	andrzej.kacprowski

Hi

Am 09.03.26 um 10:27 schrieb Karol Wachowski:
> 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!

>
> Suggested-by: Thomas Zimmermann <tzimmermann@suse.de>
> Signed-off-by: Karol Wachowski <karol.wachowski@linux.intel.com>

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

> ---
>   drivers/accel/ivpu/ivpu_gem.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/accel/ivpu/ivpu_gem.c b/drivers/accel/ivpu/ivpu_gem.c
> index 98b9ce26962b..8009965286e0 100644
> --- a/drivers/accel/ivpu/ivpu_gem.c
> +++ b/drivers/accel/ivpu/ivpu_gem.c
> @@ -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 {

-- 
--
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)



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] accel/ivpu: Test for imported buffers with drm_gem_is_imported()
  2026-03-09  9:39 ` Thomas Zimmermann
@ 2026-03-09  9:50   ` Karol Wachowski
  0 siblings, 0 replies; 5+ messages in thread
From: Karol Wachowski @ 2026-03-09  9:50 UTC (permalink / raw)
  To: Thomas Zimmermann, dri-devel
  Cc: oded.gabbay, jeff.hugo, maciej.falkowski, lizhi.hou,
	andrzej.kacprowski

On 3/9/2026 10:39 AM, Thomas Zimmermann wrote:
> Hi
> 
> Am 09.03.26 um 10:27 schrieb Karol Wachowski:
>> 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!
> 
>>
>> Suggested-by: Thomas Zimmermann <tzimmermann@suse.de>
>> Signed-off-by: Karol Wachowski <karol.wachowski@linux.intel.com>
> 
> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

Thank you, applied to drm-misc-next.

> 
>> ---
>>   drivers/accel/ivpu/ivpu_gem.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/accel/ivpu/ivpu_gem.c b/drivers/accel/ivpu/
>> ivpu_gem.c
>> index 98b9ce26962b..8009965286e0 100644
>> --- a/drivers/accel/ivpu/ivpu_gem.c
>> +++ b/drivers/accel/ivpu/ivpu_gem.c
>> @@ -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 {
> 
Karol

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Claude review: accel/ivpu: Test for imported buffers with drm_gem_is_imported()
  2026-03-09  9:27 [PATCH] accel/ivpu: Test for imported buffers with drm_gem_is_imported() Karol Wachowski
  2026-03-09  9:39 ` Thomas Zimmermann
  2026-03-10  2:33 ` Claude review: " Claude Code Review Bot
@ 2026-03-10  2:33 ` Claude Code Review Bot
  2 siblings, 0 replies; 5+ messages in thread
From: Claude Code Review Bot @ 2026-03-10  2:33 UTC (permalink / raw)
  To: dri-devel-reviews

Overall Series Review

Subject: accel/ivpu: Test for imported buffers with drm_gem_is_imported()
Author: Karol Wachowski <karol.wachowski@linux.intel.com>
Patches: 3
Reviewed: 2026-03-10T12:33:19.397216

---

This is a straightforward, single-patch cleanup that replaces direct accesses to `obj->import_attach` with the `drm_gem_is_imported()` helper function in the ivpu accelerator driver. The helper itself (in `drm_gem.h:646-648`) simply does `return !!obj->import_attach`, so the semantic behavior is identical. This is a good practice — using the abstraction layer instead of poking at struct internals directly.

The patch is **correct and ready to merge**. No functional change, no issues found.

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Claude review: accel/ivpu: Test for imported buffers with drm_gem_is_imported()
  2026-03-09  9:27 [PATCH] accel/ivpu: Test for imported buffers with drm_gem_is_imported() Karol Wachowski
  2026-03-09  9:39 ` Thomas Zimmermann
@ 2026-03-10  2:33 ` Claude Code Review Bot
  2026-03-10  2:33 ` Claude Code Review Bot
  2 siblings, 0 replies; 5+ messages in thread
From: Claude Code Review Bot @ 2026-03-10  2:33 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

**Correctness:** The two changes are semantically identical to the code they replace. `drm_gem_is_imported()` (defined at `include/drm/drm_gem.h:646`) is simply `return !!obj->import_attach`, so:

1. `!bo->base.base.import_attach` → `!drm_gem_is_imported(&bo->base.base)` — equivalent, since `!` on a pointer is the same as `!` on `!!pointer`.

2. `bo->base.base.import_attach` → `drm_gem_is_imported(&bo->base.base)` — equivalent truthiness test.

**Consistency with existing codebase:** The ivpu driver already uses `drm_gem_is_imported()` in three other places in the same file (`ivpu_gem.c:34`, `ivpu_gem.c:317`, `ivpu_gem.c:552` on drm-next), so these two call sites were stragglers. This patch brings full consistency.

**Minor note:** In the second hunk at `ivpu_bo_unbind_locked`, the very next line still uses `bo->base.base.import_attach` directly:
```c
if (drm_gem_is_imported(&bo->base.base)) {
    dma_buf_unmap_attachment(bo->base.base.import_attach,
                             bo->base.sgt, DMA_BIDIRECTIONAL);
```
This is correct — `dma_buf_unmap_attachment()` needs the actual `import_attach` pointer as a value, not a boolean test, so there's no accessor to replace there.

**Verdict:** Clean, correct, minimal patch. No concerns.

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-03-10  2:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-09  9:27 [PATCH] accel/ivpu: Test for imported buffers with drm_gem_is_imported() Karol Wachowski
2026-03-09  9:39 ` Thomas Zimmermann
2026-03-09  9:50   ` Karol Wachowski
2026-03-10  2:33 ` Claude review: " Claude Code Review Bot
2026-03-10  2:33 ` Claude Code Review Bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox