[PATCH libdrm 1/4] amdgpu: add bo from user memory to handle table
Christian König
ckoenig.leichtzumerken at gmail.com
Tue Aug 7 10:01:26 UTC 2018
Am 07.08.2018 um 11:54 schrieb Zhang, Jerry (Junwei):
> On 08/07/2018 03:51 PM, zhoucm1 wrote:
>>
>>
>> On 2018年08月07日 15:26, Junwei Zhang wrote:
>>> When create bo from user memory, add it to handle table
>>> for future query.
>>>
>>> Signed-off-by: Junwei Zhang <Jerry.Zhang at amd.com>
>>> ---
>>> amdgpu/amdgpu_bo.c | 11 ++++++++++-
>>> 1 file changed, 10 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c
>>> index 422c7c9..b24e698 100644
>>> --- a/amdgpu/amdgpu_bo.c
>>> +++ b/amdgpu/amdgpu_bo.c
>>> @@ -556,7 +556,16 @@ int
>>> amdgpu_create_bo_from_user_mem(amdgpu_device_handle dev,
>>> bo->alloc_size = size;
>>> bo->handle = args.handle;
>>> - *buf_handle = bo;
>>> + pthread_mutex_lock(&bo->dev->bo_table_mutex);
>>> + r = handle_table_insert(&bo->dev->bo_handles, bo->handle, bo);
>>> + pthread_mutex_unlock(&bo->dev->bo_table_mutex);
>>> +
>>> + pthread_mutex_init(&bo->cpu_access_mutex, NULL);
>> This line is nothing with patch itself, please separate from it.
>
> We may not add it for user mem bo, not sure if user would access that
> bo by cpu mapping.
> so add that at the same time.
>
> Do you mean add it in another patch?
I'm ok with adding it in this patch, cause it is a necessary fix.
But we might have another patch to move common BO field initialization
in a separate function, e.g. to avoid duplicating that stuff to often.
Anyway this patch is Reviewed-by: Christian König
<christian.koenig at amd.com> for now.
Christian.
>
> Jerry
>
>>
>> Regards,
>> David Zhou
>>> +
>>> + if (r)
>>> + amdgpu_bo_free(bo);
>>> + else
>>> + *buf_handle = bo;
>>> return r;
>>> }
>>
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
More information about the amd-gfx
mailing list