gallium/swr: Disable showing detected arch message.

When swr driver is in use it print detected architecture
message to std::err. It can be harmfull when swr is using
in multinodes environments.
It can be enabled setting env var SWR_PRINT_INFO to 1.

Reviewed-by: Jan Zielinski <jan.zielinski@intel.com>
This commit is contained in:
Krzysztof Raszkowski 2020-01-17 16:43:33 +01:00
parent b9b393f0ce
commit ad820d5aca
3 changed files with 29 additions and 16 deletions

View File

@ -38,7 +38,7 @@ swr_initialize_screen_interface(struct swr_screen *screen, const char arch[])
screen->pfnSwrGetInterface = SwrGetInterface;
screen->pfnSwrGetInterface = SwrGetTileInterface;
InitTilesTable();
fprintf(stderr, "(using: builtin).\n");
swr_print_info("(using: builtin).\n");
#else
char filename[256] = { 0 };
sprintf(filename, "%sswr%s%s", UTIL_DL_PREFIX, arch, UTIL_DL_EXT);
@ -71,8 +71,9 @@ swr_initialize_screen_interface(struct swr_screen *screen, const char arch[])
pInitFunc();
fprintf(stderr, "(using: %s).\n", filename);
swr_print_info("(using: %s).\n", filename);
#endif
return true;
}
@ -91,9 +92,9 @@ swr_create_screen(struct sw_winsys *winsys)
util_cpu_detect();
if (util_cpu_caps.has_avx512f && util_cpu_caps.has_avx512er) {
fprintf(stderr, "SWR detected KNL instruction support ");
swr_print_info("SWR detected KNL instruction support ");
#ifndef HAVE_SWR_KNL
fprintf(stderr, "(skipping: not built).\n");
swr_print_info("(skipping: not built).\n");
#else
if (swr_initialize_screen_interface(screen, "KNL")) {
screen->is_knl = true;
@ -103,9 +104,9 @@ swr_create_screen(struct sw_winsys *winsys)
}
if (util_cpu_caps.has_avx512f && util_cpu_caps.has_avx512bw) {
fprintf(stderr, "SWR detected SKX instruction support ");
swr_print_info("SWR detected SKX instruction support ");
#ifndef HAVE_SWR_SKX
fprintf(stderr, "(skipping not built).\n");
swr_print_info("(skipping not built).\n");
#else
if (swr_initialize_screen_interface(screen, "SKX"))
return p_screen;
@ -113,9 +114,9 @@ swr_create_screen(struct sw_winsys *winsys)
}
if (util_cpu_caps.has_avx2) {
fprintf(stderr, "SWR detected AVX2 instruction support ");
swr_print_info("SWR detected AVX2 instruction support ");
#ifndef HAVE_SWR_AVX2
fprintf(stderr, "(skipping not built).\n");
swr_print_info("(skipping not built).\n");
#else
if (swr_initialize_screen_interface(screen, "AVX2"))
return p_screen;
@ -123,9 +124,9 @@ swr_create_screen(struct sw_winsys *winsys)
}
if (util_cpu_caps.has_avx) {
fprintf(stderr, "SWR detected AVX instruction support ");
swr_print_info("SWR detected AVX instruction support ");
#ifndef HAVE_SWR_AVX
fprintf(stderr, "(skipping not built).\n");
swr_print_info("(skipping not built).\n");
#else
if (swr_initialize_screen_interface(screen, "AVX"))
return p_screen;

View File

@ -783,7 +783,7 @@ swr_texture_layout(struct swr_screen *screen,
* surface sample count. */
if (screen->msaa_force_enable) {
res->swr.numSamples = screen->msaa_max_count;
fprintf(stderr,"swr_texture_layout: forcing sample count: %d\n",
swr_print_info("swr_texture_layout: forcing sample count: %d\n",
res->swr.numSamples);
}
} else {
@ -1123,7 +1123,7 @@ swr_destroy_screen(struct pipe_screen *p_screen)
struct swr_screen *screen = swr_screen(p_screen);
struct sw_winsys *winsys = screen->winsys;
fprintf(stderr, "SWR destroy screen!\n");
swr_print_info("SWR destroy screen!\n");
if (winsys->destroy)
winsys->destroy(winsys);
@ -1157,12 +1157,11 @@ swr_validate_env_options(struct swr_screen *screen)
fprintf(stderr, "must be power of 2 between 1 and %d" \
" (or 1 to disable msaa)\n",
SWR_MAX_NUM_MULTISAMPLES);
fprintf(stderr, "(msaa disabled)\n");
msaa_max_count = 1;
}
fprintf(stderr, "SWR_MSAA_MAX_COUNT: %d\n", msaa_max_count);
if (msaa_max_count == 1)
fprintf(stderr, "(msaa disabled)\n");
swr_print_info("SWR_MSAA_MAX_COUNT: %d\n", msaa_max_count);
screen->msaa_max_count = msaa_max_count;
}
@ -1170,7 +1169,7 @@ swr_validate_env_options(struct swr_screen *screen)
screen->msaa_force_enable = debug_get_bool_option(
"SWR_MSAA_FORCE_ENABLE", false);
if (screen->msaa_force_enable)
fprintf(stderr, "SWR_MSAA_FORCE_ENABLE: true\n");
swr_print_info("SWR_MSAA_FORCE_ENABLE: true\n");
}

View File

@ -34,6 +34,8 @@
#include "memory/TilingFunctions.h"
#include "memory/InitMemory.h"
#include <stdio.h>
#include <stdarg.h>
struct sw_winsys;
@ -70,4 +72,15 @@ swr_screen(struct pipe_screen *pipe)
SWR_FORMAT
mesa_to_swr_format(enum pipe_format format);
static void swr_print_info(const char *format, ...)
{
static bool print_info = debug_get_bool_option("SWR_PRINT_INFO", false);
if(print_info) {
va_list args;
va_start(args, format);
vfprintf(stderr, format, args);
va_end(args);
}
}
#endif