Skip to contentSkip to conversation

enable XA for freedreno

PATCH In review Rob Clark 2 participants 13 messages Feb 10, 2014 – Feb 11, 2014

lore
Share & tools
lore

Rob Clark

author
#0 lore raw

v2 cover enable XA for freedreno

From: Rob Clark <[email protected]>

Original patchset:
http://lists.freedesktop.org/archives/mesa-dev/2014-February/053632.html

v1: original
v2: moves xa target into targets/xa, and fixes various issues spotted
by Emil

Rob Clark (4):
pipe-loader: split out "client" version
st/xa: use pipe-loader to get screen
st/xa: missing handle type
pipe-loader: add pipe loader for freedreno/msm

 configure.ac                                       | 23 ++++++--
 src/gallium/auxiliary/pipe-loader/Makefile.am      | 24 ++++++--
 src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c |  2 +
 src/gallium/state_trackers/xa/Makefile.am          |  1 +
 src/gallium/state_trackers/xa/xa_priv.h            |  1 +
 src/gallium/state_trackers/xa/xa_tracker.c         | 10 +++-
 src/gallium/targets/Makefile.am                    |  8 +--
 src/gallium/targets/gbm/Makefile.am                |  4 +-
 src/gallium/targets/opencl/Makefile.am             |  4 +-
 src/gallium/targets/pipe-loader/Makefile.am        | 16 +++++
 src/gallium/targets/pipe-loader/pipe_msm.c         | 21 +++++++
 src/gallium/targets/xa-vmwgfx/Makefile.am          | 61 -------------------
 src/gallium/targets/xa-vmwgfx/vmw_target.c         | 26 ---------
 src/gallium/targets/xa-vmwgfx/xatracker.pc.in      |  9 ---
 src/gallium/targets/xa/Makefile.am                 | 68 ++++++++++++++++++++++
 src/gallium/targets/xa/xa.c                        | 49 ++++++++++++++++
 src/gallium/targets/xa/xa.h                        | 37 ++++++++++++
 src/gallium/targets/xa/xatracker.pc.in             |  9 +++
 src/gallium/tests/trivial/Makefile.am              |  4 +-
 19 files changed, 260 insertions(+), 117 deletions(-)
 create mode 100644 src/gallium/targets/pipe-loader/pipe_msm.c
 delete mode 100644 src/gallium/targets/xa-vmwgfx/Makefile.am
 delete mode 100644 src/gallium/targets/xa-vmwgfx/vmw_target.c
 delete mode 100644 src/gallium/targets/xa-vmwgfx/xatracker.pc.in
 create mode 100644 src/gallium/targets/xa/Makefile.am
 create mode 100644 src/gallium/targets/xa/xa.c
 create mode 100644 src/gallium/targets/xa/xa.h
 create mode 100644 src/gallium/targets/xa/xatracker.pc.in
Signature · 1 line
1.8.5.3
author
#1 lore raw

PATCH v2 1/4 pipe-loader: split out "client" version

From: Rob Clark <[email protected]>

Build two versions of pipe-loader, with only the client version linking in x11 client side dependencies. This will allow the XA state tracker to use pipe-loader.

---
 configure.ac                                       | 14 +++++++++++--
 src/gallium/auxiliary/pipe-loader/Makefile.am      | 24 ++++++++++++++++++----
 src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c |  2 ++
 src/gallium/targets/gbm/Makefile.am                |  4 ++--
 src/gallium/targets/opencl/Makefile.am             |  4 ++--
 src/gallium/tests/trivial/Makefile.am              |  4 ++--
 6 files changed, 40 insertions(+), 12 deletions(-)
configure.ac +12 -2
index ba158e8..cba6301 100644
@@ -1895,6 +1895,11 @@ AM_CONDITIONAL(NEED_GALLIUM_LLVMPIPE_DRIVER, test "x$HAVE_GALLIUM_I915" = xyes -
                                                   "x$HAVE_GALLIUM_SOFTPIPE" = xyes \
                                                   && test "x$MESA_LLVM" = x1)
 
+# NOTE: anything using xcb or other client side libs ends up in separate
+#       _CLIENT variables.  The pipe loader is built in two variants,
+#       one that is standalone and does not link any x client libs (for
+#       use by XA tracker in particular, but could be used in any case
+#       where communication with xserver is not desired).
 if test "x$enable_gallium_loader" = xyes; then
     GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/null"
 
@@ -1903,13 +1908,18 @@ if test "x$enable_gallium_loader" = xyes; then
         PKG_CHECK_MODULES([GALLIUM_PIPE_LOADER_XCB], [xcb xcb-dri2],
                           pipe_loader_have_xcb=yes, pipe_loader_have_xcb=no)
         if test "x$pipe_loader_have_xcb" = xyes; then
-            GALLIUM_PIPE_LOADER_DEFINES="$GALLIUM_PIPE_LOADER_DEFINES -DHAVE_PIPE_LOADER_XCB"
-            GALLIUM_PIPE_LOADER_LIBS="$GALLIUM_PIPE_LOADER_LIBS $GALLIUM_PIPE_LOADER_XCB_LIBS $LIBDRM_LIBS"
+            GALLIUM_PIPE_LOADER_CLIENT_DEFINES="$GALLIUM_PIPE_LOADER_CLIENT_DEFINES -DHAVE_PIPE_LOADER_XCB"
+            GALLIUM_PIPE_LOADER_CLIENT_LIBS="$GALLIUM_PIPE_LOADER_CLIENT_LIBS $GALLIUM_PIPE_LOADER_XCB_LIBS $LIBDRM_LIBS"
         fi
     fi
 
+    GALLIUM_PIPE_LOADER_CLIENT_DEFINES="$GALLIUM_PIPE_LOADER_CLIENT_DEFINES $GALLIUM_PIPE_LOADER_DEFINES"
+    GALLIUM_PIPE_LOADER_CLIENT_LIBS="$GALLIUM_PIPE_LOADER_CLIENT_LIBS $GALLIUM_PIPE_LOADER_LIBS"
+
     AC_SUBST([GALLIUM_PIPE_LOADER_DEFINES])
     AC_SUBST([GALLIUM_PIPE_LOADER_LIBS])
+    AC_SUBST([GALLIUM_PIPE_LOADER_CLIENT_DEFINES])
+    AC_SUBST([GALLIUM_PIPE_LOADER_CLIENT_LIBS])
 fi
 
 AM_CONDITIONAL(HAVE_I915_DRI, test x$HAVE_I915_DRI = xyes)
src/gallium/auxiliary/pipe-loader/Makefile.am +20 -4
index 8e4d034..72b4798 100644
@@ -1,7 +1,6 @@
 AUTOMAKE_OPTIONS = subdir-objects
 
 AM_CPPFLAGS = $(DEFINES) \
-	$(GALLIUM_PIPE_LOADER_DEFINES) \
 	-I$(top_srcdir)/include \
 	-I$(top_srcdir)/src/loader \
 	-I$(top_srcdir)/src/gallium/include \
@@ -12,8 +11,9 @@ noinst_LTLIBRARIES =
 
 if HAVE_LOADER_GALLIUM
 noinst_LTLIBRARIES += libpipe_loader.la
+noinst_LTLIBRARIES += libpipe_loader_client.la
 
-libpipe_loader_la_SOURCES = \
+COMMON_SOURCES = \
 	pipe_loader.h \
 	pipe_loader_priv.h \
 	pipe_loader.c \
@@ -22,10 +22,26 @@ libpipe_loader_la_SOURCES = \
 if HAVE_DRM_LOADER_GALLIUM
 AM_CFLAGS = $(LIBDRM_CFLAGS)
 
-libpipe_loader_la_SOURCES += pipe_loader_drm.c
+COMMON_SOURCES += pipe_loader_drm.c
 
-libpipe_loader_la_LIBADD = \
+COMMON_LIBADD = \
 	$(top_builddir)/src/loader/libloader.la
 
 endif
