pipe-loader: wrap pipe_loader_sw_probe_xlib within HAVE_PIPE_LOADER_XLIB
authorEmil Velikov <emil.l.velikov@gmail.com>
Sat, 22 Feb 2014 16:44:14 +0000 (16:44 +0000)
committerEmil Velikov <emil.l.velikov@gmail.com>
Mon, 24 Feb 2014 14:52:27 +0000 (14:52 +0000)
The above function implies using the the xlib winsys, which
has additional library dependencies that should not be forced.

Make the software xlib pipe loader optional thus avoid all
the dependency hell. A user that wishes to use the particular
pipe-loader would need to set the following within configure.ac.

 enable_gallium_xlib_loader=yes

v2:
 - Wrap sw/xlib/xlib_sw_winsys.h to handle compilation on systems
lacking X11 headers. Spotted by Christian Prochaska.

Tested-by: Tom Stellard <thomas.stellard@amd.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75356
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
configure.ac
src/gallium/auxiliary/pipe-loader/Makefile.am
src/gallium/auxiliary/pipe-loader/pipe_loader.h
src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
src/gallium/targets/gbm/Makefile.am
src/gallium/targets/opencl/Makefile.am
src/gallium/targets/xa/Makefile.am
src/gallium/tests/trivial/Makefile.am

