From: Boris Brezillon <boris.brezillon@collabora.com>
To: Steven Price <steven.price@arm.com>,
Liviu Dudau <liviu.dudau@arm.com>,
Akash Goel <akash.goel@arm.com>,
Karunika Choo <karunika.choo@arm.com>,
Lukas Zapolskas <lukas.zapolskas@arm.com>,
Chris Diamand <chris.diamand@arm.com>
Cc: "Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Sumit Semwal" <sumit.semwal@linaro.org>,
"Christian König" <christian.koenig@amd.com>,
"Philipp Stanner" <phasta@kernel.org>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org,
"Xianzhong Li" <xianzhong.li@nxp.com>
Subject: Re: [PATCH v2] drm/panthor: Explode container fences to optimize pipelining
Date: Tue, 1 Dec 2026 17:52:19 +0100 [thread overview]
Message-ID: <20261201175219.0ac7186d@fedora1.home> (raw)
In-Reply-To: <20261201-panhtor-dep-skip-v2-1-1b38efda8a0d@collabora.com>
On Tue, 01 Dec 2026 17:35:28 +0100
Boris Brezillon <boris.brezillon@collabora.com> wrote:
> If a job is passed a dependency that's coming from the same queue the
> job is targeting, we can get rid of the dependency because of the
> implicit serialization provided by the queue. This will allow us
> benefit from the pipelining provided by the ring buffer (no extra
> MCU <-> CPU round-trip to have the job pushed to the ring buffer).
>
> drm_sched_entity_add_dependency_cb() already has this optimization in
> place, all we need to do is explode the chain/array containers with a
> dma_fence_unwrap_for_each() when we add job dependencies.
>
> Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
> Cc: Xianzhong Li <xianzhong.li@nxp.com>
> ---
> Some recent effort to improve job pipelining [1] showed that the
> MCU <-> CPU round-trip that lets us signal job fences adds a
> non-negligible overhead, and this problem seems to be easier and
> more systematically fixed if it's addressed at the KMD side, so
> here's a patch doing exactly that.
>
> [1]https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/46172
> ---
> Changes in v2:
> - Explode container fences with dma_fence_unwrap_for_each() instead of
> and rely on drm_sched_entity_add_dependency_cb() elimination instead
> of open-coding it
> ---
> drivers/gpu/drm/panthor/panthor_drv.c | 17 +++++++++++++----
> 1 file changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/panthor/panthor_drv.c
> index dc8d0191aef4..a527ce86a113 100644
> --- a/drivers/gpu/drm/panthor/panthor_drv.c
> +++ b/drivers/gpu/drm/panthor/panthor_drv.c
> @@ -7,6 +7,7 @@
> #include <asm/arch_timer.h>
> #endif
>
> +#include <linux/dma-fence-unwrap.h>
> #include <linux/list.h>
> #include <linux/module.h>
> #include <linux/of_platform.h>
> @@ -612,8 +613,9 @@ panthor_submit_ctx_add_sync_deps_to_job(struct panthor_submit_ctx *ctx,
> int ret = 0;
>
> for (u32 i = 0; i < sync_op_count; i++) {
> + struct dma_fence *fence, *inner_fence;
> struct panthor_sync_signal *sig_sync;
> - struct dma_fence *fence;
> + struct dma_fence_unwrap iter;
>
> if (!sync_op_is_wait(&sync_ops[i]))
> continue;
> @@ -637,9 +639,16 @@ panthor_submit_ctx_add_sync_deps_to_job(struct panthor_submit_ctx *ctx,
> return ret;
> }
>
> - ret = drm_sched_job_add_dependency(job, fence);
> - if (ret)
> - return ret;
> + /* Explode containers so that drm_sched_entity_add_dependency_cb() can
> + * eliminate fences that are coming from the same queue.
> + */
> + dma_fence_unwrap_for_each(inner_fence, &iter, fence) {
> + ret = drm_sched_job_add_dependency(job, inner_fence);
Missing dma_fence_get(inner_fence) here, as reported by Sashiko.
> + if (ret) {
> + dma_fence_put(iter.chain);
> + return ret;
> + }
> + }
> }
>
> return 0;
>
> ---
> base-commit: 28f286b0dfa9610d4ee2447415e964e8bc603056
> change-id: 20261201-panhtor-dep-skip-9c6a3e2f7cc7
>
> Best regards,
next prev parent reply other threads:[~2026-12-01 16:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 16:35 [PATCH v2] drm/panthor: Explode container fences to optimize pipelining Boris Brezillon
2026-12-01 16:42 ` sashiko-bot
2026-12-01 16:52 ` Boris Brezillon [this message]
2026-12-01 17:00 ` Christian König
2026-12-02 3:41 ` Xianzhong Li
2026-12-02 8:46 ` Boris Brezillon
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=20261201175219.0ac7186d@fedora1.home \
--to=boris.brezillon@collabora.com \
--cc=airlied@gmail.com \
--cc=akash.goel@arm.com \
--cc=chris.diamand@arm.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=karunika.choo@arm.com \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=liviu.dudau@arm.com \
--cc=lukas.zapolskas@arm.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=phasta@kernel.org \
--cc=simona@ffwll.ch \
--cc=steven.price@arm.com \
--cc=sumit.semwal@linaro.org \
--cc=tzimmermann@suse.de \
--cc=xianzhong.li@nxp.com \
/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.