From: Boris Brezillon <boris.brezillon@collabora.com>
To: Donald Robson <Donald.Robson@imgtec.com>
Cc: Sarah Walker <Sarah.Walker@imgtec.com>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"sumit.semwal@linaro.org" <sumit.semwal@linaro.org>,
"luben.tuikov@amd.com" <luben.tuikov@amd.com>,
"christian.koenig@amd.com" <christian.koenig@amd.com>
Subject: Re: [PATCH] drm/sched: Add native dependency support to drm_sched
Date: Mon, 12 Jun 2023 15:05:53 +0200 [thread overview]
Message-ID: <20230612150553.66999e56@collabora.com> (raw)
In-Reply-To: <7ced7c0a101cb2467c34b69d2b686c429f64d8c2.camel@imgtec.com>
Hi Donald,
On Thu, 8 Jun 2023 13:23:26 +0000
Donald Robson <Donald.Robson@imgtec.com> wrote:
> /**
> * drm_sched_job_arm - arm a scheduler job for execution
> * @job: scheduler job to arm
> @@ -669,6 +755,7 @@ void drm_sched_job_arm(struct drm_sched_job *job)
> job->s_priority = entity->rq - sched->sched_rq;
> job->id = atomic64_inc_return(&sched->job_id_count);
>
> + drm_sched_sort_native_deps(job);
If we get [1] accepted, we no longer need to sort the array. We can
just skip native dependencies as we iterate over the array in
drm_sched_job_dependency() with something like:
f = xa_load(&job->dependencies, job->last_dependency);
while (f) {
struct drm_sched_fence *s_fence;
struct dma_fence *scheduled_fence;
job->last_dependency++;
/* Not a native dependency, return the fence directly. */
if (!job->sched->ops->dependency_is_native ||
!job->sched->ops->dependency_is_native(f))
return dma_fence_get(f);
/*
* If the native fence is a drm_sched_fence object, we
* ensure the job has been submitted so drm_sched_fence
* ::parent points to a valid dma_fence object.
*/
s_fence = to_drm_sched_fence(f);
scheduled_fence = s_fence ?
dma_fence_get_rcu(&s_fence->scheduled) :
NULL;
if (scheduled_fence)
return scheduled_fence;
/* Otherwise we skip the native fence and check the next fence. */
f = xa_load(&job->dependencies, job->last_dependency);
}
And, in the driver, when you get to submit the job, you can gather
the native deps with a simple xa_for_each() loop:
xa_for_each(&job->dependencies, index, f) {
/* If the fence is not signaled, it must be a native fence,
* because drm_sched_entity waited for all non-native ones.
*/
if (!dma_fence_is_signaled(f))
// DO SOMETHING
}
> drm_sched_fence_init(job->s_fence, job->entity);
> }
Regards,
Boris
[1]https://patchwork.freedesktop.org/patch/541956/
next prev parent reply other threads:[~2023-06-12 13:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-08 13:23 [PATCH] drm/sched: Add native dependency support to drm_sched Donald Robson
2023-06-09 9:29 ` Donald Robson
2023-06-12 13:05 ` Boris Brezillon [this message]
2023-06-12 13:16 ` Christian König
2023-06-12 14:59 ` Boris Brezillon
2023-06-12 16:25 ` 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=20230612150553.66999e56@collabora.com \
--to=boris.brezillon@collabora.com \
--cc=Donald.Robson@imgtec.com \
--cc=Sarah.Walker@imgtec.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=luben.tuikov@amd.com \
--cc=sumit.semwal@linaro.org \
/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.