Mesa (master): radv: Enable VK_KHR_incremental_present.

Bas Nieuwenhuizen bnieuwenhuizen at kemper.freedesktop.org
Mon Apr 3 21:01:10 UTC 2017


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

Author: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Date:   Mon Apr  3 21:33:51 2017 +0200

radv: Enable VK_KHR_incremental_present.

Just enabling the driver-independent implementation that Jason did.

Signed-off-by: Bas Nieuwenhuizen <basni at google.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

---

 src/amd/vulkan/radv_device.c           |  4 ++++
 src/amd/vulkan/radv_entrypoints_gen.py |  1 +
 src/amd/vulkan/radv_wsi.c              | 11 ++++++++++-
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 24219e4ec4..a0d640718a 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -92,6 +92,10 @@ static const VkExtensionProperties instance_extensions[] = {
 
 static const VkExtensionProperties common_device_extensions[] = {
 	{
+		.extensionName = VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME,
+		.specVersion = 1,
+	},
+	{
 		.extensionName = VK_KHR_MAINTENANCE1_EXTENSION_NAME,
 		.specVersion = 1,
 	},
diff --git a/src/amd/vulkan/radv_entrypoints_gen.py b/src/amd/vulkan/radv_entrypoints_gen.py
index b7b2bcf97e..bee29dc120 100644
--- a/src/amd/vulkan/radv_entrypoints_gen.py
+++ b/src/amd/vulkan/radv_entrypoints_gen.py
@@ -31,6 +31,7 @@ supported_extensions = [
    'VK_AMD_draw_indirect_count',
    'VK_NV_dedicated_allocation',
    'VK_KHR_get_physical_device_properties2',
+   'VK_KHR_incremental_present',
    'VK_KHR_maintenance1',
    'VK_KHR_sampler_mirror_clamp_to_edge',
    'VK_KHR_shader_draw_parameters',
diff --git a/src/amd/vulkan/radv_wsi.c b/src/amd/vulkan/radv_wsi.c
index 8b66095b26..b8999f4eb0 100644
--- a/src/amd/vulkan/radv_wsi.c
+++ b/src/amd/vulkan/radv_wsi.c
@@ -26,6 +26,7 @@
 #include "radv_private.h"
 #include "radv_meta.h"
 #include "wsi_common.h"
+#include "util/vk_util.h"
 
 static const struct wsi_callbacks wsi_cbs = {
    .get_phys_device_format_properties = radv_GetPhysicalDeviceFormatProperties,
@@ -452,9 +453,14 @@ VkResult radv_QueuePresentKHR(
 	RADV_FROM_HANDLE(radv_queue, queue, _queue);
 	VkResult result = VK_SUCCESS;
 
+	const VkPresentRegionsKHR *regions =
+	         vk_find_struct_const(pPresentInfo->pNext, PRESENT_REGIONS_KHR);
+
 	for (uint32_t i = 0; i < pPresentInfo->swapchainCount; i++) {
 		RADV_FROM_HANDLE(wsi_swapchain, swapchain, pPresentInfo->pSwapchains[i]);
 		struct radeon_winsys_cs *cs;
+		const VkPresentRegionKHR *region = NULL;
+
 		assert(radv_device_from_handle(swapchain->device) == queue->device);
 		if (swapchain->fences[0] == VK_NULL_HANDLE) {
 			result = radv_CreateFence(radv_device_to_handle(queue->device),
@@ -484,9 +490,12 @@ VkResult radv_QueuePresentKHR(
 					     pPresentInfo->waitSemaphoreCount, NULL, 0, false, base_fence);
 		fence->submitted = true;
 
+		if (regions && regions->pRegions)
+			region = &regions->pRegions[i];
+
 		result = swapchain->queue_present(swapchain,
 						  pPresentInfo->pImageIndices[i],
-						  NULL);
+						  region);
 		/* TODO: What if one of them returns OUT_OF_DATE? */
 		if (result != VK_SUCCESS)
 			return result;




More information about the mesa-commit mailing list