summaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2017-11-18 23:23:04 +0100
committerNicolai Hähnle <[email protected]>2018-12-19 12:01:25 +0100
commitec22dd34c88f8b24a1b4f5b25f4de2aa89f0cad4 (patch)
treef9a65824c6e55261308611d9793662628ce806d4 /src/gallium/winsys
parent0ef263d62f450b5a064b7acd2252a3c7fe6838d0 (diff)
radeonsi: move SI_FORCE_FAMILY functionality to winsys
This helps some debugging cases by initializing addrlib with slightly more appropriate settings. Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r--src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
index 6b7f484f239..79d2c1345ef 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
@@ -38,6 +38,7 @@
#include <xf86drm.h>
#include <stdio.h>
#include <sys/stat.h>
+#include "amd/common/ac_llvm_util.h"
#include "amd/common/sid.h"
#include "amd/common/gfx9d.h"
@@ -50,6 +51,39 @@ static simple_mtx_t dev_tab_mutex = _SIMPLE_MTX_INITIALIZER_NP;
DEBUG_GET_ONCE_BOOL_OPTION(all_bos, "RADEON_ALL_BOS", false)
+static void handle_env_var_force_family(struct amdgpu_winsys *ws)
+{
+ const char *family = debug_get_option("SI_FORCE_FAMILY", NULL);
+ unsigned i;
+
+ if (!family)
+ return;
+
+ for (i = CHIP_TAHITI; i < CHIP_LAST; i++) {
+ if (!strcmp(family, ac_get_llvm_processor_name(i))) {
+ /* Override family and chip_class. */
+ ws->info.family = i;
+ ws->info.name = "GCN-NOOP";
+
+ if (i >= CHIP_VEGA10)
+ ws->info.chip_class = GFX9;
+ else if (i >= CHIP_TONGA)
+ ws->info.chip_class = VI;
+ else if (i >= CHIP_BONAIRE)
+ ws->info.chip_class = CIK;
+ else
+ ws->info.chip_class = SI;
+
+ /* Don't submit any IBs. */
+ setenv("RADEON_NOOP", "1", 1);
+ return;
+ }
+ }
+
+ fprintf(stderr, "radeonsi: Unknown family: %s\n", family);
+ exit(1);
+}
+
/* Helper function to do the ioctls needed for setup and init. */
static bool do_winsys_init(struct amdgpu_winsys *ws,
const struct pipe_screen_config *config,
@@ -58,6 +92,8 @@ static bool do_winsys_init(struct amdgpu_winsys *ws,
if (!ac_query_gpu_info(fd, ws->dev, &ws->info, &ws->amdinfo))
goto fail;
+ handle_env_var_force_family(ws);
+
ws->addrlib = amdgpu_addr_create(&ws->info, &ws->amdinfo, &ws->info.max_alignment);
if (!ws->addrlib) {
fprintf(stderr, "amdgpu: Cannot create addrlib.\n");