diff options
author | Emil Velikov <[email protected]> | 2014-06-16 00:20:07 +0100 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2014-07-02 10:52:52 +0100 |
commit | a66dd60547f928bb758ae94206a4a73541bfa2df (patch) | |
tree | 469f91fffa39c13658394d5d11e9e9608d1a713a /src/gallium/state_trackers/dri | |
parent | 98204ea7d047f172bfaef3abb22a7aaef60efcda (diff) |
st/dri: Allow separate dri-targets
With this commit we add a couple of DEFINES making the ST code
conditional, in a way that we can use it to gradually convert
the dri-targets from separate libraries into a single one.
Signed-off-by: Emil Velikov <[email protected]>
Tested-by: Rob Clark <[email protected]>
Tested-by: Thomas Helland <thomashelland90 at gmail.com>
Acked-by: Tom Stellard <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/dri')
-rw-r--r-- | src/gallium/state_trackers/dri/common/dri_screen.c | 17 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/common/dri_screen.h | 3 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/drm/Makefile.am | 6 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/drm/SConscript | 2 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/drm/dri2.c | 26 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/sw/Makefile.am | 3 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/sw/SConscript | 1 |
7 files changed, 56 insertions, 2 deletions
diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c b/src/gallium/state_trackers/dri/common/dri_screen.c index 7a6dcb278fd..dceb628015e 100644 --- a/src/gallium/state_trackers/dri/common/dri_screen.c +++ b/src/gallium/state_trackers/dri/common/dri_screen.c @@ -37,6 +37,7 @@ #include "util/u_inlines.h" #include "pipe/p_screen.h" #include "pipe/p_format.h" +#include "pipe-loader/pipe_loader.h" #include "state_tracker/st_gl_api.h" /* for st_gl_api_create */ #include "state_tracker/drm_driver.h" @@ -387,6 +388,12 @@ dri_destroy_screen(__DRIscreen * sPriv) dri_destroy_screen_helper(screen); +#if !SPLIT_TARGETS +#if !GALLIUM_STATIC_TARGETS + pipe_loader_release(&screen->dev, 1); +#endif // !GALLIUM_STATIC_TARGETS +#endif // !SPLIT_TARGETS + free(screen); sPriv->driverPrivate = NULL; sPriv->extensions = NULL; @@ -428,9 +435,17 @@ dri_init_screen_helper(struct dri_screen *screen, driParseOptionInfo(&screen->optionCacheDefaults, gallium_config_options.xml); driParseConfigFiles(&screen->optionCache, - &screen->optionCacheDefaults, + &screen->optionCacheDefaults, screen->sPriv->myNum, +#if SPLIT_TARGETS driver_descriptor.name); +#else +#if GALLIUM_STATIC_TARGETS + dd_driver_name()); +#else + screen->dev->driver_name); +#endif // GALLIUM_STATIC_TARGETS +#endif // SPLIT_TARGETS /* Handle force_s3tc_enable. */ if (!util_format_s3tc_enabled && diff --git a/src/gallium/state_trackers/dri/common/dri_screen.h b/src/gallium/state_trackers/dri/common/dri_screen.h index 7c8e5823fc3..2d07f517db6 100644 --- a/src/gallium/state_trackers/dri/common/dri_screen.h +++ b/src/gallium/state_trackers/dri/common/dri_screen.h @@ -43,6 +43,7 @@ struct dri_context; struct dri_drawable; +struct pipe_loader_device; struct dri_screen { @@ -70,6 +71,8 @@ struct dri_screen /* drm */ int fd; + struct pipe_loader_device *dev; + /* gallium */ boolean d_depth_bits_last; boolean sd_depth_bits_last; diff --git a/src/gallium/state_trackers/dri/drm/Makefile.am b/src/gallium/state_trackers/dri/drm/Makefile.am index f41f45d957d..a348f65f390 100644 --- a/src/gallium/state_trackers/dri/drm/Makefile.am +++ b/src/gallium/state_trackers/dri/drm/Makefile.am @@ -24,6 +24,8 @@ include Makefile.sources include $(top_srcdir)/src/gallium/Automake.inc AM_CPPFLAGS = \ + $(GALLIUM_PIPE_LOADER_DEFINES) \ + -DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\" \ -I$(top_srcdir)/include \ -I$(top_srcdir)/src/mapi \ -I$(top_srcdir)/src/mesa \ @@ -36,4 +38,8 @@ AM_CPPFLAGS = \ noinst_LTLIBRARIES = libdridrm.la +libdridrm_la_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + -DSPLIT_TARGETS=1 + libdridrm_la_SOURCES = $(C_SOURCES) diff --git a/src/gallium/state_trackers/dri/drm/SConscript b/src/gallium/state_trackers/dri/drm/SConscript index 07eaa0ae1b5..258f7eed702 100644 --- a/src/gallium/state_trackers/dri/drm/SConscript +++ b/src/gallium/state_trackers/dri/drm/SConscript @@ -15,6 +15,8 @@ env.Append(CPPPATH = [ xmlpool_options.dir.dir, # Dir to generated xmlpool/options.h ]) +env.Append(CPPDEFINES = [('SPLIT_TARGETS', '1')]) + st_dri = env.ConvenienceLibrary( target = 'st_dri', source = env.ParseSourceList('Makefile.sources', 'C_SOURCES') diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c index 275c6508cfc..898fd0ab1f6 100644 --- a/src/gallium/state_trackers/dri/drm/dri2.c +++ b/src/gallium/state_trackers/dri/drm/dri2.c @@ -36,6 +36,7 @@ #include "state_tracker/drm_driver.h" #include "state_tracker/st_texture.h" #include "state_tracker/st_context.h" +#include "pipe-loader/pipe_loader.h" #include "main/texobj.h" #include "dri_screen.h" @@ -1227,7 +1228,7 @@ dri2_init_screen(__DRIscreen * sPriv) { const __DRIconfig **configs; struct dri_screen *screen; - struct pipe_screen *pscreen; + struct pipe_screen *pscreen = NULL; const struct drm_conf_ret *throttle_ret = NULL; const struct drm_conf_ret *dmabuf_ret = NULL; @@ -1240,12 +1241,29 @@ dri2_init_screen(__DRIscreen * sPriv) sPriv->driverPrivate = (void *)screen; +#if SPLIT_TARGETS pscreen = driver_descriptor.create_screen(screen->fd); if (driver_descriptor.configuration) { throttle_ret = driver_descriptor.configuration(DRM_CONF_THROTTLE); dmabuf_ret = driver_descriptor.configuration(DRM_CONF_SHARE_FD); } +#else +#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, true)) { + 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 +#endif // SPLIT_TARGETS + if (throttle_ret && throttle_ret->val.val_int != -1) { screen->throttling_enabled = TRUE; screen->default_throttle_frames = throttle_ret->val.val_int; @@ -1276,6 +1294,12 @@ dri2_init_screen(__DRIscreen * sPriv) return configs; fail: dri_destroy_screen_helper(screen); +#if !SPLIT_TARGETS +#if !GALLIUM_STATIC_TARGETS + if (screen->dev) + pipe_loader_release(&screen->dev, 1); +#endif // !GALLIUM_STATIC_TARGETS +#endif // !SPLIT_TARGETS FREE(screen); return NULL; } diff --git a/src/gallium/state_trackers/dri/sw/Makefile.am b/src/gallium/state_trackers/dri/sw/Makefile.am index 555ea171636..0cebd6df5fa 100644 --- a/src/gallium/state_trackers/dri/sw/Makefile.am +++ b/src/gallium/state_trackers/dri/sw/Makefile.am @@ -24,6 +24,9 @@ include Makefile.sources include $(top_srcdir)/src/gallium/Automake.inc AM_CPPFLAGS = \ + $(GALLIUM_PIPE_LOADER_DEFINES) \ + -DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\" \ + -DSPLIT_TARGETS=1 \ -I$(top_srcdir)/src/mapi \ -I$(top_srcdir)/src/mesa \ -I$(top_srcdir)/src/gallium/state_trackers/dri/common \ diff --git a/src/gallium/state_trackers/dri/sw/SConscript b/src/gallium/state_trackers/dri/sw/SConscript index 6d482a5bc94..5a71b2246f0 100644 --- a/src/gallium/state_trackers/dri/sw/SConscript +++ b/src/gallium/state_trackers/dri/sw/SConscript @@ -14,6 +14,7 @@ env.Append(CPPPATH = [ ]) env.Append(CPPDEFINES = [('__NOT_HAVE_DRM_H', '1')]) +env.Append(CPPDEFINES = [('SPLIT_TARGETS', '1')]) st_drisw = env.ConvenienceLibrary( target = 'st_drisw', |