+
+libpipe_loader_la_CFLAGS  = \
+	-DSTANDALONE_LOADER \
+	$(GALLIUM_PIPE_LOADER_DEFINES) \
+	$(AM_CFLAGS) $(AM_CPPFLAGS)
+libpipe_loader_la_SOURCES = $(COMMON_SOURCES)
+libpipe_loader_la_LIBADD  = $(COMMON_LIBADD) \
+	$(GALLIUM_PIPE_LOADER_LIBS)
+
+libpipe_loader_client_la_CFLAGS  = \
+	$(GALLIUM_PIPE_LOADER_CLIENT_DEFINES) \
+	$(AM_CFLAGS) $(AM_CPPFLAGS)
+libpipe_loader_client_la_SOURCES = $(COMMON_SOURCES)
+libpipe_loader_client_la_LIBADD  = $(COMMON_LIBADD) \
+	$(GALLIUM_PIPE_LOADER_CLIENT_LIBS)
+
 endif
src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c +2 -0
index 95a4f84..e53e8af 100644
@@ -47,7 +47,9 @@ static struct sw_winsys *(*backends[])() = {
 #ifdef HAVE_WINSYS_XLIB
    x11_sw_create,
 #endif
+#ifndef STANDALONE_LOADER
    null_sw_create
+#endif
 };
 
 int
src/gallium/targets/gbm/Makefile.am +2 -2
index 4299d07..30a3427 100644
@@ -42,8 +42,8 @@ gbm_LTLIBRARIES = gbm_gallium_drm.la
 gbm_gallium_drm_la_SOURCES = gbm.c
 
 gbm_gallium_drm_la_LIBADD = \
-	$(GALLIUM_PIPE_LOADER_LIBS) \
-	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la \
+	$(GALLIUM_PIPE_LOADER_CLIENT_LIBS) \
+	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader_client.la \
 	$(top_builddir)/src/gallium/winsys/sw/null/libws_null.la \
 	$(top_builddir)/src/gallium/state_trackers/gbm/libgbm.la \
 	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
src/gallium/targets/opencl/Makefile.am +2 -2
index 653302c..a75b49c 100644
@@ -7,11 +7,11 @@ lib@OPENCL_LIBNAME@_la_LDFLAGS = \
 	-version-number 1:0
 
 lib@OPENCL_LIBNAME@_la_LIBADD = \
-	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la \
+	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader_client.la \
 	$(top_builddir)/src/gallium/winsys/sw/null/libws_null.la \
 	$(top_builddir)/src/gallium/state_trackers/clover/libclover.la \
 	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
-	$(GALLIUM_PIPE_LOADER_LIBS) $(LIBUDEV_LIBS) \
+	$(GALLIUM_PIPE_LOADER_CLIENT_LIBS) $(LIBUDEV_LIBS) \
 	-ldl \
 	-lclangCodeGen \
 	-lclangFrontendTool \
src/gallium/tests/trivial/Makefile.am +2 -2
index d65eb86..65fa90d 100644
@@ -11,8 +11,8 @@ AM_CPPFLAGS = \
 	-DPIPE_SEARCH_DIR=\"$(PIPE_SRC_DIR)/.libs\" \
 	$(GALLIUM_PIPE_LOADER_DEFINES)
 
-LDADD = $(GALLIUM_PIPE_LOADER_LIBS) \
-	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la \
+LDADD = $(GALLIUM_PIPE_LOADER_CLIENT_LIBS) \
+	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader_client.la \
 	$(top_builddir)/src/gallium/winsys/sw/null/libws_null.la \
 	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
 	$(LIBUDEV_LIBS) \
Signature · 1 line
1.8.5.3
#2 lore raw

Re: [PATCHv2 1/4] pipe-loader: split out "client" version

Quoted 6 lines · Rob Clark

From: Rob Clark <[email protected]>

Build two versions of pipe-loader, with only the client version linking in x11 client side dependencies. This will allow the XA state tracker to use pipe-loader.

Seems like you got me confused here - you're trying to get away from the null_sw_create which is a dummy stub, on the argument of x11 dependencies.

AFAICS both are completely unrelated, and the former should be fixed by adding the following during link stage.

$(top_builddir)/src/gallium/winsys/sw/null/libws_null.la

x11 dependencies should not affect you and are properly resolved by the first 5 (or so) patches in my series.

-Emil

Quoted 162 lines
---
 configure.ac                                       | 14 +++++++++++--
 src/gallium/auxiliary/pipe-loader/Makefile.am      | 24 ++++++++++++++++++----
 src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c |  2 ++
 src/gallium/targets/gbm/Makefile.am                |  4 ++--
 src/gallium/targets/opencl/Makefile.am             |  4 ++--
 src/gallium/tests/trivial/Makefile.am              |  4 ++--
 6 files changed, 40 insertions(+), 12 deletions(-)
configure.ac +12 -2
index ba158e8..cba6301 100644
@@ -1895,6 +1895,11 @@ AM_CONDITIONAL(NEED_GALLIUM_LLVMPIPE_DRIVER, test "x$HAVE_GALLIUM_I915" = xyes -
                                                   "x$HAVE_GALLIUM_SOFTPIPE" = xyes \
                                                   && test "x$MESA_LLVM" = x1)
 
+# NOTE: anything using xcb or other client side libs ends up in separate
+#       _CLIENT variables.  The pipe loader is built in two variants,
+#       one that is standalone and does not link any x client libs (for
+#       use by XA tracker in particular, but could be used in any case
+#       where communication with xserver is not desired).
 if test "x$enable_gallium_loader" = xyes; then
     GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/null"
 
@@ -1903,13 +1908,18 @@ if test "x$enable_gallium_loader" = xyes; then
         PKG_CHECK_MODULES([GALLIUM_PIPE_LOADER_XCB], [xcb xcb-dri2],
                           pipe_loader_have_xcb=yes, pipe_loader_have_xcb=no)
         if test "x$pipe_loader_have_xcb" = xyes; then
-            GALLIUM_PIPE_LOADER_DEFINES="$GALLIUM_PIPE_LOADER_DEFINES -DHAVE_PIPE_LOADER_XCB"
-            GALLIUM_PIPE_LOADER_LIBS="$GALLIUM_PIPE_LOADER_LIBS $GALLIUM_PIPE_LOADER_XCB_LIBS $LIBDRM_LIBS"
+            GALLIUM_PIPE_LOADER_CLIENT_DEFINES="$GALLIUM_PIPE_LOADER_CLIENT_DEFINES -DHAVE_PIPE_LOADER_XCB"
+            GALLIUM_PIPE_LOADER_CLIENT_LIBS="$GALLIUM_PIPE_LOADER_CLIENT_LIBS $GALLIUM_PIPE_LOADER_XCB_LIBS $LIBDRM_LIBS"
         fi
     fi
 
+    GALLIUM_PIPE_LOADER_CLIENT_DEFINES="$GALLIUM_PIPE_LOADER_CLIENT_DEFINES $GALLIUM_PIPE_LOADER_DEFINES"
+    GALLIUM_PIPE_LOADER_CLIENT_LIBS="$GALLIUM_PIPE_LOADER_CLIENT_LIBS $GALLIUM_PIPE_LOADER_LIBS"
+
     AC_SUBST([GALLIUM_PIPE_LOADER_DEFINES])
     AC_SUBST([GALLIUM_PIPE_LOADER_LIBS])
+    AC_SUBST([GALLIUM_PIPE_LOADER_CLIENT_DEFINES])
+    AC_SUBST([GALLIUM_PIPE_LOADER_CLIENT_LIBS])
 fi
 
 AM_CONDITIONAL(HAVE_I915_DRI, test x$HAVE_I915_DRI = xyes)
src/gallium/auxiliary/pipe-loader/Makefile.am +20 -4
index 8e4d034..72b4798 100644
@@ -1,7 +1,6 @@
 AUTOMAKE_OPTIONS = subdir-objects
 
 AM_CPPFLAGS = $(DEFINES) \
-	$(GALLIUM_PIPE_LOADER_DEFINES) \
 	-I$(top_srcdir)/include \
 	-I$(top_srcdir)/src/loader \
 	-I$(top_srcdir)/src/gallium/include \
@@ -12,8 +11,9 @@ noinst_LTLIBRARIES =
 
 if HAVE_LOADER_GALLIUM
 noinst_LTLIBRARIES += libpipe_loader.la
