radeonsi: Smart Access Memory not being enabled by default?
So I have the following in my ~/.drirc:
<?xml version="1.0" standalone="yes"?>
<driconf>
<device>
<application name="Default">
<option name="radeonsi_enable_sam" value="true" />
</application>
</device>
</driconf>
to enable SAM by default. radeonsi isn't set up to enable it by default except on chip class GFX10_3 (looks like RX 6000 series) and Zen 3 CPUs, I'm using an RX 5500 XT and Intel i5-7500 CPU, and this setup does activate resizable BAR at the kernel level as the BIOS setting to enable above 4G decoding is enabled, but having the default limitation in radeonsi for now makes sense I suppose.
That override in .drirc does appear to work:
$ AMD_DEBUG=info glxinfo | grep smart
smart_access_memory = 1
However, in the process of stepping through code in gdb to debug whether that override was working, I noticed that in Mesa git as of now, when this code in src/amd/common/ac_gpu_info.c (line 556, in ac_query_gpu_info) is executed:
info->smart_access_memory = info->all_vram_visible &&
info->chip_class >= GFX10_3 &&
util_get_cpu_caps()->family >= CPU_AMD_ZEN3 &&
util_get_cpu_caps()->family < CPU_AMD_LAST;
the info->chip_class variable appears to be still set to CLASS_UNKNOWN since it is only set based on the chip family farther down in the function (between lines 639-650). So the info->chip_class >= GFX10_3
check presumably will always fail, and SAM will not be activated by default even on systems where it should be. The chunk of code above presumably should be moved down to after chip_class has been set.