diff options
Diffstat (limited to 'tests/amdgpu/amdgpu_test.h')
-rw-r--r-- | tests/amdgpu/amdgpu_test.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/amdgpu/amdgpu_test.h b/tests/amdgpu/amdgpu_test.h index 1db803c6..7397dea0 100644 --- a/tests/amdgpu/amdgpu_test.h +++ b/tests/amdgpu/amdgpu_test.h | |||
@@ -252,6 +252,29 @@ static inline int gpu_mem_free(amdgpu_bo_handle bo, | |||
252 | } | 252 | } |
253 | 253 | ||
254 | static inline int | 254 | static inline int |
255 | amdgpu_bo_alloc_wrap(amdgpu_device_handle dev, unsigned size, | ||
256 | unsigned alignment, unsigned heap, uint64_t flags, | ||
257 | amdgpu_bo_handle *bo) | ||
258 | { | ||
259 | struct amdgpu_bo_alloc_request request = {}; | ||
260 | amdgpu_bo_handle buf_handle; | ||
261 | int r; | ||
262 | |||
263 | request.alloc_size = size; | ||
264 | request.phys_alignment = alignment; | ||
265 | request.preferred_heap = heap; | ||
266 | request.flags = flags; | ||
267 | |||
268 | r = amdgpu_bo_alloc(dev, &request, &buf_handle); | ||
269 | if (r) | ||
270 | return r; | ||
271 | |||
272 | *bo = buf_handle; | ||
273 | |||
274 | return 0; | ||
275 | } | ||
276 | |||
277 | static inline int | ||
255 | amdgpu_bo_alloc_and_map(amdgpu_device_handle dev, unsigned size, | 278 | amdgpu_bo_alloc_and_map(amdgpu_device_handle dev, unsigned size, |
256 | unsigned alignment, unsigned heap, uint64_t flags, | 279 | unsigned alignment, unsigned heap, uint64_t flags, |
257 | amdgpu_bo_handle *bo, void **cpu, uint64_t *mc_address, | 280 | amdgpu_bo_handle *bo, void **cpu, uint64_t *mc_address, |