+noinst_LTLIBRARIES += libpipe_loader_client.la
 
-libpipe_loader_la_SOURCES = \
+COMMON_SOURCES = \
 	pipe_loader.h \
 	pipe_loader_priv.h \
 	pipe_loader.c \
@@ -22,10 +22,26 @@ libpipe_loader_la_SOURCES = \
 if HAVE_DRM_LOADER_GALLIUM
 AM_CFLAGS = $(LIBDRM_CFLAGS)
 
-libpipe_loader_la_SOURCES += pipe_loader_drm.c
+COMMON_SOURCES += pipe_loader_drm.c
 
-libpipe_loader_la_LIBADD = \
+COMMON_LIBADD = \
 	$(top_builddir)/src/loader/libloader.la
 
 endif
+
+libpipe_loader_la_CFLAGS  = \
+	-DSTANDALONE_LOADER \
+	$(GALLIUM_PIPE_LOADER_DEFINES) \
+	$(AM_CFLAGS) $(AM_CPPFLAGS)
+libpipe_loader_la_SOURCES = $(COMMON_SOURCES)
+libpipe_loader_la_LIBADD  = $(COMMON_LIBADD) \
+	$(GALLIUM_PIPE_LOADER_LIBS)
+
+libpipe_loader_client_la_CFLAGS  = \
+	$(GALLIUM_PIPE_LOADER_CLIENT_DEFINES) \
+	$(AM_CFLAGS) $(AM_CPPFLAGS)
+libpipe_loader_client_la_SOURCES = $(COMMON_SOURCES)
+libpipe_loader_client_la_LIBADD  = $(COMMON_LIBADD) \
+	$(GALLIUM_PIPE_LOADER_CLIENT_LIBS)
+
 endif
src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c +2 -0
index 95a4f84..e53e8af 100644
@@ -47,7 +47,9 @@ static struct sw_winsys *(*backends[])() = {
 #ifdef HAVE_WINSYS_XLIB
    x11_sw_create,
 #endif
+#ifndef STANDALONE_LOADER
    null_sw_create
+#endif
 };
 
 int
src/gallium/targets/gbm/Makefile.am +2 -2
index 4299d07..30a3427 100644
@@ -42,8 +42,8 @@ gbm_LTLIBRARIES = gbm_gallium_drm.la
 gbm_gallium_drm_la_SOURCES = gbm.c
 
 gbm_gallium_drm_la_LIBADD = \
-	$(GALLIUM_PIPE_LOADER_LIBS) \
-	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la \
+	$(GALLIUM_PIPE_LOADER_CLIENT_LIBS) \
+	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader_client.la \
 	$(top_builddir)/src/gallium/winsys/sw/null/libws_null.la \
 	$(top_builddir)/src/gallium/state_trackers/gbm/libgbm.la \
 	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
src/gallium/targets/opencl/Makefile.am +2 -2
index 653302c..a75b49c 100644
@@ -7,11 +7,11 @@ lib@OPENCL_LIBNAME@_la_LDFLAGS = \
 	-version-number 1:0
 
 lib@OPENCL_LIBNAME@_la_LIBADD = \
-	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la \
+	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader_client.la \
 	$(top_builddir)/src/gallium/winsys/sw/null/libws_null.la \
 	$(top_builddir)/src/gallium/state_trackers/clover/libclover.la \
 	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
-	$(GALLIUM_PIPE_LOADER_LIBS) $(LIBUDEV_LIBS) \
+	$(GALLIUM_PIPE_LOADER_CLIENT_LIBS) $(LIBUDEV_LIBS) \
 	-ldl \
 	-lclangCodeGen \
 	-lclangFrontendTool \
src/gallium/tests/trivial/Makefile.am +2 -2
index d65eb86..65fa90d 100644
@@ -11,8 +11,8 @@ AM_CPPFLAGS = \
 	-DPIPE_SEARCH_DIR=\"$(PIPE_SRC_DIR)/.libs\" \
 	$(GALLIUM_PIPE_LOADER_DEFINES)
 
-LDADD = $(GALLIUM_PIPE_LOADER_LIBS) \
-	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la \
+LDADD = $(GALLIUM_PIPE_LOADER_CLIENT_LIBS) \
+	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader_client.la \
 	$(top_builddir)/src/gallium/winsys/sw/null/libws_null.la \
 	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
 	$(LIBUDEV_LIBS) \
author
#3 lore raw

PATCH v2 2/4 st/xa: use pipe-loader to get screen

In reply to Rob Clark

From: Rob Clark <[email protected]>

This lets multiple gallium drivers use XA.

---
 configure.ac                                  |  9 ++--
 src/gallium/state_trackers/xa/Makefile.am     |  1 +
 src/gallium/state_trackers/xa/xa_priv.h       |  1 +
 src/gallium/state_trackers/xa/xa_tracker.c    |  9 +++-
 src/gallium/targets/Makefile.am               |  8 ++--
 src/gallium/targets/xa-vmwgfx/Makefile.am     | 61 ------------------------
 src/gallium/targets/xa-vmwgfx/vmw_target.c    | 26 ----------
 src/gallium/targets/xa-vmwgfx/xatracker.pc.in |  9 ----
 src/gallium/targets/xa/Makefile.am            | 68 +++++++++++++++++++++++++++
 src/gallium/targets/xa/xa.c                   | 49 +++++++++++++++++++
 src/gallium/targets/xa/xa.h                   | 37 +++++++++++++++
 src/gallium/targets/xa/xatracker.pc.in        |  9 ++++
 12 files changed, 182 insertions(+), 105 deletions(-)
 delete mode 100644 src/gallium/targets/xa-vmwgfx/Makefile.am
 delete mode 100644 src/gallium/targets/xa-vmwgfx/vmw_target.c
 delete mode 100644 src/gallium/targets/xa-vmwgfx/xatracker.pc.in
 create mode 100644 src/gallium/targets/xa/Makefile.am
 create mode 100644 src/gallium/targets/xa/xa.c
 create mode 100644 src/gallium/targets/xa/xa.h
 create mode 100644 src/gallium/targets/xa/xatracker.pc.in
configure.ac +5 -4
index cba6301..29ca954 100644
@@ -1270,6 +1270,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)
 
@@ -1743,7 +1744,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
@@ -1962,7 +1963,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")
 
@@ -2035,6 +2036,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
@@ -2046,8 +2049,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
src/gallium/state_trackers/xa/Makefile.am +1 -0
index 7d0b366..af79ccd 100644
@@ -29,6 +29,7 @@ AM_CFLAGS = \
 	$(VISIBILITY_CFLAGS)
 
 AM_CPPFLAGS = \
+	-I$(top_srcdir)/src/gallium/targets/xa \
 	-I$(top_srcdir)/src/gallium/ \
 	-I$(top_srcdir)/src/gallium/winsys \
 	-I$(top_srcdir)/src/gallium/drivers
src/gallium/state_trackers/xa/xa_priv.h +1 -0
index ee182e7..b99c214 100644
@@ -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;
 };
src/gallium/state_trackers/xa/xa_tracker.c +8 -1
index cda6501..6943a29 100644
@@ -28,8 +28,10 @@
 
 #include "xa_tracker.h"
 #include "xa_priv.h"
+#include "xa.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 +145,9 @@ xa_tracker_create(int drm_fd)
     if (!xa)
 	return NULL;
 
-    xa->screen = driver_descriptor.create_screen(drm_fd);
+    xa->dev = xa_pipe_probe(drm_fd);
+    if (xa->dev)
+	xa->screen = xa_pipe_create_screen(xa->dev);
     if (!xa->screen)
 	goto out_no_screen;
 
@@ -190,6 +194,8 @@ xa_tracker_create(int drm_fd)
  out_no_pipe:
     xa->screen->destroy(xa->screen);
  out_no_screen:
+    if (xa->dev)
+	xa_pipe_release(xa->dev);
     free(xa);
     return NULL;
 }
@@ -200,6 +206,7 @@ xa_tracker_destroy(struct xa_tracker *xa)
     free(xa->supported_formats);
     xa_context_destroy(xa->default_ctx);
     xa->screen->destroy(xa->screen);
+    xa_pipe_release(xa->dev);
     free(xa);
 }
 
