[Mesa-dev] [PATCH 19/23] targets/xa: provide alternative(static) xa target

Emil Velikov emil.l.velikov at gmail.com
Sun May 18 00:07:41 PDT 2014


Now we can build the xa target (libxatracker) with either
static pipe-drivers or shared ones. Currently we default
to static.

Drop all the unused CFLAGS/CPPFLAGS.
Rename GALLIUM_VIDEO_CFLAGS to GALLIUM_TARGET_CFLAGS and
use it across targets.

Cc: Jakob Bornecrantz <jakob at vmware.com>
Cc: Rob Clark <robclark at freedesktop.org>
Cc: Thomas Hellstrom <thellstrom at vmware.com>
Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
 src/gallium/Automake.inc                   |  2 +-
 src/gallium/state_trackers/xa/Makefile.am  | 11 ++++++-----
 src/gallium/state_trackers/xa/xa_tracker.c |  8 ++++++++
 src/gallium/targets/omx/Makefile.am        |  2 +-
 src/gallium/targets/vdpau/Makefile.am      |  2 +-
 src/gallium/targets/xa/Makefile.am         | 31 ++++++++++++++++++++----------
 src/gallium/targets/xa/target.c            |  1 +
 src/gallium/targets/xvmc/Makefile.am       |  2 +-
 8 files changed, 40 insertions(+), 19 deletions(-)
 create mode 100644 src/gallium/targets/xa/target.c

diff --git a/src/gallium/Automake.inc b/src/gallium/Automake.inc
index 786495e..b998ebc 100644
--- a/src/gallium/Automake.inc
+++ b/src/gallium/Automake.inc
@@ -39,7 +39,7 @@ GALLIUM_DRI_CFLAGS = \
 	$(LIBDRM_CFLAGS) \
 	$(VISIBILITY_CFLAGS)
 
-GALLIUM_VIDEO_CFLAGS = \
+GALLIUM_TARGET_CFLAGS = \
 	-I$(top_srcdir)/include \
 	-I$(top_srcdir)/src/loader \
 	-I$(top_srcdir)/src/gallium/include \
diff --git a/src/gallium/state_trackers/xa/Makefile.am b/src/gallium/state_trackers/xa/Makefile.am
index 72486b9..52d84a9 100644
--- a/src/gallium/state_trackers/xa/Makefile.am
+++ b/src/gallium/state_trackers/xa/Makefile.am
@@ -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 = \
diff --git a/src/gallium/state_trackers/xa/xa_tracker.c b/src/gallium/state_trackers/xa/xa_tracker.c
index 9add584..6e4312e 100644
--- a/src/gallium/state_trackers/xa/xa_tracker.c
+++ b/src/gallium/state_trackers/xa/xa_tracker.c
@@ -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);
 }
 
diff --git a/src/gallium/targets/omx/Makefile.am b/src/gallium/targets/omx/Makefile.am
index 0eddd26..f1d62af 100644
--- a/src/gallium/targets/omx/Makefile.am
+++ b/src/gallium/targets/omx/Makefile.am
@@ -1,7 +1,7 @@
 include $(top_srcdir)/src/gallium/Automake.inc
 
 AM_CFLAGS = \
-	$(GALLIUM_VIDEO_CFLAGS)
+	$(GALLIUM_TARGET_CFLAGS)
 
 omxdir = $(OMX_LIB_INSTALL_DIR)
 omx_LTLIBRARIES = libomx_gallium.la
diff --git a/src/gallium/targets/vdpau/Makefile.am b/src/gallium/targets/vdpau/Makefile.am
index 63aff1b..ed4a0c2 100644
--- a/src/gallium/targets/vdpau/Makefile.am
+++ b/src/gallium/targets/vdpau/Makefile.am
@@ -1,7 +1,7 @@
 include $(top_srcdir)/src/gallium/Automake.inc
 
 AM_CFLAGS = \
-	$(GALLIUM_VIDEO_CFLAGS)
+	$(GALLIUM_TARGET_CFLAGS)
 
 vdpaudir = $(VDPAU_LIB_INSTALL_DIR)
 vdpau_LTLIBRARIES = libvdpau_gallium.la
diff --git a/src/gallium/targets/xa/Makefile.am b/src/gallium/targets/xa/Makefile.am
index a1a41a2..0ca3b9b 100644
--- a/src/gallium/targets/xa/Makefile.am
+++ b/src/gallium/targets/xa/Makefile.am
@@ -22,14 +22,8 @@
 
 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,9 +34,6 @@ nodist_EXTRA_libxatracker_la_SOURCES = dummy.cpp
 libxatracker_la_SOURCES =
 
 libxatracker_la_LIBADD = \
-	$(GALLIUM_PIPE_LOADER_LIBS) \
-	$(GALLIUM_PIPE_LOADER_WINSYS_LIBS) \
-	$(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 \
 	$(LIBDRM_LIBS) \
@@ -54,6 +45,26 @@ libxatracker_la_LDFLAGS = \
 	$(GC_SECTIONS) \
 	$(LD_NO_UNDEFINED)
 
+if HAVE_GALLIUM_STATIC_TARGETS
+
+libxatracker_la_SOURCES += target.c
+libxatracker_la_CPPFLAGS = $(STATIC_TARGET_CPPFLAGS)
+libxatracker_la_LIBADD += $(STATIC_TARGET_LIB_DEPS)
+
+if HAVE_GALLIUM_R300
+libxatracker_la_LIBADD += \
+	$(top_builddir)/src/gallium/drivers/r300/libr300-helper.la
+endif
+
+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
index 0000000..fde4a4a
--- /dev/null
+++ b/src/gallium/targets/xa/target.c
@@ -0,0 +1 @@
+#include "target-helpers/inline_drm_helper.h"
diff --git a/src/gallium/targets/xvmc/Makefile.am b/src/gallium/targets/xvmc/Makefile.am
index 6c2a2e5..6667082 100644
--- a/src/gallium/targets/xvmc/Makefile.am
+++ b/src/gallium/targets/xvmc/Makefile.am
@@ -1,7 +1,7 @@
 include $(top_srcdir)/src/gallium/Automake.inc
 
 AM_CFLAGS = \
-	$(GALLIUM_VIDEO_CFLAGS)
+	$(GALLIUM_TARGET_CFLAGS)
 
 xvmcdir = $(XVMC_LIB_INSTALL_DIR)
 xvmc_LTLIBRARIES = libXvMCgallium.la
-- 
1.9.2



More information about the mesa-dev mailing list