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 v4 2/3] drm/sched: Add a drm_sched_job_add_dependency_unwrapped() helper
Date: Wed, 2 Dec 2026 13:21:21 +0100 [thread overview]
Message-ID: <20261202132121.1044c6b5@fedora1.home> (raw)
In-Reply-To: <20261202-panhtor-dep-skip-v4-2-f84482d7a49c@collabora.com>
On Wed, 02 Dec 2026 12:34:18 +0100
Boris Brezillon <boris.brezillon@collabora.com> wrote:
> drm_sched_job_add_dependency() adds the dependency as is to the job,
> but drivers like to have containers unwrapped and each individual fence
> added as a dependency so they can skip same-queue dependencies and
> benefit from hardware pipelining.
>
> We don't make this behavior the default to not regress the existing
> drm_sched_job_add_dependency() users. Note that
> drm_sched_job_add_{resv,implicit}_dependencies() don't need this
> unwrapping because it already happened at resv update time. We could
> add a drm_sched_job_add_syncobj_dependency_unwrapped() variant, but
> there's no known user for that yet, so let's postpone this until
> someone actually needs it.
>
> Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
> ---
> drivers/gpu/drm/scheduler/sched_main.c | 29 +++++++++++++++++++++++++++++
> include/drm/gpu_scheduler.h | 2 ++
> 2 files changed, 31 insertions(+)
>
> diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
> index 5f123a5e39ff..6449d74b5218 100644
> --- a/drivers/gpu/drm/scheduler/sched_main.c
> +++ b/drivers/gpu/drm/scheduler/sched_main.c
> @@ -66,6 +66,7 @@
> * This implies waiting for previously executed jobs.
> */
>
> +#include <linux/dma-fence-unwrap.h>
> #include <linux/export.h>
> #include <linux/wait.h>
> #include <linux/sched.h>
> @@ -708,6 +709,34 @@ int drm_sched_job_add_dependency(struct drm_sched_job *job,
> }
> EXPORT_SYMBOL(drm_sched_job_add_dependency);
>
> +/**
> + * drm_sched_job_add_dependency_unwrapped - unwrap the fence (if this is a
> + * container) and add the resulting fences as job dependencies
> + * @job: scheduler job to add the dependencies to
> + * @fence: the dma_fence to add to the list of dependencies.
> + *
> + * Note that @fence is consumed in both the success and error cases.
> + *
> + * Returns:
> + * 0 on success, or an error on failing to expand the array.
> + */
> +int drm_sched_job_add_dependency_unwrapped(struct drm_sched_job *job,
> + struct dma_fence *fence)
> +{
> + struct dma_fence *inner_fence;
> + int ret;
For the record, missing ret = 0 initialization here.
> +
> + 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);
> + return ret;
> +}
> +EXPORT_SYMBOL(drm_sched_job_add_dependency_unwrapped);
> +
> /**
> * drm_sched_job_add_syncobj_dependency - adds a syncobj's fence as a job dependency
> * @job: scheduler job to add the dependencies to
> diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h
> index 3b0978fa8cf0..5308f53d3168 100644
> --- a/include/drm/gpu_scheduler.h
> +++ b/include/drm/gpu_scheduler.h
> @@ -694,6 +694,8 @@ void drm_sched_job_arm(struct drm_sched_job *job);
> void drm_sched_entity_push_job(struct drm_sched_job *sched_job);
> int drm_sched_job_add_dependency(struct drm_sched_job *job,
> struct dma_fence *fence);
> +int drm_sched_job_add_dependency_unwrapped(struct drm_sched_job *job,
> + struct dma_fence *fence);
> int drm_sched_job_add_syncobj_dependency(struct drm_sched_job *job,
> struct drm_file *file,
> u32 handle,
>
next prev parent reply other threads:[~2026-12-02 12:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 11:34 [PATCH v4 0/3] drm/panthor: Improve job pipelining Boris Brezillon
2026-12-02 11:34 ` [PATCH v4 1/3] drm/sched: Eliminate NOP dependencies at insertion time Boris Brezillon
2026-12-02 11:44 ` Philipp Stanner
2026-12-02 12:20 ` Boris Brezillon
2026-12-02 12:37 ` Philipp Stanner
2026-12-02 11:34 ` [PATCH v4 2/3] drm/sched: Add a drm_sched_job_add_dependency_unwrapped() helper Boris Brezillon
2026-12-02 11:44 ` sashiko-bot
2026-12-02 12:21 ` Boris Brezillon [this message]
2026-12-02 11:34 ` [PATCH v4 3/3] drm/panthor: Explode container fences to optimize pipelining 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=20261202132121.1044c6b5@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.