[Mesa-dev] [PATCH] pipe-loader: abstract GALLIUM_STATIC_TARGETS behind pipe_loader API

Rob Clark robdclark at gmail.com
Tue Oct 6 10:30:37 PDT 2015


From: Rob Clark <robclark at freedesktop.org>

v2: now building both _static and _dynamic variants of libpipe_loader,
targets can link appropriate version depending on whether they want to
statically link or dynamically load pipe drivers.

TODO probably we should just move inline_{drm,sw}_helper.h into pipe-
loader but there look to be a handful of sw-only (?) targets (graw,
haiku, etc) which I didn't touch yet.

Also didn't look very much at all at the sw renderers yet, so they
might be broken at the moment.  Not completely decided how I want to
handle those.. I guess in theory if pipe_loader_drm_probe_fd() fails
the target should fall back to pipe_loader_probe() which tries the
sw backend?  Need to dig through how all that stuff works and fun
long named fxns like wrapper_sw_winsys_wrap_pipe_screen()..

Signed-off-by: Rob Clark <robclark at freedesktop.org>
---
 configure.ac                                       |  7 -----
 src/gallium/Makefile.am                            |  2 --
 src/gallium/auxiliary/Makefile.am                  |  2 --
 src/gallium/auxiliary/pipe-loader/Makefile.am      | 35 ++++++++++++++--------
 src/gallium/auxiliary/pipe-loader/pipe_loader.c    |  4 +--
 src/gallium/auxiliary/pipe-loader/pipe_loader.h    |  4 ---
 .../auxiliary/pipe-loader/pipe_loader_drm.c        | 13 ++++++++
 src/gallium/auxiliary/pipe-loader/target.c         |  2 ++
 src/gallium/auxiliary/vl/vl_winsys_dri.c           |  8 -----
 src/gallium/state_trackers/dri/dri2.c              | 13 --------
 src/gallium/state_trackers/dri/dri_screen.c        |  2 --
 src/gallium/state_trackers/xa/xa_tracker.c         | 10 +------
 src/gallium/targets/d3dadapter9/Makefile.am        |  4 +--
 src/gallium/targets/d3dadapter9/drm.c              | 26 +++++-----------
 src/gallium/targets/dri/Makefile.am                |  4 +--
 src/gallium/targets/dri/dri.sym                    |  3 ++
 src/gallium/targets/dri/target.c                   |  2 --
 src/gallium/targets/omx/Makefile.am                |  4 +--
 src/gallium/targets/omx/target.c                   |  1 -
 src/gallium/targets/opencl/Makefile.am             |  2 +-
 src/gallium/targets/osmesa/Makefile.am             |  3 +-
 src/gallium/targets/va/Makefile.am                 |  4 +--
 src/gallium/targets/va/target.c                    |  1 -
 src/gallium/targets/vdpau/Makefile.am              |  4 +--
 src/gallium/targets/vdpau/target.c                 |  1 -
 src/gallium/targets/xa/Makefile.am                 |  6 ++--
 src/gallium/targets/xa/target.c                    |  1 -
 src/gallium/targets/xvmc/Makefile.am               |  4 +--
 src/gallium/targets/xvmc/target.c                  |  1 -
 29 files changed, 68 insertions(+), 105 deletions(-)
 create mode 100644 src/gallium/auxiliary/pipe-loader/target.c
 delete mode 100644 src/gallium/targets/dri/target.c
 delete mode 100644 src/gallium/targets/omx/target.c
 delete mode 100644 src/gallium/targets/va/target.c
 delete mode 100644 src/gallium/targets/vdpau/target.c
 delete mode 100644 src/gallium/targets/xa/target.c
 delete mode 100644 src/gallium/targets/xvmc/target.c

diff --git a/configure.ac b/configure.ac
index 1ef5fbc..1fe510f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2044,7 +2044,6 @@ gallium_require_drm_loader() {
         if test "x$need_pci_id$have_pci_id" = xyesno; then
             AC_MSG_ERROR([Gallium drm loader requires libudev >= $LIBUDEV_REQUIRED or sysfs])
         fi
-        enable_gallium_drm_loader=yes
     fi
     if test "x$enable_va" = xyes && test "x$7" != x; then
          GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $7"
@@ -2248,10 +2247,6 @@ if test "x$enable_gallium_loader" = xyes; then
         GALLIUM_PIPE_LOADER_DEFINES="$GALLIUM_PIPE_LOADER_DEFINES -DHAVE_PIPE_LOADER_DRI"
     fi
 
-    if test "x$enable_gallium_drm_loader" = xyes; then
-        GALLIUM_PIPE_LOADER_DEFINES="$GALLIUM_PIPE_LOADER_DEFINES -DHAVE_PIPE_LOADER_DRM"
-    fi
-
     AC_SUBST([GALLIUM_PIPE_LOADER_DEFINES])
 fi
 
@@ -2268,8 +2263,6 @@ AM_CONDITIONAL(NEED_RADEON_DRM_WINSYS, test "x$HAVE_GALLIUM_R300" = xyes -o \
 AM_CONDITIONAL(NEED_WINSYS_XLIB, test "x$NEED_WINSYS_XLIB" = xyes)
 AM_CONDITIONAL(NEED_RADEON_LLVM, test x$NEED_RADEON_LLVM = xyes)
 AM_CONDITIONAL(USE_R600_LLVM_COMPILER, test x$USE_R600_LLVM_COMPILER = xyes)
-AM_CONDITIONAL(HAVE_LOADER_GALLIUM, test x$enable_gallium_loader = xyes)
-AM_CONDITIONAL(HAVE_DRM_LOADER_GALLIUM, test x$enable_gallium_drm_loader = xyes)
 AM_CONDITIONAL(HAVE_GALLIUM_COMPUTE, test x$enable_opencl = xyes)
 AM_CONDITIONAL(HAVE_MESA_LLVM, test x$MESA_LLVM = x1)
 AM_CONDITIONAL(USE_VC4_SIMULATOR, test x$USE_VC4_SIMULATOR = xyes)
diff --git a/src/gallium/Makefile.am b/src/gallium/Makefile.am
index a7c3606..cc099d5 100644
--- a/src/gallium/Makefile.am
+++ b/src/gallium/Makefile.am
@@ -115,9 +115,7 @@ EXTRA_DIST = \
 ## Gallium state trackers and their users (targets)
 ##
 
-if HAVE_LOADER_GALLIUM
 SUBDIRS += targets/pipe-loader
-endif
 
 if HAVE_CLOVER
 SUBDIRS += state_trackers/clover targets/opencl
diff --git a/src/gallium/auxiliary/Makefile.am b/src/gallium/auxiliary/Makefile.am
index a728162..dcd51bf 100644
--- a/src/gallium/auxiliary/Makefile.am
+++ b/src/gallium/auxiliary/Makefile.am
@@ -1,6 +1,4 @@
-if HAVE_LOADER_GALLIUM
 SUBDIRS := pipe-loader
-endif
 
 include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
diff --git a/src/gallium/auxiliary/pipe-loader/Makefile.am b/src/gallium/auxiliary/pipe-loader/Makefile.am
index 8c83799..a9f159b 100644
--- a/src/gallium/auxiliary/pipe-loader/Makefile.am
+++ b/src/gallium/auxiliary/pipe-loader/Makefile.am
@@ -5,24 +5,35 @@ include $(top_srcdir)/src/gallium/Automake.inc
 AM_CFLAGS = \
 	-I$(top_srcdir)/src/loader \
 	-I$(top_srcdir)/src/gallium/winsys \
+	$(LIBDRM_CFLAGS) \
 	$(GALLIUM_PIPE_LOADER_DEFINES) \
 	$(GALLIUM_CFLAGS) \
 	$(VISIBILITY_CFLAGS)
 
-noinst_LTLIBRARIES = libpipe_loader.la
+noinst_LTLIBRARIES = \
+	libpipe_loader_dynamic.la \
+	libpipe_loader_static.la
 
-libpipe_loader_la_SOURCES = \
-	$(COMMON_SOURCES)
-
-if HAVE_DRM_LOADER_GALLIUM
-AM_CFLAGS += \
-	$(LIBDRM_CFLAGS)
-
-libpipe_loader_la_SOURCES += \
+libpipe_loader_dynamic_la_SOURCES = \
+	$(COMMON_SOURCES) \
 	$(DRM_SOURCES)
 
-libpipe_loader_la_LIBADD = \
-	$(top_builddir)/src/loader/libloader.la
+libpipe_loader_static_la_CFLAGS = \
+	-I$(top_srcdir)/include \
+	-I$(top_srcdir)/src \
+	-I$(top_srcdir)/src/loader \
+	-I$(top_srcdir)/src/gallium/include \
+	-I$(top_srcdir)/src/gallium/auxiliary \
+	-I$(top_srcdir)/src/gallium/winsys \
+	$(LIBDRM_CFLAGS) \
+	-DGALLIUM_STATIC_TARGETS=1
 
-endif
+libpipe_loader_static_la_LIBADD = \
+	$(top_builddir)/src/gallium/winsys/sw/null/libws_null.la \
+	$(top_builddir)/src/gallium/winsys/sw/wrapper/libwsw.la \
+	$(LIBDRM_LIBS)
 
+libpipe_loader_static_la_SOURCES = \
+	target.c \
+	$(COMMON_SOURCES) \
+	$(DRM_SOURCES)
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader.c b/src/gallium/auxiliary/pipe-loader/pipe_loader.c
index 8e79f85..bb4e061 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader.c
@@ -25,6 +25,8 @@
  *
  **************************************************************************/
 
+#include <linux/limits.h>
+
 #include "pipe_loader_priv.h"
 
 #include "util/u_inlines.h"
@@ -35,9 +37,7 @@
 #define MODULE_PREFIX "pipe_"
 
 static int (*backends[])(struct pipe_loader_device **, int) = {
-#ifdef HAVE_PIPE_LOADER_DRM
    &pipe_loader_drm_probe,
-#endif
    &pipe_loader_sw_probe
 };
 
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader.h b/src/gallium/auxiliary/pipe-loader/pipe_loader.h
index 9b87126..cf0c51b 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader.h
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader.h
@@ -158,8 +158,6 @@ boolean
 pipe_loader_sw_probe_wrapped(struct pipe_loader_device **dev,
                              struct pipe_screen *screen);
 
-#ifdef HAVE_PIPE_LOADER_DRM
-
 /**
  * Get a list of known DRM devices.
  *
@@ -180,8 +178,6 @@ pipe_loader_drm_probe(struct pipe_loader_device **devs, int ndev);
 bool
 pipe_loader_drm_probe_fd(struct pipe_loader_device **dev, int fd);
 
-#endif
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
index 1799df7..f1e2534 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
@@ -34,6 +34,7 @@
 #include <stdio.h>
 #include <xf86drm.h>
 #include <unistd.h>
+#include <linux/limits.h>
 
 #include "loader.h"
 #include "state_tracker/drm_driver.h"
@@ -50,7 +51,9 @@
 
 struct pipe_loader_drm_device {
    struct pipe_loader_device base;
+#if !GALLIUM_STATIC_TARGETS
    struct util_dl_library *lib;
+#endif
    int fd;
 };
 
@@ -132,8 +135,10 @@ pipe_loader_drm_release(struct pipe_loader_device **dev)
 {
    struct pipe_loader_drm_device *ddev = pipe_loader_drm_device(*dev);
 
+#if !GALLIUM_STATIC_TARGETS
    if (ddev->lib)
       util_dl_close(ddev->lib);
+#endif
 
    close(ddev->fd);
    FREE(ddev->base.driver_name);
@@ -145,6 +150,9 @@ static const struct drm_conf_ret *
 pipe_loader_drm_configuration(struct pipe_loader_device *dev,
                               enum drm_conf conf)
 {
+#if GALLIUM_STATIC_TARGETS
+   return dd_configuration(conf);
+#else
    struct pipe_loader_drm_device *ddev = pipe_loader_drm_device(dev);
    const struct drm_driver_descriptor *dd;
 
@@ -162,6 +170,7 @@ pipe_loader_drm_configuration(struct pipe_loader_device *dev,
       return NULL;
 
    return dd->configuration(conf);
+#endif
 }
 
 static struct pipe_screen *
@@ -169,6 +178,9 @@ pipe_loader_drm_create_screen(struct pipe_loader_device *dev,
                               const char *library_paths)
 {
    struct pipe_loader_drm_device *ddev = pipe_loader_drm_device(dev);
+#if GALLIUM_STATIC_TARGETS
+   return dd_create_screen(ddev->fd);
+#else
    const struct drm_driver_descriptor *dd;
 
    if (!ddev->lib)
@@ -184,6 +196,7 @@ pipe_loader_drm_create_screen(struct pipe_loader_device *dev,
       return NULL;
 
    return dd->create_screen(ddev->fd);
+#endif
 }
 
 static struct pipe_loader_ops pipe_loader_drm_ops = {
diff --git a/src/gallium/auxiliary/pipe-loader/target.c b/src/gallium/auxiliary/pipe-loader/target.c
new file mode 100644
index 0000000..32a11ef
--- /dev/null
+++ b/src/gallium/auxiliary/pipe-loader/target.c
@@ -0,0 +1,2 @@
+#include "target-helpers/inline_drm_helper.h"
+#include "target-helpers/inline_sw_helper.h"
diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri.c b/src/gallium/auxiliary/vl/vl_winsys_dri.c
index 3b1b87f..c5c87c8 100644
--- a/src/gallium/auxiliary/vl/vl_winsys_dri.c
+++ b/src/gallium/auxiliary/vl/vl_winsys_dri.c
@@ -387,12 +387,8 @@ vl_screen_create(Display *display, int screen)
    if (authenticate == NULL || !authenticate->authenticated)
       goto free_authenticate;
 
-#if GALLIUM_STATIC_TARGETS
-   scrn->base.pscreen = dd_create_screen(fd);
-#else
    if (pipe_loader_drm_probe_fd(&scrn->base.dev, fd))
       scrn->base.pscreen = pipe_loader_create_screen(scrn->base.dev, PIPE_SEARCH_DIR);
-#endif // GALLIUM_STATIC_TARGETS
 
    if (!scrn->base.pscreen)
       goto release_pipe;
@@ -409,10 +405,8 @@ vl_screen_create(Display *display, int screen)
    return &scrn->base;
 
 release_pipe:
-#if !GALLIUM_STATIC_TARGETS
    if (scrn->base.dev)
       pipe_loader_release(&scrn->base.dev, 1);
-#endif // !GALLIUM_STATIC_TARGETS
 free_authenticate:
    free(authenticate);
 free_connect:
@@ -440,8 +434,6 @@ void vl_screen_destroy(struct vl_screen *vscreen)
 
    vl_dri2_destroy_drawable(scrn);
    scrn->base.pscreen->destroy(scrn->base.pscreen);
-#if !GALLIUM_STATIC_TARGETS
    pipe_loader_release(&scrn->base.dev, 1);
-#endif // !GALLIUM_STATIC_TARGETS
    FREE(scrn);
 }
diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
index 91b4431..a24acdd 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -1454,19 +1454,12 @@ dri2_init_screen(__DRIscreen * sPriv)
 
    sPriv->driverPrivate = (void *)screen;
 
-#if GALLIUM_STATIC_TARGETS
-   pscreen = dd_create_screen(screen->fd);
-
-   throttle_ret = dd_configuration(DRM_CONF_THROTTLE);
-   dmabuf_ret = dd_configuration(DRM_CONF_SHARE_FD);
-#else
    if (pipe_loader_drm_probe_fd(&screen->dev, screen->fd)) {
       pscreen = pipe_loader_create_screen(screen->dev, PIPE_SEARCH_DIR);
 
       throttle_ret = pipe_loader_configuration(screen->dev, DRM_CONF_THROTTLE);
       dmabuf_ret = pipe_loader_configuration(screen->dev, DRM_CONF_SHARE_FD);
    }
-#endif // GALLIUM_STATIC_TARGETS
 
    if (throttle_ret && throttle_ret->val.val_int != -1) {
       screen->throttling_enabled = TRUE;
@@ -1492,11 +1485,7 @@ dri2_init_screen(__DRIscreen * sPriv)
 
    /* dri_init_screen_helper checks pscreen for us */
 
-#if GALLIUM_STATIC_TARGETS
-   configs = dri_init_screen_helper(screen, pscreen, dd_driver_name());
-#else
    configs = dri_init_screen_helper(screen, pscreen, screen->dev->driver_name);
-#endif // GALLIUM_STATIC_TARGETS
    if (!configs)
       goto fail;
 
@@ -1508,10 +1497,8 @@ dri2_init_screen(__DRIscreen * sPriv)
    return configs;
 fail:
    dri_destroy_screen_helper(screen);
-#if !GALLIUM_STATIC_TARGETS
    if (screen->dev)
       pipe_loader_release(&screen->dev, 1);
-#endif // !GALLIUM_STATIC_TARGETS
    FREE(screen);
    return NULL;
 }
diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c
index c4c2d9c..cf0f265 100644
--- a/src/gallium/state_trackers/dri/dri_screen.c
+++ b/src/gallium/state_trackers/dri/dri_screen.c
@@ -390,9 +390,7 @@ dri_destroy_screen(__DRIscreen * sPriv)
 
    dri_destroy_screen_helper(screen);
 
-#if !GALLIUM_STATIC_TARGETS
    pipe_loader_release(&screen->dev, 1);
-#endif // !GALLIUM_STATIC_TARGETS
 
    free(screen);
    sPriv->driverPrivate = NULL;
diff --git a/src/gallium/state_trackers/xa/xa_tracker.c b/src/gallium/state_trackers/xa/xa_tracker.c
index 4fdbdc9..598d540 100644
--- a/src/gallium/state_trackers/xa/xa_tracker.c
+++ b/src/gallium/state_trackers/xa/xa_tracker.c
@@ -157,16 +157,12 @@ xa_tracker_create(int drm_fd)
     if (!xa)
 	return NULL;
 
-#if GALLIUM_STATIC_TARGETS
-    xa->screen = dd_create_screen(drm_fd);
-    (void) loader_fd; /* silence unused var warning */
-#else
     loader_fd = dup(drm_fd);
     if (loader_fd == -1)
         return NULL;
     if (pipe_loader_drm_probe_fd(&xa->dev, loader_fd))
 	xa->screen = pipe_loader_create_screen(xa->dev, PIPE_SEARCH_DIR);
-#endif
+
     if (!xa->screen)
 	goto out_no_screen;
 
@@ -214,10 +210,8 @@ 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;
 }