index 08aed4e30c5b322a04832dec6ee2d5cd3cc93897..d42803c8a45d7d60d1d54dff5d51aca1b0c34feb 100644 (file)
@@ -1887,6 +1887,12 @@ AM_CONDITIONAL(NEED_GALLIUM_LLVMPIPE_DRIVER, test "x$HAVE_GALLIUM_I915" = xyes -
 if test "x$enable_gallium_loader" = xyes; then
     GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/null"
 
+    if test "x$enable_gallium_xlib_loader" = xyes; then
+        GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib"
+        NEED_WINSYS_XLIB="yes"
+        GALLIUM_PIPE_LOADER_DEFINES="$GALLIUM_PIPE_LOADER_DEFINES -DHAVE_PIPE_LOADER_XLIB"
+    fi
+
     if test "x$enable_gallium_drm_loader" = xyes; then
         GALLIUM_PIPE_LOADER_DEFINES="$GALLIUM_PIPE_LOADER_DEFINES -DHAVE_PIPE_LOADER_DRM"
         PKG_CHECK_MODULES([GALLIUM_PIPE_LOADER_XCB], [xcb xcb-dri2],
@@ -1905,6 +1911,7 @@ if test "x$enable_gallium_loader" = xyes; then
     AC_SUBST([GALLIUM_PIPE_LOADER_CLIENT_DEFINES])
     AC_SUBST([GALLIUM_PIPE_LOADER_CLIENT_LIBS])
 fi
+AM_CONDITIONAL(NEED_PIPE_LOADER_XLIB, test "x$enable_gallium_xlib_loader" = xyes)
 
 AM_CONDITIONAL(HAVE_I915_DRI, test x$HAVE_I915_DRI = xyes)
 AM_CONDITIONAL(HAVE_I965_DRI, test x$HAVE_I965_DRI = xyes)
index 232fe40f12e1f44b0bf5172ce7e63a8b956f25da..ccdbea56d7a7abc39b147cd928aff0c106b823b6 100644 (file)
@@ -8,10 +8,6 @@ AM_CPPFLAGS = $(DEFINES) \
        -I$(top_srcdir)/src/gallium/auxiliary \
        -I$(top_srcdir)/src/gallium/winsys
 
-if NEED_WINSYS_XLIB
-AM_CPPFLAGS += -DHAVE_WINSYS_XLIB
-endif
-
 noinst_LTLIBRARIES =
 
 if HAVE_LOADER_GALLIUM
index 125086d24abdc2f158661459a3a5bbbf2334bb69..a5e49fc2c1a3d7050c5a3a3cb36f7f6c15e4b126 100644 (file)
@@ -35,7 +35,7 @@
 
 #include "pipe/p_compiler.h"
 
-#ifdef HAVE_WINSYS_XLIB
+#ifdef HAVE_PIPE_LOADER_XLIB
 #include <X11/Xlib.h>
 #endif
 
@@ -105,7 +105,7 @@ pipe_loader_create_screen(struct pipe_loader_device *dev,
 void
 pipe_loader_release(struct pipe_loader_device **devs, int ndev);
 
-#ifdef HAVE_WINSYS_XLIB
+#ifdef HAVE_PIPE_LOADER_XLIB
 
 /**
  * Initialize Xlib for an associated display.
index ece687bf2f55aff93c2b37f9c803dd8faaa04fef..35ec37fa2db98ce61d9b49bb5722357e049b9a24 100644 (file)
 #include "util/u_dl.h"
 #include "sw/dri/dri_sw_winsys.h"
 #include "sw/null/null_sw_winsys.h"
+#ifdef HAVE_PIPE_LOADER_XLIB
+/* Explicitly wrap the header to ease build without X11 headers */
 #include "sw/xlib/xlib_sw_winsys.h"
+#endif
 #include "target-helpers/inline_sw_helper.h"
 #include "state_tracker/drisw_api.h"
 
@@ -49,7 +52,7 @@ static struct sw_winsys *(*backends[])() = {
    null_sw_create
 };
 
-#ifdef HAVE_WINSYS_XLIB
+#ifdef HAVE_PIPE_LOADER_XLIB
 bool
 pipe_loader_sw_probe_xlib(struct pipe_loader_device **devs, Display *display)
 {
index c0dcd8cd1c298fc983d557b4db7c5381edd09e4f..ecbb9ad2d22e6c8e9b6a17ff181a30b1aa0b9976 100644 (file)
@@ -50,6 +50,13 @@ gbm_gallium_drm_la_LIBADD = \
        $(LIBDRM_LIBS) \
        -lm
 
+if NEED_PIPE_LOADER_XLIB
+gbm_gallium_drm_la_LIBADD += \
+       $(top_builddir)/src/gallium/winsys/sw/xlib/libws_xlib.la \
+       -lX11 -lXext -lXfixes \
+       $(LIBDRM_LIBS)
+endif
+
 gbm_gallium_drm_la_LDFLAGS = -no-undefined -avoid-version -module
 
 # FIXME: this shouldn't be needed
index 8eec40586e3507725fbb9f53f24333038d587a42..e82889e0f46045da6b1b47d908244747167ae78c 100644 (file)
@@ -28,6 +28,13 @@ lib@OPENCL_LIBNAME@_la_LIBADD = \
        -lclangBasic \
        $(LLVM_LIBS)
 
+if NEED_PIPE_LOADER_XLIB
+lib@OPENCL_LIBNAME@_la_LIBADD += \
+       $(top_builddir)/src/gallium/winsys/sw/xlib/libws_xlib.la \
+       -lX11 -lXext -lXfixes \
+       $(LIBDRM_LIBS)
+endif
+
 lib@OPENCL_LIBNAME@_la_SOURCES =
 
 # Force usage of a C++ linker
index e305dbfdc13439c92e8451fc3df5121a23def95a..7ab57ffec56606369be64d241894a69327dea52f 100644 (file)
@@ -48,6 +48,13 @@ libxatracker_la_LIBADD = \
        $(LIBUDEV_LIBS) \
        $(LIBDRM_LIBS)
 
+if NEED_PIPE_LOADER_XLIB
+libxatracker_la_LIBADD += \
+       $(top_builddir)/src/gallium/winsys/sw/xlib/libws_xlib.la \
+       -lX11 -lXext -lXfixes \
+       $(LIBDRM_LIBS)
+endif
+
 libxatracker_la_LDFLAGS = \
        -no-undefined \
        -version-number $(XA_MAJOR):$(XA_MINOR):$(XA_TINY)
index 656ee64e0f56529272867e7d5764ca7ce663cf96..15a81b3a696eae13720e01d651dc1ac12d4d5192 100644 (file)
@@ -20,6 +20,13 @@ LDADD = $(GALLIUM_PIPE_LOADER_CLIENT_LIBS) \
        $(PTHREAD_LIBS) \
        -lm
 
+if NEED_PIPE_LOADER_XLIB
+LDADD += \
+       $(top_builddir)/src/gallium/winsys/sw/xlib/libws_xlib.la \
+       -lX11 -lXext -lXfixes \
+       $(LIBDRM_LIBS)
+endif
+
 noinst_PROGRAMS = compute tri quad-tex
 
 compute_SOURCES = compute.c