[PATCH 3/5] drm/amdgpu: use amdgpu_bo_create_user() for gem object

Christian König ckoenig.leichtzumerken at gmail.com
Fri Mar 5 15:11:39 UTC 2021


We might need to use this for the KFD as well.

Christian.

Am 05.03.21 um 15:35 schrieb Nirmoy Das:
> GEM objects encapsulate amdgpu_bo for userspace applications.
> Now that we have a new amdgpu_bo_user subclass for that purpose,
> let's use that instead.
>
> Signed-off-by: Nirmoy Das <nirmoy.das at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> index 8e9b8a6e6ef0..9d2b55eb31c2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> @@ -54,6 +54,7 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size,
>   			     struct drm_gem_object **obj)
>   {
>   	struct amdgpu_bo *bo;
> +	struct amdgpu_bo_user *ubo;
>   	struct amdgpu_bo_param bp;
>   	int r;
>   
> @@ -68,7 +69,7 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size,
>   retry:
>   	bp.flags = flags;
>   	bp.domain = initial_domain;
> -	r = amdgpu_bo_create(adev, &bp, &bo);
> +	r = amdgpu_bo_create_user(adev, &bp, &ubo);
>   	if (r) {
>   		if (r != -ERESTARTSYS) {
>   			if (flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED) {
> @@ -85,6 +86,7 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size,
>   		}
>   		return r;
>   	}
> +	bo = &ubo->bo;
>   	*obj = &bo->tbo.base;
>   
>   	return 0;



More information about the amd-gfx mailing list