radv: Expose the ETC2 emulation.

As needed on Android (as it is required) and by driconf flag otherwise.
The non-Android case would be on the host side for an Android VM.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14071>
This commit is contained in:
Bas Nieuwenhuizen 2021-12-06 03:39:01 +01:00 committed by Marge Bot
parent a8078bab91
commit 9e8fa8168b
2 changed files with 11 additions and 1 deletions

View file

@ -691,7 +691,12 @@ radv_physical_device_try_create(struct radv_instance *instance, drmDevicePtr drm
}
#endif
device->emulate_etc2 = false;
#ifdef ANDROID
device->emulate_etc2 = !radv_device_supports_etc(device);
#else
device->emulate_etc2 = !radv_device_supports_etc(device) &&
driQueryOptionb(&device->instance->dri_options, "radv_require_etc2");
#endif
snprintf(device->name, sizeof(device->name), "AMD RADV %s%s", device->rad_info.name,
radv_get_compiler_string(device));
@ -925,6 +930,7 @@ static const driOptionDescription radv_dri_options[] = {
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_RADV_REQUIRE_ETC2(false)
DRI_CONF_SECTION_END
};
// clang-format on

View file

@ -556,4 +556,8 @@
DRI_CONF_OPT_B(radv_report_apu_as_dgpu, def, \
"Report APUs as discrete GPUs instead of integrated GPUs")
#define DRI_CONF_RADV_REQUIRE_ETC2(def) \
DRI_CONF_OPT_B(radv_require_etc2, def, \
"Implement emulated ETC2 on HW that does not support it")
#endif