anv: move to using shared wsi code
authorDave Airlie <airlied@redhat.com>
Fri, 14 Oct 2016 06:12:33 +0000 (07:12 +0100)
committerDave Airlie <airlied@redhat.com>
Wed, 19 Oct 2016 00:15:43 +0000 (10:15 +1000)
This moves the shared code to a common subdirectory
and makes anv linked to that code instead of the copy
it was using.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
configure.ac
src/Makefile.am
src/intel/vulkan/Makefile.am
src/intel/vulkan/Makefile.sources
src/vulkan/wsi/Makefile.am [new file with mode: 0644]
src/vulkan/wsi/Makefile.sources [new file with mode: 0644]
src/vulkan/wsi/wsi_common.h [moved from src/intel/vulkan/wsi_common.h with 100% similarity]
src/vulkan/wsi/wsi_common_wayland.c [moved from src/intel/vulkan/wsi_common_wayland.c with 99% similarity]
src/vulkan/wsi/wsi_common_wayland.h [moved from src/intel/vulkan/wsi_common_wayland.h with 100% similarity]
src/vulkan/wsi/wsi_common_x11.c [moved from src/intel/vulkan/wsi_common_x11.c with 99% similarity]
src/vulkan/wsi/wsi_common_x11.h [moved from src/intel/vulkan/wsi_common_x11.h with 100% similarity]

index 8e779d4..7e63bfa 100644 (file)
@@ -2631,6 +2631,8 @@ VA_MINOR=`$PKG_CONFIG --modversion libva | $SED -n 's/.*\.\(.*\)\..*$/\1/p'`
 AC_SUBST([VA_MAJOR], $VA_MAJOR)
 AC_SUBST([VA_MINOR], $VA_MINOR)
 
+AM_CONDITIONAL(HAVE_VULKAN_COMMON, test "x$VULKAN_DRIVERS" != "x")
+
 AC_SUBST([XVMC_MAJOR], 1)
 AC_SUBST([XVMC_MINOR], 0)
 
@@ -2789,7 +2791,8 @@ AC_CONFIG_FILES([Makefile
                src/mesa/drivers/x11/Makefile
                src/mesa/main/tests/Makefile
                src/util/Makefile
-               src/util/tests/hash_table/Makefile])
+               src/util/tests/hash_table/Makefile
+               src/vulkan/wsi/Makefile])
 
 AC_OUTPUT
 
index b63d135..1347120 100644 (file)
@@ -115,6 +115,10 @@ if HAVE_INTEL_DRIVERS
 SUBDIRS += intel/tools
 endif
 
+if HAVE_VULKAN_COMMON
+SUBDIRS += vulkan/wsi
+endif
+
 ## Requires the i965 compiler (part of mesa) and wayland-drm
 if HAVE_INTEL_VULKAN
 SUBDIRS += intel/vulkan
index 54a51be..5d2b3a5 100644 (file)
@@ -49,6 +49,7 @@ AM_CPPFLAGS = \
        -I$(top_srcdir)/include \
        -I$(top_builddir)/src \
        -I$(top_srcdir)/src \
+       -I$(top_srcdir)/src/vulkan/wsi \
        -I$(top_builddir)/src/compiler \
        -I$(top_srcdir)/src/compiler \
        -I$(top_builddir)/src/compiler/nir \
@@ -116,6 +117,7 @@ libvulkan_common_la_SOURCES = $(VULKAN_SOURCES)
 
 VULKAN_LIB_DEPS += \
        libvulkan_common.la \
+       $(top_builddir)/src/vulkan/wsi/libvulkan_wsi.la \
        $(top_builddir)/src/mesa/drivers/dri/i965/libi965_compiler.la \
        $(top_builddir)/src/compiler/nir/libnir.la \
        $(top_builddir)/src/util/libmesautil.la \
index 62205d4..c51c146 100644 (file)
@@ -42,19 +42,14 @@ VULKAN_FILES := \
        anv_query.c \
        anv_util.c \
        anv_wsi.c \
-       wsi_common.h \
        genX_pipeline_util.h \
        vk_format_info.h
 
 VULKAN_WSI_WAYLAND_FILES := \
-       anv_wsi_wayland.c \
-       wsi_common_wayland.c \
-       wsi_common_wayland.h
+       anv_wsi_wayland.c
 
 VULKAN_WSI_X11_FILES := \
