[Mesa-dev] [PATCH] Vulkan: Add VK_ANDROID_native_buffer to device extension list

Randy Xu randy.xu at intel.com
Wed Mar 1 03:52:42 UTC 2017


The VK_ANDROID_native_buffer is implemented in Android Vulkan HAL,
not driver, but must be claimed in device extension list. Otherwise,
this extension will be screened off in framework and driver.

Test: Pass Vulkan dEQP-VK.wsi.android.swapchain.* on Android platform

Signed-off-by: Randy Xu <randy.xu at intel.com>
---
 Android.common.mk             | 3 +++
 src/intel/vulkan/anv_device.c | 9 +++++++++
 2 files changed, 12 insertions(+)

diff --git a/Android.common.mk b/Android.common.mk
index 611162a..f49189b 100644
--- a/Android.common.mk
+++ b/Android.common.mk
@@ -116,6 +116,9 @@ else
   LOCAL_CFLAGS += -DDEFAULT_DRIVER_DIR=\"/system/lib/$(MESA_DRI_MODULE_REL_PATH)\"
 endif
 
+# Enable VK_ANDROID_native_buffer
+LOCAL_CFLAGS += -DVK_USE_PLATFORM_ANDROID_KHR
+
 # uncomment to keep the debug symbols
 #LOCAL_STRIP_MODULE := false
 
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 0db96f2..478d753 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -258,6 +258,15 @@ static const VkExtensionProperties device_extensions[] = {
       .extensionName = VK_KHR_MAINTENANCE1_EXTENSION_NAME,
       .specVersion = 1,
    },
+#ifdef VK_USE_PLATFORM_ANDROID_KHR
+   {
+      // Refer https://source.android.com/devices/graphics/implement-vulkan.html
+      // "Window System Integration (WSI) extensions are exported by the loader
+      //  and primarily implemented in it rather than the driver."
+      .extensionName = "VK_ANDROID_native_buffer",
+      .specVersion = 1,
+   },
+#endif
    {
       .extensionName = VK_KHR_SHADER_DRAW_PARAMETERS_EXTENSION_NAME,
       .specVersion = 1,
-- 
2.7.4



More information about the mesa-dev mailing list