src/gallium/targets/Makefile.am +4 -4
index e356020..a7c70f4 100644
@@ -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
src/gallium/targets/xa-vmwgfx/Makefile.am deleted +0 -61

61 lines not on this page · raw message

src/gallium/targets/xa-vmwgfx/vmw_target.c deleted +0 -26
deleted file mode 100644
index 1087801..0000000
@@ -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)
src/gallium/targets/xa-vmwgfx/xatracker.pc.in deleted +0 -9
deleted file mode 100644
index c99d8d6..0000000
@@ -1,9 +0,0 @@
-prefix=@prefix@
-exec_prefix=${prefix}
-libdir=@libdir@
-includedir=@includedir@
-
-Name: xatracker
-Description: Xorg Gallium3D acceleration library
-Version: @XA_VERSION@
-Libs: -L${libdir} -lxatracker
src/gallium/targets/xa/Makefile.am new file +68 -0

68 lines not on this page · raw message

src/gallium/targets/xa/xa.c new file +49 -0

49 lines not on this page · raw message

src/gallium/targets/xa/xa.h new file +37 -0
new file mode 100644
index 0000000..9de6851
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 Red Hat
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Authors:
+ *    Rob Clark <[email protected]>
+ */
+
+#ifndef _XA_H_
+#define _XA_H_
+
+#include "pipe/p_screen.h"
+#include "pipe-loader/pipe_loader.h"
+
+struct pipe_loader_device *xa_pipe_probe(int fd);
+void xa_pipe_release(struct pipe_loader_device *dev);
+struct pipe_screen * xa_pipe_create_screen(struct pipe_loader_device *dev);
+
+#endif /* _XA_H_ */
src/gallium/targets/xa/xatracker.pc.in new file +9 -0
new file mode 100644
index 0000000..c99d8d6
@@ -0,0 +1,9 @@
+prefix=@prefix@
+exec_prefix=${prefix}
+libdir=@libdir@
+includedir=@includedir@
+
+Name: xatracker
+Description: Xorg Gallium3D acceleration library
+Version: @XA_VERSION@
+Libs: -L${libdir} -lxatracker
Signature · 6 lines
1.8.5.3

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw

Re: [PATCHv2 2/4] st/xa: use pipe-loader to get screen

Quoted 4 lines · Rob Clark

From: Rob Clark <[email protected]>

This lets multiple gallium drivers use XA.

Hi Rob,

Seems like I should have explained a bit better.

There is no need to have sourcefiles in order to have a specific target. All you needed was to link the state-tracker, mesagallium, gallium(aux library), pipe-loader and a few winsys' to wrap up the library.

The opencl target + my vdpau/dri patches are a decent example of what I had in mind.

Sorry for the confusion
-Emil

Quoted 457 lines
---
 configure.ac                                  |  9 ++--
 src/gallium/state_trackers/xa/Makefile.am     |  1 +
 src/gallium/state_trackers/xa/xa_priv.h       |  1 +
 src/gallium/state_trackers/xa/xa_tracker.c    |  9 +++-
 src/gallium/targets/Makefile.am               |  8 ++--
 src/gallium/targets/xa-vmwgfx/Makefile.am     | 61 ------------------------
 src/gallium/targets/xa-vmwgfx/vmw_target.c    | 26 ----------
 src/gallium/targets/xa-vmwgfx/xatracker.pc.in |  9 ----
 src/gallium/targets/xa/Makefile.am            | 68 +++++++++++++++++++++++++++
 src/gallium/targets/xa/xa.c                   | 49 +++++++++++++++++++
 src/gallium/targets/xa/xa.h                   | 37 +++++++++++++++
 src/gallium/targets/xa/xatracker.pc.in        |  9 ++++
 12 files changed, 182 insertions(+), 105 deletions(-)
 delete mode 100644 src/gallium/targets/xa-vmwgfx/Makefile.am
 delete mode 100644 src/gallium/targets/xa-vmwgfx/vmw_target.c
 delete mode 100644 src/gallium/targets/xa-vmwgfx/xatracker.pc.in
 create mode 100644 src/gallium/targets/xa/Makefile.am
 create mode 100644 src/gallium/targets/xa/xa.c
 create mode 100644 src/gallium/targets/xa/xa.h
 create mode 100644 src/gallium/targets/xa/xatracker.pc.in
configure.ac +5 -4
index cba6301..29ca954 100644
@@ -1270,6 +1270,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)
 
@@ -1743,7 +1744,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
@@ -1962,7 +1963,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")
 
@@ -2035,6 +2036,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
@@ -2046,8 +2049,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
src/gallium/state_trackers/xa/Makefile.am +1 -0
index 7d0b366..af79ccd 100644
@@ -29,6 +29,7 @@ AM_CFLAGS = \
 	$(VISIBILITY_CFLAGS)
 
 AM_CPPFLAGS = \
+	-I$(top_srcdir)/src/gallium/targets/xa \
 	-I$(top_srcdir)/src/gallium/ \
 	-I$(top_srcdir)/src/gallium/winsys \
 	-I$(top_srcdir)/src/gallium/drivers
src/gallium/state_trackers/xa/xa_priv.h +1 -0
index ee182e7..b99c214 100644
@@ -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;
 };
src/gallium/state_trackers/xa/xa_tracker.c +8 -1
index cda6501..6943a29 100644
@@ -28,8 +28,10 @@
 
 #include "xa_tracker.h"
 #include "xa_priv.h"
+#include "xa.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 +145,9 @@ xa_tracker_create(int drm_fd)
     if (!xa)
 	return NULL;
 
-    xa->screen = driver_descriptor.create_screen(drm_fd);
+    xa->dev = xa_pipe_probe(drm_fd);
+    if (xa->dev)
+	xa->screen = xa_pipe_create_screen(xa->dev);
     if (!xa->screen)
 	goto out_no_screen;
 
@@ -190,6 +194,8 @@ xa_tracker_create(int drm_fd)
  out_no_pipe:
     xa->screen->destroy(xa->screen);
  out_no_screen:
+    if (xa->dev)
+	xa_pipe_release(xa->dev);
     free(xa);
     return NULL;
 }
@@ -200,6 +206,7 @@ xa_tracker_destroy(struct xa_tracker *xa)
     free(xa->supported_formats);
     xa_context_destroy(xa->default_ctx);
     xa->screen->destroy(xa->screen);
+    xa_pipe_release(xa->dev);
     free(xa);
 }
 
