radv: report APUs as discrete GPUs for Red Dead Redemption 2

On APUs, we fake heaps to simulate a dGPU setup because it seems to
have the maximum compatibility. Though, some applications like RDR2
still only looks at GTT if the driver reports an iGPU which means it
will only use 1/3rd of total memory available.

This is currently behind a drirc option because it might have
implications for other apps but we might want to extend this later
if everything is fine.

Cc: 21.2 mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11891>
This commit is contained in:
Samuel Pitoiset 2021-07-14 11:40:15 +02:00 committed by Marge Bot
parent 7a1cc56e40
commit cadf2d63b7
4 changed files with 22 additions and 2 deletions

View File

@ -863,6 +863,7 @@ static const driOptionDescription radv_dri_options[] = {
DRI_CONF_RADV_INVARIANT_GEOM(false)
DRI_CONF_RADV_DISABLE_TC_COMPAT_HTILE_GENERAL(false)
DRI_CONF_RADV_DISABLE_DCC(false)
DRI_CONF_RADV_REPORT_APU_AS_DGPU(false)
DRI_CONF_SECTION_END
};
// clang-format on
@ -902,6 +903,9 @@ radv_init_dri_options(struct radv_instance *instance)
if (driQueryOptionb(&instance->dri_options, "radv_disable_dcc"))
instance->debug_flags |= RADV_DEBUG_NO_DCC;
instance->report_apu_as_dgpu =
driQueryOptionb(&instance->dri_options, "radv_report_apu_as_dgpu");
}
VkResult
@ -1826,13 +1830,20 @@ radv_GetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice,
.nonCoherentAtomSize = 64,
};
VkPhysicalDeviceType device_type;
if (pdevice->rad_info.has_dedicated_vram || pdevice->instance->report_apu_as_dgpu) {
device_type = VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU;
} else {
device_type = VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU;
}
*pProperties = (VkPhysicalDeviceProperties){
.apiVersion = RADV_API_VERSION,
.driverVersion = vk_get_driver_version(),
.vendorID = ATI_VENDOR_ID,
.deviceID = pdevice->rad_info.pci_id,
.deviceType = pdevice->rad_info.has_dedicated_vram ? VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU
: VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU,
.deviceType = device_type,
.limits = limits,
.sparseProperties =
{

View File

@ -333,6 +333,7 @@ struct radv_instance {
bool disable_tc_compat_htile_in_general;
bool disable_shrink_image_store;
bool absolute_depth_bias;
bool report_apu_as_dgpu;
};
VkResult radv_init_wsi(struct radv_physical_device *physical_device);

View File

@ -843,5 +843,9 @@ TODO: document the other workarounds.
<application name="Wolfenstein II" application_name_match="Wolfenstein II The New Colossus">
<option name="radv_disable_dcc" value="true" />
</application>
<application name="RDR2" application_name_match="Red Dead Redemption 2">
<option name="radv_report_apu_as_dgpu" value="true" />
</application>
</device>
</driconf>

View File

@ -513,4 +513,8 @@
DRI_CONF_OPT_B(radv_disable_dcc, def, \
"Disable DCC for color images")
#define DRI_CONF_RADV_REPORT_APU_AS_DGPU(def) \
DRI_CONF_OPT_B(radv_report_apu_as_dgpu, def, \
"Report APUs as discrete GPUs instead of integrated GPUs")
#endif