From: Boris Brezillon <boris.brezillon@collabora.com>
To: Steven Price <steven.price@arm.com>
Cc: Thomas Zimmermann <tzimmermann@suse.de>,
airlied@gmail.com, simona@ffwll.ch,
maarten.lankhorst@linux.intel.com, mripard@kernel.org,
dri-devel@lists.freedesktop.org,
Liviu Dudau <liviu.dudau@arm.com>
Subject: Re: [PATCH 09/15] drm/panthor: Test for imported buffers with drm_gem_is_imported()
Date: Fri, 25 Apr 2025 16:30:17 +0200 [thread overview]
Message-ID: <20250425163017.050f94f0@collabora.com> (raw)
In-Reply-To: <bd83794c-17a9-4e28-bf62-7a62bef57c22@arm.com>
On Fri, 25 Apr 2025 14:34:53 +0100
Steven Price <steven.price@arm.com> wrote:
> On 17/03/2025 13:06, 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: Boris Brezillon <boris.brezillon@collabora.com>
> > Cc: Steven Price <steven.price@arm.com>
> > Cc: Liviu Dudau <liviu.dudau@arm.com>
> > ---
> > drivers/gpu/drm/panthor/panthor_gem.c | 2 +-
> > drivers/gpu/drm/panthor/panthor_mmu.c | 10 +++++-----
> > 2 files changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/panthor/panthor_gem.c b/drivers/gpu/drm/panthor/panthor_gem.c
> > index 8244a4e6c2a2..fd014ccc3bfc 100644
> > --- a/drivers/gpu/drm/panthor/panthor_gem.c
> > +++ b/drivers/gpu/drm/panthor/panthor_gem.c
> > @@ -155,7 +155,7 @@ static enum drm_gem_object_status panthor_gem_status(struct drm_gem_object *obj)
> > struct panthor_gem_object *bo = to_panthor_bo(obj);
> > enum drm_gem_object_status res = 0;
> >
> > - if (bo->base.base.import_attach || bo->base.pages)
> > + if (drm_gem_is_imported(&bo->base.base) || bo->base.pages)
> > res |= DRM_GEM_OBJECT_RESIDENT;
> >
> > return res;
> > diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c b/drivers/gpu/drm/panthor/panthor_mmu.c
> > index 12a02e28f50f..3e123159ac10 100644
> > --- a/drivers/gpu/drm/panthor/panthor_mmu.c
> > +++ b/drivers/gpu/drm/panthor/panthor_mmu.c
> > @@ -1103,7 +1103,7 @@ static void panthor_vm_bo_put(struct drm_gpuvm_bo *vm_bo)
> > /* If the vm_bo object was destroyed, release the pin reference that
> > * was hold by this object.
> > */
> > - if (unpin && !bo->base.base.import_attach)
> > + if (unpin && !drm_gem_is_imported(&bo->base.base))
> > drm_gem_shmem_unpin(&bo->base);
>
> I'm seeing issues on cleanup where drm_gem_is_imported() doesn't return
> the same as !!import_attach in the above code. Specifically this appears
> to be caused by drm_gem_object_exported_dma_buf_free() setting ->dma_buf
> to NULL which makes the BO look like it isn't imported.
>
> Stashing the imported state in the BO fixes the problem (see below
> hack), but it would be nice to fix this more generally in case there are
> other drivers that need to know the imported state during cleanup.
>
> Any suggestions for how drm_gem_is_imported() can more accurately report
> the state during cleanup?
This should be fixed by [1], but I wonder why it's not been merged in
drm-misc-next yet.
[1]https://patches.linaro.org/project/linux-media/patch/20250416065820.26076-1-tzimmermann@suse.de/
next prev parent reply other threads:[~2025-04-25 14:30 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-17 13:06 [PATCH 00/15] drm: Do not use import_attach in drivers Thomas Zimmermann
2025-03-17 13:06 ` [PATCH 01/15] drm/armada: Test for imported buffers with drm_gem_is_imported() Thomas Zimmermann
2025-03-17 13:06 ` [PATCH 02/15] drm/etnaviv: " Thomas Zimmermann
2025-03-17 13:06 ` [PATCH 03/15] drm/etnaviv: Use dma_buf from GEM object instance Thomas Zimmermann
2025-03-17 14:54 ` Lucas Stach
2025-03-17 13:06 ` [PATCH 04/15] drm/exynos: Test for imported buffers with drm_gem_is_imported() Thomas Zimmermann
2025-03-17 13:06 ` [PATCH 05/15] drm/gud: " Thomas Zimmermann
2025-03-17 13:06 ` [PATCH 06/15] drm/msm: " Thomas Zimmermann
2025-03-17 14:10 ` Dmitry Baryshkov
2025-03-17 13:06 ` [PATCH 07/15] drm/omapdrm: " Thomas Zimmermann
2025-03-17 13:06 ` [PATCH 08/15] drm/panfrost: " Thomas Zimmermann
2025-03-31 9:02 ` Steven Price
2025-03-17 13:06 ` [PATCH 09/15] drm/panthor: " Thomas Zimmermann
2025-03-17 13:59 ` Liviu Dudau
2025-03-31 9:02 ` Steven Price
2025-04-25 13:34 ` Steven Price
2025-04-25 14:30 ` Boris Brezillon [this message]
2025-04-25 14:57 ` Steven Price
2025-03-17 13:06 ` [PATCH 10/15] drm/rockchip: " Thomas Zimmermann
2025-03-17 13:06 ` [PATCH 11/15] drm/vc4: " Thomas Zimmermann
2025-03-17 13:06 ` [PATCH 12/15] drm/virtio: " Thomas Zimmermann
2025-03-17 13:06 ` [PATCH 13/15] drm/vmwgfx: " Thomas Zimmermann
2025-03-17 16:12 ` Zack Rusin
2025-03-17 13:06 ` [PATCH 14/15] drm/vmwgfx: Use dma_buf from GEM object instance Thomas Zimmermann
2025-03-17 16:13 ` Zack Rusin
2025-03-17 13:06 ` [PATCH 15/15] drm/xen: Test for imported buffers with drm_gem_is_imported() Thomas Zimmermann
2025-04-10 17:27 ` [PATCH 00/15] drm: Do not use import_attach in drivers Thomas Zimmermann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250425163017.050f94f0@collabora.com \
--to=boris.brezillon@collabora.com \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=liviu.dudau@arm.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=steven.price@arm.com \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.