@@ -228,9 +222,7 @@ 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/d3dadapter9/Makefile.am b/src/gallium/targets/d3dadapter9/Makefile.am
index e26ca33..1548c72 100644
--- a/src/gallium/targets/d3dadapter9/Makefile.am
+++ b/src/gallium/targets/d3dadapter9/Makefile.am
@@ -79,7 +79,6 @@ d3dadapter9_la_LIBADD = \
 	$(top_builddir)/src/libglsl_util.la \
 	$(top_builddir)/src/gallium/state_trackers/nine/libninetracker.la \
 	$(top_builddir)/src/util/libmesautil.la \
-	$(top_builddir)/src/gallium/winsys/sw/wrapper/libwsw.la \
 	$(EXPAT_LIBS) \
 	$(GALLIUM_COMMON_LIB_DEPS)
 
@@ -113,12 +112,13 @@ if HAVE_GALLIUM_STATIC_TARGETS
 
 d3dadapter9_la_CPPFLAGS = $(AM_CPPFLAGS) $(TARGET_CPPFLAGS)
 d3dadapter9_la_LIBADD += $(TARGET_LIB_DEPS) \
+	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader_static.la \
 	$(TARGET_RADEON_WINSYS) $(TARGET_RADEON_COMMON)
 
 else # HAVE_GALLIUM_STATIC_TARGETS
 
 d3dadapter9_la_LIBADD += \
