From: "Christian König" <christian.koenig@amd.com>
To: "Maíra Canal" <mcanal@igalia.com>,
"Luben Tuikov" <luben.tuikov@amd.com>,
"David Airlie" <airlied@gmail.com>,
"Daniel Vetter" <daniel@ffwll.ch>,
"Sumit Semwal" <sumit.semwal@linaro.org>,
"Qiang Yu" <yuq825@gmail.com>,
"Abhinav Kumar" <quic_abhinavk@quicinc.com>,
"Dmitry Baryshkov" <dmitry.baryshkov@linaro.org>,
"Sean Paul" <sean@poorly.run>, "Rob Clark" <robdclark@gmail.com>,
"Rob Herring" <robh@kernel.org>,
"Tomeu Vizoso" <tomeu.vizoso@collabora.com>,
"Steven Price" <steven.price@arm.com>,
"Alyssa Rosenzweig" <alyssa.rosenzweig@collabora.com>,
"Melissa Wen" <mwen@igalia.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/5] drm/sched: Create wrapper to add a syncobj dependency to job
Date: Wed, 8 Feb 2023 20:54:08 +0100 [thread overview]
Message-ID: <49d580fa-60db-5d55-00de-20dd3eefe737@amd.com> (raw)
In-Reply-To: <20230208194817.199932-2-mcanal@igalia.com>
Am 08.02.23 um 20:48 schrieb Maíra Canal:
> In order to add a syncobj's fence as a dependency to a job, it is
> necessary to call drm_syncobj_find_fence() to find the fence and then
> add the dependency with drm_sched_job_add_dependency(). So, wrap these
> steps in one single function, drm_sched_job_add_syncobj_dependency().
>
> Signed-off-by: Maíra Canal <mcanal@igalia.com>
Just one nit pick below, with that fixed Reviewed-by: Christian König
<christian.koenig@amd.com>
I'm pretty sure we have the exact same function now in amdgpu cause I
cleaned that up just a few weeks ago to look the same as the other drivers.
Would be nice to have that new function applied there as well.
Thanks,
Christian.
> ---
> drivers/gpu/drm/scheduler/sched_main.c | 29 ++++++++++++++++++++++++++
> include/drm/gpu_scheduler.h | 6 ++++++
> 2 files changed, 35 insertions(+)
>
> diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
> index 0e4378420271..d5331b1877a3 100644
> --- a/drivers/gpu/drm/scheduler/sched_main.c
> +++ b/drivers/gpu/drm/scheduler/sched_main.c
> @@ -53,6 +53,7 @@
>
> #include <drm/drm_print.h>
> #include <drm/drm_gem.h>
> +#include <drm/drm_syncobj.h>
> #include <drm/gpu_scheduler.h>
> #include <drm/spsc_queue.h>
>
> @@ -718,6 +719,34 @@ int drm_sched_job_add_dependency(struct drm_sched_job *job,
> }
> EXPORT_SYMBOL(drm_sched_job_add_dependency);
>
> +/**
> + * drm_sched_job_add_syncobj_dependency - adds a syncobj's fence as a job dependency
> + * @job: scheduler job to add the dependencies to
> + * @file_private: drm file private pointer
> + * @handle: syncobj handle to lookup
> + * @point: timeline point
> + *
> + * This adds the fence matching the given syncobj to @job.
> + *
> + * Returns:
> + * 0 on success, or an error on failing to expand the array.
> + */
> +int drm_sched_job_add_syncobj_dependency(struct drm_sched_job *job,
> + struct drm_file *file,
> + u32 handle,
> + u32 point)
> +{
> + struct dma_fence *fence;
> + int ret = 0;
Please don't initialize any local return variables if it isn't necessary.
This just suppresses uninitialized variables from the compiler which
quite often have helped finding more wider bugs.
Regards,
Christian.
> +
> + ret = drm_syncobj_find_fence(file, handle, point, 0, &fence);
> + if (ret)
> + return ret;
> +
> + return drm_sched_job_add_dependency(job, fence);
> +}
> +EXPORT_SYMBOL(drm_sched_job_add_syncobj_dependency);
> +
> /**
> * drm_sched_job_add_resv_dependencies - add all fences from the resv to the job
> * @job: scheduler job to add the dependencies to
> diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h
> index 9935d1e2ff69..4cc54f8b57b4 100644
> --- a/include/drm/gpu_scheduler.h
> +++ b/include/drm/gpu_scheduler.h
> @@ -48,6 +48,8 @@ struct drm_gem_object;
> struct drm_gpu_scheduler;
> struct drm_sched_rq;
>
> +struct drm_file;
> +
> /* These are often used as an (initial) index
> * to an array, and as such should start at 0.
> */
> @@ -515,6 +517,10 @@ int drm_sched_job_init(struct drm_sched_job *job,
> void drm_sched_job_arm(struct drm_sched_job *job);
> int drm_sched_job_add_dependency(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,
> + u32 point);
> int drm_sched_job_add_resv_dependencies(struct drm_sched_job *job,
> struct dma_resv *resv,
> enum dma_resv_usage usage);
next prev parent reply other threads:[~2023-02-08 19:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-08 19:48 [PATCH 0/5] drm/sched: Create wrapper to add a syncobj dependency to job Maíra Canal
2023-02-08 19:48 ` [PATCH 1/5] " Maíra Canal
2023-02-08 19:54 ` Christian König [this message]
2023-02-08 22:20 ` Luben Tuikov
2023-02-09 6:54 ` Christian König
2023-02-08 22:36 ` Luben Tuikov
2023-02-08 19:48 ` [PATCH 2/5] drm/lima: Use drm_sched_job_add_syncobj_dependency() Maíra Canal
2023-02-08 19:48 ` [PATCH 3/5] drm/msm: " Maíra Canal
2023-02-08 19:48 ` [PATCH 4/5] drm/panfrost: " Maíra Canal
2023-02-08 20:12 ` Alyssa Rosenzweig
2023-02-08 19:48 ` [PATCH 5/5] drm/v3d: " Maíra Canal
2023-02-09 11:27 ` Melissa Wen
2023-02-09 12:08 ` Christian König
2023-02-09 12:36 ` Melissa Wen
2023-02-09 12:45 ` 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=49d580fa-60db-5d55-00de-20dd3eefe737@amd.com \
--to=christian.koenig@amd.com \
--cc=airlied@gmail.com \
--cc=alyssa.rosenzweig@collabora.com \
--cc=daniel@ffwll.ch \
--cc=dmitry.baryshkov@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=luben.tuikov@amd.com \
--cc=mcanal@igalia.com \
--cc=mwen@igalia.com \
--cc=quic_abhinavk@quicinc.com \
--cc=robdclark@gmail.com \
--cc=robh@kernel.org \
--cc=sean@poorly.run \
--cc=steven.price@arm.com \
--cc=sumit.semwal@linaro.org \
--cc=tomeu.vizoso@collabora.com \
--cc=yuq825@gmail.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.