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:
@@ -66,8 +66,7 @@ COMMON_VL_CFLAGS = \
|
|||||||
$(AM_CFLAGS) \
|
$(AM_CFLAGS) \
|
||||||
$(VL_CFLAGS) \
|
$(VL_CFLAGS) \
|
||||||
$(DRI2PROTO_CFLAGS) \
|
$(DRI2PROTO_CFLAGS) \
|
||||||
$(LIBDRM_CFLAGS) \
|
$(LIBDRM_CFLAGS)
|
||||||
-DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\"
|
|
||||||
|
|
||||||
if HAVE_GALLIUM_STATIC_TARGETS
|
if HAVE_GALLIUM_STATIC_TARGETS
|
||||||
COMMON_VL_CFLAGS += \
|
COMMON_VL_CFLAGS += \
|
||||||
|
@@ -5,6 +5,7 @@ include $(top_srcdir)/src/gallium/Automake.inc
|
|||||||
AM_CFLAGS = \
|
AM_CFLAGS = \
|
||||||
-I$(top_srcdir)/src/loader \
|
-I$(top_srcdir)/src/loader \
|
||||||
-I$(top_srcdir)/src/gallium/winsys \
|
-I$(top_srcdir)/src/gallium/winsys \
|
||||||
|
-DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\" \
|
||||||
$(GALLIUM_PIPE_LOADER_DEFINES) \
|
$(GALLIUM_PIPE_LOADER_DEFINES) \
|
||||||
$(GALLIUM_CFLAGS) \
|
$(GALLIUM_CFLAGS) \
|
||||||
$(VISIBILITY_CFLAGS)
|
$(VISIBILITY_CFLAGS)
|
||||||
|
@@ -69,10 +69,9 @@ pipe_loader_configuration(struct pipe_loader_device *dev,
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct pipe_screen *
|
struct pipe_screen *
|
||||||
pipe_loader_create_screen(struct pipe_loader_device *dev,
|
pipe_loader_create_screen(struct pipe_loader_device *dev)
|
||||||
const char *library_paths)
|
|
||||||
{
|
{
|
||||||
return dev->ops->create_screen(dev, library_paths);
|
return dev->ops->create_screen(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct util_dl_library *
|
struct util_dl_library *
|
||||||
|
@@ -82,13 +82,9 @@ pipe_loader_probe(struct pipe_loader_device **devs, int ndev);
|
|||||||
* Create a pipe_screen for the specified device.
|
* Create a pipe_screen for the specified device.
|
||||||
*
|
*
|
||||||
* \param dev Device the screen will be created for.
|
* \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 *
|
struct pipe_screen *
|
||||||
pipe_loader_create_screen(struct pipe_loader_device *dev,
|
pipe_loader_create_screen(struct pipe_loader_device *dev);
|
||||||
const char *library_paths);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query the configuration parameters for the specified device.
|
* Query the configuration parameters for the specified device.
|
||||||
|
@@ -165,14 +165,13 @@ pipe_loader_drm_configuration(struct pipe_loader_device *dev,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct pipe_screen *
|
static struct pipe_screen *
|
||||||
pipe_loader_drm_create_screen(struct pipe_loader_device *dev,
|
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);
|
struct pipe_loader_drm_device *ddev = pipe_loader_drm_device(dev);
|
||||||
const struct drm_driver_descriptor *dd;
|
const struct drm_driver_descriptor *dd;
|
||||||
|
|
||||||
if (!ddev->lib)
|
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)
|
if (!ddev->lib)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@@ -31,8 +31,7 @@
|
|||||||
#include "pipe_loader.h"
|
#include "pipe_loader.h"
|
||||||
|
|
||||||
struct pipe_loader_ops {
|
struct pipe_loader_ops {
|
||||||
struct pipe_screen *(*create_screen)(struct pipe_loader_device *dev,
|
struct pipe_screen *(*create_screen)(struct pipe_loader_device *dev);
|
||||||
const char *library_paths);
|
|
||||||
|
|
||||||
const struct drm_conf_ret *(*configuration)(struct pipe_loader_device *dev,
|
const struct drm_conf_ret *(*configuration)(struct pipe_loader_device *dev,
|
||||||
enum drm_conf conf);
|
enum drm_conf conf);
|
||||||
|
@@ -180,14 +180,13 @@ pipe_loader_sw_configuration(struct pipe_loader_device *dev,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct pipe_screen *
|
static struct pipe_screen *
|
||||||
pipe_loader_sw_create_screen(struct pipe_loader_device *dev,
|
pipe_loader_sw_create_screen(struct pipe_loader_device *dev)
|
||||||
const char *library_paths)
|
|
||||||
{
|
{
|
||||||
struct pipe_loader_sw_device *sdev = pipe_loader_sw_device(dev);
|
struct pipe_loader_sw_device *sdev = pipe_loader_sw_device(dev);
|
||||||
struct pipe_screen *(*init)(struct sw_winsys *);
|
struct pipe_screen *(*init)(struct sw_winsys *);
|
||||||
|
|
||||||
if (!sdev->lib)
|
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)
|
if (!sdev->lib)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@@ -406,7 +406,7 @@ vl_dri2_screen_create(Display *display, int screen)
|
|||||||
scrn->base.pscreen = dd_create_screen(fd);
|
scrn->base.pscreen = dd_create_screen(fd);
|
||||||
#else
|
#else
|
||||||
if (pipe_loader_drm_probe_fd(&scrn->base.dev, fd))
|
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
|
#endif // GALLIUM_STATIC_TARGETS
|
||||||
|
|
||||||
if (!scrn->base.pscreen)
|
if (!scrn->base.pscreen)
|
||||||
|
@@ -49,10 +49,8 @@ vl_drm_screen_create(int fd)
|
|||||||
#if GALLIUM_STATIC_TARGETS
|
#if GALLIUM_STATIC_TARGETS
|
||||||
vscreen->pscreen = dd_create_screen(fd);
|
vscreen->pscreen = dd_create_screen(fd);
|
||||||
#else
|
#else
|
||||||
if (pipe_loader_drm_probe_fd(&vscreen->dev, dup(fd))) {
|
if (pipe_loader_drm_probe_fd(&vscreen->dev, dup(fd)))
|
||||||
vscreen->pscreen =
|
vscreen->pscreen = pipe_loader_create_screen(vscreen->dev);
|
||||||
pipe_loader_create_screen(vscreen->dev, PIPE_SEARCH_DIR);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!vscreen->pscreen)
|
if (!vscreen->pscreen)
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
include Makefile.sources
|
include Makefile.sources
|
||||||
|
|
||||||
AM_CPPFLAGS = \
|
AM_CPPFLAGS = \
|
||||||
-DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\" \
|
|
||||||
-I$(top_srcdir)/include \
|
-I$(top_srcdir)/include \
|
||||||
-I$(top_srcdir)/src \
|
-I$(top_srcdir)/src \
|
||||||
-I$(top_srcdir)/src/gallium/include \
|
-I$(top_srcdir)/src/gallium/include \
|
||||||
|
@@ -41,7 +41,7 @@ namespace {
|
|||||||
|
|
||||||
device::device(clover::platform &platform, pipe_loader_device *ldev) :
|
device::device(clover::platform &platform, pipe_loader_device *ldev) :
|
||||||
platform(platform), ldev(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->get_param(pipe, PIPE_CAP_COMPUTE)) {
|
||||||
if (pipe)
|
if (pipe)
|
||||||
pipe->destroy(pipe);
|
pipe->destroy(pipe);
|
||||||
|
@@ -25,7 +25,6 @@ include Makefile.sources
|
|||||||
include $(top_srcdir)/src/gallium/Automake.inc
|
include $(top_srcdir)/src/gallium/Automake.inc
|
||||||
|
|
||||||
AM_CPPFLAGS = \
|
AM_CPPFLAGS = \
|
||||||
-DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\" \
|
|
||||||
-I$(top_srcdir)/include \
|
-I$(top_srcdir)/include \
|
||||||
-I$(top_srcdir)/src/mapi \
|
-I$(top_srcdir)/src/mapi \
|
||||||
-I$(top_srcdir)/src/mesa \
|
-I$(top_srcdir)/src/mesa \
|
||||||
|
@@ -1464,7 +1464,7 @@ dri2_init_screen(__DRIscreen * sPriv)
|
|||||||
dmabuf_ret = dd_configuration(DRM_CONF_SHARE_FD);
|
dmabuf_ret = dd_configuration(DRM_CONF_SHARE_FD);
|
||||||
#else
|
#else
|
||||||
if (pipe_loader_drm_probe_fd(&screen->dev, screen->fd)) {
|
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);
|
throttle_ret = pipe_loader_configuration(screen->dev, DRM_CONF_THROTTLE);
|
||||||
dmabuf_ret = pipe_loader_configuration(screen->dev, DRM_CONF_SHARE_FD);
|
dmabuf_ret = pipe_loader_configuration(screen->dev, DRM_CONF_SHARE_FD);
|
||||||
|
@@ -28,11 +28,8 @@ AM_CFLAGS = \
|
|||||||
$(GALLIUM_CFLAGS) \
|
$(GALLIUM_CFLAGS) \
|
||||||
$(VISIBILITY_CFLAGS)
|
$(VISIBILITY_CFLAGS)
|
||||||
|
|
||||||
AM_CPPFLAGS = \
|
|
||||||
-DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\"
|
|
||||||
|
|
||||||
if HAVE_GALLIUM_STATIC_TARGETS
|
if HAVE_GALLIUM_STATIC_TARGETS
|
||||||
AM_CPPFLAGS += \
|
AM_CPPFLAGS = \
|
||||||
-DGALLIUM_STATIC_TARGETS=1
|
-DGALLIUM_STATIC_TARGETS=1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@@ -165,7 +165,7 @@ xa_tracker_create(int drm_fd)
|
|||||||
if (loader_fd == -1)
|
if (loader_fd == -1)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (pipe_loader_drm_probe_fd(&xa->dev, loader_fd))
|
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
|
#endif
|
||||||
if (!xa->screen)
|
if (!xa->screen)
|
||||||
goto out_no_screen;
|
goto out_no_screen;
|
||||||
|
@@ -38,11 +38,6 @@ if HAVE_GALLIUM_STATIC_TARGETS
|
|||||||
AM_CPPFLAGS = \
|
AM_CPPFLAGS = \
|
||||||
-DGALLIUM_STATIC_TARGETS=1
|
-DGALLIUM_STATIC_TARGETS=1
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
AM_CPPFLAGS = \
|
|
||||||
-DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\"
|
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ninedir = $(D3D_DRIVER_INSTALL_DIR)
|
ninedir = $(D3D_DRIVER_INSTALL_DIR)
|
||||||
|
@@ -235,7 +235,7 @@ drm_create_adapter( int fd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* use pipe-loader to create a drm screen (hal) */
|
/* 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
|
#endif
|
||||||
if (!ctx->base.hal) {
|
if (!ctx->base.hal) {
|
||||||
ERR("Unable to load requested driver.\n");
|
ERR("Unable to load requested driver.\n");
|
||||||
@@ -301,7 +301,7 @@ drm_create_adapter( int fd,
|
|||||||
#else
|
#else
|
||||||
/* wrap it to create a software screen that can share resources */
|
/* wrap it to create a software screen that can share resources */
|
||||||
if (pipe_loader_sw_probe_wrapped(&ctx->swdev, ctx->base.hal)) {
|
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
|
#endif
|
||||||
if (!ctx->base.ref) {
|
if (!ctx->base.ref) {
|
||||||
|
@@ -7,8 +7,7 @@ AM_CFLAGS = \
|
|||||||
|
|
||||||
AM_CPPFLAGS = \
|
AM_CPPFLAGS = \
|
||||||
-I$(top_srcdir)/src/gallium/drivers \
|
-I$(top_srcdir)/src/gallium/drivers \
|
||||||
-I$(top_srcdir)/src/gallium/winsys \
|
-I$(top_srcdir)/src/gallium/winsys
|
||||||
-DPIPE_SEARCH_DIR=\"$(PIPE_SRC_DIR)/.libs\"
|
|
||||||
|
|
||||||
LDADD = \
|
LDADD = \
|
||||||
$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la \
|
$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la \
|
||||||
|
@@ -74,7 +74,7 @@ static void init_ctx(struct context *ctx)
|
|||||||
ret = pipe_loader_probe(&ctx->dev, 1);
|
ret = pipe_loader_probe(&ctx->dev, 1);
|
||||||
assert(ret);
|
assert(ret);
|
||||||
|
|
||||||
ctx->screen = pipe_loader_create_screen(ctx->dev, PIPE_SEARCH_DIR);
|
ctx->screen = pipe_loader_create_screen(ctx->dev);
|
||||||
assert(ctx->screen);
|
assert(ctx->screen);
|
||||||
|
|
||||||
ctx->pipe = ctx->screen->context_create(ctx->screen, NULL, 0);
|
ctx->pipe = ctx->screen->context_create(ctx->screen, NULL, 0);
|
||||||
|
@@ -96,7 +96,7 @@ static void init_prog(struct program *p)
|
|||||||
assert(ret);
|
assert(ret);
|
||||||
|
|
||||||
/* init a pipe screen */
|
/* 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);
|
assert(p->screen);
|
||||||
|
|
||||||
/* create the pipe driver context and cso context */
|
/* create the pipe driver context and cso context */
|
||||||
|
@@ -91,7 +91,7 @@ static void init_prog(struct program *p)
|
|||||||
assert(ret);
|
assert(ret);
|
||||||
|
|
||||||
/* init a pipe screen */
|
/* 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);
|
assert(p->screen);
|
||||||
|
|
||||||
/* create the pipe driver context and cso context */
|
/* create the pipe driver context and cso context */
|
||||||
|
Reference in New Issue
Block a user