I think actually I'll drop this commit entirely. Really it should be it's own stand-alone topic and probably be more pervasive than just the loader.
- Chuck <(518)%20881-1183> On Tue, Jan 16, 2018 at 2:59 PM, Chuck Atkins <chuck.atk...@kitware.com> wrote: > Signed-off-by: Chuck Atkins <chuck.atk...@kitware.com> > CC: Tim Rowley <timothy.o.row...@intel.com> > CC: Bruce Cherniak <bruce.chern...@intel.com> > --- > src/gallium/drivers/swr/swr_loader.cpp | 41 > +++++++++++++++++++++------------- > 1 file changed, 25 insertions(+), 16 deletions(-) > > diff --git a/src/gallium/drivers/swr/swr_loader.cpp > b/src/gallium/drivers/swr/swr_loader.cpp > index 57f826fd59..f4ae9cc115 100644 > --- a/src/gallium/drivers/swr/swr_loader.cpp > +++ b/src/gallium/drivers/swr/swr_loader.cpp > @@ -36,24 +36,31 @@ swr_create_screen(struct sw_winsys *winsys) > bool found = false; > bool is_knl = false; > > +#ifdef DEBUG > + bool mesa_debug = true; > +#else > + bool mesa_debug = getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG"); > +#endif > + > #ifndef HAVE_SWR_BUILTIN > char filename[256] = { 0 }; > #endif > > +#define debug_printf(...) if(mesa_debug) { fprintf(stderr, __VA_ARGS__); } > > util_cpu_detect(); > > if (!found && util_cpu_caps.has_avx512f && util_cpu_caps.has_avx512er) > { > - fprintf(stderr, "SWR detected KNL instruction support "); > + debug_printf("SWR detected KNL instruction support "); > #ifndef HAVE_SWR_KNL > - fprintf(stderr, "(skipping; not built).\n"); > + debug_printf("(skipping; not built).\n"); > #else > #ifdef HAVE_SWR_BUILTIN > swr_screen(screen)->pfnSwrGetInterface = SwrGetInterface; > - fprintf(stderr, "(using; builtin).\n"); > + debug_printf("(using; builtin).\n"); > #else > sprintf(filename, "%s%s%s", UTIL_DL_PREFIX, "swrKNL", UTIL_DL_EXT); > - fprintf(stderr, "(using; %s).\n", filename); > + debug_printf("(using; %s).\n", filename); > #endif > found = true; > is_knl = true; > @@ -61,53 +68,55 @@ swr_create_screen(struct sw_winsys *winsys) > } > > if (!found && util_cpu_caps.has_avx512f && util_cpu_caps.has_avx512bw) > { > - fprintf(stderr, "SWR detected SKX instruction support "); > + debug_printf("SWR detected SKX instruction support "); > #ifndef HAVE_SWR_SKX > - fprintf(stderr, "(skipping; not built).\n"); > + debug_printf("(skipping; not built).\n"); > #else > #ifdef HAVE_SWR_BUILTIN > swr_screen(screen)->pfnSwrGetInterface = SwrGetInterface; > - fprintf(stderr, "(using; builtin).\n"); > + debug_printf("(using; builtin).\n"); > #else > sprintf(filename, "%s%s%s", UTIL_DL_PREFIX, "swrSKX", UTIL_DL_EXT); > - fprintf(stderr, "(using; %s).\n", filename); > + debug_printf("(using; %s).\n", filename); > #endif > found = true; > #endif > } > > if (!found && util_cpu_caps.has_avx2) { > - fprintf(stderr, "SWR detected AVX2 instruction support "); > + debug_printf("SWR detected AVX2 instruction support "); > #ifndef HAVE_SWR_AVX2 > - fprintf(stderr, "(skipping; not built).\n"); > + debug_printf("(skipping; not built).\n"); > #else > #ifdef HAVE_SWR_BUILTIN > swr_screen(screen)->pfnSwrGetInterface = SwrGetInterface; > - fprintf(stderr, "(using; builtin).\n"); > + debug_printf("(using; builtin).\n"); > #else > sprintf(filename, "%s%s%s", UTIL_DL_PREFIX, "swrAVX2", UTIL_DL_EXT); > - fprintf(stderr, "(using; %s).\n", filename); > + debug_printf("(using; %s).\n", filename); > #endif > found = true; > #endif > } > > if (!found && util_cpu_caps.has_avx) { > - fprintf(stderr, "SWR detected AVX instruction support "); > + debug_printf("SWR detected AVX instruction support "); > #ifndef HAVE_SWR_AVX > - fprintf(stderr, "(skipping; not built).\n"); > + debug_printf("(skipping; not built).\n"); > #else > #ifdef HAVE_SWR_BUILTIN > swr_screen(screen)->pfnSwrGetInterface = SwrGetInterface; > - fprintf(stderr, "(using; builtin).\n"); > + debug_printf("(using; builtin).\n"); > #else > sprintf(filename, "%s%s%s", UTIL_DL_PREFIX, "swrAVX", UTIL_DL_EXT); > - fprintf(stderr, "(using; %s).\n", filename); > + debug_printf("(using; %s).\n", filename); > #endif > found = true; > #endif > } > > +#undef debug_printf > + > if (!found) { > fprintf(stderr, "SWR could not detect a supported CPU > architecture.\n"); > exit(-1); > -- > 2.14.3 > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev >
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev