Mesa (master): st/xa: use pipe-loader to get screen

Rob Clark robclark at kemper.freedesktop.org
Sun Feb 16 13:50:52 UTC 2014


Module: Mesa
Branch: master
Commit: 42158926c6d7d3ddbe61b9a04d60544ff1b50a96
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=42158926c6d7d3ddbe61b9a04d60544ff1b50a96

Author: Rob Clark <robclark at freedesktop.org>
Date:   Mon Feb 10 10:43:11 2014 -0500

st/xa: use pipe-loader to get screen

This lets multiple gallium drivers use XA.

Signed-off-by: Rob Clark <robclark at freedesktop.org>

---

 configure.ac                                       |    9 ++--
 src/gallium/state_trackers/xa/Makefile.am          |    3 ++
 src/gallium/state_trackers/xa/xa_priv.h            |    1 +
 src/gallium/state_trackers/xa/xa_tracker.c         |    7 ++-
 src/gallium/targets/Makefile.am                    |    8 ++--
 src/gallium/targets/xa-vmwgfx/vmw_target.c         |   26 -----------
 src/gallium/targets/{xa-vmwgfx => xa}/Makefile.am  |   46 +++++++++++---------
 .../targets/{xa-vmwgfx => xa}/xatracker.pc.in      |    0
 8 files changed, 45 insertions(+), 55 deletions(-)

diff --git a/configure.ac b/configure.ac
index cf7562b..e3a72bd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1269,6 +1269,7 @@ dnl XA configuration
 dnl
 if test "x$enable_xa" = xyes; then
     GALLIUM_STATE_TRACKERS_DIRS="xa $GALLIUM_STATE_TRACKERS_DIRS"
+    enable_gallium_loader=yes
 fi
 AM_CONDITIONAL(HAVE_ST_XA, test "x$enable_xa" = xyes)
 
@@ -1761,7 +1762,7 @@ if test "x$with_gallium_drivers" != x; then
         xsvga)
             HAVE_GALLIUM_SVGA=yes
             GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga softpipe"
-            gallium_check_st "svga/drm" "dri-vmwgfx" "xa-vmwgfx"
+            gallium_check_st "svga/drm" "dri-vmwgfx" ""
             ;;
         xi915)
             HAVE_GALLIUM_I915=yes
@@ -1980,7 +1981,7 @@ AC_SUBST([XVMC_MAJOR], 1)
 AC_SUBST([XVMC_MINOR], 0)
 
 AC_SUBST([XA_MAJOR], 2)
-AC_SUBST([XA_MINOR], 1)
+AC_SUBST([XA_MINOR], 2)
 AC_SUBST([XA_TINY], 0)
 AC_SUBST([XA_VERSION], "$XA_MAJOR.$XA_MINOR.$XA_TINY")
 
