[Mesa-dev] [PATCH] anv: Feed vk_android_native_buffer.xml to generators (v2)

Chad Versace chadversary at chromium.org
Thu Sep 14 21:18:12 UTC 2017


Feed the XML to anv_extensions.py and anv_entrypoints_gen.py.
Do it on all platforms, not just Android. Tested on Android and Fedora.

We always parse the Android XML, regardless of target platform, to
help reduce the chance that people working on non-Android break the
Android build.

v2:
  - Squash in Tapani's changes to Android.*.mk.

Reviewed-by: Tapani Pälli <tapani.palli at intel.com> (v1)
---
 src/intel/Android.vulkan.mk        |  5 ++++-
 src/intel/Makefile.vulkan.am       | 17 +++++++++++++----
 src/intel/vulkan/anv_extensions.py | 12 +++++++++++-
 3 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/src/intel/Android.vulkan.mk b/src/intel/Android.vulkan.mk
index 17ae4b071b..a15d916942 100644
--- a/src/intel/Android.vulkan.mk
+++ b/src/intel/Android.vulkan.mk
@@ -65,7 +65,8 @@ $(intermediates)/vulkan/dummy.c:
 $(intermediates)/vulkan/anv_entrypoints.h: $(intermediates)/vulkan/dummy.c
 	$(VK_ENTRYPOINTS_SCRIPT) \
 		--outdir $(dir $@) \
-		--xml $(MESA_TOP)/src/vulkan/registry/vk.xml
+		--xml $(MESA_TOP)/src/vulkan/registry/vk.xml \
+		--xml $(MESA_TOP)/src/vulkan/registry/vk_android_native_buffer.xml
 
 LOCAL_EXPORT_C_INCLUDE_DIRS := \
         $(intermediates)
@@ -214,12 +215,14 @@ $(intermediates)/vulkan/anv_entrypoints.c:
 	@mkdir -p $(dir $@)
 	$(VK_ENTRYPOINTS_SCRIPT) \
 		--xml $(MESA_TOP)/src/vulkan/registry/vk.xml \
+		--xml $(MESA_TOP)/src/vulkan/registry/vk_android_native_buffer.xml \
 		--outdir $(dir $@)
 
 $(intermediates)/vulkan/anv_extensions.c:
 	@mkdir -p $(dir $@)
 	$(VK_EXTENSIONS_SCRIPT) \
 		--xml $(MESA_TOP)/src/vulkan/registry/vk.xml \
+		--xml $(MESA_TOP)/src/vulkan/registry/vk_android_native_buffer.xml \
 		--out $@
 
 LOCAL_SHARED_LIBRARIES := libdrm
diff --git a/src/intel/Makefile.vulkan.am b/src/intel/Makefile.vulkan.am
index fa9b6ba724..8a19f96096 100644
--- a/src/intel/Makefile.vulkan.am
+++ b/src/intel/Makefile.vulkan.am
@@ -23,18 +23,27 @@
 # rules must be outside of any AM_CONDITIONALs. Otherwise they will be commented
 # out and we'll fail at `make dist'
 vulkan_api_xml = $(top_srcdir)/src/vulkan/registry/vk.xml
+vk_android_native_buffer_xml = $(top_srcdir)/src/vulkan/registry/vk_android_native_buffer.xml
 
 vulkan/anv_entrypoints.c: vulkan/anv_entrypoints_gen.py \
-			  vulkan/anv_extensions.py $(vulkan_api_xml)
+			  vulkan/anv_extensions.py \
+			  $(vulkan_api_xml) \
+			  $(vk_android_native_buffer_xml)
 	$(MKDIR_GEN)
 	$(AM_V_GEN)$(PYTHON2) $(srcdir)/vulkan/anv_entrypoints_gen.py \
-		--xml $(vulkan_api_xml) --outdir $(builddir)/vulkan
+		--xml $(vulkan_api_xml) \
+		--xml $(vk_android_native_buffer_xml) \
+		--outdir $(builddir)/vulkan
 vulkan/anv_entrypoints.h: vulkan/anv_entrypoints.c
 
-vulkan/anv_extensions.c: vulkan/anv_extensions.py $(vulkan_api_xml)
+vulkan/anv_extensions.c: vulkan/anv_extensions.py \
+			 $(vulkan_api_xml) \
+			 $(vk_android_native_buffer_xml)
 	$(MKDIR_GEN)
 	$(AM_V_GEN)$(PYTHON2) $(srcdir)/vulkan/anv_extensions.py \
-		--xml $(vulkan_api_xml) --out $@
+		--xml $(vulkan_api_xml) \
+		--xml $(vk_android_native_buffer_xml) \
+		--out $@
 
 BUILT_SOURCES += $(VULKAN_GENERATED_FILES)
 CLEANFILES += \
diff --git a/src/intel/vulkan/anv_extensions.py b/src/intel/vulkan/anv_extensions.py
index d995f9f177..316e1f04e7 100644
--- a/src/intel/vulkan/anv_extensions.py
+++ b/src/intel/vulkan/anv_extensions.py
@@ -134,8 +134,18 @@ def _init_exts_from_xml(xml):
         ext_name = ext_elem.attrib['name']
         if ext_name not in ext_name_map:
             continue
-        ext = ext_name_map[ext_name]
 
+        # Workaround for VK_ANDROID_native_buffer. Its <extension> element in
+        # vk.xml lists it as supported="disabled" and provides only a stub
+        # definition.  Its <extension> element in Mesa's custom
+        # vk_android_native_buffer.xml, though, lists it as
+        # supported='android-vendor' and fully defines the extension. We want
+        # to skip the <extension> element in vk.xml.
+        if ext_elem.attrib['supported'] == 'disabled':
+            assert ext_name == 'VK_ANDROID_native_buffer'
+            continue
+
+        ext = ext_name_map[ext_name]
         ext.type = ext_elem.attrib['type']
 
 _TEMPLATE = Template(COPYRIGHT + """
-- 
2.13.0



More information about the mesa-dev mailing list