targets/xa: provide alternative(static) xa target
authorEmil Velikov <emil.l.velikov@gmail.com>
Sat, 21 Jun 2014 11:42:03 +0000 (12:42 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Mon, 30 Jun 2014 21:27:11 +0000 (22:27 +0100)
Now we can build the xa target (libxatracker) with either static
pipe-drivers or shared ones. Currently we default to static.

 - Remove the unused CFLAGS/CPPFLAGS.
 - Use GALLIUM_TARGET_CFLAGS where applicable.

v2: Update the printout messages at configure.
v3: Drop inclusion of the wrapper winsys and softpipe/llvmpipe.

Cc: Jakob Bornecrantz <jakob@vmware.com>
Cc: Rob Clark <robclark@freedesktop.org>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
configure.ac
src/gallium/state_trackers/xa/Makefile.am
src/gallium/state_trackers/xa/xa_tracker.c
src/gallium/targets/xa/Makefile.am
src/gallium/targets/xa/target.c [new file with mode: 0644]

index faf148567426b5a3d09c211f87c927d4c0b39f67..9e90d85574b3a04740f651bee5d1d854dc4b6c39 100644 (file)
@@ -1910,14 +1910,14 @@ if test -n "$with_gallium_drivers"; then
             HAVE_GALLIUM_SVGA=yes
             GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga softpipe"
             gallium_require_drm_loader
-            gallium_check_st "svga/drm" "dri-vmwgfx" ""
+            gallium_check_st "svga/drm" "dri-vmwgfx" "xa/vmwgfx"
             ;;
         xi915)
             HAVE_GALLIUM_I915=yes
             PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
             gallium_require_drm_loader
             GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915"
-            gallium_check_st "i915/drm" "dri-i915"
+            gallium_check_st "i915/drm" "dri-i915" "xa/i915"
             DRICOMMON_NEED_LIBDRM=yes
             ;;
         xilo)
@@ -1925,7 +1925,7 @@ if test -n "$with_gallium_drivers"; then
             PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
             gallium_require_drm_loader
             GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS ilo"
-            gallium_check_st "intel/drm" "dri-ilo"
+            gallium_check_st "intel/drm" "dri-ilo" "xa/ilo"
             DRICOMMON_NEED_LIBDRM=yes
             ;;
         xr300)
@@ -1934,7 +1934,7 @@ if test -n "$with_gallium_drivers"; then
             gallium_require_drm_loader
             gallium_require_llvm "Gallium R300"
             GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
-            gallium_check_st "radeon/drm" "r300/dri" "" "" ""
+            gallium_check_st "radeon/drm" "r300/dri" "xa/r300" "" ""
             DRICOMMON_NEED_LIBDRM=yes
             ;;
         xr600)
@@ -1952,7 +1952,7 @@ if test -n "$with_gallium_drivers"; then
             if test "x$enable_opencl" = xyes; then
                 LLVM_COMPONENTS="${LLVM_COMPONENTS} bitreader asmparser"
             fi
-            gallium_check_st "radeon/drm" "r600/dri" "" "xvmc/r600" "vdpau/r600" "omx/r600"
+            gallium_check_st "radeon/drm" "r600/dri" "xa/r600" "xvmc/r600" "vdpau/r600" "omx/r600"
             DRICOMMON_NEED_LIBDRM=yes
             ;;
         xradeonsi)
@@ -1962,7 +1962,7 @@ if test -n "$with_gallium_drivers"; then
             GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS radeonsi"
             radeon_llvm_check "radeonsi"
             require_egl_drm "radeonsi"
-            gallium_check_st "radeon/drm" "radeonsi/dri" "" "" "vdpau/radeonsi" "omx/radeonsi"
+            gallium_check_st "radeon/drm" "radeonsi/dri" "xa/radeonsi" "" "vdpau/radeonsi" "omx/radeonsi"
             DRICOMMON_NEED_LIBDRM=yes
             ;;
         xnouveau)
@@ -1970,7 +1970,7 @@ if test -n "$with_gallium_drivers"; then
             PKG_CHECK_MODULES([NOUVEAU], [libdrm_nouveau >= $LIBDRM_NOUVEAU_REQUIRED])
             gallium_require_drm_loader
             GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau"
-            gallium_check_st "nouveau/drm" "dri-nouveau" "" "xvmc/nouveau" "vdpau/nouveau" "omx/nouveau"
+            gallium_check_st "nouveau/drm" "dri-nouveau" "xa/nouveau" "xvmc/nouveau" "vdpau/nouveau" "omx/nouveau"
             DRICOMMON_NEED_LIBDRM=yes
             ;;
         xfreedreno)
