All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] [reference] Disable implicit sync for non-wsi bos
@ 2017-09-19 15:49 Andres Rodriguez
       [not found] ` <20170919154912.29916-1-andresx7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Andres Rodriguez @ 2017-09-19 15:49 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: airlied-H+wXaHxf7aLQT0dZR+AlfA,
	deathsimple-ANTagKRnAhcb1SvskN2V4Q,
	andresx7-Re5JQEeQqe8AvxtiuMwx3w

This is a reference patch series for the kernel series:
"drm/amdgpu: introduce AMDGPU_GEM_CREATE_EXPLICIT_SYNC v2"

Andres Rodriguez (2):
  radv: factor out radv_alloc_memory
  radv: disable implicit sync for radv allocated bos v2

 src/amd/vulkan/radv_device.c                  | 22 +++++++++++++++++-----
 src/amd/vulkan/radv_private.h                 | 11 +++++++++++
 src/amd/vulkan/radv_radeon_winsys.h           |  1 +
 src/amd/vulkan/radv_wsi.c                     |  3 ++-
 src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c |  2 ++
 5 files changed, 33 insertions(+), 6 deletions(-)

-- 
2.9.3

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] radv: factor out radv_alloc_memory
       [not found] ` <20170919154912.29916-1-andresx7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-09-19 15:49   ` Andres Rodriguez
  2017-09-19 15:49   ` [PATCH 2/2] radv: disable implicit sync for radv allocated bos v2 Andres Rodriguez
  1 sibling, 0 replies; 3+ messages in thread
From: Andres Rodriguez @ 2017-09-19 15:49 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: airlied-H+wXaHxf7aLQT0dZR+AlfA,
	deathsimple-ANTagKRnAhcb1SvskN2V4Q,
	andresx7-Re5JQEeQqe8AvxtiuMwx3w

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@gmail.com>
---
 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 5d96070..106eaf6 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -2242,11 +2242,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;
@@ -2328,6 +2328,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 a9da9e7..8cb3807 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -105,6 +105,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
@@ -935,6 +940,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.
  *
-- 
2.9.3

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] radv: disable implicit sync for radv allocated bos v2
       [not found] ` <20170919154912.29916-1-andresx7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2017-09-19 15:49   ` [PATCH 1/2] radv: factor out radv_alloc_memory Andres Rodriguez
@ 2017-09-19 15:49   ` Andres Rodriguez
  1 sibling, 0 replies; 3+ messages in thread
From: Andres Rodriguez @ 2017-09-19 15:49 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: airlied-H+wXaHxf7aLQT0dZR+AlfA,
	deathsimple-ANTagKRnAhcb1SvskN2V4Q,
	andresx7-Re5JQEeQqe8AvxtiuMwx3w

Implicit sync kicks in when a buffer is used by two different amdgpu
contexts simultaneously. Jobs that use explicit synchronization
mechanisms end up needlessly waiting to be scheduled for long periods
of time in order to achieve serialized execution.

This patch disables implicit synchronization for all radv allocations
except for wsi bos. The only systems that require implicit
synchronization are DRI2/3 and PRIME.

v2: mark wsi bos as RADV_MEM_IMPLICIT_SYNC

Signed-off-by: Andres Rodriguez <andresx7@gmail.com>
---
 src/amd/vulkan/radv_device.c                  | 3 +++
 src/amd/vulkan/radv_radeon_winsys.h           | 1 +
 src/amd/vulkan/radv_wsi.c                     | 3 ++-
 src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c | 2 ++
 4 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 106eaf6..26944d2 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -2309,6 +2309,9 @@ VkResult radv_alloc_memory(VkDevice                        _device,
 	if (pAllocateInfo->memoryTypeIndex == RADV_MEM_TYPE_GTT_WRITE_COMBINE)
 		flags |= RADEON_FLAG_GTT_WC;
 
+	if (mem_flags & RADV_MEM_IMPLICIT_SYNC)
+		flags |= RADEON_FLAG_IMPLICIT_SYNC;
+
 	mem->bo = device->ws->buffer_create(device->ws, alloc_size, device->physical_device->rad_info.max_alignment,
 					       domain, flags);
 
diff --git a/src/amd/vulkan/radv_radeon_winsys.h b/src/amd/vulkan/radv_radeon_winsys.h
index 82ec5fe..02e0243 100644
--- a/src/amd/vulkan/radv_radeon_winsys.h
+++ b/src/amd/vulkan/radv_radeon_winsys.h
@@ -53,6 +53,7 @@ enum radeon_bo_flag { /* bitfield */
 	RADEON_FLAG_NO_CPU_ACCESS = (1 << 2),
 	RADEON_FLAG_VIRTUAL =       (1 << 3),
 	RADEON_FLAG_VA_UNCACHED =   (1 << 4),
+	RADEON_FLAG_IMPLICIT_SYNC = (1 << 5),
 };
 
 enum radeon_bo_usage { /* bitfield */
diff --git a/src/amd/vulkan/radv_wsi.c b/src/amd/vulkan/radv_wsi.c
index aa44b7d..f8307ee 100644
--- a/src/amd/vulkan/radv_wsi.c
+++ b/src/amd/vulkan/radv_wsi.c
@@ -193,7 +193,7 @@ radv_wsi_image_create(VkDevice device_h,
 		.image = image_h
 	};
 
-	result = radv_AllocateMemory(device_h,
+	result = radv_alloc_memory(device_h,
 				     &(VkMemoryAllocateInfo) {
 					     .sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
 					     .pNext = &ded_alloc,
@@ -201,6 +201,7 @@ radv_wsi_image_create(VkDevice device_h,
 					     .memoryTypeIndex = linear ? 1 : 0,
 				     },
 				     NULL /* XXX: pAllocator */,
+				     RADV_MEM_IMPLICIT_SYNC,
 				     &memory_h);
 	if (result != VK_SUCCESS)
 		goto fail_create_image;
diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c
index 325f875..cd0efbe 100644
--- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c
+++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c
@@ -330,6 +330,8 @@ radv_amdgpu_winsys_bo_create(struct radeon_winsys *_ws,
 		request.flags |= AMDGPU_GEM_CREATE_NO_CPU_ACCESS;
 	if (flags & RADEON_FLAG_GTT_WC)
 		request.flags |= AMDGPU_GEM_CREATE_CPU_GTT_USWC;
+	if (!(flags & RADEON_FLAG_IMPLICIT_SYNC))
+		request.flags |= AMDGPU_GEM_CREATE_EXPLICIT_SYNC;
 
 	r = amdgpu_bo_alloc(ws->dev, &request, &buf_handle);
 	if (r) {
-- 
2.9.3

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-09-19 15:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-19 15:49 [PATCH 0/2] [reference] Disable implicit sync for non-wsi bos Andres Rodriguez
     [not found] ` <20170919154912.29916-1-andresx7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-09-19 15:49   ` [PATCH 1/2] radv: factor out radv_alloc_memory Andres Rodriguez
2017-09-19 15:49   ` [PATCH 2/2] radv: disable implicit sync for radv allocated bos v2 Andres Rodriguez

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.