diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/swr/Makefile.am | 17 | ||||
-rw-r--r-- | src/gallium/drivers/swr/SConscript | 1 | ||||
-rw-r--r-- | src/gallium/drivers/swr/swr_loader.cpp | 30 |
3 files changed, 40 insertions, 8 deletions
diff --git a/src/gallium/drivers/swr/Makefile.am b/src/gallium/drivers/swr/Makefile.am index 74612280fe7..f38ce7b1d97 100644 --- a/src/gallium/drivers/swr/Makefile.am +++ b/src/gallium/drivers/swr/Makefile.am @@ -55,6 +55,14 @@ libmesaswr_la_CXXFLAGS = \ $(SWR_AVX_CXXFLAGS) \ $(COMMON_CXXFLAGS) +if HAVE_SWR_AVX +libmesaswr_la_CXXFLAGS += -DHAVE_SWR_AVX +endif + +if HAVE_SWR_AVX2 +libmesaswr_la_CXXFLAGS += -DHAVE_SWR_AVX2 +endif + COMMON_SOURCES = \ $(ARCHRAST_CXX_SOURCES) \ $(COMMON_CXX_SOURCES) \ @@ -224,7 +232,10 @@ COMMON_LDFLAGS = \ $(GC_SECTIONS) \ $(NO_UNDEFINED) -lib_LTLIBRARIES = libswrAVX.la libswrAVX2.la +lib_LTLIBRARIES = + +if HAVE_SWR_AVX +lib_LTLIBRARIES += libswrAVX.la libswrAVX_la_CXXFLAGS = \ $(SWR_AVX_CXXFLAGS) \ @@ -236,7 +247,10 @@ libswrAVX_la_SOURCES = \ libswrAVX_la_LDFLAGS = \ $(COMMON_LDFLAGS) +endif +if HAVE_SWR_AVX2 +lib_LTLIBRARIES += libswrAVX2.la libswrAVX2_la_CXXFLAGS = \ $(SWR_AVX2_CXXFLAGS) \ -DKNOB_ARCH=KNOB_ARCH_AVX2 \ @@ -247,6 +261,7 @@ libswrAVX2_la_SOURCES = \ libswrAVX2_la_LDFLAGS = \ $(COMMON_LDFLAGS) +endif include $(top_srcdir)/install-gallium-links.mk diff --git a/src/gallium/drivers/swr/SConscript b/src/gallium/drivers/swr/SConscript index cdfb91a5bba..a32807d36bd 100644 --- a/src/gallium/drivers/swr/SConscript +++ b/src/gallium/drivers/swr/SConscript @@ -245,6 +245,7 @@ source += [ # main SWR lib envSWR = envavx.Clone() # pick up the arch flag for intrinsic usage +envSWR.Append(CPPDEFINES = ['HAVE_SWR_AVX', 'HAVE_SWR_AVX2']) swr = envSWR.ConvenienceLibrary( target = 'swr', source = source, diff --git a/src/gallium/drivers/swr/swr_loader.cpp b/src/gallium/drivers/swr/swr_loader.cpp index d56fb0e59fb..4aa850a6b8d 100644 --- a/src/gallium/drivers/swr/swr_loader.cpp +++ b/src/gallium/drivers/swr/swr_loader.cpp @@ -31,22 +31,38 @@ struct pipe_screen * swr_create_screen(struct sw_winsys *winsys) { - char filename[256]; + char filename[256] = { 0 }; fprintf(stderr, "SWR detected "); util_dl_library *pLibrary = nullptr; util_cpu_detect(); - if (util_cpu_caps.has_avx2) { - fprintf(stderr, "AVX2\n"); + + if (!strlen(filename) && util_cpu_caps.has_avx2) { +#if HAVE_SWR_AVX2 + fprintf(stderr, "AVX2 "); sprintf(filename, "%s%s%s", UTIL_DL_PREFIX, "swrAVX2", UTIL_DL_EXT); - } else if (util_cpu_caps.has_avx) { - fprintf(stderr, "AVX\n"); +#else + fprintf(stderr, "AVX2 (not built) "); +#endif + } + + if (!strlen(filename) && util_cpu_caps.has_avx) { +#if HAVE_SWR_AVX + fprintf(stderr, "AVX "); sprintf(filename, "%s%s%s", UTIL_DL_PREFIX, "swrAVX", UTIL_DL_EXT); - } else { - fprintf(stderr, "no AVX/AVX2 support. Aborting!\n"); +#else + fprintf(stderr, "AVX (not built) "); +#endif + } + + if (!strlen(filename)) { + fprintf(stderr, "- no appropriate swr architecture library. Aborting!\n"); exit(-1); + } else { + fprintf(stderr, "\n"); } + pLibrary = util_dl_open(filename); if (!pLibrary) { |