[Mesa-dev] [PATCH v2 10/40] gallium: remove library_path argument from pipe_loader_create_screen()
Emil Velikov
emil.l.velikov at gmail.com
Fri Nov 20 12:11:19 PST 2015
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 at gmail.com>
Acked-by: Rob Clark <robclark at freedesktop.org>
---
src/gallium/auxiliary/Makefile.am | 3 +--
src/gallium/auxiliary/pipe-loader/Makefile.am | 1 +
src/gallium/auxiliary/pipe-loader/pipe_loader.c | 5 ++---
src/gallium/auxiliary/pipe-loader/pipe_loader.h | 6 +-----
src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c | 5 ++---
src/gallium/auxiliary/pipe-loader/pipe_loader_priv.h | 3 +--
src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c | 5 ++---
src/gallium/auxiliary/vl/vl_winsys_dri.c | 2 +-
src/gallium/auxiliary/vl/vl_winsys_drm.c | 6 ++----
src/gallium/state_trackers/clover/Makefile.am | 1 -
src/gallium/state_trackers/clover/core/device.cpp | 2 +-
src/gallium/state_trackers/dri/Makefile.am | 1 -
src/gallium/state_trackers/dri/dri2.c | 2 +-
src/gallium/state_trackers/xa/Makefile.am | 5 +----
src/gallium/state_trackers/xa/xa_tracker.c | 2 +-
src/gallium/targets/d3dadapter9/Makefile.am | 5 -----
src/gallium/targets/d3dadapter9/drm.c | 4 ++--
src/gallium/tests/trivial/Makefile.am | 3 +--
src/gallium/tests/trivial/compute.c | 2 +-
src/gallium/tests/trivial/quad-tex.c | 2 +-
src/gallium/tests/trivial/tri.c | 2 +-
21 files changed, 23 insertions(+), 44 deletions(-)
diff --git a/src/gallium/auxiliary/Makefile.am b/src/gallium/auxiliary/Makefile.am
index c33def7..0908608 100644
--- a/src/gallium/auxiliary/Makefile.am
+++ b/src/gallium/auxiliary/Makefile.am
@@ -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 += \
diff --git a/src/gallium/auxiliary/pipe-loader/Makefile.am b/src/gallium/auxiliary/pipe-loader/Makefile.am
index e12620c..1597b79 100644
--- a/src/gallium/auxiliary/pipe-loader/Makefile.am
+++ b/src/gallium/auxiliary/pipe-loader/Makefile.am
@@ -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)
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader.c b/src/gallium/auxiliary/pipe-loader/pipe_loader.c
index 0ca2e8c..40df216 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader.c
@@ -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 *
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader.h b/src/gallium/auxiliary/pipe-loader/pipe_loader.h
index 8eba8a6..690d088 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader.h
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader.h
@@ -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.
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
index 1799df7..3b858e7 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
@@ -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;
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_priv.h b/src/gallium/auxiliary/pipe-loader/pipe_loader_priv.h
index d3b0252..da2ca8c 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader_priv.h
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_priv.h
@@ -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);
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c b/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
index 86039a3..c79f7c9 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
@@ -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;
diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri.c b/src/gallium/auxiliary/vl/vl_winsys_dri.c
index e0683a5..fb16adc 100644
--- a/src/gallium/auxiliary/vl/vl_winsys_dri.c
+++ b/src/gallium/auxiliary/vl/vl_winsys_dri.c
@@ -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)
diff --git a/src/gallium/auxiliary/vl/vl_winsys_drm.c b/src/gallium/auxiliary/vl/vl_winsys_drm.c
index c96187b..f4e8306 100644
--- a/src/gallium/auxiliary/vl/vl_winsys_drm.c
+++ b/src/gallium/auxiliary/vl/vl_winsys_drm.c
@@ -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)
diff --git a/src/gallium/state_trackers/clover/Makefile.am b/src/gallium/state_trackers/clover/Makefile.am
index c6528ff..3c94216 100644
--- a/src/gallium/state_trackers/clover/Makefile.am
+++ b/src/gallium/state_trackers/clover/Makefile.am
@@ -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 \
diff --git a/src/gallium/state_trackers/clover/core/device.cpp b/src/gallium/state_trackers/clover/core/device.cpp
index 6efff79..1be2f64 100644
--- a/src/gallium/state_trackers/clover/core/device.cpp
+++ b/src/gallium/state_trackers/clover/core/device.cpp
@@ -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);
diff --git a/src/gallium/state_trackers/dri/Makefile.am b/src/gallium/state_trackers/dri/Makefile.am
index e407304..102b843 100644
--- a/src/gallium/state_trackers/dri/Makefile.am
+++ b/src/gallium/state_trackers/dri/Makefile.am
@@ -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 \
diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
index 019414b..a11f3b8 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -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);
diff --git a/src/gallium/state_trackers/xa/Makefile.am b/src/gallium/state_trackers/xa/Makefile.am
index 400a70b..0d50c27 100644
--- a/src/gallium/state_trackers/xa/Makefile.am
+++ b/src/gallium/state_trackers/xa/Makefile.am
@@ -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
diff --git a/src/gallium/state_trackers/xa/xa_tracker.c b/src/gallium/state_trackers/xa/xa_tracker.c
index 4fdbdc9..3011598 100644
--- a/src/gallium/state_trackers/xa/xa_tracker.c
+++ b/src/gallium/state_trackers/xa/xa_tracker.c
@@ -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;
diff --git a/src/gallium/targets/d3dadapter9/Makefile.am b/src/gallium/targets/d3dadapter9/Makefile.am
index 7ec5c83..bd6d620 100644
--- a/src/gallium/targets/d3dadapter9/Makefile.am
+++ b/src/gallium/targets/d3dadapter9/Makefile.am
@@ -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)
diff --git a/src/gallium/targets/d3dadapter9/drm.c b/src/gallium/targets/d3dadapter9/drm.c
index 92567ac..78896cb 100644
--- a/src/gallium/targets/d3dadapter9/drm.c
+++ b/src/gallium/targets/d3dadapter9/drm.c
@@ -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) {
diff --git a/src/gallium/tests/trivial/Makefile.am b/src/gallium/tests/trivial/Makefile.am
index 26783ab..4a86dc8 100644
--- a/src/gallium/tests/trivial/Makefile.am
+++ b/src/gallium/tests/trivial/Makefile.am
@@ -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 \
diff --git a/src/gallium/tests/trivial/compute.c b/src/gallium/tests/trivial/compute.c
index b344f78..bcdfb11 100644
--- a/src/gallium/tests/trivial/compute.c
+++ b/src/gallium/tests/trivial/compute.c
@@ -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);
diff --git a/src/gallium/tests/trivial/quad-tex.c b/src/gallium/tests/trivial/quad-tex.c
index f66f630..4c5a920 100644
--- a/src/gallium/tests/trivial/quad-tex.c
+++ b/src/gallium/tests/trivial/quad-tex.c
@@ -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 */
diff --git a/src/gallium/tests/trivial/tri.c b/src/gallium/tests/trivial/tri.c
index a555200..c71a63f 100644
--- a/src/gallium/tests/trivial/tri.c
+++ b/src/gallium/tests/trivial/tri.c
@@ -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 */
--
2.6.2
More information about the mesa-dev
mailing list