[PATCH 1/2] drm/amdgpu: add support for inplace IB patching for MM engines v2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Christian,

Sure, Let me find a time to try this afternoon.

Best Regards!

James Zhu


On 2018-07-25 08:18 AM, Christian König wrote:
> Hi James,
>
> can you give those two patches another try on a Vega20? At least in 
> theory it should work now.
>
> Thanks in advance,
> Christian.
>
> Am 25.07.2018 um 13:05 schrieb Christian König:
>> We are going to need that for the second UVD instance on Vega20.
>>
>> v2: rename to patch_cs_in_place
>>
>> Signed-off-by: Christian König <christian.koenig at amd.com>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu.h      |  1 +
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c   | 22 +++++++++++++++-------
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h |  1 +
>>   3 files changed, 17 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h 
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> index a9f09daeffa3..3ec1f31b892c 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> @@ -1751,6 +1751,7 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring)
>>   #define amdgpu_vm_write_pte(adev, ib, pe, value, count, incr) 
>> ((adev)->vm_manager.vm_pte_funcs->write_pte((ib), (pe), (value), 
>> (count), (incr)))
>>   #define amdgpu_vm_set_pte_pde(adev, ib, pe, addr, count, incr, 
>> flags) ((adev)->vm_manager.vm_pte_funcs->set_pte_pde((ib), (pe), 
>> (addr), (count), (incr), (flags)))
>>   #define amdgpu_ring_parse_cs(r, p, ib) ((r)->funcs->parse_cs((p), 
>> (ib)))
>> +#define amdgpu_ring_patch_cs_in_place(r, p, ib) 
>> ((r)->funcs->patch_cs_in_place((p), (ib)))
>>   #define amdgpu_ring_test_ring(r) (r)->funcs->test_ring((r))
>>   #define amdgpu_ring_test_ib(r, t) (r)->funcs->test_ib((r), (t))
>>   #define amdgpu_ring_get_rptr(r) (r)->funcs->get_rptr((r))
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c 
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>> index 7c5cc33d0cda..566e2c51931b 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>> @@ -916,7 +916,7 @@ static int amdgpu_cs_ib_vm_chunk(struct 
>> amdgpu_device *adev,
>>       int r;
>>         /* Only for UVD/VCE VM emulation */
>> -    if (p->ring->funcs->parse_cs) {
>> +    if (p->ring->funcs->parse_cs || 
>> p->ring->funcs->patch_cs_in_place) {
>>           unsigned i, j;
>>             for (i = 0, j = 0; i < p->nchunks && j < p->job->num_ibs; 
>> i++) {
>> @@ -957,12 +957,20 @@ static int amdgpu_cs_ib_vm_chunk(struct 
>> amdgpu_device *adev,
>>               offset = m->start * AMDGPU_GPU_PAGE_SIZE;
>>               kptr += va_start - offset;
>>   -            memcpy(ib->ptr, kptr, chunk_ib->ib_bytes);
>> -            amdgpu_bo_kunmap(aobj);
>> -
>> -            r = amdgpu_ring_parse_cs(ring, p, j);
>> -            if (r)
>> -                return r;
>> +            if (p->ring->funcs->parse_cs) {
>> +                memcpy(ib->ptr, kptr, chunk_ib->ib_bytes);
>> +                amdgpu_bo_kunmap(aobj);
>> +
>> +                r = amdgpu_ring_parse_cs(ring, p, j);
>> +                if (r)
>> +                    return r;
>> +            } else {
>> +                ib->ptr = (uint32_t *)kptr;
>> +                r = amdgpu_ring_patch_cs_in_place(ring, p, j);
>> +                amdgpu_bo_kunmap(aobj);
>> +                if (r)
>> +                    return r;
>> +            }
>>                 j++;
>>           }
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h 
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
>> index 5018c0b6bf1a..d242b9a51e90 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
>> @@ -123,6 +123,7 @@ struct amdgpu_ring_funcs {
>>       void (*set_wptr)(struct amdgpu_ring *ring);
>>       /* validating and patching of IBs */
>>       int (*parse_cs)(struct amdgpu_cs_parser *p, uint32_t ib_idx);
>> +    int (*patch_cs_in_place)(struct amdgpu_cs_parser *p, uint32_t 
>> ib_idx);
>>       /* constants to calculate how many DW are needed for an emit */
>>       unsigned emit_frame_size;
>>       unsigned emit_ib_size;
>



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux