* [PATCH 10/11] drm/xe: Test for imported buffers with drm_gem_is_imported()
@ 2025-04-14 13:48 Thomas Zimmermann
2025-04-15 13:49 ` Thomas Hellström
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Zimmermann @ 2025-04-14 13:48 UTC (permalink / raw)
To: airlied, simona, mripard, maarten.lankhorst
Cc: dri-devel, Thomas Zimmermann, Lucas De Marchi,
Thomas Hellström, Rodrigo Vivi, intel-xe
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 De Marchi <lucas.demarchi@intel.com>
Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: intel-xe@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
---
drivers/gpu/drm/xe/xe_bo.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
index c337790c81ae..adb69e0bbcb4 100644
--- a/drivers/gpu/drm/xe/xe_bo.c
+++ b/drivers/gpu/drm/xe/xe_bo.c
@@ -749,7 +749,7 @@ static int xe_bo_move_notify(struct xe_bo *bo,
return ret;
/* Don't call move_notify() for imported dma-bufs. */
- if (ttm_bo->base.dma_buf && !ttm_bo->base.import_attach)
+ if (ttm_bo->base.dma_buf && !drm_gem_is_imported(&ttm_bo->base))
dma_buf_move_notify(ttm_bo->base.dma_buf);
/*
@@ -1514,7 +1514,7 @@ static void xe_ttm_bo_destroy(struct ttm_buffer_object *ttm_bo)
struct xe_tile *tile;
u8 id;
- if (bo->ttm.base.import_attach)
+ if (drm_gem_is_imported(&bo->ttm.base))
drm_prime_gem_destroy(&bo->ttm.base, NULL);
drm_gem_object_release(&bo->ttm.base);
@@ -2228,7 +2228,7 @@ int xe_bo_pin(struct xe_bo *bo)
* No reason we can't support pinning imported dma-bufs we just don't
* expect to pin an imported dma-buf.
*/
- xe_assert(xe, !bo->ttm.base.import_attach);
+ xe_assert(xe, !drm_gem_is_imported(&bo->ttm.base));
/* We only expect at most 1 pin */
xe_assert(xe, !xe_bo_is_pinned(bo));
@@ -2298,7 +2298,7 @@ void xe_bo_unpin(struct xe_bo *bo)
struct ttm_place *place = &bo->placements[0];
struct xe_device *xe = xe_bo_device(bo);
- xe_assert(xe, !bo->ttm.base.import_attach);
+ xe_assert(xe, !drm_gem_is_imported(&bo->ttm.base));
xe_assert(xe, xe_bo_is_pinned(bo));
if (mem_type_is_vram(place->mem_type) || bo->flags & XE_BO_FLAG_GGTT) {
--
2.49.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 10/11] drm/xe: Test for imported buffers with drm_gem_is_imported()
2025-04-14 13:48 [PATCH 10/11] drm/xe: Test for imported buffers with drm_gem_is_imported() Thomas Zimmermann
@ 2025-04-15 13:49 ` Thomas Hellström
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Hellström @ 2025-04-15 13:49 UTC (permalink / raw)
To: Thomas Zimmermann, airlied, simona, mripard, maarten.lankhorst
Cc: dri-devel, Lucas De Marchi, Rodrigo Vivi, intel-xe
On Mon, 2025-04-14 at 15:48 +0200, Thomas Zimmermann wrote:
> 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 De Marchi <lucas.demarchi@intel.com>
> Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: intel-xe@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> ---
> drivers/gpu/drm/xe/xe_bo.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
> index c337790c81ae..adb69e0bbcb4 100644
> --- a/drivers/gpu/drm/xe/xe_bo.c
> +++ b/drivers/gpu/drm/xe/xe_bo.c
> @@ -749,7 +749,7 @@ static int xe_bo_move_notify(struct xe_bo *bo,
> return ret;
>
> /* Don't call move_notify() for imported dma-bufs. */
> - if (ttm_bo->base.dma_buf && !ttm_bo->base.import_attach)
> + if (ttm_bo->base.dma_buf && !drm_gem_is_imported(&ttm_bo-
> >base))
> dma_buf_move_notify(ttm_bo->base.dma_buf);
>
> /*
> @@ -1514,7 +1514,7 @@ static void xe_ttm_bo_destroy(struct
> ttm_buffer_object *ttm_bo)
> struct xe_tile *tile;
> u8 id;
>
> - if (bo->ttm.base.import_attach)
> + if (drm_gem_is_imported(&bo->ttm.base))
> drm_prime_gem_destroy(&bo->ttm.base, NULL);
> drm_gem_object_release(&bo->ttm.base);
>
> @@ -2228,7 +2228,7 @@ int xe_bo_pin(struct xe_bo *bo)
> * No reason we can't support pinning imported dma-bufs we
> just don't
> * expect to pin an imported dma-buf.
> */
> - xe_assert(xe, !bo->ttm.base.import_attach);
> + xe_assert(xe, !drm_gem_is_imported(&bo->ttm.base));
>
> /* We only expect at most 1 pin */
> xe_assert(xe, !xe_bo_is_pinned(bo));
> @@ -2298,7 +2298,7 @@ void xe_bo_unpin(struct xe_bo *bo)
> struct ttm_place *place = &bo->placements[0];
> struct xe_device *xe = xe_bo_device(bo);
>
> - xe_assert(xe, !bo->ttm.base.import_attach);
> + xe_assert(xe, !drm_gem_is_imported(&bo->ttm.base));
> xe_assert(xe, xe_bo_is_pinned(bo));
>
> if (mem_type_is_vram(place->mem_type) || bo->flags &
> XE_BO_FLAG_GGTT) {
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-04-15 13:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-14 13:48 [PATCH 10/11] drm/xe: Test for imported buffers with drm_gem_is_imported() Thomas Zimmermann
2025-04-15 13:49 ` Thomas Hellström
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.