mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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>,
	"Boris Brezillon" <boris.brezillon@collabora.com>
Subject: [PATCH v3 1/2] drm/panthor: Explode container fences to optimize pipelining
Date: Wed, 02 Dec 2026 10:00:41 +0100	[thread overview]
Message-ID: <20261202-panhtor-dep-skip-v3-1-81c141ee0461@collabora.com> (raw)
In-Reply-To: <20261202-panhtor-dep-skip-v3-0-81c141ee0461@collabora.com>

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>
---
 drivers/gpu/drm/panthor/panthor_drv.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/panthor/panthor_drv.c
index dc8d0191aef4..79c994aa1b3a 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,8 @@ 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;
 
 		if (!sync_op_is_wait(&sync_ops[i]))
 			continue;
@@ -637,7 +638,16 @@ panthor_submit_ctx_add_sync_deps_to_job(struct panthor_submit_ctx *ctx,
 				return ret;
 		}
 
-		ret = drm_sched_job_add_dependency(job, fence);
+		/* Explode containers so that drm_sched_job_add_dependency() can
+		 * eliminate fences that are coming from the same queue.
+		 */
+		dma_fence_unwrap_for_each(inner_fence, fence) {
+			ret = drm_sched_job_add_dependency(job, dma_fence_get(inner_fence));
+			if (ret)
+				break;
+		}
+		dma_fence_put(fence);
+
 		if (ret)
 			return ret;
 	}

-- 
2.56.1


  reply	other threads:[~2026-12-02  9:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02  9:00 [PATCH v3 0/2] drm/panthor: Improve job pipelining Boris Brezillon
2026-12-02  9:00 ` Boris Brezillon [this message]
2026-12-02  9:00 ` [PATCH v3 2/2] drm/sched: Eliminate NOP dependencies at insertion time Boris Brezillon
2026-12-02  9:11   ` Tvrtko Ursulin
2026-12-02  9:28     ` Boris Brezillon
2026-12-02 11:40     ` Boris Brezillon
2026-12-02 12:16       ` Christian König

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=20261202-panhtor-dep-skip-v3-1-81c141ee0461@collabora.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®