diff options
| author | Thomas Zimmermann <tzimmermann@suse.de> | 2020-09-23 12:21:38 +0200 | 
|---|---|---|
| committer | Thomas Zimmermann <tzimmermann@suse.de> | 2020-09-25 09:19:42 +0200 | 
| commit | 246cb7e49a70e5c4b71caed5df518693c345bab7 (patch) | |
| tree | 00ba55bd6060f133810e3156d769ed3de5d92a26 /drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | |
| parent | a0d078d06e516184e2f575f3803935697b5e3ac6 (diff) | |
drm/amdgpu: Introduce GEM object functions
GEM object functions deprecate several similar callback interfaces in
struct drm_driver. This patch replaces the per-driver callbacks with
per-instance callbacks in amdgpu. The only exception is gem_prime_mmap,
which is non-trivial to convert.
v3:
	* remove amdgpu_object.c from patch (Christian)
v2:
	* move object-function instance to amdgpu_gem.c (Christian)
	* set callbacks in amdgpu_gem_object_create() (Christian)
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200923102159.24084-2-tzimmermann@suse.de
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 23 | 
1 files changed, 18 insertions, 5 deletions
| diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c index 59b52804622d..be08a63ef58c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c @@ -36,9 +36,12 @@  #include "amdgpu.h"  #include "amdgpu_display.h" +#include "amdgpu_dma_buf.h"  #include "amdgpu_xgmi.h" -void amdgpu_gem_object_free(struct drm_gem_object *gobj) +static const struct drm_gem_object_funcs amdgpu_gem_object_funcs; + +static void amdgpu_gem_object_free(struct drm_gem_object *gobj)  {  	struct amdgpu_bo *robj = gem_to_amdgpu_bo(gobj); @@ -87,6 +90,7 @@ retry:  		return r;  	}  	*obj = &bo->tbo.base; +	(*obj)->funcs = &amdgpu_gem_object_funcs;  	return 0;  } @@ -119,8 +123,8 @@ void amdgpu_gem_force_release(struct amdgpu_device *adev)   * Call from drm_gem_handle_create which appear in both new and open ioctl   * case.   */ -int amdgpu_gem_object_open(struct drm_gem_object *obj, -			   struct drm_file *file_priv) +static int amdgpu_gem_object_open(struct drm_gem_object *obj, +				  struct drm_file *file_priv)  {  	struct amdgpu_bo *abo = gem_to_amdgpu_bo(obj);  	struct amdgpu_device *adev = amdgpu_ttm_adev(abo->tbo.bdev); @@ -152,8 +156,8 @@ int amdgpu_gem_object_open(struct drm_gem_object *obj,  	return 0;  } -void amdgpu_gem_object_close(struct drm_gem_object *obj, -			     struct drm_file *file_priv) +static void amdgpu_gem_object_close(struct drm_gem_object *obj, +				    struct drm_file *file_priv)  {  	struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);  	struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); @@ -211,6 +215,15 @@ out_unlock:  	ttm_eu_backoff_reservation(&ticket, &list);  } +static const struct drm_gem_object_funcs amdgpu_gem_object_funcs = { +	.free = amdgpu_gem_object_free, +	.open = amdgpu_gem_object_open, +	.close = amdgpu_gem_object_close, +	.export = amdgpu_gem_prime_export, +	.vmap = amdgpu_gem_prime_vmap, +	.vunmap = amdgpu_gem_prime_vunmap, +}; +  /*   * GEM ioctls.   */ | 