@@ -1978,7 +1978,7 @@ if test -n "$with_gallium_drivers"; then
             PKG_CHECK_MODULES([FREEDRENO], [libdrm_freedreno >= $LIBDRM_FREEDRENO_REQUIRED])
             gallium_require_drm_loader
             GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS freedreno"
-            gallium_check_st "freedreno/drm" "dri-freedreno" "" "" ""
+            gallium_check_st "freedreno/drm" "dri-freedreno" "xa/freedreno" "" ""
             DRICOMMON_NEED_LIBDRM=yes
             ;;
         xswrast)
index 72486b9816ce5a7c4af2dcc3b5133de134f94605..52d84a9ab48644c4a4c6e06f55399a673e75e1f9 100644 (file)
@@ -30,11 +30,12 @@ AM_CFLAGS = \
 
 AM_CPPFLAGS = \
        $(GALLIUM_PIPE_LOADER_DEFINES) \
-       -DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\" \
-       -I$(top_srcdir)/src/gallium/targets/xa \
-       -I$(top_srcdir)/src/gallium/ \
-       -I$(top_srcdir)/src/gallium/winsys \
-       -I$(top_srcdir)/src/gallium/drivers
+       -DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\"
+
+if HAVE_GALLIUM_STATIC_TARGETS
+AM_CPPFLAGS += \
+       -DGALLIUM_STATIC_TARGETS=1
+endif
 
 xa_includedir = $(includedir)
 xa_include_HEADERS = \
index 9add5843c73a56d2f01089b2fbc87ca39cd42824..6e4312e0079b2b064fbd5d3a16f5329f193dd48b 100644 (file)
@@ -144,8 +144,12 @@ xa_tracker_create(int drm_fd)
     if (!xa)
        return NULL;
 
+#if GALLIUM_STATIC_TARGETS
+    xa->screen = dd_create_screen(drm_fd);
+#else
     if (pipe_loader_drm_probe_fd(&xa->dev, drm_fd, false))
        xa->screen = pipe_loader_create_screen(xa->dev, PIPE_SEARCH_DIR);
+#endif
     if (!xa->screen)
        goto out_no_screen;
 
@@ -192,8 +196,10 @@ xa_tracker_create(int drm_fd)
  out_no_pipe:
     xa->screen->destroy(xa->screen);
  out_no_screen:
+#if !GALLIUM_STATIC_TARGETS
     if (xa->dev)
        pipe_loader_release(&xa->dev, 1);
+#endif
     free(xa);
     return NULL;
 }
@@ -204,7 +210,9 @@ xa_tracker_destroy(struct xa_tracker *xa)
     free(xa->supported_formats);
     xa_context_destroy(xa->default_ctx);
     xa->screen->destroy(xa->screen);
+#if !GALLIUM_STATIC_TARGETS
     pipe_loader_release(&xa->dev, 1);
+#endif
     free(xa);
 }
 
index a62704099d3a9b53a4c7e1447bddf511bb55bbc9..6a20ae71f9d89b30108571f7f0039ca3f8e3af2b 100644 (file)
 
 include $(top_srcdir)/src/gallium/Automake.inc
 
-AM_CPPFLAGS = \
-       -I$(top_srcdir)/include \
-       -I$(top_srcdir)/src/gallium/state_trackers/xa \
-       -I$(top_srcdir)/src/gallium/winsys
-
 AM_CFLAGS = \
-       $(GALLIUM_CFLAGS) \
-       $(LIBDRM_CFLAGS)
+       $(GALLIUM_TARGET_CFLAGS)
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = xatracker.pc
@@ -40,11 +34,8 @@ nodist_EXTRA_libxatracker_la_SOURCES = dummy.cpp
 libxatracker_la_SOURCES =
 
 libxatracker_la_LIBADD = \
