anv: factor out the X11/XCB build
authorEmil Velikov <emil.velikov@collabora.com>
Wed, 20 Apr 2016 18:15:18 +0000 (19:15 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Sun, 1 May 2016 07:38:04 +0000 (08:38 +0100)
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@collabora.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
src/intel/vulkan/Makefile.am
src/intel/vulkan/anv_device.c
src/intel/vulkan/anv_wsi.c

index 98784aa2714551a7c1ac530869bbf3f13d70752b..5289860b50458e7d602d1c975917962c5b2e4deb 100644 (file)
@@ -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 \
index 03a14392b4dbaea4791288bcf5b7c6efd70f0837..02b96ca3d691f3ca380478c1ffb728d77f381e05 100644 (file)
@@ -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,
index 850e14fd60dc7bdaa1e4b3bfc50db331f0a0a390..49edbdc2f99cb05c0e4917748b6f05ed6e529fd3 100644 (file)
@@ -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(