-       anv_wsi_x11.c \
-       wsi_common_x11.c \
-       wsi_common_x11.h
+       anv_wsi_x11.c
 
 VULKAN_GEM_FILES := \
        anv_gem.c
diff --git a/src/vulkan/wsi/Makefile.am b/src/vulkan/wsi/Makefile.am
new file mode 100644 (file)
index 0000000..50a7401
--- /dev/null
@@ -0,0 +1,49 @@
+
+include Makefile.sources
+
+vulkan_includedir = $(includedir)/vulkan
+
+noinst_LTLIBRARIES = libvulkan_wsi.la
+
+AM_CPPFLAGS = \
+       $(DEFINES) \
+       -I$(top_srcdir)/include \
+       -I$(top_builddir)/src \
+       -I$(top_srcdir)/src/gallium/auxiliary \
+       -I$(top_srcdir)/src/gallium/include
+
+AM_CFLAGS = \
+       $(VISIBILITY_CFLAGS)
+
+VULKAN_LIB_DEPS =
+
+VULKAN_WSI_SOURCES = \
+       $(VULKAN_WSI_FILES)
+
+if HAVE_PLATFORM_X11
+AM_CPPFLAGS += \
+       $(XCB_DRI3_CFLAGS) \
+       -DVK_USE_PLATFORM_XCB_KHR \
+       -DVK_USE_PLATFORM_XLIB_KHR
+
+VULKAN_WSI_SOURCES += $(VULKAN_WSI_X11_FILES)
+
+# FIXME: Use pkg-config for X11-xcb ldflags.
+VULKAN_LIB_DEPS += $(XCB_DRI3_LIBS) -lX11-xcb
+endif
+
+if HAVE_PLATFORM_WAYLAND
+AM_CPPFLAGS += \
+       -I$(top_builddir)/src/egl/wayland/wayland-drm \
+       -I$(top_srcdir)/src/egl/wayland/wayland-drm \
+       $(WAYLAND_CFLAGS) \
+       -DVK_USE_PLATFORM_WAYLAND_KHR
+
+VULKAN_WSI_SOURCES += $(VULKAN_WSI_WAYLAND_FILES)
+
+VULKAN_LIB_DEPS += \
+       $(top_builddir)/src/egl/wayland/wayland-drm/libwayland-drm.la \
+       $(WAYLAND_LIBS)
+endif
+
+libvulkan_wsi_la_SOURCES = $(VULKAN_WSI_SOURCES)
diff --git a/src/vulkan/wsi/Makefile.sources b/src/vulkan/wsi/Makefile.sources
new file mode 100644 (file)
index 0000000..3139e6d
--- /dev/null
@@ -0,0 +1,11 @@
+
+VULKAN_WSI_FILES := \
+       wsi_common.h
+
+VULKAN_WSI_WAYLAND_FILES := \
+       wsi_common_wayland.c \
+       wsi_common_wayland.h
+
+VULKAN_WSI_X11_FILES := \
+       wsi_common_x11.c \
+       wsi_common_x11.h
\ No newline at end of file
similarity index 99%
rename from src/intel/vulkan/wsi_common_wayland.c
rename to src/vulkan/wsi/wsi_common_wayland.c
index fc6775a..32a0a51 100644 (file)
@@ -24,6 +24,7 @@
 #include <wayland-client.h>
 #include <wayland-drm-client-protocol.h>
 
+#include <assert.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <unistd.h>
@@ -31,7 +32,7 @@
 #include <string.h>
 
 #include "wsi_common_wayland.h"
-#include "vk_format_info.h"
+
 #include <util/hash_table.h>
 #include <util/u_vector.h>
 
similarity index 99%
rename from src/intel/vulkan/wsi_common_x11.c
rename to src/vulkan/wsi/wsi_common_x11.c
index 02b6eb6..b5832c6 100644 (file)
 #include <xcb/dri3.h>
 #include <xcb/present.h>
 
-#include "util/hash_table.h"
+#include "util/macros.h"
 #include <stdlib.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <errno.h>
 #include <string.h>
+
+#include "util/hash_table.h"
+
 #include "wsi_common.h"
 #include "wsi_common_x11.h"