summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorKrzysztof Raszkowski <[email protected]>2020-01-17 16:43:33 +0100
committerKrzysztof Raszkowski <[email protected]>2020-01-17 16:41:53 +0000
commitad820d5aca1b5d2133a7e7bd380c91401cd1c1e3 (patch)
treec4d814f266226bea0b35bd78f2d618acc4ce7c51 /src/gallium
parentb9b393f0ce4e8df85f2e7eafeb409b032819e33d (diff)
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 <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/swr/swr_loader.cpp21
-rw-r--r--src/gallium/drivers/swr/swr_screen.cpp11
-rw-r--r--src/gallium/drivers/swr/swr_screen.h13
3 files changed, 29 insertions, 16 deletions
diff --git a/src/gallium/drivers/swr/swr_loader.cpp b/src/gallium/drivers/swr/swr_loader.cpp
index f597b5015e4..d9211315e58 100644
--- a/src/gallium/drivers/swr/swr_loader.cpp
+++ b/src/gallium/drivers/swr/swr_loader.cpp
@@ -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;
diff --git a/src/gallium/drivers/swr/swr_screen.cpp b/src/gallium/drivers/swr/swr_screen.cpp
index b2e3132b2a7..a27462f1a45 100644
--- a/src/gallium/drivers/swr/swr_screen.cpp
+++ b/src/gallium/drivers/swr/swr_screen.cpp
@@ -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");
}
diff --git a/src/gallium/drivers/swr/swr_screen.h b/src/gallium/drivers/swr/swr_screen.h
index fac2a5ea8c7..8c79acfea4c 100644
--- a/src/gallium/drivers/swr/swr_screen.h
+++ b/src/gallium/drivers/swr/swr_screen.h
@@ -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