-	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la \
+	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader_dynamic.la \
 	$(GALLIUM_PIPE_LOADER_WINSYS_LIBS)
 
 endif # HAVE_GALLIUM_STATIC_TARGETS
diff --git a/src/gallium/targets/d3dadapter9/drm.c b/src/gallium/targets/d3dadapter9/drm.c
index fabc820..ce55137 100644
--- a/src/gallium/targets/d3dadapter9/drm.c
+++ b/src/gallium/targets/d3dadapter9/drm.c
@@ -29,8 +29,6 @@
 #include "pipe/p_screen.h"
 #include "pipe/p_state.h"
 
-#include "target-helpers/inline_drm_helper.h"
-#include "target-helpers/inline_sw_helper.h"
 #include "state_tracker/drm_driver.h"
 
 #include "d3dadapter/d3dadapter9.h"
@@ -91,12 +89,10 @@ drm_destroy( struct d3dadapter9_context *ctx )
     else if (ctx->hal)
         ctx->hal->destroy(ctx->hal);
 
-#if !GALLIUM_STATIC_TARGETS
     if (drm->swdev)
         pipe_loader_release(&drm->swdev, 1);
     if (drm->dev)
         pipe_loader_release(&drm->dev, 1);
-#endif
 
     close(drm->fd);
     FREE(ctx);
