diff options
author | Tim Rowley <[email protected]> | 2017-06-29 14:37:07 -0500 |
---|---|---|
committer | Tim Rowley <[email protected]> | 2017-07-11 13:38:20 -0500 |
commit | f50aa21456d82c8cb6fbaa565835f1acc1720a5d (patch) | |
tree | 1d646268c57b3c42bdeee271d3243964fc6e45ab /src/gallium/drivers/swr | |
parent | 50cd222116b40e4df2462cb25a92960d557c9144 (diff) |
swr: build driver proper separate from rasterizer
swr used to build and link the rasterizer to the driver, and to support
multiple architectures we needed to have multiple versions of the
driver/rasterizer combination, which needed to link in much of mesa.
Changing to having one instance of the driver and just building
architecture specific versions of the rasterizer gives a large reduction
in disk space.
libGL.so 6464 Kb -> 7000 Kb
libswrAVX.so 10068 Kb -> 5432 Kb
libswrAVX2.so 9828 Kb -> 5200 Kb
Total 26360 Kb -> 17632 Kb
Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/gallium/drivers/swr')
-rw-r--r-- | src/gallium/drivers/swr/Makefile.am | 31 | ||||
-rw-r--r-- | src/gallium/drivers/swr/SConscript | 26 | ||||
-rw-r--r-- | src/gallium/drivers/swr/swr_context.cpp | 2 | ||||
-rw-r--r-- | src/gallium/drivers/swr/swr_loader.cpp | 14 | ||||
-rw-r--r-- | src/gallium/drivers/swr/swr_screen.h | 2 |
5 files changed, 36 insertions, 39 deletions
diff --git a/src/gallium/drivers/swr/Makefile.am b/src/gallium/drivers/swr/Makefile.am index 4b4bd3793b3..74612280fe7 100644 --- a/src/gallium/drivers/swr/Makefile.am +++ b/src/gallium/drivers/swr/Makefile.am @@ -26,7 +26,14 @@ AM_CXXFLAGS = $(GALLIUM_DRIVER_CFLAGS) $(SWR_CXX11_CXXFLAGS) noinst_LTLIBRARIES = libmesaswr.la -libmesaswr_la_SOURCES = $(LOADER_SOURCES) +# gen_knobs.* included here to provide driver access to swr configuration +libmesaswr_la_SOURCES = \ + $(CXX_SOURCES) \ + $(COMMON_CXX_SOURCES) \ + $(JITTER_CXX_SOURCES) \ + rasterizer/codegen/gen_knobs.cpp \ + rasterizer/codegen/gen_knobs.h \ + $(LOADER_SOURCES) COMMON_CXXFLAGS = \ -fno-strict-aliasing \ @@ -43,12 +50,15 @@ COMMON_CXXFLAGS = \ -I$(srcdir)/rasterizer/jitter \ -I$(srcdir)/rasterizer/archrast +# SWR_AVX_CXXFLAGS needed for intrinsic usage in swr api headers +libmesaswr_la_CXXFLAGS = \ + $(SWR_AVX_CXXFLAGS) \ + $(COMMON_CXXFLAGS) + COMMON_SOURCES = \ - $(CXX_SOURCES) \ $(ARCHRAST_CXX_SOURCES) \ $(COMMON_CXX_SOURCES) \ $(CORE_CXX_SOURCES) \ - $(JITTER_CXX_SOURCES) \ $(MEMORY_CXX_SOURCES) \ $(BUILT_SOURCES) @@ -207,19 +217,12 @@ rasterizer.intermediate: rasterizer/codegen/gen_backends.py rasterizer/codegen/t --cpp \ --hpp -COMMON_LIBADD = \ - $(top_builddir)/src/gallium/auxiliary/libgallium.la \ - $(top_builddir)/src/mesa/libmesagallium.la \ - $(LLVM_LIBS) - COMMON_LDFLAGS = \ -shared \ -module \ -no-undefined \ $(GC_SECTIONS) \ - $(NO_UNDEFINED) \ - $(LLVM_LDFLAGS) - + $(NO_UNDEFINED) lib_LTLIBRARIES = libswrAVX.la libswrAVX2.la @@ -231,9 +234,6 @@ libswrAVX_la_CXXFLAGS = \ libswrAVX_la_SOURCES = \ $(COMMON_SOURCES) -libswrAVX_la_LIBADD = \ - $(COMMON_LIBADD) - libswrAVX_la_LDFLAGS = \ $(COMMON_LDFLAGS) @@ -245,9 +245,6 @@ libswrAVX2_la_CXXFLAGS = \ libswrAVX2_la_SOURCES = \ $(COMMON_SOURCES) -libswrAVX2_la_LIBADD = \ - $(COMMON_LIBADD) - libswrAVX2_la_LDFLAGS = \ $(COMMON_LDFLAGS) diff --git a/src/gallium/drivers/swr/SConscript b/src/gallium/drivers/swr/SConscript index 512269afbef..cdfb91a5bba 100644 --- a/src/gallium/drivers/swr/SConscript +++ b/src/gallium/drivers/swr/SConscript @@ -30,12 +30,6 @@ else: llvm_includedir = env.backtick('%s --includedir' % llvm_config).rstrip() print "llvm include dir %s" % llvm_includedir -# the loader is included in the mesa lib itself -# All the remaining files are in loadable modules -loadersource = env.ParseSourceList('Makefile.sources', [ - 'LOADER_SOURCES' -]) - if not env['msvc'] : env.Append(CCFLAGS = [ '-std=c++11', @@ -191,16 +185,12 @@ built_sources += [backendPixelRateFiles, genRasterizerFiles] source = built_sources source += env.ParseSourceList(swrroot + 'Makefile.sources', [ - 'CXX_SOURCES', 'ARCHRAST_CXX_SOURCES', 'COMMON_CXX_SOURCES', 'CORE_CXX_SOURCES', - 'JITTER_CXX_SOURCES', 'MEMORY_CXX_SOURCES' ]) -env.Prepend(LIBS = [ mesautil, mesa, gallium ]) - env.Prepend(CPPPATH = [ '.', 'rasterizer', @@ -242,14 +232,24 @@ swrAVX2 = envavx2.SharedLibrary( ) env.Alias('swrAVX2', swrAVX2) +source = env.ParseSourceList(swrroot + 'Makefile.sources', [ + 'CXX_SOURCES', + 'COMMON_CXX_SOURCES', + 'JITTER_CXX_SOURCES', + 'LOADER_SOURCES' +]) +source += [ + 'rasterizer/codegen/gen_knobs.cpp', + 'rasterizer/archrast/gen_ar_event.cpp', + ] # main SWR lib -swr = env.ConvenienceLibrary( +envSWR = envavx.Clone() # pick up the arch flag for intrinsic usage +swr = envSWR.ConvenienceLibrary( target = 'swr', - source = loadersource, + source = source, ) - # treat arch libs as dependencies, even though they are not linked # into swr, so we don't have to build them separately Depends(swr, ['swrAVX', 'swrAVX2']) diff --git a/src/gallium/drivers/swr/swr_context.cpp b/src/gallium/drivers/swr/swr_context.cpp index 9648278c691..c058870f276 100644 --- a/src/gallium/drivers/swr/swr_context.cpp +++ b/src/gallium/drivers/swr/swr_context.cpp @@ -467,7 +467,7 @@ swr_create_context(struct pipe_screen *p_screen, void *priv, unsigned flags) AlignedMalloc(sizeof(struct swr_context), KNOB_SIMD_BYTES); memset(ctx, 0, sizeof(struct swr_context)); - SwrGetInterface(ctx->api); + swr_screen(p_screen)->pfnSwrGetInterface(ctx->api); ctx->swrDC.pAPI = &ctx->api; ctx->blendJIT = diff --git a/src/gallium/drivers/swr/swr_loader.cpp b/src/gallium/drivers/swr/swr_loader.cpp index 4d71a671044..d56fb0e59fb 100644 --- a/src/gallium/drivers/swr/swr_loader.cpp +++ b/src/gallium/drivers/swr/swr_loader.cpp @@ -24,13 +24,10 @@ #include "util/u_cpu_detect.h" #include "util/u_dl.h" #include "swr_public.h" - -#include "pipe/p_screen.h" +#include "swr_screen.h" #include <stdio.h> -typedef pipe_screen *(*screen_create_proc)(struct sw_winsys *winsys); - struct pipe_screen * swr_create_screen(struct sw_winsys *winsys) { @@ -57,16 +54,17 @@ swr_create_screen(struct sw_winsys *winsys) exit(-1); } - util_dl_proc pScreenProc = util_dl_get_proc_address(pLibrary, "swr_create_screen_internal"); + util_dl_proc pApiProc = util_dl_get_proc_address(pLibrary, "SwrGetInterface"); - if (!pScreenProc) { + if (!pApiProc) { fprintf(stderr, "SWR library search failure: %s\n", util_dl_error()); exit(-1); } - screen_create_proc pScreenCreate = (screen_create_proc)pScreenProc; + struct pipe_screen *screen = swr_create_screen_internal(winsys); + swr_screen(screen)->pfnSwrGetInterface = (PFNSwrGetInterface)pApiProc; - return pScreenCreate(winsys); + return screen; } diff --git a/src/gallium/drivers/swr/swr_screen.h b/src/gallium/drivers/swr/swr_screen.h index dc1bb47f02d..a10f4265354 100644 --- a/src/gallium/drivers/swr/swr_screen.h +++ b/src/gallium/drivers/swr/swr_screen.h @@ -47,6 +47,8 @@ struct swr_screen { uint8_t msaa_max_count; HANDLE hJitMgr; + + PFNSwrGetInterface pfnSwrGetInterface; }; static INLINE struct swr_screen * |