src/gallium/targets/Makefile.am +4 -4
index e356020..a7c70f4 100644
@@ -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
src/gallium/targets/xa-vmwgfx/Makefile.am deleted +0 -61
deleted file mode 100644
index 6fe0510..0000000
@@ -1,61 +0,0 @@
-# Copyright © 2012 Intel Corporation
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice (including the next
-# paragraph) shall be included in all copies or substantial portions of the
-# Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-# DEALINGS IN THE SOFTWARE.
-
-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)/src/gallium/winsys
-
-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_LIBADD = \
-	$(top_builddir)/src/gallium/auxiliary/libgallium.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
-
-nodist_EXTRA_libxatracker_la_SOURCES = dummy.cpp
-
-if HAVE_MESA_LLVM
-libxatracker_la_LDFLAGS += $(LLVM_LDFLAGS)
-libxatracker_la_LIBADD += $(LLVM_LIBS)
-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/
src/gallium/targets/xa-vmwgfx/vmw_target.c deleted +0 -26
deleted file mode 100644
index 1087801..0000000
@@ -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)
src/gallium/targets/xa-vmwgfx/xatracker.pc.in deleted +0 -9
deleted file mode 100644
index c99d8d6..0000000
@@ -1,9 +0,0 @@
-prefix=@prefix@
-exec_prefix=${prefix}
-libdir=@libdir@
-includedir=@includedir@
-
-Name: xatracker
-Description: Xorg Gallium3D acceleration library
-Version: @XA_VERSION@
-Libs: -L${libdir} -lxatracker
src/gallium/targets/xa/Makefile.am new file +68 -0
new file mode 100644
index 0000000..dddb05c
@@ -0,0 +1,68 @@
+# Copyright © 2012 Intel Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+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 \
+	$(GALLIUM_PIPE_LOADER_DEFINES) \
+	-DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\"
+
+AM_CFLAGS = \
+	$(GALLIUM_CFLAGS) \
+	$(LIBUDEV_CFLAGS) \
+	$(LIBDRM_CFLAGS)
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = xatracker.pc
+
+lib_LTLIBRARIES = libxatracker.la
+
+libxatracker_la_SOURCES = xa.c
+
+libxatracker_la_LIBADD = \
+	$(GALLIUM_PIPE_LOADER_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 \
+	$(LIBUDEV_LIBS) \
+	$(LIBDRM_LIBS)
+
+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_LINK = $(CXXLINK) $(libxatracker_la_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
+libxatracker_la_LINK = $(CXXLINK) $(libxatracker_la_LDFLAGS)
+# Mention a dummy pure C file to trigger generation of the $(LINK) variable
+nodist_EXTRA_libxatracker_la_SOURCES = dummy-c.c
+endif
src/gallium/targets/xa/xa.c new file +49 -0
new file mode 100644
index 0000000..e3ceaf6
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2014 Red Hat
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Authors:
+ *    Rob Clark <[email protected]>
+ */
+
+#include "xa.h"
+
+struct pipe_loader_device *
+xa_pipe_probe(int fd)
+{
+    struct pipe_loader_device *dev;
+    if (pipe_loader_drm_probe_fd(&dev, fd))
+	return dev;
+    return NULL;
+}
+
+void
+xa_pipe_release(struct pipe_loader_device *dev)
+{
+    if (dev)
+	pipe_loader_release(&dev, 1);
+}
+
+struct pipe_screen *
+xa_pipe_create_screen(struct pipe_loader_device *dev)
+{
+    return pipe_loader_create_screen(dev, PIPE_SEARCH_DIR);
+}
src/gallium/targets/xa/xa.h new file +37 -0
new file mode 100644
index 0000000..9de6851
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 Red Hat
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Authors:
+ *    Rob Clark <[email protected]>
+ */
+
+#ifndef _XA_H_
+#define _XA_H_
+
+#include "pipe/p_screen.h"
+#include "pipe-loader/pipe_loader.h"
+
+struct pipe_loader_device *xa_pipe_probe(int fd);
+void xa_pipe_release(struct pipe_loader_device *dev);
+struct pipe_screen * xa_pipe_create_screen(struct pipe_loader_device *dev);
+
+#endif /* _XA_H_ */
src/gallium/targets/xa/xatracker.pc.in new file +0 -0
new file mode 100644
index 0000000..c99d8d6

src/gallium/targets/xa/xatracker.pc.in line 9

Quoted 9 lines
src/gallium/targets/xa/xatracker.pc.in new file +9 -0
@@ -0,0 +1,9 @@
+prefix=@prefix@
+exec_prefix=${prefix}
+libdir=@libdir@
+includedir=@includedir@
+
+Name: xatracker
+Description: Xorg Gallium3D acceleration library
+Version: @XA_VERSION@
+Libs: -L${libdir} -lxatracker

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

author
#5 lore raw

Re: [PATCHv2 2/4] st/xa: use pipe-loader to get screen

Quoted 7 lines · Emil Velikov
Quoted 4 lines · Rob Clark

From: Rob Clark <[email protected]>

This lets multiple gallium drivers use XA.

Hi Rob,

Quoted 8 lines

Seems like I should have explained a bit better.

There is no need to have sourcefiles in order to have a specific target. All you needed was to link the state-tracker, mesagallium, gallium(aux library), pipe-loader and a few winsys' to wrap up the library.

The opencl target + my vdpau/dri patches are a decent example of what I had in mind.

yeah, the only reason for the wrappers in target/xa was to keep -DPIPE_SEARCH_DIR=.. and GALLIUM_PIPE_LOADER_LIBS in targets vs state_trackers.. if you don't care about that, then we can do it with no src files as with opencl.

BR,
-R

Quoted 470 lines

Sorry for the confusion
-Emil

Quoted 466 lines
---
 configure.ac                                  |  9 ++--
 src/gallium/state_trackers/xa/Makefile.am     |  1 +
 src/gallium/state_trackers/xa/xa_priv.h       |  1 +
 src/gallium/state_trackers/xa/xa_tracker.c    |  9 +++-
 src/gallium/targets/Makefile.am               |  8 ++--
 src/gallium/targets/xa-vmwgfx/Makefile.am     | 61 ------------------------
 src/gallium/targets/xa-vmwgfx/vmw_target.c    | 26 ----------
 src/gallium/targets/xa-vmwgfx/xatracker.pc.in |  9 ----
 src/gallium/targets/xa/Makefile.am            | 68 +++++++++++++++++++++++++++
 src/gallium/targets/xa/xa.c                   | 49 +++++++++++++++++++
 src/gallium/targets/xa/xa.h                   | 37 +++++++++++++++
 src/gallium/targets/xa/xatracker.pc.in        |  9 ++++
 12 files changed, 182 insertions(+), 105 deletions(-)
 delete mode 100644 src/gallium/targets/xa-vmwgfx/Makefile.am
 delete mode 100644 src/gallium/targets/xa-vmwgfx/vmw_target.c
 delete mode 100644 src/gallium/targets/xa-vmwgfx/xatracker.pc.in
 create mode 100644 src/gallium/targets/xa/Makefile.am
 create mode 100644 src/gallium/targets/xa/xa.c
 create mode 100644 src/gallium/targets/xa/xa.h
 create mode 100644 src/gallium/targets/xa/xatracker.pc.in
configure.ac +5 -4
index cba6301..29ca954 100644
@@ -1270,6 +1270,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)
 
@@ -1743,7 +1744,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
@@ -1962,7 +1963,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")
 
@@ -2035,6 +2036,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
@@ -2046,8 +2049,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
src/gallium/state_trackers/xa/Makefile.am +1 -0
index 7d0b366..af79ccd 100644
@@ -29,6 +29,7 @@ AM_CFLAGS = \
      $(VISIBILITY_CFLAGS)
 
 AM_CPPFLAGS = \
+     -I$(top_srcdir)/src/gallium/targets/xa \
      -I$(top_srcdir)/src/gallium/ \
      -I$(top_srcdir)/src/gallium/winsys \
      -I$(top_srcdir)/src/gallium/drivers
src/gallium/state_trackers/xa/xa_priv.h +1 -0
index ee182e7..b99c214 100644
@@ -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;
 };
src/gallium/state_trackers/xa/xa_tracker.c +8 -1
index cda6501..6943a29 100644
@@ -28,8 +28,10 @@
 
 #include "xa_tracker.h"
 #include "xa_priv.h"
+#include "xa.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 +145,9 @@ xa_tracker_create(int drm_fd)
     if (!xa)
      return NULL;
 
-    xa->screen = driver_descriptor.create_screen(drm_fd);
+    xa->dev = xa_pipe_probe(drm_fd);
+    if (xa->dev)
+     xa->screen = xa_pipe_create_screen(xa->dev);
     if (!xa->screen)
      goto out_no_screen;
 
@@ -190,6 +194,8 @@ xa_tracker_create(int drm_fd)
  out_no_pipe:
     xa->screen->destroy(xa->screen);
  out_no_screen:
+    if (xa->dev)
+     xa_pipe_release(xa->dev);
     free(xa);
     return NULL;
 }
@@ -200,6 +206,7 @@ xa_tracker_destroy(struct xa_tracker *xa)
     free(xa->supported_formats);
     xa_context_destroy(xa->default_ctx);
     xa->screen->destroy(xa->screen);
+    xa_pipe_release(xa->dev);
     free(xa);
 }
 
