From 0bdc3e1afda111c5741a699da3ff891fedfe89de Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Sat, 21 Jun 2014 12:50:10 +0100 Subject: [PATCH] targets/dri-swrast: Convert to static/shared pipe-driver Convert the final dri target to the single DRI (megadriver) library. Cleanup all the automake leftovers from the conversion stage and update the scons build. v2: Link in llvmpipe, when applicable. Signed-off-by: Emil Velikov Tested-by: Rob Clark Tested-by: Thomas Helland Acked-by: Tom Stellard --- configure.ac | 3 +- src/gallium/Automake.inc | 43 ----------- src/gallium/SConscript | 1 - .../target-helpers/inline_sw_helper.h | 36 +++++++++ src/gallium/targets/Makefile.am | 10 +-- src/gallium/targets/dri-swrast/Makefile.am | 55 -------------- src/gallium/targets/dri-swrast/SConscript | 49 ------------ .../targets/dri-swrast/swrast_drm_api.c | 74 ------------------- src/gallium/targets/dri/Makefile.am | 14 ++++ src/gallium/targets/dri/SConscript | 19 ++++- src/gallium/targets/dri/target.c | 1 + 11 files changed, 72 insertions(+), 233 deletions(-) delete mode 100644 src/gallium/targets/dri-swrast/Makefile.am delete mode 100644 src/gallium/targets/dri-swrast/SConscript delete mode 100644 src/gallium/targets/dri-swrast/swrast_drm_api.c diff --git a/configure.ac b/configure.ac index b8f15479a72..0d4e26d3527 100644 --- a/configure.ac +++ b/configure.ac @@ -1985,7 +1985,7 @@ if test -n "$with_gallium_drivers"; then fi if test "x$enable_dri" = xyes; then - GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri-swrast" + GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri/swrast" fi ;; *) @@ -2199,7 +2199,6 @@ AC_CONFIG_FILES([Makefile src/gallium/state_trackers/xa/Makefile src/gallium/state_trackers/xvmc/Makefile src/gallium/targets/Makefile - src/gallium/targets/dri-swrast/Makefile src/gallium/targets/dri/Makefile src/gallium/targets/egl-static/Makefile src/gallium/targets/gbm/Makefile diff --git a/src/gallium/Automake.inc b/src/gallium/Automake.inc index bef16c8aff6..73d65a4d10f 100644 --- a/src/gallium/Automake.inc +++ b/src/gallium/Automake.inc @@ -26,21 +26,6 @@ GALLIUM_DRIVER_CXXFLAGS = \ $(DEFINES) \ $(VISIBILITY_CXXFLAGS) -GALLIUM_DRI_CFLAGS = \ - -I$(top_srcdir)/include \ - -I$(top_srcdir)/src/gallium/state_trackers/dri \ - -I$(top_srcdir)/src/mesa/drivers/dri/common \ - -I$(top_srcdir)/src/gallium/include \ - -I$(top_srcdir)/src/gallium/auxiliary \ - -I$(top_srcdir)/src/gallium/drivers \ - -I$(top_srcdir)/src/gallium/winsys \ - -I$(top_srcdir)/src/mesa \ - -I$(top_srcdir)/src/mapi \ - $(DEFINES) \ - $(PTHREAD_CFLAGS) \ - $(LIBDRM_CFLAGS) \ - $(VISIBILITY_CFLAGS) - GALLIUM_TARGET_CFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/src/loader \ @@ -53,35 +38,12 @@ GALLIUM_TARGET_CFLAGS = \ $(LIBDRM_CFLAGS) \ $(VISIBILITY_CFLAGS) - -GALLIUM_DRI_LINKER_FLAGS = \ - -shared \ - -shrext .so \ - -module \ - -avoid-version \ - $(GC_SECTIONS) - -if HAVE_LD_VERSION_SCRIPT -GALLIUM_DRI_LINKER_FLAGS += \ - -Wl,--version-script=$(top_srcdir)/src/gallium/targets/dri/dri.sym - -endif - - GALLIUM_COMMON_LIB_DEPS = \ -lm \ $(CLOCK_LIB) \ $(PTHREAD_LIBS) \ $(DLOPEN_LIBS) -GALLIUM_DRI_LIB_DEPS = \ - $(top_builddir)/src/mesa/libmesagallium.la \ - $(top_builddir)/src/gallium/auxiliary/libgallium.la \ - $(SELINUX_LIBS) \ - $(LIBDRM_LIBS) \ - $(EXPAT_LIBS) \ - $(GALLIUM_COMMON_LIB_DEPS) - GALLIUM_WINSYS_CFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/src/gallium/include \ @@ -89,11 +51,6 @@ GALLIUM_WINSYS_CFLAGS = \ $(DEFINES) \ $(VISIBILITY_CFLAGS) -if HAVE_MESA_LLVM -GALLIUM_DRI_LINKER_FLAGS += $(LLVM_LDFLAGS) -GALLIUM_DRI_LIB_DEPS += $(LLVM_LIBS) -endif - GALLIUM_PIPE_LOADER_WINSYS_LIBS = \ $(top_builddir)/src/gallium/winsys/sw/null/libws_null.la diff --git a/src/gallium/SConscript b/src/gallium/SConscript index df71b9aeada..8d9849e0009 100644 --- a/src/gallium/SConscript +++ b/src/gallium/SConscript @@ -107,7 +107,6 @@ if not env['embedded']: if env['dri']: SConscript([ - 'targets/dri-swrast/SConscript', 'targets/dri/SConscript', ]) diff --git a/src/gallium/auxiliary/target-helpers/inline_sw_helper.h b/src/gallium/auxiliary/target-helpers/inline_sw_helper.h index 596c691e9c1..8a144db09c3 100644 --- a/src/gallium/auxiliary/target-helpers/inline_sw_helper.h +++ b/src/gallium/auxiliary/target-helpers/inline_sw_helper.h @@ -57,5 +57,41 @@ sw_screen_create(struct sw_winsys *winsys) return sw_screen_create_named(winsys, driver); } +#if defined(GALLIUM_SOFTPIPE) +#if defined(DRI_TARGET) +#include "target-helpers/inline_debug_helper.h" +#include "sw/dri/dri_sw_winsys.h" +#include "dri_screen.h" + +const __DRIextension **__driDriverGetExtensions_swrast(void); + +PUBLIC const __DRIextension **__driDriverGetExtensions_swrast(void) +{ + globalDriverAPI = &galliumsw_driver_api; + return galliumsw_driver_extensions; +} + +INLINE struct pipe_screen * +drisw_create_screen(struct drisw_loader_funcs *lf) +{ + struct sw_winsys *winsys = NULL; + struct pipe_screen *screen = NULL; + + winsys = dri_create_sw_winsys(lf); + if (winsys == NULL) + return NULL; + + screen = sw_screen_create(winsys); + if (screen == NULL) { + winsys->destroy(winsys); + return NULL; + } + + screen = debug_screen_wrap(screen); + return screen; +} +#endif // DRI_TARGET +#endif // GALLIUM_SOFTPIPE + #endif diff --git a/src/gallium/targets/Makefile.am b/src/gallium/targets/Makefile.am index 5e0ecc34a77..3cacb040a7a 100644 --- a/src/gallium/targets/Makefile.am +++ b/src/gallium/targets/Makefile.am @@ -24,6 +24,10 @@ SUBDIRS = if HAVE_DRI2 SUBDIRS += dri +else +if HAVE_DRISW +SUBDIRS += dri +endif endif if HAVE_X11_DRIVER @@ -58,12 +62,6 @@ if HAVE_CLOVER SUBDIRS += opencl endif -if HAVE_GALLIUM_SOFTPIPE -if HAVE_DRISW -SUBDIRS += dri-swrast -endif -endif - if NEED_GALLIUM_LOADER SUBDIRS += pipe-loader endif diff --git a/src/gallium/targets/dri-swrast/Makefile.am b/src/gallium/targets/dri-swrast/Makefile.am deleted file mode 100644 index 3e3f1c7a2b0..00000000000 --- a/src/gallium/targets/dri-swrast/Makefile.am +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright © 2012 Intel Corporation -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice (including the next -# paragraph) shall be included in all copies or substantial portions of the -# Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -include $(top_srcdir)/src/gallium/Automake.inc - -AM_CFLAGS = \ - $(GALLIUM_DRI_CFLAGS) -AM_CPPFLAGS = \ - -DGALLIUM_RBUG \ - -DGALLIUM_TRACE \ - -DGALLIUM_SOFTPIPE - -dridir = $(DRI_DRIVER_INSTALL_DIR) -dri_LTLIBRARIES = swrast_dri.la - -nodist_EXTRA_swrast_dri_la_SOURCES = dummy.cpp -swrast_dri_la_SOURCES = swrast_drm_api.c - -swrast_dri_la_LDFLAGS = $(GALLIUM_DRI_LINKER_FLAGS) - -swrast_dri_la_LIBADD = \ - $(top_builddir)/src/mesa/drivers/dri/common/libdricommon.la \ - $(top_builddir)/src/mesa/drivers/dri/common/libmegadriver_stub.la \ - $(top_builddir)/src/gallium/state_trackers/dri/libdri.la \ - $(top_builddir)/src/gallium/winsys/sw/dri/libswdri.la \ - $(top_builddir)/src/gallium/drivers/softpipe/libsoftpipe.la \ - $(top_builddir)/src/gallium/drivers/trace/libtrace.la \ - $(top_builddir)/src/gallium/drivers/rbug/librbug.la \ - $(GALLIUM_DRI_LIB_DEPS) - -if HAVE_MESA_LLVM -AM_CPPFLAGS += -DGALLIUM_LLVMPIPE -swrast_dri_la_LIBADD += $(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la -endif - -include $(top_srcdir)/install-gallium-links.mk diff --git a/src/gallium/targets/dri-swrast/SConscript b/src/gallium/targets/dri-swrast/SConscript deleted file mode 100644 index 374444be2c6..00000000000 --- a/src/gallium/targets/dri-swrast/SConscript +++ /dev/null @@ -1,49 +0,0 @@ -Import('*') - -env = drienv.Clone() - -env.Append(CPPPATH = [ - '#/src/loader', - '#/src/mapi', - '#/src/mesa', - '#/src/mesa/drivers/dri/common', - '#/src/gallium/state_trackers/dri', -]) - -env.Prepend(LIBS = [ - st_dri, - ws_dri, - trace, - rbug, - mesa, - glsl, - gallium, - megadrivers_stub, - dri_common, -]) - -if True: - env.Append(CPPDEFINES = [ - 'GALLIUM_SOFTPIPE', - 'GALLIUM_RBUG', - 'GALLIUM_TRACE', - ]) - env.Prepend(LIBS = [softpipe]) - -if env['llvm']: - env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE') - env.Prepend(LIBS = [llvmpipe]) - -swrast_sources = [ - 'swrast_drm_api.c' -] - -module = env.LoadableModule( - target ='swrast_dri.so', - source = swrast_sources, - SHLIBPREFIX = '', -) - -module = env.InstallSharedLibrary(module) - -env.Alias('dri-swrast', module) diff --git a/src/gallium/targets/dri-swrast/swrast_drm_api.c b/src/gallium/targets/dri-swrast/swrast_drm_api.c deleted file mode 100644 index 102d5bd1a38..00000000000 --- a/src/gallium/targets/dri-swrast/swrast_drm_api.c +++ /dev/null @@ -1,74 +0,0 @@ -/************************************************************************** - * - * Copyright 2009, VMware, Inc. - * All Rights Reserved. - * Copyright 2010 George Sapountzis - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include "pipe/p_compiler.h" -#include "util/u_memory.h" - -#include "target-helpers/inline_debug_helper.h" -#include "target-helpers/inline_sw_helper.h" - -#include "state_tracker/drm_driver.h" -#include "sw/dri/dri_sw_winsys.h" -#include "dri_screen.h" - -const __DRIextension **__driDriverGetExtensions_swrast(void); - -PUBLIC const __DRIextension **__driDriverGetExtensions_swrast(void) -{ - globalDriverAPI = &galliumsw_driver_api; - return galliumsw_driver_extensions; -} - -DRM_DRIVER_DESCRIPTOR("swrast", NULL, NULL, NULL); - -struct pipe_screen * -drisw_create_screen(struct drisw_loader_funcs *lf) -{ - struct sw_winsys *winsys = NULL; - struct pipe_screen *screen = NULL; - - winsys = dri_create_sw_winsys(lf); - if (winsys == NULL) - return NULL; - - screen = sw_screen_create(winsys); - if (!screen) - goto fail; - - screen = debug_screen_wrap(screen); - - return screen; - -fail: - if (winsys) - winsys->destroy(winsys); - - return NULL; -} - -/* vim: set sw=3 ts=8 sts=3 expandtab: */ diff --git a/src/gallium/targets/dri/Makefile.am b/src/gallium/targets/dri/Makefile.am index 4da3e71d6af..61d6bc7aa3e 100644 --- a/src/gallium/targets/dri/Makefile.am +++ b/src/gallium/targets/dri/Makefile.am @@ -140,6 +140,20 @@ STATIC_TARGET_LIB_DEPS += \ endif +if HAVE_GALLIUM_SOFTPIPE +MEGADRIVERS += swrast +STATIC_TARGET_CPPFLAGS += -DGALLIUM_SOFTPIPE +STATIC_TARGET_LIB_DEPS += \ + $(top_builddir)/src/gallium/winsys/sw/dri/libswdri.la \ + $(top_builddir)/src/gallium/drivers/softpipe/libsoftpipe.la +endif + +if NEED_GALLIUM_LLVMPIPE_DRIVER +STATIC_TARGET_CPPFLAGS += -DGALLIUM_LLVMPIPE +STATIC_TARGET_LIB_DEPS += \ + $(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la +endif + gallium_dri_la_SOURCES += target.c AM_CPPFLAGS += $(STATIC_TARGET_CPPFLAGS) gallium_dri_la_LIBADD += $(STATIC_TARGET_LIB_DEPS) diff --git a/src/gallium/targets/dri/SConscript b/src/gallium/targets/dri/SConscript index 27e2047740e..faf370f2c34 100644 --- a/src/gallium/targets/dri/SConscript +++ b/src/gallium/targets/dri/SConscript @@ -18,11 +18,16 @@ if env['build'] == 'release': env.Append(CPPDEFINES = ['GALLIUM_RBUG']) env.Prepend(LIBS = [rbug]) else: - env.Append(CPPDEFINES = ['GALLIUM_TRACE', 'GALLIUM_RBUG', 'GALLIUM_GALAHAD', 'GALLIUM_SOFTPIPE']) - env.Prepend(LIBS = [trace, rbug, galahad, softpipe, ws_wrapper]) + env.Append(CPPDEFINES = ['GALLIUM_TRACE', 'GALLIUM_RBUG', 'GALLIUM_GALAHAD']) + env.Prepend(LIBS = [trace, rbug, galahad]) + +if env['llvm']: + env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE') + env.Prepend(LIBS = [llvmpipe]) env.Append(CPPDEFINES = [ 'GALLIUM_VMWGFX', + 'GALLIUM_SOFTPIPE', 'DRI_TARGET', ]) @@ -30,6 +35,8 @@ env.Prepend(LIBS = [ st_dri, svgadrm, svga, + ws_dri, + softpipe, libloader, mesa, glsl, @@ -39,9 +46,15 @@ env.Prepend(LIBS = [ ]) module = env.LoadableModule( - target = 'vmwgfx_dri.so', + target = 'gallium_dri.so', source = 'target.c', SHLIBPREFIX = '', ) +# vmwgfx_dri.so +env.Command('vmwgfx_dri.so', 'gallium_dri.so', "ln -f ${SOURCE} ${TARGET}") +# swrast_dri.so +env.Command('swrast_dri.so', 'gallium_dri.so', "ln -f ${SOURCE} ${TARGET}") + env.Alias('dri-vmwgfx', module) +env.Alias('dri-swrast', module) diff --git a/src/gallium/targets/dri/target.c b/src/gallium/targets/dri/target.c index fde4a4a7dcf..32a11ef6281 100644 --- a/src/gallium/targets/dri/target.c +++ b/src/gallium/targets/dri/target.c @@ -1 +1,2 @@ #include "target-helpers/inline_drm_helper.h" +#include "target-helpers/inline_sw_helper.h" -- 2.30.2