-       $(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la \
        $(top_builddir)/src/gallium/state_trackers/xa/libxatracker.la \
        $(top_builddir)/src/gallium/auxiliary/libgallium.la \
-       $(GALLIUM_PIPE_LOADER_WINSYS_LIBS) \
-       $(GALLIUM_PIPE_LOADER_LIBS) \
        $(LIBDRM_LIBS) \
        $(GALLIUM_COMMON_LIB_DEPS)
 
@@ -59,6 +50,97 @@ libxatracker_la_LDFLAGS += \
        -Wl,--version-script=$(top_srcdir)/src/gallium/targets/xa/xa.sym
 endif
 
+if HAVE_GALLIUM_STATIC_TARGETS
+
+STATIC_TARGET_CPPFLAGS =
+STATIC_TARGET_LIB_DEPS = \
+       $(top_builddir)/src/loader/libloader.la
+
+if HAVE_GALLIUM_I915
+STATIC_TARGET_CPPFLAGS += -DGALLIUM_I915
+STATIC_TARGET_LIB_DEPS += \
+       $(top_builddir)/src/gallium/winsys/i915/drm/libi915drm.la \
+       $(top_builddir)/src/gallium/drivers/i915/libi915.la \
+       $(INTEL_LIBS)
+endif
+
+if HAVE_GALLIUM_ILO
+STATIC_TARGET_CPPFLAGS += -DGALLIUM_ILO
+STATIC_TARGET_LIB_DEPS += \
+       $(top_builddir)/src/gallium/winsys/intel/drm/libintelwinsys.la \
+       $(top_builddir)/src/gallium/drivers/ilo/libilo.la \
+       $(INTEL_LIBS)
+endif
+
+if HAVE_GALLIUM_NOUVEAU
+STATIC_TARGET_CPPFLAGS += -DGALLIUM_NOUVEAU
+STATIC_TARGET_LIB_DEPS += \
+       $(top_builddir)/src/gallium/winsys/nouveau/drm/libnouveaudrm.la \
+       $(top_builddir)/src/gallium/drivers/nouveau/libnouveau.la \
+       $(NOUVEAU_LIBS)
+endif
+
+if NEED_RADEON_DRM_WINSYS
+STATIC_TARGET_LIB_DEPS += \
+       $(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la
+endif
+
+if HAVE_GALLIUM_RADEON_COMMON
+STATIC_TARGET_LIB_DEPS += \
+       $(top_builddir)/src/gallium/drivers/radeon/libradeon.la
+endif
+
+if HAVE_GALLIUM_R300
+STATIC_TARGET_CPPFLAGS += -DGALLIUM_R300
+STATIC_TARGET_LIB_DEPS += \
+       $(top_builddir)/src/gallium/drivers/r300/libr300.la \
+       $(top_builddir)/src/gallium/drivers/r300/libr300-helper.la \
+       $(RADEON_LIBS)
+endif
+
+if HAVE_GALLIUM_R600
+STATIC_TARGET_CPPFLAGS += -DGALLIUM_R600
+STATIC_TARGET_LIB_DEPS += \
+       $(top_builddir)/src/gallium/drivers/r600/libr600.la \
+       $(RADEON_LIBS)
+endif
+
+if HAVE_GALLIUM_RADEONSI
+STATIC_TARGET_CPPFLAGS += -DGALLIUM_RADEONSI
+STATIC_TARGET_LIB_DEPS += \
+       $(top_builddir)/src/gallium/drivers/radeonsi/libradeonsi.la \
+       $(RADEON_LIBS)
+endif
+
+if HAVE_GALLIUM_SVGA
+STATIC_TARGET_CPPFLAGS += -DGALLIUM_VMWGFX
+STATIC_TARGET_LIB_DEPS += \
+       $(top_builddir)/src/gallium/winsys/svga/drm/libsvgadrm.la \
+       $(top_builddir)/src/gallium/drivers/svga/libsvga.la
+endif
+
+if HAVE_GALLIUM_FREEDRENO
+STATIC_TARGET_CPPFLAGS += -DGALLIUM_FREEDRENO
+STATIC_TARGET_LIB_DEPS += \
+       $(top_builddir)/src/gallium/winsys/freedreno/drm/libfreedrenodrm.la \
+       $(top_builddir)/src/gallium/drivers/freedreno/libfreedreno.la \
+       $(FREEDRENO_LIBS)
+
+endif
+
+libxatracker_la_SOURCES += target.c
+libxatracker_la_CPPFLAGS = $(STATIC_TARGET_CPPFLAGS)
+libxatracker_la_LIBADD += $(STATIC_TARGET_LIB_DEPS)
+
+else # HAVE_GALLIUM_STATIC_TARGETS
+
+libxatracker_la_LIBADD += \
+       $(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la \
+       $(GALLIUM_PIPE_LOADER_WINSYS_LIBS) \
+       $(GALLIUM_PIPE_LOADER_LIBS)
+
+endif # HAVE_GALLIUM_STATIC_TARGETS
+
 if HAVE_MESA_LLVM
 libxatracker_la_LIBADD += $(LLVM_LIBS)
 libxatracker_la_LDFLAGS += $(LLVM_LDFLAGS)
diff --git a/src/gallium/targets/xa/target.c b/src/gallium/targets/xa/target.c
new file mode 100644 (file)
index 0000000..fde4a4a
--- /dev/null
@@ -0,0 +1 @@
+#include "target-helpers/inline_drm_helper.h"