src/gallium/targets/Makefile.am +4 -4
index e356020..a7c70f4 100644
@@ -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
src/gallium/targets/xa-vmwgfx/Makefile.am deleted +0 -61
deleted file mode 100644
index 6fe0510..0000000
@@ -1,61 +0,0 @@
-# Copyright © 2012 Intel Corporation
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice (including the next
-# paragraph) shall be included in all copies or substantial portions of the
-# Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-# DEALINGS IN THE SOFTWARE.
-
-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)/src/gallium/winsys
-
-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_LIBADD = \
-     $(top_builddir)/src/gallium/auxiliary/libgallium.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
-
-nodist_EXTRA_libxatracker_la_SOURCES = dummy.cpp
-
-if HAVE_MESA_LLVM
-libxatracker_la_LDFLAGS += $(LLVM_LDFLAGS)
-libxatracker_la_LIBADD += $(LLVM_LIBS)
-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/
src/gallium/targets/xa-vmwgfx/vmw_target.c deleted +0 -26
deleted file mode 100644
index 1087801..0000000
@@ -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)
src/gallium/targets/xa-vmwgfx/xatracker.pc.in deleted +0 -9
deleted file mode 100644
index c99d8d6..0000000
@@ -1,9 +0,0 @@
-prefix=@prefix@
-exec_prefix=${prefix}
-libdir=@libdir@
-includedir=@includedir@
-
-Name: xatracker
-Description: Xorg Gallium3D acceleration library
-Version: @XA_VERSION@
-Libs: -L${libdir} -lxatracker
src/gallium/targets/xa/Makefile.am new file +68 -0
new file mode 100644
index 0000000..dddb05c
@@ -0,0 +1,68 @@
+# Copyright © 2012 Intel Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+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 \
+     $(GALLIUM_PIPE_LOADER_DEFINES) \
+     -DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\"
+
+AM_CFLAGS = \
+     $(GALLIUM_CFLAGS) \
+     $(LIBUDEV_CFLAGS) \
+     $(LIBDRM_CFLAGS)
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = xatracker.pc
+
+lib_LTLIBRARIES = libxatracker.la
+
+libxatracker_la_SOURCES = xa.c
+
+libxatracker_la_LIBADD = \
+     $(GALLIUM_PIPE_LOADER_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 \
+     $(LIBUDEV_LIBS) \
+     $(LIBDRM_LIBS)
+
+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_LINK = $(CXXLINK) $(libxatracker_la_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
+libxatracker_la_LINK = $(CXXLINK) $(libxatracker_la_LDFLAGS)
+# Mention a dummy pure C file to trigger generation of the $(LINK) variable
+nodist_EXTRA_libxatracker_la_SOURCES = dummy-c.c
+endif
src/gallium/targets/xa/xa.c new file +49 -0
new file mode 100644
index 0000000..e3ceaf6
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2014 Red Hat
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Authors:
+ *    Rob Clark <[email protected]>
+ */
+
+#include "xa.h"
+
+struct pipe_loader_device *
+xa_pipe_probe(int fd)
+{
+    struct pipe_loader_device *dev;
+    if (pipe_loader_drm_probe_fd(&dev, fd))
+     return dev;
+    return NULL;
+}
+
+void
+xa_pipe_release(struct pipe_loader_device *dev)
+{
+    if (dev)
+     pipe_loader_release(&dev, 1);
+}
+
+struct pipe_screen *
+xa_pipe_create_screen(struct pipe_loader_device *dev)
+{
+    return pipe_loader_create_screen(dev, PIPE_SEARCH_DIR);
+}
src/gallium/targets/xa/xa.h new file +37 -0
new file mode 100644
index 0000000..9de6851
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 Red Hat
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Authors:
+ *    Rob Clark <[email protected]>
+ */
+
+#ifndef _XA_H_
+#define _XA_H_
+
+#include "pipe/p_screen.h"
+#include "pipe-loader/pipe_loader.h"
+
+struct pipe_loader_device *xa_pipe_probe(int fd);
+void xa_pipe_release(struct pipe_loader_device *dev);
+struct pipe_screen * xa_pipe_create_screen(struct pipe_loader_device *dev);
+
+#endif /* _XA_H_ */
src/gallium/targets/xa/xatracker.pc.in new file +9 -0
new file mode 100644
index 0000000..c99d8d6
@@ -0,0 +1,9 @@
+prefix=@prefix@
+exec_prefix=${prefix}
+libdir=@libdir@
+includedir=@includedir@
+
+Name: xatracker
+Description: Xorg Gallium3D acceleration library
+Version: @XA_VERSION@
+Libs: -L${libdir} -lxatracker
#6 lore raw

Re: [PATCHv2 2/4] st/xa: use pipe-loader to get screen

Quoted 14 lines · Rob Clark
Quoted 13 lines · Emil Velikov
Quoted 4 lines · Rob Clark

From: Rob Clark <[email protected]>

This lets multiple gallium drivers use XA.

Hi Rob,

Seems like I should have explained a bit better.

There is no need to have sourcefiles in order to have a specific target. All you needed was to link the state-tracker, mesagallium, gallium(aux library), pipe-loader and a few winsys' to wrap up the library.

Quoted 8 lines
Quoted 2 lines

The opencl target + my vdpau/dri patches are a decent example of what I had in mind.

yeah, the only reason for the wrappers in target/xa was to keep -DPIPE_SEARCH_DIR=.. and GALLIUM_PIPE_LOADER_LIBS in targets vs state_trackers.. if you don't care about that, then we can do it with no src files as with opencl.

In my humble understanding the relationship between state-trackers and targets should be one way. Targets should expose the st functionality rather than imposing new one back to the st.
One can build several variations of one st from the by flexing the aux module to their liking.

Pardon for the preach
-Emil

Quoted 473 lines

BR,
-R

Quoted 470 lines

Sorry for the confusion
-Emil

Quoted 466 lines
---
 configure.ac                                  |  9 ++--
 src/gallium/state_trackers/xa/Makefile.am     |  1 +
 src/gallium/state_trackers/xa/xa_priv.h       |  1 +
 src/gallium/state_trackers/xa/xa_tracker.c    |  9 +++-
 src/gallium/targets/Makefile.am               |  8 ++--
 src/gallium/targets/xa-vmwgfx/Makefile.am     | 61 ------------------------
 src/gallium/targets/xa-vmwgfx/vmw_target.c    | 26 ----------
 src/gallium/targets/xa-vmwgfx/xatracker.pc.in |  9 ----
 src/gallium/targets/xa/Makefile.am            | 68 +++++++++++++++++++++++++++
 src/gallium/targets/xa/xa.c                   | 49 +++++++++++++++++++
 src/gallium/targets/xa/xa.h                   | 37 +++++++++++++++
 src/gallium/targets/xa/xatracker.pc.in        |  9 ++++
 12 files changed, 182 insertions(+), 105 deletions(-)
 delete mode 100644 src/gallium/targets/xa-vmwgfx/Makefile.am
 delete mode 100644 src/gallium/targets/xa-vmwgfx/vmw_target.c
 delete mode 100644 src/gallium/targets/xa-vmwgfx/xatracker.pc.in
 create mode 100644 src/gallium/targets/xa/Makefile.am
 create mode 100644 src/gallium/targets/xa/xa.c
 create mode 100644 src/gallium/targets/xa/xa.h
 create mode 100644 src/gallium/targets/xa/xatracker.pc.in
configure.ac +5 -4
index cba6301..29ca954 100644
@@ -1270,6 +1270,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)
 
@@ -1743,7 +1744,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
@@ -1962,7 +1963,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")
 
@@ -2035,6 +2036,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
@@ -2046,8 +2049,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
src/gallium/state_trackers/xa/Makefile.am +1 -0
index 7d0b366..af79ccd 100644
@@ -29,6 +29,7 @@ AM_CFLAGS = \
      $(VISIBILITY_CFLAGS)
 
 AM_CPPFLAGS = \
+     -I$(top_srcdir)/src/gallium/targets/xa \
      -I$(top_srcdir)/src/gallium/ \
      -I$(top_srcdir)/src/gallium/winsys \
      -I$(top_srcdir)/src/gallium/drivers
src/gallium/state_trackers/xa/xa_priv.h +1 -0
index ee182e7..b99c214 100644
@@ -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;
 };
src/gallium/state_trackers/xa/xa_tracker.c +8 -1
index cda6501..6943a29 100644
@@ -28,8 +28,10 @@
 
 #include "xa_tracker.h"
 #include "xa_priv.h"
+#include "xa.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 +145,9 @@ xa_tracker_create(int drm_fd)
     if (!xa)
      return NULL;
 
