gallium: remove library_path argument from pipe_loader_create_screen()

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>
This commit is contained in:
Emil Velikov
2015-10-14 16:37:37 +01:00
parent cbc4d9730a
commit 74d41a32bc
21 changed files with 23 additions and 44 deletions

View 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 += \

View 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)

View 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 *

View 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.

View 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;

View 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);

View 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;

View 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)

View 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)

View 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 \

View 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);

View 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 \

View 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);

View 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

View 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;

View 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)

View 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) {

View 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 \

View 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);

View 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 */

View 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 */