diff mbox series

[libdrm,2/3] amdgpu/test: Allow flags to be passed to amdgpu_bo_va_op

Message ID 1538075109-3759-2-git-send-email-andrey.grodzovsky@amd.com (mailing list archive)
State New, archived
Headers show
Series [libdrm,1/3] amdgpu: Propogate user flags to amdgpu_bo_va_op_raw | expand

Commit Message

Andrey Grodzovsky Sept. 27, 2018, 7:05 p.m. UTC
Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
---
 tests/amdgpu/amdgpu_test.h | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/tests/amdgpu/amdgpu_test.h b/tests/amdgpu/amdgpu_test.h
index 0609a74..8024507 100644
--- a/tests/amdgpu/amdgpu_test.h
+++ b/tests/amdgpu/amdgpu_test.h
@@ -280,7 +280,7 @@  static inline int gpu_mem_free(amdgpu_bo_handle bo,
 
 static inline int
 amdgpu_bo_alloc_wrap(amdgpu_device_handle dev, unsigned size,
-		     unsigned alignment, unsigned heap, uint64_t flags,
+		     unsigned alignment, unsigned heap, uint64_t alloc_flags,
 		     amdgpu_bo_handle *bo)
 {
 	struct amdgpu_bo_alloc_request request = {};
@@ -290,7 +290,7 @@  amdgpu_bo_alloc_wrap(amdgpu_device_handle dev, unsigned size,
 	request.alloc_size = size;
 	request.phys_alignment = alignment;
 	request.preferred_heap = heap;
-	request.flags = flags;
+	request.flags = alloc_flags;
 
 	r = amdgpu_bo_alloc(dev, &request, &buf_handle);
 	if (r)
@@ -302,9 +302,9 @@  amdgpu_bo_alloc_wrap(amdgpu_device_handle dev, unsigned size,
 }
 
 static inline int
-amdgpu_bo_alloc_and_map(amdgpu_device_handle dev, unsigned size,
-			unsigned alignment, unsigned heap, uint64_t flags,
-			amdgpu_bo_handle *bo, void **cpu, uint64_t *mc_address,
+amdgpu_bo_alloc_and_map_raw(amdgpu_device_handle dev, unsigned size,
+			unsigned alignment, unsigned heap, uint64_t alloc_flags,
+			uint64_t mapping_flags, amdgpu_bo_handle *bo, void **cpu, uint64_t *mc_address,
 			amdgpu_va_handle *va_handle)
 {
 	struct amdgpu_bo_alloc_request request = {};
@@ -316,7 +316,7 @@  amdgpu_bo_alloc_and_map(amdgpu_device_handle dev, unsigned size,
 	request.alloc_size = size;
 	request.phys_alignment = alignment;
 	request.preferred_heap = heap;
-	request.flags = flags;
+	request.flags = alloc_flags;
 
 	r = amdgpu_bo_alloc(dev, &request, &buf_handle);
 	if (r)
@@ -329,7 +329,7 @@  amdgpu_bo_alloc_and_map(amdgpu_device_handle dev, unsigned size,
 	if (r)
 		goto error_va_alloc;
 
-	r = amdgpu_bo_va_op(buf_handle, 0, size, vmc_addr, 0, AMDGPU_VA_OP_MAP);
+	r = amdgpu_bo_va_op(buf_handle, 0, size, vmc_addr, mapping_flags, AMDGPU_VA_OP_MAP);
 	if (r)
 		goto error_va_map;
 
@@ -355,6 +355,16 @@  error_va_alloc:
 }
 
 static inline int
+amdgpu_bo_alloc_and_map(amdgpu_device_handle dev, unsigned size,
+			unsigned alignment, unsigned heap, uint64_t alloc_flags,
+			amdgpu_bo_handle *bo, void **cpu, uint64_t *mc_address,
+			amdgpu_va_handle *va_handle)
+{
+	return amdgpu_bo_alloc_and_map_raw(dev, size, alignment, heap,
+					alloc_flags, 0, bo, cpu, mc_address, va_handle);
+}
+
+static inline int
 amdgpu_bo_unmap_and_free(amdgpu_bo_handle bo, amdgpu_va_handle va_handle,
 			 uint64_t mc_addr, uint64_t size)
 {