-    xa->screen = driver_descriptor.create_screen(drm_fd);
+    xa->dev = xa_pipe_probe(drm_fd);
+    if (xa->dev)
+     xa->screen = xa_pipe_create_screen(xa->dev);
     if (!xa->screen)
      goto out_no_screen;
 
@@ -190,6 +194,8 @@ xa_tracker_create(int drm_fd)
  out_no_pipe:
     xa->screen->destroy(xa->screen);
  out_no_screen:
+    if (xa->dev)
+     xa_pipe_release(xa->dev);
     free(xa);
     return NULL;
 }
@@ -200,6 +206,7 @@ xa_tracker_destroy(struct xa_tracker *xa)
     free(xa->supported_formats);
     xa_context_destroy(xa->default_ctx);
     xa->screen->destroy(xa->screen);
+    xa_pipe_release(xa->dev);
     free(xa);
 }
 
src/gallium/targets/Makefile.am +4 -4
index e356020..a7c70f4 100644
@@ -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
src/gallium/targets/xa-vmwgfx/Makefile.am deleted +0 -61
deleted file mode 100644
index 6fe0510..0000000
@@ -1,61 +0,0 @@
-# Copyright © 2012 Intel Corporation
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice (including the next
-# paragraph) shall be included in all copies or substantial portions of the
-# Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-# DEALINGS IN THE SOFTWARE.
-
-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)/src/gallium/winsys
-
-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_LIBADD = \
-     $(top_builddir)/src/gallium/auxiliary/libgallium.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
-
-nodist_EXTRA_libxatracker_la_SOURCES = dummy.cpp
-
-if HAVE_MESA_LLVM
-libxatracker_la_LDFLAGS += $(LLVM_LDFLAGS)
-libxatracker_la_LIBADD += $(LLVM_LIBS)
-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/
src/gallium/targets/xa-vmwgfx/vmw_target.c deleted +0 -26
deleted file mode 100644
index 1087801..0000000
@@ -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)
src/gallium/targets/xa-vmwgfx/xatracker.pc.in deleted +0 -9
deleted file mode 100644
index c99d8d6..0000000
@@ -1,9 +0,0 @@
-prefix=@prefix@
-exec_prefix=${prefix}
-libdir=@libdir@
-includedir=@includedir@
-
-Name: xatracker
-Description: Xorg Gallium3D acceleration library
-Version: @XA_VERSION@
-Libs: -L${libdir} -lxatracker
src/gallium/targets/xa/Makefile.am new file +68 -0
new file mode 100644
index 0000000..dddb05c
@@ -0,0 +1,68 @@
+# Copyright © 2012 Intel Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+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 \
+     $(GALLIUM_PIPE_LOADER_DEFINES) \
+     -DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\"
+
+AM_CFLAGS = \
+     $(GALLIUM_CFLAGS) \
+     $(LIBUDEV_CFLAGS) \
+     $(LIBDRM_CFLAGS)
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = xatracker.pc
+
+lib_LTLIBRARIES = libxatracker.la
+
+libxatracker_la_SOURCES = xa.c
+
+libxatracker_la_LIBADD = \
+     $(GALLIUM_PIPE_LOADER_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 \
+     $(LIBUDEV_LIBS) \
+     $(LIBDRM_LIBS)
+
+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_LINK = $(CXXLINK) $(libxatracker_la_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
+libxatracker_la_LINK = $(CXXLINK) $(libxatracker_la_LDFLAGS)
+# Mention a dummy pure C file to trigger generation of the $(LINK) variable
+nodist_EXTRA_libxatracker_la_SOURCES = dummy-c.c
+endif
src/gallium/targets/xa/xa.c new file +49 -0
new file mode 100644
index 0000000..e3ceaf6
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2014 Red Hat
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Authors:
+ *    Rob Clark <[email protected]>
+ */
+
+#include "xa.h"
+
+struct pipe_loader_device *
+xa_pipe_probe(int fd)
+{
+    struct pipe_loader_device *dev;
+    if (pipe_loader_drm_probe_fd(&dev, fd))
+     return dev;
+    return NULL;
+}
+
+void
+xa_pipe_release(struct pipe_loader_device *dev)
+{
+    if (dev)
+     pipe_loader_release(&dev, 1);
+}
+
+struct pipe_screen *
+xa_pipe_create_screen(struct pipe_loader_device *dev)
+{
+    return pipe_loader_create_screen(dev, PIPE_SEARCH_DIR);
+}
src/gallium/targets/xa/xa.h new file +37 -0
new file mode 100644
index 0000000..9de6851
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 Red Hat
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Authors:
+ *    Rob Clark <[email protected]>
+ */
+
+#ifndef _XA_H_
+#define _XA_H_
+
+#include "pipe/p_screen.h"
+#include "pipe-loader/pipe_loader.h"
+
+struct pipe_loader_device *xa_pipe_probe(int fd);
+void xa_pipe_release(struct pipe_loader_device *dev);
+struct pipe_screen * xa_pipe_create_screen(struct pipe_loader_device *dev);
+
+#endif /* _XA_H_ */
src/gallium/targets/xa/xatracker.pc.in new file +9 -0
new file mode 100644
index 0000000..c99d8d6
@@ -0,0 +1,9 @@
+prefix=@prefix@
+exec_prefix=${prefix}
+libdir=@libdir@
+includedir=@includedir@
+
+Name: xatracker
+Description: Xorg Gallium3D acceleration library
+Version: @XA_VERSION@
+Libs: -L${libdir} -lxatracker
author
#7 lore raw

Re: [PATCHv2 2/4] st/xa: use pipe-loader to get screen

Quoted 23 lines · Emil Velikov
Quoted 14 lines · Rob Clark
Quoted 13 lines · Emil Velikov
Quoted 4 lines · Rob Clark

From: Rob Clark <[email protected]>

This lets multiple gallium drivers use XA.

Hi Rob,

Seems like I should have explained a bit better.

There is no need to have sourcefiles in order to have a specific target. All you needed was to link the state-tracker, mesagallium, gallium(aux library), pipe-loader and a few winsys' to wrap up the library.

Quoted 8 lines
Quoted 2 lines

The opencl target + my vdpau/dri patches are a decent example of what I had in mind.

yeah, the only reason for the wrappers in target/xa was to keep -DPIPE_SEARCH_DIR=.. and GALLIUM_PIPE_LOADER_LIBS in targets vs state_trackers.. if you don't care about that, then we can do it with no src files as with opencl.

Quoted 5 lines

In my humble understanding the relationship between state-trackers and targets should be one way. Targets should expose the st functionality rather than imposing new one back to the st.
One can build several variations of one st from the by flexing the aux module to their liking.

hmm, well this is the case currently with this patch, if I understand you properly. A different target could provide it's own loader by implementing it's own version of xa_pipe_probe(), etc. I suppose if someone wanted to, this could be used for static xatracker targets (ie. libxatracer-vmwgfx.so). Without any src files in the target, you could not do this. But perhaps in this case, where the xa.h lives is not correct.

It could be that I am missing your point.. ;-)

BR,
-R

Quoted 8 lines

Pardon for the preach
-Emil

Quoted 5 lines

BR,
-R

Quoted 2 lines

Sorry for the confusion
-Emil

author
#8 lore raw

PATCH v2 3/4 st/xa: missing handle type

In reply to Rob Clark

From: Rob Clark <[email protected]>

DRM_API_HANDLE_TYPE_SHARED is zero, so doesn't actually fix anything. But we shouldn't rely on SHARED handle type being zero.

---
 src/gallium/state_trackers/xa/xa_tracker.c | 1 +
 1 file changed, 1 insertion(+)
src/gallium/state_trackers/xa/xa_tracker.c +1 -0
index 6943a29..01db945 100644
@@ -370,6 +370,7 @@ xa_surface_from_handle(struct xa_tracker *xa,
 {
     struct winsys_handle whandle;
     memset(&whandle, 0, sizeof(whandle));
+    whandle.type = DRM_API_HANDLE_TYPE_SHARED;
     whandle.handle = handle;
     whandle.stride = stride;
     return surface_create(xa, width, height, depth, stype, xa_format, flags, &whandle);
Signature · 1 line
1.8.5.3
author
#9 lore raw

PATCH v2 4/4 pipe-loader: add pipe loader for freedreno/msm

In reply to Rob Clark

From: Rob Clark <[email protected]>

---
 src/gallium/targets/pipe-loader/Makefile.am | 16 ++++++++++++++++
 src/gallium/targets/pipe-loader/pipe_msm.c  | 21 +++++++++++++++++++++
 2 files changed, 37 insertions(+)
 create mode 100644 src/gallium/targets/pipe-loader/pipe_msm.c
src/gallium/targets/pipe-loader/Makefile.am +16 -0
index 97733c1..8a0f254 100644
@@ -132,6 +132,22 @@ pipe_radeonsi_la_LDFLAGS += $(LLVM_LDFLAGS)
 endif
 endif
 
+if HAVE_GALLIUM_FREEDRENO
+pipe_LTLIBRARIES += pipe_msm.la
+pipe_msm_la_SOURCES = pipe_msm.c
+nodist_EXTRA_pipe_msm_la_SOURCES = dummy.cpp
+pipe_msm_la_LIBADD = \
+	$(PIPE_LIBS) \
+	$(top_builddir)/src/gallium/winsys/freedreno/drm/libfreedrenodrm.la \
+	$(top_builddir)/src/gallium/drivers/freedreno/libfreedreno.la \
+	$(LIBDRM_LIBS)
+pipe_msm_la_LDFLAGS = -no-undefined -avoid-version -module
+if HAVE_MESA_LLVM
+pipe_msm_la_LIBADD += $(LLVM_LIBS)
+pipe_msm_la_LDFLAGS += $(LLVM_LDFLAGS)
+endif
+endif
+
 if HAVE_GALLIUM_SVGA
 pipe_LTLIBRARIES += pipe_vmwgfx.la
 pipe_vmwgfx_la_SOURCES = pipe_vmwgfx.c
src/gallium/targets/pipe-loader/pipe_msm.c new file +21 -0
new file mode 100644
index 0000000..76e4023
@@ -0,0 +1,21 @@
+
+#include "target-helpers/inline_debug_helper.h"
+#include "state_tracker/drm_driver.h"
+#include "freedreno/drm/freedreno_drm_public.h"
+
+static struct pipe_screen *
+create_screen(int fd)
+{
+   struct pipe_screen *screen;
+
+   screen = fd_drm_screen_create(fd);
+   if (!screen)
+      return NULL;
+
+   screen = debug_screen_wrap(screen);
+
+   return screen;
+}
+
+PUBLIC
+DRM_DRIVER_DESCRIPTOR("msm", "freedreno", create_screen, NULL)
Signature · 1 line
1.8.5.3
#10 lore raw

Re: [PATCHv2 4/4] pipe-loader: add pipe loader for freedreno/msm

Quoted 15 lines · Rob Clark

From: Rob Clark <[email protected]>

---
 src/gallium/targets/pipe-loader/Makefile.am | 16 ++++++++++++++++
 src/gallium/targets/pipe-loader/pipe_msm.c  | 21 +++++++++++++++++++++
 2 files changed, 37 insertions(+)
 create mode 100644 src/gallium/targets/pipe-loader/pipe_msm.c
src/gallium/targets/pipe-loader/Makefile.am +0 -0
index 97733c1..8a0f254 100644
@@ -132,6 +132,22 @@ pipe_radeonsi_la_LDFLAGS += $(LLVM_LDFLAGS)
 endif

src/gallium/targets/pipe-loader/Makefile.am pipe_radeonsi_la_LDFLAGS += $(LLVM_LDFLAGS) · line 142

Quoted 10 lines
src/gallium/targets/pipe-loader/Makefile.am +8 -0
 endif
 
+if HAVE_GALLIUM_FREEDRENO
+pipe_LTLIBRARIES += pipe_msm.la
+pipe_msm_la_SOURCES = pipe_msm.c
+nodist_EXTRA_pipe_msm_la_SOURCES = dummy.cpp
+pipe_msm_la_LIBADD = \
+	$(PIPE_LIBS) \
+	$(top_builddir)/src/gallium/winsys/freedreno/drm/libfreedrenodrm.la \
+	$(top_builddir)/src/gallium/drivers/freedreno/libfreedreno.la \

Should have spotted this earlier, but it seems like you're forgot to link against libdrm_freedreno ?

+ $(FREEDRENO_LIBS) \

-Emil

author
#11 lore raw

Re: [PATCHv2 4/4] pipe-loader: add pipe loader for freedreno/msm

Quoted 29 lines · Emil Velikov
Quoted 15 lines · Rob Clark

From: Rob Clark <[email protected]>

---
 src/gallium/targets/pipe-loader/Makefile.am | 16 ++++++++++++++++
 src/gallium/targets/pipe-loader/pipe_msm.c  | 21 +++++++++++++++++++++
 2 files changed, 37 insertions(+)
 create mode 100644 src/gallium/targets/pipe-loader/pipe_msm.c
src/gallium/targets/pipe-loader/Makefile.am +0 -0
index 97733c1..8a0f254 100644
@@ -132,6 +132,22 @@ pipe_radeonsi_la_LDFLAGS += $(LLVM_LDFLAGS)
 endif

src/gallium/targets/pipe-loader/Makefile.am pipe_radeonsi_la_LDFLAGS += $(LLVM_LDFLAGS) · line 142

Quoted 10 lines
src/gallium/targets/pipe-loader/Makefile.am +8 -0
 endif
 
+if HAVE_GALLIUM_FREEDRENO
+pipe_LTLIBRARIES += pipe_msm.la
+pipe_msm_la_SOURCES = pipe_msm.c
+nodist_EXTRA_pipe_msm_la_SOURCES = dummy.cpp
+pipe_msm_la_LIBADD = \
+     $(PIPE_LIBS) \
+     $(top_builddir)/src/gallium/winsys/freedreno/drm/libfreedrenodrm.la \
+     $(top_builddir)/src/gallium/drivers/freedreno/libfreedreno.la \

Should have spotted this earlier, but it seems like you're forgot to link against libdrm_freedreno ?

Quoted 1 line

+ $(FREEDRENO_LIBS) \

hmm, good point.. I wonder why it works?

Quoted 1 line

-Emil

#12 lore raw

Re: [PATCHv2 4/4] pipe-loader: add pipe loader for freedreno/msm

Quoted 30 lines · Rob Clark
Quoted 29 lines · Emil Velikov
Quoted 15 lines · Rob Clark

From: Rob Clark <[email protected]>

---
 src/gallium/targets/pipe-loader/Makefile.am | 16 ++++++++++++++++
 src/gallium/targets/pipe-loader/pipe_msm.c  | 21 +++++++++++++++++++++
 2 files changed, 37 insertions(+)
 create mode 100644 src/gallium/targets/pipe-loader/pipe_msm.c
src/gallium/targets/pipe-loader/Makefile.am +0 -0
index 97733c1..8a0f254 100644
@@ -132,6 +132,22 @@ pipe_radeonsi_la_LDFLAGS += $(LLVM_LDFLAGS)
 endif

src/gallium/targets/pipe-loader/Makefile.am pipe_radeonsi_la_LDFLAGS += $(LLVM_LDFLAGS) · line 142

Quoted 10 lines
src/gallium/targets/pipe-loader/Makefile.am +8 -0
 endif
 
+if HAVE_GALLIUM_FREEDRENO
+pipe_LTLIBRARIES += pipe_msm.la
+pipe_msm_la_SOURCES = pipe_msm.c
+nodist_EXTRA_pipe_msm_la_SOURCES = dummy.cpp
+pipe_msm_la_LIBADD = \
+     $(PIPE_LIBS) \
+     $(top_builddir)/src/gallium/winsys/freedreno/drm/libfreedrenodrm.la \
+     $(top_builddir)/src/gallium/drivers/freedreno/libfreedreno.la \

Should have spotted this earlier, but it seems like you're forgot to link against libdrm_freedreno ?

Quoted 4 lines
Quoted 1 line

+ $(FREEDRENO_LIBS) \

hmm, good point.. I wonder why it works?

Guessing that the linker favours us or there is a bug somewhere :)

Quoted 1 line
Quoted 1 line

-Emil