[Mesa-dev] [PATCH 15/25] anv: factor out the X11/XCB build

Emil Velikov emil.l.velikov at gmail.com
Thu Apr 21 13:16:15 UTC 2016


From: Emil Velikov <emil.velikov at collabora.com>

Similar to earlier commit - move all the common bits into a single
place, thus improving readability and allowing us to see what's missing.

Also don't forget to add the missing bits. This commit should allows us
to build wayland only vulkan ;-)

Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
 src/intel/vulkan/Makefile.am  | 23 +++++++++++++++++------
 src/intel/vulkan/anv_device.c |  2 ++
 src/intel/vulkan/anv_wsi.c    |  4 ++++
 3 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/src/intel/vulkan/Makefile.am b/src/intel/vulkan/Makefile.am
index 587532b..3169a4d 100644
--- a/src/intel/vulkan/Makefile.am
+++ b/src/intel/vulkan/Makefile.am
@@ -30,8 +30,7 @@ vulkan_include_HEADERS =				\
 
 # Used when generating entrypoints to filter out unwanted extensions
 VULKAN_ENTRYPOINT_CPPFLAGS = \
-   -I$(top_srcdir)/include/vulkan \
-   -DVK_USE_PLATFORM_XCB_KHR
+   -I$(top_srcdir)/include/vulkan
 
 lib_LTLIBRARIES = libvulkan_intel.la
 
@@ -66,12 +65,11 @@ AM_CPPFLAGS = \
 	-I$(top_builddir)/src/compiler/nir \
 	-I$(top_builddir)/src/intel
 
-AM_CFLAGS = -DVK_USE_PLATFORM_XCB_KHR -Wno-override-init -msse2
+AM_CFLAGS = -Wno-override-init -msse2
 
 VULKAN_SOURCES = \
 	$(VULKAN_GENERATED_FILES) \
-	$(VULKAN_FILES) \
-	$(VULKAN_WSI_X11_FILES)
+	$(VULKAN_FILES)
 
 VULKAN_LIB_DEPS =
 
@@ -91,6 +89,20 @@ libanv_gen8_la_SOURCES = $(GEN8_FILES)
 libanv_gen9_la_CFLAGS = $(AM_CFLAGS) -DGEN_VERSIONx10=90
 libanv_gen9_la_SOURCES = $(GEN9_FILES)
 
+
+if HAVE_EGL_PLATFORM_X11
+VULKAN_ENTRYPOINT_CPPFLAGS += \
+	-DVK_USE_PLATFORM_XCB_KHR
+
+AM_CPPFLAGS += \
+	$(XCB_DRI3_CFLAGS) \
+	-DVK_USE_PLATFORM_XCB_KHR
+
+VULKAN_SOURCES += $(VULKAN_WSI_X11_FILES)
+VULKAN_LIB_DEPS += $(XCB_DRI3_LIBS)
+endif
+
+
 if HAVE_EGL_PLATFORM_WAYLAND
 VULKAN_ENTRYPOINT_CPPFLAGS += -DVK_USE_PLATFORM_WAYLAND_KHR
 
@@ -112,7 +124,6 @@ libvulkan_common_la_SOURCES = $(VULKAN_SOURCES)
 
 VULKAN_LIB_DEPS += \
 	libvulkan_common.la \
-	-lxcb -lxcb-dri3 -lxcb-present -lxcb-sync -lxshmfence \
 	$(top_builddir)/src/intel/isl/libisl.la \
 	$(top_builddir)/src/mesa/drivers/dri/i965/libi965_compiler.la \
 	$(top_builddir)/src/mesa/libmesa.la \
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index e07cca5..19d807d 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -170,10 +170,12 @@ static const VkExtensionProperties global_extensions[] = {
       .extensionName = VK_KHR_SURFACE_EXTENSION_NAME,
       .specVersion = 25,
    },
+#ifdef VK_USE_PLATFORM_XCB_KHR
    {
       .extensionName = VK_KHR_XCB_SURFACE_EXTENSION_NAME,
       .specVersion = 5,
    },
+#endif
 #ifdef VK_USE_PLATFORM_WAYLAND_KHR
    {
       .extensionName = VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME,
diff --git a/src/intel/vulkan/anv_wsi.c b/src/intel/vulkan/anv_wsi.c
index 850e14f..49edbdc 100644
--- a/src/intel/vulkan/anv_wsi.c
+++ b/src/intel/vulkan/anv_wsi.c
@@ -28,9 +28,11 @@ anv_init_wsi(struct anv_instance *instance)
 {
    VkResult result;
 
+#ifdef VK_USE_PLATFORM_XCB_KHR
    result = anv_x11_init_wsi(instance);
    if (result != VK_SUCCESS)
       return result;
+#endif
 
 #ifdef VK_USE_PLATFORM_WAYLAND_KHR
    result = anv_wl_init_wsi(instance);
@@ -49,7 +51,9 @@ anv_finish_wsi(struct anv_instance *instance)
 #ifdef VK_USE_PLATFORM_WAYLAND_KHR
    anv_wl_finish_wsi(instance);
 #endif
+#ifdef VK_USE_PLATFORM_XCB_KHR
    anv_x11_finish_wsi(instance);
+#endif
 }
 
 void anv_DestroySurfaceKHR(
-- 
2.8.0



More information about the mesa-dev mailing list