libvulkan: Rev 8 of ANDROID_native_buffer
This change ramps up the ANDROID_native_buffer spec version becasue of
the new behavior introduced to support the new structure added in
VK_KHR_swapchain v69. This change also advertise the swapchain spec
verison based upon the ANDROID_native_buffer version the drivers are
reporting.
Bug: 130182551
Test: CtsDeqpTestCases
Change-Id: Ic95489dac883726d10e1a949875a576116622f3c
diff --git a/vulkan/api/vulkan.api b/vulkan/api/vulkan.api
index 7604c95..76503c8 100644
--- a/vulkan/api/vulkan.api
+++ b/vulkan/api/vulkan.api
@@ -96,7 +96,7 @@
@extension("VK_KHR_win32_surface") define VK_KHR_WIN32_SURFACE_NAME "VK_KHR_win32_surface"
// 11
-@extension("VK_ANDROID_native_buffer") define VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION 7
+@extension("VK_ANDROID_native_buffer") define VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION 8
@extension("VK_ANDROID_native_buffer") define VK_ANDROID_NATIVE_BUFFER_NAME "VK_ANDROID_native_buffer"
// 12
diff --git a/vulkan/include/vulkan/vk_android_native_buffer.h b/vulkan/include/vulkan/vk_android_native_buffer.h
index d3e5f0f..23006fa 100644
--- a/vulkan/include/vulkan/vk_android_native_buffer.h
+++ b/vulkan/include/vulkan/vk_android_native_buffer.h
@@ -37,7 +37,17 @@
* backwards-compatibility support is temporary, and will likely be removed in
* (along with all gralloc0 support) in a future release.
*/
-#define VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION 7
+/* NOTE ON VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION 8
+ *
+ * This version of the extension doesn't introduce new types or structs, but is
+ * to accommodate the new struct VkBindImageMemorySwapchainInfoKHR added in
+ * VK_KHR_swapchain spec version 69. When VkBindImageMemorySwapchainInfoKHR is
+ * chained in the pNext chain of VkBindImageMemoryInfo, a VkNativeBufferANDROID
+ * that holds the correct gralloc handle according to the imageIndex specified
+ * in VkBindImageMemorySwapchainInfoKHR will be additionally chained to the
+ * pNext chain of VkBindImageMemoryInfo and passed down to the driver.
+ */
+#define VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION 8
#define VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME "VK_ANDROID_native_buffer"
#define VK_ANDROID_NATIVE_BUFFER_ENUM(type,id) ((type)(1000000000 + (1000 * (VK_ANDROID_NATIVE_BUFFER_EXTENSION_NUMBER - 1)) + (id)))
diff --git a/vulkan/libvulkan/driver.cpp b/vulkan/libvulkan/driver.cpp
index 491d4d1..613fa13 100644
--- a/vulkan/libvulkan/driver.cpp
+++ b/vulkan/libvulkan/driver.cpp
@@ -983,7 +983,12 @@
memcpy(prop.extensionName, VK_KHR_SWAPCHAIN_EXTENSION_NAME,
sizeof(VK_KHR_SWAPCHAIN_EXTENSION_NAME));
- prop.specVersion = VK_KHR_SWAPCHAIN_SPEC_VERSION;
+
+ if (prop.specVersion >= 8) {
+ prop.specVersion = VK_KHR_SWAPCHAIN_SPEC_VERSION;
+ } else {
+ prop.specVersion = 68;
+ }
}
}