Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amdgpu: introduce struct amdgpu_bo_user

Implement a new struct amdgpu_bo_user as subclass of
struct amdgpu_bo and a function to created amdgpu_bo_user
bo with a flag to identify the owner.

v2: amdgpu_bo_to_amdgpu_bo_user -> to_amdgpu_bo_user()

Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Nirmoy Das and committed by
Alex Deucher
9ad0d033 9fd5543e

+42
+28
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
··· 695 695 } 696 696 697 697 /** 698 + * amdgpu_bo_create_user - create an &amdgpu_bo_user buffer object 699 + * @adev: amdgpu device object 700 + * @bp: parameters to be used for the buffer object 701 + * @ubo_ptr: pointer to the buffer object pointer 702 + * 703 + * Create a BO to be used by user application; 704 + * 705 + * Returns: 706 + * 0 for success or a negative error code on failure. 707 + */ 708 + 709 + int amdgpu_bo_create_user(struct amdgpu_device *adev, 710 + struct amdgpu_bo_param *bp, 711 + struct amdgpu_bo_user **ubo_ptr) 712 + { 713 + struct amdgpu_bo *bo_ptr; 714 + int r; 715 + 716 + bp->flags = bp->flags & ~AMDGPU_GEM_CREATE_SHADOW; 717 + bp->bo_ptr_size = sizeof(struct amdgpu_bo_user); 718 + r = amdgpu_bo_do_create(adev, bp, &bo_ptr); 719 + if (r) 720 + return r; 721 + 722 + *ubo_ptr = to_amdgpu_bo_user(bo_ptr); 723 + return r; 724 + } 725 + /** 698 726 * amdgpu_bo_validate - validate an &amdgpu_bo buffer object 699 727 * @bo: pointer to the buffer object 700 728 *
+14
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
··· 37 37 #define AMDGPU_BO_INVALID_OFFSET LONG_MAX 38 38 #define AMDGPU_BO_MAX_PLACEMENTS 3 39 39 40 + #define to_amdgpu_bo_user(abo) container_of((abo), struct amdgpu_bo_user, bo) 41 + 40 42 struct amdgpu_bo_param { 41 43 unsigned long size; 42 44 int byte_align; ··· 112 110 struct list_head shadow_list; 113 111 114 112 struct kgd_mem *kfd_bo; 113 + }; 114 + 115 + struct amdgpu_bo_user { 116 + struct amdgpu_bo bo; 117 + u64 tiling_flags; 118 + u64 metadata_flags; 119 + void *metadata; 120 + u32 metadata_size; 121 + 115 122 }; 116 123 117 124 static inline struct amdgpu_bo *ttm_to_amdgpu_bo(struct ttm_buffer_object *tbo) ··· 266 255 int amdgpu_bo_create_kernel_at(struct amdgpu_device *adev, 267 256 uint64_t offset, uint64_t size, uint32_t domain, 268 257 struct amdgpu_bo **bo_ptr, void **cpu_addr); 258 + int amdgpu_bo_create_user(struct amdgpu_device *adev, 259 + struct amdgpu_bo_param *bp, 260 + struct amdgpu_bo_user **ubo_ptr); 269 261 void amdgpu_bo_free_kernel(struct amdgpu_bo **bo, u64 *gpu_addr, 270 262 void **cpu_addr); 271 263 int amdgpu_bo_kmap(struct amdgpu_bo *bo, void **ptr);