All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leo Liu <leo.liu-5C7GfCeVMHo@public.gmane.org>
To: "Christian König"
	<ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH 2/2] drm/amdgpu: cleanup VCN IB generation
Date: Fri, 9 Feb 2018 10:39:25 -0500	[thread overview]
Message-ID: <4c0cd4e8-ffcf-7558-24a2-b4ea0eb4bdb0@amd.com> (raw)
In-Reply-To: <680530de-0b4b-8c22-1210-2b2b4d70cbe1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>



On 02/09/2018 07:32 AM, Christian König wrote:
> Leo could you give this patch on Raven a try and review/ack it?

Sure.

Leo
>
> I've tested patch #1 on Vega10, but I don't have a stable Raven system 
> to test this one.
>
> Thanks,
> Christian.
>
> Am 07.02.2018 um 20:48 schrieb Christian König:
>> Start to use amdgpu_bo_create_reserved.
>>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 91 
>> ++++++++-------------------------
>>   1 file changed, 21 insertions(+), 70 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c 
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
>> index e86d0b2e9b7a..97bdde9a739e 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
>> @@ -270,43 +270,28 @@ int amdgpu_vcn_dec_ring_test_ring(struct 
>> amdgpu_ring *ring)
>>       return r;
>>   }
>>   -static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring, 
>> struct amdgpu_bo *bo,
>> -                   bool direct, struct dma_fence **fence)
>> +static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring,
>> +                   struct amdgpu_bo *bo, bool direct,
>> +                   struct dma_fence **fence)
>>   {
>> -    struct ttm_operation_ctx ctx = { true, false };
>> -    struct ttm_validate_buffer tv;
>> -    struct ww_acquire_ctx ticket;
>> -    struct list_head head;
>> +    struct amdgpu_device *adev = ring->adev;
>> +    struct dma_fence *f = NULL;
>>       struct amdgpu_job *job;
>>       struct amdgpu_ib *ib;
>> -    struct dma_fence *f = NULL;
>> -    struct amdgpu_device *adev = ring->adev;
>>       uint64_t addr;
>>       int i, r;
>>   -    memset(&tv, 0, sizeof(tv));
>> -    tv.bo = &bo->tbo;
>> -
>> -    INIT_LIST_HEAD(&head);
>> -    list_add(&tv.head, &head);
>> -
>> -    r = ttm_eu_reserve_buffers(&ticket, &head, true, NULL);
>> -    if (r)
>> -        return r;
>> -
>> -    r = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx);
>> -    if (r)
>> -        goto err;
>> -
>>       r = amdgpu_job_alloc_with_ib(adev, 64, &job);
>>       if (r)
>>           goto err;
>>         ib = &job->ibs[0];
>>       addr = amdgpu_bo_gpu_offset(bo);
>> -    ib->ptr[0] = PACKET0(SOC15_REG_OFFSET(UVD, 0, 
>> mmUVD_GPCOM_VCPU_DATA0), 0);
>> +    ib->ptr[0] = PACKET0(SOC15_REG_OFFSET(UVD, 0, 
>> mmUVD_GPCOM_VCPU_DATA0),
>> +                 0);
>>       ib->ptr[1] = addr;
>> -    ib->ptr[2] = PACKET0(SOC15_REG_OFFSET(UVD, 0, 
>> mmUVD_GPCOM_VCPU_DATA1), 0);
>> +    ib->ptr[2] = PACKET0(SOC15_REG_OFFSET(UVD, 0, 
>> mmUVD_GPCOM_VCPU_DATA1),
>> +                 0);
>>       ib->ptr[3] = addr >> 32;
>>       ib->ptr[4] = PACKET0(SOC15_REG_OFFSET(UVD, 0, 
>> mmUVD_GPCOM_VCPU_CMD), 0);
>>       ib->ptr[5] = 0;
>> @@ -330,11 +315,12 @@ static int amdgpu_vcn_dec_send_msg(struct 
>> amdgpu_ring *ring, struct amdgpu_bo *b
>>               goto err_free;
>>       }
>>   -    ttm_eu_fence_buffer_objects(&ticket, &head, f);
>> +    amdgpu_bo_fence(bo, f, false);
>> +    amdgpu_bo_unreserve(bo);
>> +    amdgpu_bo_unref(&bo);
>>         if (fence)
>>           *fence = dma_fence_get(f);
>> -    amdgpu_bo_unref(&bo);
>>       dma_fence_put(f);
>>         return 0;
>> @@ -343,7 +329,8 @@ static int amdgpu_vcn_dec_send_msg(struct 
>> amdgpu_ring *ring, struct amdgpu_bo *b
>>       amdgpu_job_free(job);
>>     err:
>> -    ttm_eu_backoff_reservation(&ticket, &head);
>> +    amdgpu_bo_unreserve(bo);
>> +    amdgpu_bo_unref(&bo);
>>       return r;
>>   }
>>   @@ -351,31 +338,16 @@ static int 
>> amdgpu_vcn_dec_get_create_msg(struct amdgpu_ring *ring, uint32_t hand
>>                     struct dma_fence **fence)
>>   {
>>       struct amdgpu_device *adev = ring->adev;
>> -    struct amdgpu_bo *bo;
>> +    struct amdgpu_bo *bo = NULL;
>>       uint32_t *msg;
>>       int r, i;
>>   -    r = amdgpu_bo_create(adev, 1024, PAGE_SIZE, true,
>> -                 AMDGPU_GEM_DOMAIN_VRAM,
>> -                 AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED |
>> -                 AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS,
>> -                 NULL, NULL, &bo);
>> +    r = amdgpu_bo_create_reserved(adev, 1024, PAGE_SIZE,
>> +                      AMDGPU_GEM_DOMAIN_VRAM,
>> +                      &bo, NULL, (void **)&msg);
>>       if (r)
>>           return r;
>>   -    r = amdgpu_bo_reserve(bo, false);
>> -    if (r) {
>> -        amdgpu_bo_unref(&bo);
>> -        return r;
>> -    }
>> -
>> -    r = amdgpu_bo_kmap(bo, (void **)&msg);
>> -    if (r) {
>> -        amdgpu_bo_unreserve(bo);
>> -        amdgpu_bo_unref(&bo);
>> -        return r;
>> -    }
>> -
>>       msg[0] = cpu_to_le32(0x00000028);
>>       msg[1] = cpu_to_le32(0x00000038);
>>       msg[2] = cpu_to_le32(0x00000001);
>> @@ -393,9 +365,6 @@ static int amdgpu_vcn_dec_get_create_msg(struct 
>> amdgpu_ring *ring, uint32_t hand
>>       for (i = 14; i < 1024; ++i)
>>           msg[i] = cpu_to_le32(0x0);
>>   -    amdgpu_bo_kunmap(bo);
>> -    amdgpu_bo_unreserve(bo);
>> -
>>       return amdgpu_vcn_dec_send_msg(ring, bo, true, fence);
>>   }
>>   @@ -407,27 +376,12 @@ static int 
>> amdgpu_vcn_dec_get_destroy_msg(struct amdgpu_ring *ring, uint32_t han
>>       uint32_t *msg;
>>       int r, i;
>>   -    r = amdgpu_bo_create(adev, 1024, PAGE_SIZE, true,
>> -                 AMDGPU_GEM_DOMAIN_VRAM,
>> -                 AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED |
>> -                 AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS,
>> -                 NULL, NULL, &bo);
>> +    r = amdgpu_bo_create_reserved(adev, 1024, PAGE_SIZE,
>> +                      AMDGPU_GEM_DOMAIN_VRAM,
>> +                      &bo, NULL, (void **)&msg);
>>       if (r)
>>           return r;
>>   -    r = amdgpu_bo_reserve(bo, false);
>> -    if (r) {
>> -        amdgpu_bo_unref(&bo);
>> -        return r;
>> -    }
>> -
>> -    r = amdgpu_bo_kmap(bo, (void **)&msg);
>> -    if (r) {
>> -        amdgpu_bo_unreserve(bo);
>> -        amdgpu_bo_unref(&bo);
>> -        return r;
>> -    }
>> -
>>       msg[0] = cpu_to_le32(0x00000028);
>>       msg[1] = cpu_to_le32(0x00000018);
>>       msg[2] = cpu_to_le32(0x00000000);
>> @@ -437,9 +391,6 @@ static int amdgpu_vcn_dec_get_destroy_msg(struct 
>> amdgpu_ring *ring, uint32_t han
>>       for (i = 6; i < 1024; ++i)
>>           msg[i] = cpu_to_le32(0x0);
>>   -    amdgpu_bo_kunmap(bo);
>> -    amdgpu_bo_unreserve(bo);
>> -
>>       return amdgpu_vcn_dec_send_msg(ring, bo, direct, fence);
>>   }
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2018-02-09 15:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-07 19:48 [PATCH 1/2] drm/amdgpu: fix and cleanup UVD IB generation Christian König
     [not found] ` <20180207194822.7878-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-02-07 19:48   ` [PATCH 2/2] drm/amdgpu: cleanup VCN " Christian König
     [not found]     ` <20180207194822.7878-2-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-02-09 12:20       ` Andrey Grodzovsky
     [not found]         ` <839e2b57-edf4-d389-56ab-1a97dd84c832-5C7GfCeVMHo@public.gmane.org>
2018-02-09 12:31           ` Christian König
     [not found]             ` <6262040a-ef05-bda4-904e-d8a5954239bc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-02-09 12:38               ` Andrey Grodzovsky
2018-02-12 19:46               ` Andrey Grodzovsky
     [not found]                 ` <eca08a4f-cc5c-ab86-acf0-f04444f733f4-5C7GfCeVMHo@public.gmane.org>
2018-02-13 13:50                   ` Andrey Grodzovsky
     [not found]                     ` <2992ee3b-c077-9222-b1e1-79ea9cb3c143-5C7GfCeVMHo@public.gmane.org>
2018-02-13 13:57                       ` Christian König
     [not found]                         ` <64b53d0a-62d6-cfe5-341d-2aa5548c4f8d-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-02-13 14:02                           ` Andrey Grodzovsky
2018-02-13 14:14                           ` Leo Liu
2018-02-09 12:32       ` Christian König
     [not found]         ` <680530de-0b4b-8c22-1210-2b2b4d70cbe1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-02-09 15:39           ` Leo Liu [this message]
2018-02-13 14:19   ` [PATCH 1/2] drm/amdgpu: fix and cleanup UVD " Leo Liu

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=4c0cd4e8-ffcf-7558-24a2-b4ea0eb4bdb0@amd.com \
    --to=leo.liu-5c7gfcevmho@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@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 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.