gallium: remove library_path argument from pipe_loader_create_screen()
authorEmil Velikov <emil.l.velikov@gmail.com>
Wed, 14 Oct 2015 15:37:37 +0000 (16:37 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Sat, 21 Nov 2015 12:52:18 +0000 (12:52 +0000)
Currently the location is determined at configure/build time and
consistently copied across gallium. Just remove the extra argument, and
use PIPE_SEARCH_DIR where appropriate.

This will allow us to remove the duplication in the *configuration and
*screen_create APIs by moving util_dl_get_proc_address() and friends to
probe time.

v2: rebase on top of vl_winsys_drm.c addition

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Rob Clark <robclark@freedesktop.org>
21 files changed:
src/gallium/auxiliary/Makefile.am
src/gallium/auxiliary/pipe-loader/Makefile.am
src/gallium/auxiliary/pipe-loader/pipe_loader.c
src/gallium/auxiliary/pipe-loader/pipe_loader.h
src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
src/gallium/auxiliary/pipe-loader/pipe_loader_priv.h
src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
src/gallium/auxiliary/vl/vl_winsys_dri.c
src/gallium/auxiliary/vl/vl_winsys_drm.c
src/gallium/state_trackers/clover/Makefile.am
src/gallium/state_trackers/clover/core/device.cpp
src/gallium/state_trackers/dri/Makefile.am
src/gallium/state_trackers/dri/dri2.c
src/gallium/state_trackers/xa/Makefile.am
src/gallium/state_trackers/xa/xa_tracker.c
src/gallium/targets/d3dadapter9/Makefile.am
src/gallium/targets/d3dadapter9/drm.c
src/gallium/tests/trivial/Makefile.am
src/gallium/tests/trivial/compute.c
src/gallium/tests/trivial/quad-tex.c
src/gallium/tests/trivial/tri.c

index c33def742f17cd536308fdc19ec3f8915903b7e2..0908608d2db283219a07a7441ec2417299e9ba76 100644 (file)
@@ -66,8 +66,7 @@ COMMON_VL_CFLAGS = \
        $(AM_CFLAGS) \
        $(VL_CFLAGS) \
        $(DRI2PROTO_CFLAGS) \
-       $(LIBDRM_CFLAGS) \
-       -DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\"
+       $(LIBDRM_CFLAGS)
 
 if HAVE_GALLIUM_STATIC_TARGETS
 COMMON_VL_CFLAGS += \
index e12620c44187c6774b7f3a048c8303021f69901a..1597b79598e74bb4fb66ae5f608ed4e3935fb43f 100644 (file)
@@ -5,6 +5,7 @@ include $(top_srcdir)/src/gallium/Automake.inc
 AM_CFLAGS = \
        -I$(top_srcdir)/src/loader \
        -I$(top_srcdir)/src/gallium/winsys \
+       -DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\" \
        $(GALLIUM_PIPE_LOADER_DEFINES) \
        $(GALLIUM_CFLAGS) \
        $(VISIBILITY_CFLAGS)
index 0ca2e8ce4cda230352ddbcae8747061f230b27b8..40df2167797b93a34fa4f4fb392ee9a9f539a910 100644 (file)
@@ -69,10 +69,9 @@ pipe_loader_configuration(struct pipe_loader_device *dev,
 }
 
 struct pipe_screen *
-pipe_loader_create_screen(struct pipe_loader_device *dev,
-                          const char *library_paths)
+pipe_loader_create_screen(struct pipe_loader_device *dev)
 {
-   return dev->ops->create_screen(dev, library_paths);
+   return dev->ops->create_screen(dev);
 }
 
 struct util_dl_library *
index 8eba8a6f008cacaa06507843147e7b5050725205..690d088ed82e4bf309b042b6d1e253f45944d325 100644 (file)
@@ -82,13 +82,9 @@ pipe_loader_probe(struct pipe_loader_device **devs, int ndev);
  * Create a pipe_screen for the specified device.
  *
  * \param dev Device the screen will be created for.
- * \param library_paths Colon-separated list of filesystem paths that
- *                      will be used to look for the pipe driver
- *                      module that handles this device.
  */
 struct pipe_screen *
-pipe_loader_create_screen(struct pipe_loader_device *dev,
-                          const char *library_paths);
+pipe_loader_create_screen(struct pipe_loader_device *dev);
 
 /**
  * Query the configuration parameters for the specified device.
index 1799df7e4c594161713d3781745864839074a254..3b858e7425ca1ade1bbec5494460ed45cba6ddc4 100644 (file)
@@ -165,14 +165,13 @@ pipe_loader_drm_configuration(struct pipe_loader_device *dev,
 }
 
 static struct pipe_screen *
-pipe_loader_drm_create_screen(struct pipe_loader_device *dev,
-                              const char *library_paths)
+pipe_loader_drm_create_screen(struct pipe_loader_device *dev)
 {
    struct pipe_loader_drm_device *ddev = pipe_loader_drm_device(dev);
    const struct drm_driver_descriptor *dd;
 
    if (!ddev->lib)
-      ddev->lib = pipe_loader_find_module(dev, library_paths);
+      ddev->lib = pipe_loader_find_module(&ddev->base, PIPE_SEARCH_DIR);
    if (!ddev->lib)
       return NULL;
 
index d3b025221c5b84b85613c5a5187eafc07f860cd7..da2ca8c6e1f6f01e63991e146ef141ee1e0c0c96 100644 (file)
@@ -31,8 +31,7 @@
 #include "pipe_loader.h"
 
 struct pipe_loader_ops {
-   struct pipe_screen *(*create_screen)(struct pipe_loader_device *dev,
-                                        const char *library_paths);
+   struct pipe_screen *(*create_screen)(struct pipe_loader_device *dev);
 
    const struct drm_conf_ret *(*configuration)(struct pipe_loader_device *dev,
                                                enum drm_conf conf);
index 86039a35ef7e9d85353099ecadda62cb8e007686..c79f7c9ee341b22b724292045ae0e9060af2acb7 100644 (file)
@@ -180,14 +180,13 @@ pipe_loader_sw_configuration(struct pipe_loader_device *dev,
 }
 
 static struct pipe_screen *
-pipe_loader_sw_create_screen(struct pipe_loader_device *dev,
-                             const char *library_paths)
+pipe_loader_sw_create_screen(struct pipe_loader_device *dev)
 {
    struct pipe_loader_sw_device *sdev = pipe_loader_sw_device(dev);
    struct pipe_screen *(*init)(struct sw_winsys *);
 
    if (!sdev->lib)
-      sdev->lib = pipe_loader_find_module(dev, library_paths);
+      sdev->lib = pipe_loader_find_module(&sdev->base, PIPE_SEARCH_DIR);
    if (!sdev->lib)
       return NULL;
 
index e0683a5e7d6ebc161c85d0b0ee8c02e371db9f87..fb16adc966c838e8c6fbb947bfc8d4db8ff736c8 100644 (file)
@@ -406,7 +406,7 @@ vl_dri2_screen_create(Display *display, int screen)
    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);
+      scrn->base.pscreen = pipe_loader_create_screen(scrn->base.dev);
 #endif // GALLIUM_STATIC_TARGETS
 
    if (!scrn->base.pscreen)
index c96187bf1c5234f6e1f4a0dbcfa943ad7589a125..f4e8306b67c7b40d8ad6778fcb45efb6203eb668 100644 (file)
@@ -49,10 +49,8 @@ vl_drm_screen_create(int fd)
 #if GALLIUM_STATIC_TARGETS
    vscreen->pscreen = dd_create_screen(fd);
 #else
-   if (pipe_loader_drm_probe_fd(&vscreen->dev, dup(fd))) {
-      vscreen->pscreen =
-         pipe_loader_create_screen(vscreen->dev, PIPE_SEARCH_DIR);
-   }
+   if (pipe_loader_drm_probe_fd(&vscreen->dev, dup(fd)))
+      vscreen->pscreen = pipe_loader_create_screen(vscreen->dev);
 #endif
 
    if (!vscreen->pscreen)
index c6528ff97cb0ce1cb01a32f041f8ac61dc0abe6e..3c9421692fc00a4306c9269a62a591972de243eb 100644 (file)
@@ -1,7 +1,6 @@
 include Makefile.sources
 
 AM_CPPFLAGS = \
-       -DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\" \
        -I$(top_srcdir)/include \
        -I$(top_srcdir)/src \
        -I$(top_srcdir)/src/gallium/include \
index 6efff79c7f40e00c3209731d896b9d7ff68c29d5..1be2f6413f41a83946863ddae5827654d3cf2426 100644 (file)
@@ -41,7 +41,7 @@ namespace {
 
 device::device(clover::platform &platform, pipe_loader_device *ldev) :
    platform(platform), ldev(ldev) {
-   pipe = pipe_loader_create_screen(ldev, PIPE_SEARCH_DIR);
+   pipe = pipe_loader_create_screen(ldev);
    if (!pipe || !pipe->get_param(pipe, PIPE_CAP_COMPUTE)) {
       if (pipe)
          pipe->destroy(pipe);
index e407304fed94319a64ec91c551ed540db6cfca47..102b84390bbbd69993e280e8c42848d1c4e622cb 100644 (file)
@@ -25,7 +25,6 @@ include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
 AM_CPPFLAGS = \
-       -DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\" \
        -I$(top_srcdir)/include \
        -I$(top_srcdir)/src/mapi \
        -I$(top_srcdir)/src/mesa \
index 019414b56fec2ca21bc0de9c867104d8a9530cc1..a11f3b8d21c154fb5a28e052fe0ff50cb0e157a9 100644 (file)
@@ -1464,7 +1464,7 @@ dri2_init_screen(__DRIscreen * sPriv)
    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);
+      pscreen = pipe_loader_create_screen(screen->dev);
 
       throttle_ret = pipe_loader_configuration(screen->dev, DRM_CONF_THROTTLE);
       dmabuf_ret = pipe_loader_configuration(screen->dev, DRM_CONF_SHARE_FD);
index 400a70b300fec11dd95e9001a878957d12e1c358..0d50c27253bd8798202ce8cea1dc8e634fda8e95 100644 (file)
@@ -28,11 +28,8 @@ AM_CFLAGS = \
        $(GALLIUM_CFLAGS) \
        $(VISIBILITY_CFLAGS)
 
-AM_CPPFLAGS = \
-       -DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\"
-
 if HAVE_GALLIUM_STATIC_TARGETS
-AM_CPPFLAGS += \
+AM_CPPFLAGS = \
        -DGALLIUM_STATIC_TARGETS=1
 endif
 
index 4fdbdc96ae6b6ac151aa1aae7d0266ef36f7cf5a..3011598e0d928c5308eb3f93c8fb88842e1b2838 100644 (file)
@@ -165,7 +165,7 @@ xa_tracker_create(int 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);
+       xa->screen = pipe_loader_create_screen(xa->dev);
 #endif
     if (!xa->screen)
        goto out_no_screen;
index 7ec5c834419991b627598b4aa05eda1b06038e8a..bd6d620e8196edb3423bb46a9920bccebd3cabfc 100644 (file)
@@ -38,11 +38,6 @@ if HAVE_GALLIUM_STATIC_TARGETS
 AM_CPPFLAGS = \
        -DGALLIUM_STATIC_TARGETS=1
 
-else
-
-AM_CPPFLAGS = \
-       -DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\"
-
 endif
 
 ninedir = $(D3D_DRIVER_INSTALL_DIR)
index 92567ac65a3ea47d1844fa7bc1624d2982968748..78896cb34fd8e5eda1537bea76f9aa038f830e47 100644 (file)
@@ -235,7 +235,7 @@ drm_create_adapter( int fd,
     }
 
     /* use pipe-loader to create a drm screen (hal) */
-    ctx->base.hal = pipe_loader_create_screen(ctx->dev, PIPE_SEARCH_DIR);
+    ctx->base.hal = pipe_loader_create_screen(ctx->dev);
 #endif
     if (!ctx->base.hal) {
         ERR("Unable to load requested driver.\n");
@@ -301,7 +301,7 @@ drm_create_adapter( int fd,
 #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 = pipe_loader_create_screen(ctx->swdev, PIPE_SEARCH_DIR);
+        ctx->base.ref = pipe_loader_create_screen(ctx->swdev);
     }
 #endif
     if (!ctx->base.ref) {
index 26783ab6f6d1fe69e0dd47c05e7703397eda4b71..4a86dc8cfa0a44613e9009d4c1fecace74b74395 100644 (file)
@@ -7,8 +7,7 @@ AM_CFLAGS = \
 
 AM_CPPFLAGS = \
        -I$(top_srcdir)/src/gallium/drivers \
-       -I$(top_srcdir)/src/gallium/winsys \
-       -DPIPE_SEARCH_DIR=\"$(PIPE_SRC_DIR)/.libs\"
+       -I$(top_srcdir)/src/gallium/winsys
 
 LDADD = \
        $(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la \
index b344f78b25c0cd87a36790ff23b10748eda4a513..bcdfb11c4f1ca95d78032a77139fb0ae80bcf182 100644 (file)
@@ -74,7 +74,7 @@ static void init_ctx(struct context *ctx)
         ret = pipe_loader_probe(&ctx->dev, 1);
         assert(ret);
 
-        ctx->screen = pipe_loader_create_screen(ctx->dev, PIPE_SEARCH_DIR);
+        ctx->screen = pipe_loader_create_screen(ctx->dev);
         assert(ctx->screen);
 
         ctx->pipe = ctx->screen->context_create(ctx->screen, NULL, 0);
index f66f63043da26b3365108add9dc72165114947fc..4c5a9200a52b7bb8b7a8c7b2e5c2fb15c884099b 100644 (file)
@@ -96,7 +96,7 @@ static void init_prog(struct program *p)
        assert(ret);
 
        /* init a pipe screen */
-       p->screen = pipe_loader_create_screen(p->dev, PIPE_SEARCH_DIR);
+       p->screen = pipe_loader_create_screen(p->dev);
        assert(p->screen);
 
        /* create the pipe driver context and cso context */
index a555200842e6e75b7e0e332724022b0bd6949156..c71a63f44e564f56b70655b43bc18350dd52fb4e 100644 (file)
@@ -91,7 +91,7 @@ static void init_prog(struct program *p)
        assert(ret);
 
        /* init a pipe screen */
-       p->screen = pipe_loader_create_screen(p->dev, PIPE_SEARCH_DIR);
+       p->screen = pipe_loader_create_screen(p->dev);
        assert(p->screen);
 
        /* create the pipe driver context and cso context */