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@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8225>
This commit is contained in:
Marek Olšák
2020-12-24 07:04:07 -05:00
committed by Marge Bot
parent b94626d3ee
commit 31240a875c
9 changed files with 32 additions and 15 deletions

View File

@@ -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);

View File

@@ -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);

View File

@@ -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:

View File

@@ -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) {

View File

@@ -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

View File

@@ -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

View File

@@ -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;

View File

@@ -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,

View File

@@ -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;
}