From: zhoucm1 <david1.zhou-5C7GfCeVMHo@public.gmane.org>
To: Dave Airlie <airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH 4/5] amdgpu/cs: split out fence dependency checking
Date: Wed, 26 Apr 2017 14:53:35 +0800 [thread overview]
Message-ID: <590043EF.5050007@amd.com> (raw)
In-Reply-To: <20170426032833.1455-5-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
On 2017年04月26日 11:28, Dave Airlie wrote:
> From: Dave Airlie <airlied@redhat.com>
>
> This just splits out the fence depenency checking into it's
> own function to make it easier to add semaphore dependencies.
>
> Reviewed-by: Christian König <christian.koenig@amd.com>
> Signed-off-by: Dave Airlie <airlied@redhat.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 85 +++++++++++++++++++---------------
> 1 file changed, 47 insertions(+), 38 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index 99424cb..df25b32 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -963,56 +963,65 @@ static int amdgpu_cs_ib_fill(struct amdgpu_device *adev,
> return 0;
> }
>
> -static int amdgpu_cs_dependencies(struct amdgpu_device *adev,
> - struct amdgpu_cs_parser *p)
> +static int amdgpu_process_fence_dep(struct amdgpu_cs_parser *p,
To consistent, we'd like amdgpu_cs prefix in amdgpu_cs.c, same as other
patches.
Regards,
David Zhou
> + struct amdgpu_cs_chunk *chunk)
> {
> struct amdgpu_fpriv *fpriv = p->filp->driver_priv;
> - int i, j, r;
> -
> - for (i = 0; i < p->nchunks; ++i) {
> - struct drm_amdgpu_cs_chunk_dep *deps;
> - struct amdgpu_cs_chunk *chunk;
> - unsigned num_deps;
> + unsigned num_deps;
> + int i, r;
> + struct drm_amdgpu_cs_chunk_dep *deps;
>
> - chunk = &p->chunks[i];
> + deps = (struct drm_amdgpu_cs_chunk_dep *)chunk->kdata;
> + num_deps = chunk->length_dw * 4 /
> + sizeof(struct drm_amdgpu_cs_chunk_dep);
>
> - if (chunk->chunk_id != AMDGPU_CHUNK_ID_DEPENDENCIES)
> - continue;
> + for (i = 0; i < num_deps; ++i) {
> + struct amdgpu_ring *ring;
> + struct amdgpu_ctx *ctx;
> + struct dma_fence *fence;
>
> - deps = (struct drm_amdgpu_cs_chunk_dep *)chunk->kdata;
> - num_deps = chunk->length_dw * 4 /
> - sizeof(struct drm_amdgpu_cs_chunk_dep);
> + r = amdgpu_cs_get_ring(p->adev, deps[i].ip_type,
> + deps[i].ip_instance,
> + deps[i].ring, &ring);
> + if (r)
> + return r;
>
> - for (j = 0; j < num_deps; ++j) {
> - struct amdgpu_ring *ring;
> - struct amdgpu_ctx *ctx;
> - struct dma_fence *fence;
> + ctx = amdgpu_ctx_get(fpriv, deps[i].ctx_id);
> + if (ctx == NULL)
> + return -EINVAL;
>
> - r = amdgpu_cs_get_ring(adev, deps[j].ip_type,
> - deps[j].ip_instance,
> - deps[j].ring, &ring);
> + fence = amdgpu_ctx_get_fence(ctx, ring,
> + deps[i].handle);
> + if (IS_ERR(fence)) {
> + r = PTR_ERR(fence);
> + amdgpu_ctx_put(ctx);
> + return r;
> + } else if (fence) {
> + r = amdgpu_sync_fence(p->adev, &p->job->sync,
> + fence);
> + dma_fence_put(fence);
> + amdgpu_ctx_put(ctx);
> if (r)
> return r;
> + }
> + }
> + return 0;
> +}
>
> - ctx = amdgpu_ctx_get(fpriv, deps[j].ctx_id);
> - if (ctx == NULL)
> - return -EINVAL;
> +static int amdgpu_cs_dependencies(struct amdgpu_device *adev,
> + struct amdgpu_cs_parser *p)
> +{
> + int i, r;
>
> - fence = amdgpu_ctx_get_fence(ctx, ring,
> - deps[j].handle);
> - if (IS_ERR(fence)) {
> - r = PTR_ERR(fence);
> - amdgpu_ctx_put(ctx);
> - return r;
> + for (i = 0; i < p->nchunks; ++i) {
> + struct amdgpu_cs_chunk *chunk;
>
> - } else if (fence) {
> - r = amdgpu_sync_fence(adev, &p->job->sync,
> - fence);
> - dma_fence_put(fence);
> - amdgpu_ctx_put(ctx);
> - if (r)
> - return r;
> - }
> + chunk = &p->chunks[i];
> +
> + if (chunk->chunk_id == AMDGPU_CHUNK_ID_DEPENDENCIES) {
> + r = amdgpu_process_fence_dep(p, chunk);
> + if (r)
> + return r;
> }
> }
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2017-04-26 6:53 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-26 3:28 [rfc] drm sync objects (search for spock) Dave Airlie
[not found] ` <20170426032833.1455-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-04-26 3:28 ` [PATCH 1/5] drm: introduce sync objects Dave Airlie
[not found] ` <20170426032833.1455-2-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-04-26 6:35 ` zhoucm1
2017-04-26 6:36 ` zhoucm1
2017-05-04 8:16 ` Chris Wilson
[not found] ` <20170504081633.GC17961-aII6DKEyn0pWYbfKqPwjAkR8Iwp7RQ6xAL8bYrjMMd8@public.gmane.org>
2017-05-09 2:26 ` Dave Airlie
[not found] ` <CAPM=9tzzn69_89nRpp3L3Y_qzd6AWg_aZ4PFF3twJg0gV0K8Fg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-05-09 9:17 ` Chris Wilson
2017-05-09 22:06 ` Jason Ekstrand
2017-05-09 14:56 ` Sean Paul
2017-04-26 3:28 ` [PATCH 2/5] drm/syncobj: add sync obj wait interface Dave Airlie
[not found] ` <20170426032833.1455-3-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-05-04 8:22 ` Chris Wilson
2017-04-26 3:28 ` [PATCH 3/5] drm/syncobj: add sync_file interaction Dave Airlie
2017-04-26 3:28 ` [PATCH 4/5] amdgpu/cs: split out fence dependency checking Dave Airlie
[not found] ` <20170426032833.1455-5-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-04-26 6:53 ` zhoucm1 [this message]
2017-04-26 8:45 ` [rfc] drm sync objects (search for spock) Christian König
[not found] ` <373f3919-2f52-44c0-89b9-0c10b7b7bed4-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-04-26 9:57 ` Dave Airlie
[not found] ` <CAPM=9tz_S1Y87PxFTw_+SM2f+g9hUvFviKtb9xR=2xLpSCjEAA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-04-26 14:57 ` Christian König
2017-05-09 22:23 ` Jason Ekstrand
2017-04-26 3:28 ` [PATCH 5/5] amdgpu: use drm sync objects for shared semaphores (v4) Dave Airlie
-- strict thread matches above, loose matches on Subject: below --
2017-05-12 0:34 drm syncobj - can we get some r-b/a-bs? Dave Airlie
[not found] ` <20170512003457.24936-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-05-12 0:34 ` [PATCH 4/5] amdgpu/cs: split out fence dependency checking Dave Airlie
2017-05-24 7:06 drm syncobj - final posting I hope Dave Airlie
[not found] ` <20170524070615.1634-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-05-24 7:06 ` [PATCH 4/5] amdgpu/cs: split out fence dependency checking Dave Airlie
2017-05-29 7:30 drm-syncobj - mostly wait changes Dave Airlie
[not found] ` <20170529073033.10903-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-05-29 7:30 ` [PATCH 4/5] amdgpu/cs: split out fence dependency checking Dave Airlie
2017-06-01 1:06 drm syncobjs - running out of tag lines Dave Airlie
[not found] ` <20170601010643.28616-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-06-01 1:06 ` [PATCH 4/5] amdgpu/cs: split out fence dependency checking Dave Airlie
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=590043EF.5050007@amd.com \
--to=david1.zhou-5c7gfcevmho@public.gmane.org \
--cc=airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).