@@ -2053,6 +2054,8 @@ AC_CONFIG_FILES([Makefile
 		src/gallium/targets/egl-static/Makefile
 		src/gallium/targets/gbm/Makefile
 		src/gallium/targets/opencl/Makefile
+		src/gallium/targets/xa/Makefile
+		src/gallium/targets/xa/xatracker.pc
 		src/gallium/targets/osmesa/Makefile
 		src/gallium/targets/osmesa/osmesa.pc
 		src/gallium/targets/pipe-loader/Makefile
@@ -2066,8 +2069,6 @@ AC_CONFIG_FILES([Makefile
 		src/gallium/targets/r600/xvmc/Makefile
 		src/gallium/targets/libgl-xlib/Makefile
 		src/gallium/targets/vdpau-nouveau/Makefile
-		src/gallium/targets/xa-vmwgfx/Makefile
-		src/gallium/targets/xa-vmwgfx/xatracker.pc
 		src/gallium/targets/xvmc-nouveau/Makefile
 		src/gallium/tests/trivial/Makefile
 		src/gallium/tests/unit/Makefile
diff --git a/src/gallium/state_trackers/xa/Makefile.am b/src/gallium/state_trackers/xa/Makefile.am
index 7d0b366..72486b9 100644
--- a/src/gallium/state_trackers/xa/Makefile.am
+++ b/src/gallium/state_trackers/xa/Makefile.am
@@ -29,6 +29,9 @@ AM_CFLAGS = \
 	$(VISIBILITY_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
diff --git a/src/gallium/state_trackers/xa/xa_priv.h b/src/gallium/state_trackers/xa/xa_priv.h
index ee182e7..b99c214 100644
--- a/src/gallium/state_trackers/xa/xa_priv.h
+++ b/src/gallium/state_trackers/xa/xa_priv.h
@@ -74,6 +74,7 @@ struct xa_tracker {
     unsigned int format_map[XA_LAST_SURFACE_TYPE][2];
     int d_depth_bits_last;
     int ds_depth_bits_last;
+    struct pipe_loader_device *dev;
     struct pipe_screen *screen;
     struct xa_context *default_ctx;
 };
diff --git a/src/gallium/state_trackers/xa/xa_tracker.c b/src/gallium/state_trackers/xa/xa_tracker.c
index cda6501..d3601c6 100644
--- a/src/gallium/state_trackers/xa/xa_tracker.c
+++ b/src/gallium/state_trackers/xa/xa_tracker.c
@@ -30,6 +30,7 @@
 #include "xa_priv.h"
 #include "pipe/p_state.h"
 #include "pipe/p_format.h"
+#include "pipe-loader/pipe_loader.h"
 #include "state_tracker/drm_driver.h"
 #include "util/u_inlines.h"
 
@@ -143,7 +144,8 @@ xa_tracker_create(int drm_fd)
     if (!xa)
 	return NULL;
 
-    xa->screen = driver_descriptor.create_screen(drm_fd);
+    if (pipe_loader_drm_probe_fd(&xa->dev, drm_fd, false))
+	xa->screen = pipe_loader_create_screen(xa->dev, PIPE_SEARCH_DIR);
     if (!xa->screen)
 	goto out_no_screen;
 
@@ -190,6 +192,8 @@ xa_tracker_create(int drm_fd)
  out_no_pipe:
     xa->screen->destroy(xa->screen);
  out_no_screen:
+    if (xa->dev)
+	pipe_loader_release(&xa->dev, 1);
     free(xa);
     return NULL;
 }
@@ -200,6 +204,7 @@ xa_tracker_destroy(struct xa_tracker *xa)
     free(xa->supported_formats);
     xa_context_destroy(xa->default_ctx);
     xa->screen->destroy(xa->screen);
+    pipe_loader_release(&xa->dev, 1);
     free(xa);
 }
 
diff --git a/src/gallium/targets/Makefile.am b/src/gallium/targets/Makefile.am
index a336914..871b31d 100644
--- a/src/gallium/targets/Makefile.am
+++ b/src/gallium/targets/Makefile.am
@@ -34,6 +34,10 @@ if HAVE_GALLIUM_GBM
 SUBDIRS += gbm
 endif
 
+if HAVE_ST_XA
+SUBDIRS += xa
+endif
+
 if HAVE_CLOVER
 SUBDIRS += opencl
 endif
@@ -42,10 +46,6 @@ if HAVE_GALLIUM_SVGA
 if HAVE_DRI
 SUBDIRS += dri-vmwgfx
 endif
-
-if HAVE_ST_XA
-SUBDIRS += xa-vmwgfx
-endif
 endif
 
 if HAVE_GALLIUM_FREEDRENO
diff --git a/src/gallium/targets/xa-vmwgfx/vmw_target.c b/src/gallium/targets/xa-vmwgfx/vmw_target.c
deleted file mode 100644
index 1087801..0000000
--- a/src/gallium/targets/xa-vmwgfx/vmw_target.c
+++ /dev/null
@@ -1,26 +0,0 @@
-
-#include "target-helpers/inline_debug_helper.h"
-#include "state_tracker/drm_driver.h"
-#include "svga/drm/svga_drm_public.h"
-#include "svga/svga_public.h"
-
-static struct pipe_screen *
-create_screen(int fd)
-{
-   struct svga_winsys_screen *sws;
-   struct pipe_screen *screen;
-
-   sws = svga_drm_winsys_screen_create(fd);
-   if (!sws)
-      return NULL;
-
-   screen = svga_screen_create(sws);
-   if (!screen)
-      return NULL;
-
-   screen = debug_screen_wrap(screen);
-
-   return screen;
-}
-
-DRM_DRIVER_DESCRIPTOR("vmwgfx", "vmwgfx", create_screen, NULL)
diff --git a/src/gallium/targets/xa-vmwgfx/Makefile.am b/src/gallium/targets/xa/Makefile.am
similarity index 67%
rename from src/gallium/targets/xa-vmwgfx/Makefile.am
rename to src/gallium/targets/xa/Makefile.am
index 6fe0510..e305dbf 100644
--- a/src/gallium/targets/xa-vmwgfx/Makefile.am
+++ b/src/gallium/targets/xa/Makefile.am
@@ -22,40 +22,46 @@
 
 include $(top_srcdir)/src/gallium/Automake.inc
 
-AM_CFLAGS = \
-	-Wall -pedantic \
-	$(GALLIUM_CFLAGS) \
-	$(XORG_CFLAGS)
 AM_CPPFLAGS = \
-	-I$(top_srcdir)/src/gallium/drivers \
+	-I$(top_srcdir)/include \
+	-I$(top_srcdir)/src/gallium/state_trackers/xa \
 	-I$(top_srcdir)/src/gallium/winsys
 
+AM_CFLAGS = \
+	$(GALLIUM_CFLAGS) \
+	$(LIBUDEV_CFLAGS) \
+	$(LIBDRM_CFLAGS)
+
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = xatracker.pc
 
 lib_LTLIBRARIES = libxatracker.la
 
-libxatracker_la_SOURCES = vmw_target.c
-
-libxatracker_la_LDFLAGS = -version-number $(XA_MAJOR):$(XA_MINOR):$(XA_TINY)
+libxatracker_la_SOURCES =
 
 libxatracker_la_LIBADD = \
-	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
+	$(GALLIUM_PIPE_LOADER_LIBS) \
+	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la \
+	$(top_builddir)/src/gallium/winsys/sw/null/libws_null.la \
 	$(top_builddir)/src/gallium/state_trackers/xa/libxatracker.la \
-	$(top_builddir)/src/gallium/winsys/svga/drm/libsvgadrm.la \
-	$(top_builddir)/src/gallium/drivers/svga/libsvga.la \
-	$(top_builddir)/src/gallium/drivers/trace/libtrace.la \
-	$(top_builddir)/src/gallium/drivers/rbug/librbug.la
+	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
+	$(LIBUDEV_LIBS) \
+	$(LIBDRM_LIBS)
 
-nodist_EXTRA_libxatracker_la_SOURCES = dummy.cpp
+libxatracker_la_LDFLAGS = \
+	-no-undefined \
+	-version-number $(XA_MAJOR):$(XA_MINOR):$(XA_TINY)
 
+# FIXME: this shouldn't be needed
 if HAVE_MESA_LLVM
-libxatracker_la_LDFLAGS += $(LLVM_LDFLAGS)
+# Mention a dummy pure C++ file to trigger generation of the $(LINK) variable
+nodist_EXTRA_libxatracker_la_SOURCES = dummy-cpp.cpp
+
 libxatracker_la_LIBADD += $(LLVM_LIBS)
+libxatracker_la_LDFLAGS += $(LLVM_LDFLAGS)
+else
+# Mention a dummy pure C file to trigger generation of the $(LINK) variable
+nodist_EXTRA_libxatracker_la_SOURCES = dummy-c.c
 endif
 
-# Provide compatibility with scripts for the old Mesa build system for
-# a while by putting a link to the driver into /lib of the build tree.
-all-local: libxatracker.la
-	$(MKDIR_P) $(top_builddir)/$(LIB_DIR)/gallium
-	ln -f .libs/libxatracker.so* $(top_builddir)/$(LIB_DIR)/gallium/
+include $(top_srcdir)/install-lib-links.mk
diff --git a/src/gallium/targets/xa-vmwgfx/xatracker.pc.in b/src/gallium/targets/xa/xatracker.pc.in
similarity index 100%
rename from src/gallium/targets/xa-vmwgfx/xatracker.pc.in
rename to src/gallium/targets/xa/xatracker.pc.in




More information about the mesa-commit mailing list