Mesa (master): radeonsi: add driconf options to enable/disable Smart Access Memory
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jan 5 03:04:53 UTC 2021
Module: Mesa
Branch: master
Commit: 31240a875c0d6174d8d1389d16572d9d5f872adc
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=31240a875c0d6174d8d1389d16572d9d5f872adc
Author: Marek Olšák <marek.olsak at amd.com>
Date: Thu Dec 24 07:04:07 2020 -0500
radeonsi: add driconf options to enable/disable Smart Access Memory
so that anybody can test it if they have Above 4G Decoding and compare
performance.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8225>
---
src/gallium/drivers/r300/r300_screen.c | 2 +-
src/gallium/drivers/r600/r600_pipe_common.c | 2 +-
src/gallium/drivers/r600/radeon_uvd.c | 2 +-
src/gallium/drivers/r600/radeon_video.c | 2 +-
src/gallium/drivers/radeon/radeon_winsys.h | 4 +++-
src/gallium/drivers/radeonsi/si_debug_options.h | 2 ++
src/gallium/drivers/radeonsi/si_pipe.c | 16 +++++++++-------
src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c | 13 +++++++++++--
src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 4 +++-
9 files changed, 32 insertions(+), 15 deletions(-)
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
index f1bcf9b80ba..c841e68c6e5 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -693,7 +693,7 @@ struct pipe_screen* r300_screen_create(struct radeon_winsys *rws,
return NULL;
}
- rws->query_info(rws, &r300screen->info);
+ rws->query_info(rws, &r300screen->info, false, false);
r300_init_debug(r300screen);
r300_parse_chipset(r300screen->info.pci_id, &r300screen->caps);
diff --git a/src/gallium/drivers/r600/r600_pipe_common.c b/src/gallium/drivers/r600/r600_pipe_common.c
index 101f98a722a..7d2909f2de5 100644
--- a/src/gallium/drivers/r600/r600_pipe_common.c
+++ b/src/gallium/drivers/r600/r600_pipe_common.c
@@ -1236,7 +1236,7 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen,
struct utsname uname_data;
const char *chip_name;
- ws->query_info(ws, &rscreen->info);
+ ws->query_info(ws, &rscreen->info, false, false);
rscreen->ws = ws;
chip_name = r600_get_family_name(rscreen);
diff --git a/src/gallium/drivers/r600/radeon_uvd.c b/src/gallium/drivers/r600/radeon_uvd.c
index 959f2ebbb06..adc246f1154 100644
--- a/src/gallium/drivers/r600/radeon_uvd.c
+++ b/src/gallium/drivers/r600/radeon_uvd.c
@@ -1044,7 +1044,7 @@ struct pipe_video_codec *ruvd_create_decoder(struct pipe_context *context,
struct ruvd_decoder *dec;
int r, i;
- ws->query_info(ws, &info);
+ ws->query_info(ws, &info, false, false);
switch(u_reduce_video_profile(templ->profile)) {
case PIPE_VIDEO_FORMAT_MPEG12:
diff --git a/src/gallium/drivers/r600/radeon_video.c b/src/gallium/drivers/r600/radeon_video.c
index 2229f2af65c..f3e2a088106 100644
--- a/src/gallium/drivers/r600/radeon_video.c
+++ b/src/gallium/drivers/r600/radeon_video.c
@@ -224,7 +224,7 @@ int rvid_get_video_param(struct pipe_screen *screen,
enum pipe_video_format codec = u_reduce_video_profile(profile);
struct radeon_info info;
- rscreen->ws->query_info(rscreen->ws, &info);
+ rscreen->ws->query_info(rscreen->ws, &info, false, false);
if (entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) {
switch (param) {
diff --git a/src/gallium/drivers/radeon/radeon_winsys.h b/src/gallium/drivers/radeon/radeon_winsys.h
index 0bd1cdbdbe6..3e4fa01c0cd 100644
--- a/src/gallium/drivers/radeon/radeon_winsys.h
+++ b/src/gallium/drivers/radeon/radeon_winsys.h
@@ -284,7 +284,9 @@ struct radeon_winsys {
* \param ws The winsys this function is called from.
* \param info Return structure
*/
- void (*query_info)(struct radeon_winsys *ws, struct radeon_info *info);
+ void (*query_info)(struct radeon_winsys *ws, struct radeon_info *info,
+ bool enable_smart_access_memory,
+ bool disable_smart_access_memory);
/**
* A hint for the winsys that it should pin its execution threads to
diff --git a/src/gallium/drivers/radeonsi/si_debug_options.h b/src/gallium/drivers/radeonsi/si_debug_options.h
index b550be72ba8..11af7e2d594 100644
--- a/src/gallium/drivers/radeonsi/si_debug_options.h
+++ b/src/gallium/drivers/radeonsi/si_debug_options.h
@@ -13,5 +13,7 @@ OPT_BOOL(clamp_div_by_zero, false, "Clamp div by zero (x / 0 becomes FLT_MAX ins
OPT_BOOL(no_trunc_coord, false, "Always set TRUNC_COORD=0")
OPT_BOOL(shader_culling, false, "Cull primitives in shaders when benefical (without tess and GS)")
OPT_BOOL(vrs2x2, false, "Enable 2x2 coarse shading for non-GUI elements")
+OPT_BOOL(enable_sam, false, "Enable Smart Access Memory with Above 4G Decoding for unvalidated platforms.")
+OPT_BOOL(disable_sam, false, "Disable Smart Access Memory.")
#undef OPT_BOOL
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index eb4a94c2a10..5c9775ee039 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -945,8 +945,16 @@ static struct pipe_screen *radeonsi_screen_create_impl(struct radeon_winsys *ws,
return NULL;
}
+ {
+#define OPT_BOOL(name, dflt, description) \
+ sscreen->options.name = driQueryOptionb(config->options, "radeonsi_" #name);
+#include "si_debug_options.h"
+ }
+
sscreen->ws = ws;
- ws->query_info(ws, &sscreen->info);
+ ws->query_info(ws, &sscreen->info,
+ sscreen->options.enable_sam,
+ sscreen->options.disable_sam);
/* Older LLVM have buggy v_pk_* instructions. */
sscreen->info.has_packed_math_16bit &= LLVM_VERSION_MAJOR >= 11;
@@ -1031,12 +1039,6 @@ static struct pipe_screen *radeonsi_screen_create_impl(struct radeon_winsys *ws,
return NULL;
}
- {
-#define OPT_BOOL(name, dflt, description) \
- sscreen->options.name = driQueryOptionb(config->options, "radeonsi_" #name);
-#include "si_debug_options.h"
- }
-
if (sscreen->info.chip_class < GFX10_3)
sscreen->options.vrs2x2 = false;
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
index ebc1cbe6498..94ade923611 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
@@ -186,9 +186,18 @@ static void amdgpu_winsys_destroy(struct radeon_winsys *rws)
}
static void amdgpu_winsys_query_info(struct radeon_winsys *rws,
- struct radeon_info *info)
+ struct radeon_info *info,
+ bool enable_smart_access_memory,
+ bool disable_smart_access_memory)
{
- *info = amdgpu_winsys(rws)->info;
+ struct amdgpu_winsys *ws = amdgpu_winsys(rws);
+
+ if (disable_smart_access_memory)
+ ws->info.smart_access_memory = false;
+ else if (enable_smart_access_memory && ws->info.all_vram_visible)
+ ws->info.smart_access_memory = true;
+
+ *info = ws->info;
}
static bool amdgpu_cs_request_feature(struct radeon_cmdbuf *rcs,
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
index ef7434d7589..2c5e3968cf8 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
@@ -645,7 +645,9 @@ static void radeon_winsys_destroy(struct radeon_winsys *rws)
}
static void radeon_query_info(struct radeon_winsys *rws,
- struct radeon_info *info)
+ struct radeon_info *info,
+ bool enable_smart_access_memory,
+ bool disable_smart_access_memory)
{
*info = ((struct radeon_drm_winsys *)rws)->info;
}
More information about the mesa-commit
mailing list