All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/6] drm: consolidate self-imported PRIME dma-buf detection
@ 2026-10-14 19:02 Niranjana Vishwanathapura
  2026-10-14 19:02 ` [PATCH v3 1/6] drm/gem: add helper to detect self-imported PRIME dma-bufs Niranjana Vishwanathapura
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Niranjana Vishwanathapura @ 2026-10-14 19:02 UTC (permalink / raw)
  To: dri-devel, intel-xe, matthew.brost, tzimmermann

Detecting that a PRIME dma-buf being imported was exported by the same
DRM device is a pattern currently open-coded in many drivers (compare
dma_buf->ops against the driver's own ops, check obj->dev == dev, then
return the GEM object with an extra reference). This series adds generic
helpers for it and converts several drivers to use them.

Patch 1 adds drm_gem_prime_self_import(dev, dma_buf, ops): for a dma-buf
self-exported via the given ops, it returns the backing GEM object with
a reference, letting a driver short-circuit the generic PRIME import and
skip the extra dma-buf file reference. Patch 2 converts Xe to it.

Patch 3 adds drm_gem_prime_dma_buf_to_gem(), a thin wrapper that uses the
core PRIME ops, and replaces the drm_gem_is_prime_exported_dma_buf() bool
predicate with it so the shmem importer resolves the object directly
(the sole caller already wanted the referenced object).

Patches 4-6 convert panthor, panfrost and amdgpu to
drm_gem_prime_self_import(), removing the duplicated open-coded checks.

No intended functional change.

v2: Add patches 4-6
v2: Move drm_gem_prime_self_import() to drm_gem.h as a static inline
    helper routine

Assisted-by: GitHub-Copilot:claude-opus-4.8
Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>

Farah Kassabri (2):
  drm/gem: add helper to detect self-imported PRIME dma-bufs
  drm/xe/dma-buf: Use drm helper to detect dma-buf self-import

Niranjana Vishwanathapura (4):
  drm/gem: add drm_gem_prime_dma_buf_to_gem() self-import helper
  drm/panthor: use drm_gem_prime_self_import() helper
  drm/panfrost: use drm_gem_prime_self_import() helper
  drm/amdgpu: use drm_gem_prime_self_import() helper

 drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 14 ++-----
 drivers/gpu/drm/drm_gem_shmem_helper.c      | 14 +++----
 drivers/gpu/drm/drm_prime.c                 | 36 +++++++++---------
 drivers/gpu/drm/panfrost/panfrost_gem.c     | 10 ++---
 drivers/gpu/drm/panthor/panthor_gem.c       | 10 ++---
 drivers/gpu/drm/xe/xe_dma_buf.c             | 23 ++++++-----
 drivers/gpu/drm/xe/xe_dma_buf.h             |  2 +
 include/drm/drm_gem.h                       | 42 +++++++++++++++++++++
 include/drm/drm_prime.h                     |  4 +-
 9 files changed, 91 insertions(+), 64 deletions(-)

-- 
2.43.0


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

end of thread, other threads:[~2026-10-18 20:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-14 19:02 [PATCH v3 0/6] drm: consolidate self-imported PRIME dma-buf detection Niranjana Vishwanathapura
2026-10-14 19:02 ` [PATCH v3 1/6] drm/gem: add helper to detect self-imported PRIME dma-bufs Niranjana Vishwanathapura
2026-10-15  7:27   ` Thomas Zimmermann
2026-10-16  6:26     ` Niranjana Vishwanathapura
2026-10-16  7:46       ` Thomas Zimmermann
2026-10-18 20:25         ` Niranjana Vishwanathapura
2026-10-14 19:02 ` [PATCH v3 2/6] drm/xe/dma-buf: Use drm helper to detect dma-buf self-import Niranjana Vishwanathapura
2026-10-14 19:02 ` [PATCH v3 3/6] drm/gem: add drm_gem_prime_dma_buf_to_gem() self-import helper Niranjana Vishwanathapura
2026-10-14 19:02 ` [PATCH v3 4/6] drm/panthor: use drm_gem_prime_self_import() helper Niranjana Vishwanathapura
2026-10-14 19:02 ` [PATCH v3 5/6] drm/panfrost: " Niranjana Vishwanathapura
2026-10-14 19:02 ` [PATCH v3 6/6] drm/amdgpu: " Niranjana Vishwanathapura

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.