Mesa (master): radv: factor out radv_alloc_memory

Bas Nieuwenhuizen bnieuwenhuizen at kemper.freedesktop.org
Fri Oct 20 23:17:49 UTC 2017


Module: Mesa
Branch: master
Commit: eff2bdbd8272ceec723dcc1643dd3d5f77020d1f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=eff2bdbd8272ceec723dcc1643dd3d5f77020d1f

Author: Andres Rodriguez <andresx7 at gmail.com>
Date:   Fri Oct 20 18:42:12 2017 -0400

radv: factor out radv_alloc_memory

This allows us to pass extra parameters to the memory allocation
operation that are not defined in the vulkan spec. This is useful for
internal usage.

Signed-off-by: Andres Rodriguez <andresx7 at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>

---

 src/amd/vulkan/radv_device.c  | 19 ++++++++++++++-----
 src/amd/vulkan/radv_private.h | 11 +++++++++++
 2 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 3748d51488..5e6e9dcdb5 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -2048,11 +2048,11 @@ bool radv_get_memory_fd(struct radv_device *device,
 					 pFD);
 }
 
-VkResult radv_AllocateMemory(
-	VkDevice                                    _device,
-	const VkMemoryAllocateInfo*                 pAllocateInfo,
-	const VkAllocationCallbacks*                pAllocator,
-	VkDeviceMemory*                             pMem)
+VkResult radv_alloc_memory(VkDevice                        _device,
+			   const VkMemoryAllocateInfo*     pAllocateInfo,
+			   const VkAllocationCallbacks*    pAllocator,
+			   enum radv_mem_flags_bits        mem_flags,
+			   VkDeviceMemory*                 pMem)
 {
 	RADV_FROM_HANDLE(radv_device, device, _device);
 	struct radv_device_memory *mem;
@@ -2134,6 +2134,15 @@ fail:
 	return result;
 }
 
+VkResult radv_AllocateMemory(
+	VkDevice                                    _device,
+	const VkMemoryAllocateInfo*                 pAllocateInfo,
+	const VkAllocationCallbacks*                pAllocator,
+	VkDeviceMemory*                             pMem)
+{
+	return radv_alloc_memory(_device, pAllocateInfo, pAllocator, 0, pMem);
+}
+
 void radv_FreeMemory(
 	VkDevice                                    _device,
 	VkDeviceMemory                              _mem,
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index 47a068b559..a4e52b2530 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -106,6 +106,11 @@ enum radv_mem_type {
 	RADV_MEM_TYPE_COUNT
 };
 
+enum radv_mem_flags_bits {
+	/* enable implicit synchronization when accessing the underlying bo */
+	RADV_MEM_IMPLICIT_SYNC = 1 << 0,
+};
+
 #define radv_printflike(a, b) __attribute__((__format__(__printf__, a, b)))
 
 static inline uint32_t
@@ -946,6 +951,12 @@ void radv_cmd_buffer_trace_emit(struct radv_cmd_buffer *cmd_buffer);
 bool radv_get_memory_fd(struct radv_device *device,
 			struct radv_device_memory *memory,
 			int *pFD);
+VkResult radv_alloc_memory(VkDevice _device,
+			   const VkMemoryAllocateInfo* pAllocateInfo,
+			   const VkAllocationCallbacks* pAllocator,
+			   enum radv_mem_flags_bits flags,
+			   VkDeviceMemory* pMem);
+
 /*
  * Takes x,y,z as exact numbers of invocations, instead of blocks.
  *




More information about the mesa-commit mailing list