@@ -214,14 +210,16 @@ drm_create_adapter( int fd,
     driOptionCache defaultInitOptions;
     driOptionCache userInitOptions;
     int throttling_value_user = -2;
+    unsigned i;
 
-#if !GALLIUM_STATIC_TARGETS
     const char *paths[] = {
         getenv("D3D9_DRIVERS_PATH"),
         getenv("D3D9_DRIVERS_DIR"),
+#ifdef PIPE_SEARCH_DIR
+        /* TODO just drop paths param to pipe_loader_create_screen()? */
         PIPE_SEARCH_DIR
-    };
 #endif
+    };
 
     if (!ctx) { return E_OUTOFMEMORY; }
 
@@ -231,9 +229,6 @@ drm_create_adapter( int fd,
     ctx->fd = fd;
     ctx->base.linear_framebuffer = !!different_device;
 
-#if GALLIUM_STATIC_TARGETS
-    ctx->base.hal = dd_create_screen(fd);
-#else
     /* use pipe-loader to dlopen appropriate drm driver */
     if (!pipe_loader_drm_probe_fd(&ctx->dev, fd)) {
         ERR("Failed to probe drm fd %d.\n", fd);
@@ -248,20 +243,16 @@ drm_create_adapter( int fd,
         if (!paths[i]) { continue; }
         ctx->base.hal = pipe_loader_create_screen(ctx->dev, paths[i]);
     }
-#endif
+
     if (!ctx->base.hal) {
         ERR("Unable to load requested driver.\n");
         drm_destroy(&ctx->base);
         return D3DERR_DRIVERINTERNALERROR;
     }
 
-#if GALLIUM_STATIC_TARGETS
-    dmabuf_ret = dd_configuration(DRM_CONF_SHARE_FD);
-    throttle_ret = dd_configuration(DRM_CONF_THROTTLE);
-#else
     dmabuf_ret = pipe_loader_configuration(ctx->dev, DRM_CONF_SHARE_FD);
     throttle_ret = pipe_loader_configuration(ctx->dev, DRM_CONF_THROTTLE);
-#endif // GALLIUM_STATIC_TARGETS
+
     if (!dmabuf_ret || !dmabuf_ret->val.val_bool) {
         ERR("The driver is not capable of dma-buf sharing."
             "Abandon to load nine state tracker\n");
@@ -308,9 +299,6 @@ drm_create_adapter( int fd,
     driDestroyOptionCache(&userInitOptions);
     driDestroyOptionInfo(&defaultInitOptions);
 
-#if GALLIUM_STATIC_TARGETS
-    ctx->base.ref = ninesw_create_screen(ctx->base.hal);
-#else
     /* wrap it to create a software screen that can share resources */
     if (pipe_loader_sw_probe_wrapped(&ctx->swdev, ctx->base.hal)) {
         ctx->base.ref = NULL;
@@ -319,7 +307,7 @@ drm_create_adapter( int fd,
             ctx->base.ref = pipe_loader_create_screen(ctx->swdev, paths[i]);
         }
     }
-#endif
+
     if (!ctx->base.ref) {
         ERR("Couldn't wrap drm screen to swrast screen. Software devices "
             "will be unavailable.\n");
diff --git a/src/gallium/targets/dri/Makefile.am b/src/gallium/targets/dri/Makefile.am
index 7f945d1..dcbce2f 100644
--- a/src/gallium/targets/dri/Makefile.am
+++ b/src/gallium/targets/dri/Makefile.am
@@ -88,15 +88,15 @@ include $(top_srcdir)/src/gallium/drivers/llvmpipe/Automake.inc
 
 if HAVE_GALLIUM_STATIC_TARGETS
 
-gallium_dri_la_SOURCES += target.c
 gallium_dri_la_CPPFLAGS = $(AM_CPPFLAGS) $(TARGET_CPPFLAGS)
 gallium_dri_la_LIBADD += $(TARGET_LIB_DEPS) \
+	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader_static.la \
 	$(TARGET_RADEON_WINSYS) $(TARGET_RADEON_COMMON)
 
 else # HAVE_GALLIUM_STATIC_TARGETS
 
 gallium_dri_la_LIBADD += \
-	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la \
+	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader_dynamic.la \
 	$(GALLIUM_PIPE_LOADER_WINSYS_LIBS)
 
 endif # HAVE_GALLIUM_STATIC_TARGETS
diff --git a/src/gallium/targets/dri/dri.sym b/src/gallium/targets/dri/dri.sym
index 1fdf18b..497f4bd 100644
--- a/src/gallium/targets/dri/dri.sym
+++ b/src/gallium/targets/dri/dri.sym
@@ -2,6 +2,9 @@
 	global:
 		__driDriverExtensions;
 		__driDriverGetExtensions*;
+		pipe_loader_drm_probe_fd;
+		pipe_loader_create_screen;
+		pipe_loader_configuration;
 		nouveau_drm_screen_create;
 		radeon_drm_winsys_create;
 		amdgpu_winsys_create;
diff --git a/src/gallium/targets/dri/target.c b/src/gallium/targets/dri/target.c
deleted file mode 100644
index 32a11ef..0000000
--- a/src/gallium/targets/dri/target.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "target-helpers/inline_drm_helper.h"
-#include "target-helpers/inline_sw_helper.h"
diff --git a/src/gallium/targets/omx/Makefile.am b/src/gallium/targets/omx/Makefile.am
index a4dff48..5d574b5 100644
--- a/src/gallium/targets/omx/Makefile.am
+++ b/src/gallium/targets/omx/Makefile.am
@@ -48,15 +48,15 @@ include $(top_srcdir)/src/gallium/drivers/nouveau/Automake.inc
 include $(top_srcdir)/src/gallium/drivers/r600/Automake.inc
 include $(top_srcdir)/src/gallium/drivers/radeonsi/Automake.inc
 
-libomx_mesa_la_SOURCES += target.c
 libomx_mesa_la_CPPFLAGS = $(TARGET_CPPFLAGS)
 libomx_mesa_la_LIBADD += $(TARGET_LIB_DEPS) \
+	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader_static.la \
 	$(TARGET_RADEON_WINSYS) $(TARGET_RADEON_COMMON)
 
 else # HAVE_GALLIUM_STATIC_TARGETS
 
 libomx_mesa_la_LIBADD += \
-	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la \
+	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader_dynamic.la \
 	$(GALLIUM_PIPE_LOADER_WINSYS_LIBS)
 
 endif # HAVE_GALLIUM_STATIC_TARGETS
diff --git a/src/gallium/targets/omx/target.c b/src/gallium/targets/omx/target.c
deleted file mode 100644
index fde4a4a..0000000
--- a/src/gallium/targets/omx/target.c
+++ /dev/null
@@ -1 +0,0 @@
-#include "target-helpers/inline_drm_helper.h"
diff --git a/src/gallium/targets/opencl/Makefile.am b/src/gallium/targets/opencl/Makefile.am
index 4ab706e..c435bd0 100644
--- a/src/gallium/targets/opencl/Makefile.am
+++ b/src/gallium/targets/opencl/Makefile.am
@@ -15,7 +15,7 @@ lib at OPENCL_LIBNAME@_la_LDFLAGS += \
 endif
 
 lib at OPENCL_LIBNAME@_la_LIBADD = \
-	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la \
+	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader_dynamic.la \
 	$(top_builddir)/src/gallium/state_trackers/clover/libclover.la \
 	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
 	$(top_builddir)/src/util/libmesautil.la \
diff --git a/src/gallium/targets/osmesa/Makefile.am b/src/gallium/targets/osmesa/Makefile.am
index 38e515f..b45c77a 100644
--- a/src/gallium/targets/osmesa/Makefile.am
+++ b/src/gallium/targets/osmesa/Makefile.am
@@ -39,7 +39,6 @@ AM_CPPFLAGS = \
 lib_LTLIBRARIES = lib at OSMESA_LIB@.la
 
 nodist_EXTRA_lib at OSMESA_LIB@_la_SOURCES = dummy.cpp
-lib at OSMESA_LIB@_la_SOURCES = target.c
 
 lib at OSMESA_LIB@_la_LDFLAGS = \
 	-no-undefined \
@@ -57,9 +56,9 @@ SHARED_GLAPI_LIB = $(top_builddir)/src/mapi/shared-glapi/libglapi.la
 endif
 
 lib at OSMESA_LIB@_la_LIBADD = \
+	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader_static.la \
 	$(top_builddir)/src/mesa/libmesagallium.la \
 	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
-	$(top_builddir)/src/gallium/winsys/sw/null/libws_null.la \
 	$(top_builddir)/src/gallium/drivers/trace/libtrace.la \
 	$(top_builddir)/src/gallium/drivers/softpipe/libsoftpipe.la \
 	$(top_builddir)/src/gallium/state_trackers/osmesa/libosmesa.la \
diff --git a/src/gallium/targets/va/Makefile.am b/src/gallium/targets/va/Makefile.am
index 9613f04..3c4dc32 100644
--- a/src/gallium/targets/va/Makefile.am
+++ b/src/gallium/targets/va/Makefile.am
@@ -45,15 +45,15 @@ TARGET_LIB_DEPS = $(top_builddir)/src/loader/libloader.la
 include $(top_srcdir)/src/gallium/drivers/r600/Automake.inc
 include $(top_srcdir)/src/gallium/drivers/radeonsi/Automake.inc
 
-gallium_drv_video_la_SOURCES += target.c
 gallium_drv_video_la_CPPFLAGS = $(TARGET_CPPFLAGS)
 gallium_drv_video_la_LIBADD += $(TARGET_LIB_DEPS) \
+	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader_static.la \
 	$(TARGET_RADEON_WINSYS) $(TARGET_RADEON_COMMON)
 
 else # HAVE_GALLIUM_STATIC_TARGETS
 
 gallium_drv_video_la_LIBADD += \
-	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la \
+	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader_dynamic.la \
 	$(GALLIUM_PIPE_LOADER_WINSYS_LIBS)
 
 endif # HAVE_GALLIUM_STATIC_TARGETS
diff --git a/src/gallium/targets/va/target.c b/src/gallium/targets/va/target.c
deleted file mode 100644
index fde4a4a..0000000
--- a/src/gallium/targets/va/target.c
+++ /dev/null
@@ -1 +0,0 @@
-#include "target-helpers/inline_drm_helper.h"
diff --git a/src/gallium/targets/vdpau/Makefile.am b/src/gallium/targets/vdpau/Makefile.am
index 7eb62c1..f60522a 100644
--- a/src/gallium/targets/vdpau/Makefile.am
+++ b/src/gallium/targets/vdpau/Makefile.am
@@ -57,15 +57,15 @@ include $(top_srcdir)/src/gallium/drivers/radeonsi/Automake.inc
 
 if HAVE_GALLIUM_STATIC_TARGETS
 
-libvdpau_gallium_la_SOURCES += target.c
 libvdpau_gallium_la_CPPFLAGS = $(TARGET_CPPFLAGS)
 libvdpau_gallium_la_LIBADD += $(TARGET_LIB_DEPS) \
+	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader_static.la \
 	$(TARGET_RADEON_WINSYS) $(TARGET_RADEON_COMMON)
 
 else # HAVE_GALLIUM_STATIC_TARGETS
 
 libvdpau_gallium_la_LIBADD += \
-	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la \
+	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader_dynamic.la \
 	$(GALLIUM_PIPE_LOADER_WINSYS_LIBS)
 
 endif # HAVE_GALLIUM_STATIC_TARGETS
diff --git a/src/gallium/targets/vdpau/target.c b/src/gallium/targets/vdpau/target.c
deleted file mode 100644
index fde4a4a..0000000
--- a/src/gallium/targets/vdpau/target.c
+++ /dev/null
@@ -1 +0,0 @@
-#include "target-helpers/inline_drm_helper.h"
diff --git a/src/gallium/targets/xa/Makefile.am b/src/gallium/targets/xa/Makefile.am
index 92173de..146ba0e 100644
--- a/src/gallium/targets/xa/Makefile.am
+++ b/src/gallium/targets/xa/Makefile.am
@@ -73,14 +73,14 @@ include $(top_srcdir)/src/gallium/drivers/svga/Automake.inc
 
 include $(top_srcdir)/src/gallium/drivers/freedreno/Automake.inc
 
-libxatracker_la_SOURCES += target.c
 libxatracker_la_CPPFLAGS = $(TARGET_CPPFLAGS)
-libxatracker_la_LIBADD += $(TARGET_LIB_DEPS)
+libxatracker_la_LIBADD += $(TARGET_LIB_DEPS) \
+	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader_static.la
 
 else # HAVE_GALLIUM_STATIC_TARGETS
 
 libxatracker_la_LIBADD += \
-	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la \
+	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader_dynamic.la \
 	$(GALLIUM_PIPE_LOADER_WINSYS_LIBS)
 
 endif # HAVE_GALLIUM_STATIC_TARGETS
diff --git a/src/gallium/targets/xa/target.c b/src/gallium/targets/xa/target.c
deleted file mode 100644
index fde4a4a..0000000
--- a/src/gallium/targets/xa/target.c
+++ /dev/null
@@ -1 +0,0 @@
-#include "target-helpers/inline_drm_helper.h"
diff --git a/src/gallium/targets/xvmc/Makefile.am b/src/gallium/targets/xvmc/Makefile.am
index b328589..54353ee 100644
--- a/src/gallium/targets/xvmc/Makefile.am
+++ b/src/gallium/targets/xvmc/Makefile.am
@@ -46,14 +46,14 @@ include $(top_srcdir)/src/gallium/drivers/r600/Automake.inc
 
 if HAVE_GALLIUM_STATIC_TARGETS
 
-libXvMCgallium_la_SOURCES += target.c
 libXvMCgallium_la_CPPFLAGS = $(TARGET_CPPFLAGS)
 libXvMCgallium_la_LIBADD += $(TARGET_LIB_DEPS) \
+	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader_static.la \
 	$(TARGET_RADEON_WINSYS) $(TARGET_RADEON_COMMON)
 
 else # HAVE_GALLIUM_STATIC_TARGETS
 libXvMCgallium_la_LIBADD += \
-	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la \
+	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader_dynamic.la \
 	$(GALLIUM_PIPE_LOADER_WINSYS_LIBS)
 
 endif # HAVE_GALLIUM_STATIC_TARGETS
diff --git a/src/gallium/targets/xvmc/target.c b/src/gallium/targets/xvmc/target.c
deleted file mode 100644
index fde4a4a..0000000
--- a/src/gallium/targets/xvmc/target.c
+++ /dev/null
@@ -1 +0,0 @@
-#include "target-helpers/inline_drm_helper.h"
-- 
2.4.3



More information about the mesa-dev mailing list