diff mbox

[1/2] drm/amdgpu: use drm_gem_private_object_init

Message ID 20180216092635.64271-1-christian.koenig@amd.com (mailing list archive)
State New, archived
Headers show

Commit Message

Christian König Feb. 16, 2018, 9:26 a.m. UTC
We use our own backing store and don't need the shmem file.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Comments

Daniel Vetter Feb. 19, 2018, 3:32 p.m. UTC | #1
On Fri, Feb 16, 2018 at 10:26:34AM +0100, Christian König wrote:
> We use our own backing store and don't need the shmem file.
> 
> Signed-off-by: Christian König <christian.koenig@amd.com>

I thought ttm swaps to the shmem when under memory pressure. Or does it
allocate it's own shmem file for that?
-Daniel

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 512612ec3557..969de54b62da 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -371,11 +371,7 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev,
>  	bo = kzalloc(sizeof(struct amdgpu_bo), GFP_KERNEL);
>  	if (bo == NULL)
>  		return -ENOMEM;
> -	r = drm_gem_object_init(adev->ddev, &bo->gem_base, size);
> -	if (unlikely(r)) {
> -		kfree(bo);
> -		return r;
> -	}
> +	drm_gem_private_object_init(adev->ddev, &bo->gem_base, size);
>  	INIT_LIST_HEAD(&bo->shadow_list);
>  	INIT_LIST_HEAD(&bo->va);
>  	bo->preferred_domains = domain & (AMDGPU_GEM_DOMAIN_VRAM |
> -- 
> 2.14.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Christian König Feb. 19, 2018, 3:40 p.m. UTC | #2
Am 19.02.2018 um 16:32 schrieb Daniel Vetter:
> On Fri, Feb 16, 2018 at 10:26:34AM +0100, Christian König wrote:
>> We use our own backing store and don't need the shmem file.
>>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
> I thought ttm swaps to the shmem when under memory pressure. Or does it
> allocate it's own shmem file for that?

It allocates a separate shmem file for that.

Christian.

> -Daniel
>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 6 +-----
>>   1 file changed, 1 insertion(+), 5 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>> index 512612ec3557..969de54b62da 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>> @@ -371,11 +371,7 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev,
>>   	bo = kzalloc(sizeof(struct amdgpu_bo), GFP_KERNEL);
>>   	if (bo == NULL)
>>   		return -ENOMEM;
>> -	r = drm_gem_object_init(adev->ddev, &bo->gem_base, size);
>> -	if (unlikely(r)) {
>> -		kfree(bo);
>> -		return r;
>> -	}
>> +	drm_gem_private_object_init(adev->ddev, &bo->gem_base, size);
>>   	INIT_LIST_HEAD(&bo->shadow_list);
>>   	INIT_LIST_HEAD(&bo->va);
>>   	bo->preferred_domains = domain & (AMDGPU_GEM_DOMAIN_VRAM |
>> -- 
>> 2.14.1
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Daniel Vetter Feb. 19, 2018, 4:32 p.m. UTC | #3
On Mon, Feb 19, 2018 at 04:40:40PM +0100, Christian König wrote:
> Am 19.02.2018 um 16:32 schrieb Daniel Vetter:
> > On Fri, Feb 16, 2018 at 10:26:34AM +0100, Christian König wrote:
> > > We use our own backing store and don't need the shmem file.
> > > 
> > > Signed-off-by: Christian König <christian.koenig@amd.com>
> > I thought ttm swaps to the shmem when under memory pressure. Or does it
> > allocate it's own shmem file for that?
> 
> It allocates a separate shmem file for that.

fwiw Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> on both.
-Daniel

> 
> Christian.
> 
> > -Daniel
> > 
> > > ---
> > >   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 6 +-----
> > >   1 file changed, 1 insertion(+), 5 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> > > index 512612ec3557..969de54b62da 100644
> > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> > > @@ -371,11 +371,7 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev,
> > >   	bo = kzalloc(sizeof(struct amdgpu_bo), GFP_KERNEL);
> > >   	if (bo == NULL)
> > >   		return -ENOMEM;
> > > -	r = drm_gem_object_init(adev->ddev, &bo->gem_base, size);
> > > -	if (unlikely(r)) {
> > > -		kfree(bo);
> > > -		return r;
> > > -	}
> > > +	drm_gem_private_object_init(adev->ddev, &bo->gem_base, size);
> > >   	INIT_LIST_HEAD(&bo->shadow_list);
> > >   	INIT_LIST_HEAD(&bo->va);
> > >   	bo->preferred_domains = domain & (AMDGPU_GEM_DOMAIN_VRAM |
> > > -- 
> > > 2.14.1
> > > 
> > > _______________________________________________
> > > dri-devel mailing list
> > > dri-devel@lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 512612ec3557..969de54b62da 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -371,11 +371,7 @@  static int amdgpu_bo_do_create(struct amdgpu_device *adev,
 	bo = kzalloc(sizeof(struct amdgpu_bo), GFP_KERNEL);
 	if (bo == NULL)
 		return -ENOMEM;
-	r = drm_gem_object_init(adev->ddev, &bo->gem_base, size);
-	if (unlikely(r)) {
-		kfree(bo);
-		return r;
-	}
+	drm_gem_private_object_init(adev->ddev, &bo->gem_base, size);
 	INIT_LIST_HEAD(&bo->shadow_list);
 	INIT_LIST_HEAD(&bo->va);
 	bo->preferred_domains = domain & (AMDGPU_GEM_DOMAIN_VRAM |