Mesa (main): radv: Expose the ETC2 emulation.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Dec 14 12:10:38 UTC 2021
Module: Mesa
Branch: main
Commit: 9e8fa8168b9056c27736514b4d757b091412ce3d
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9e8fa8168b9056c27736514b4d757b091412ce3d
Author: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Date: Mon Dec 6 03:39:01 2021 +0100
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 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14071>
---
src/amd/vulkan/radv_device.c | 8 +++++++-
src/util/driconf.h | 4 ++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 0169bf188c4..87a2712f789 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -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
diff --git a/src/util/driconf.h b/src/util/driconf.h
index 7539fdee4fc..fc1164087de 100644
--- a/src/util/driconf.h
+++ b/src/util/driconf.h
@@ -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
More information about the mesa-commit
mailing list