Mesa (master): radv: allow to force family using RADV_FORCE_FAMILY
Samuel Pitoiset
hakzsam at kemper.freedesktop.org
Tue Feb 20 09:45:20 UTC 2018
Module: Mesa
Branch: master
Commit: b5d111ae763b672c141266760db55e83716d77f9
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b5d111ae763b672c141266760db55e83716d77f9
Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date: Fri Feb 16 11:00:14 2018 +0100
radv: allow to force family using RADV_FORCE_FAMILY
Useful for pipeline-db.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Dave Airlie <airlied at redhat.com>
---
src/amd/vulkan/radv_device.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 09bb382eeb..98cfd9b58a 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -183,6 +183,37 @@ radv_physical_device_init_mem_types(struct radv_physical_device *device)
device->memory_properties.memoryTypeCount = type_count;
}
+static void
+radv_handle_env_var_force_family(struct radv_physical_device *device)
+{
+ const char *family = getenv("RADV_FORCE_FAMILY");
+ unsigned i;
+
+ if (!family)
+ return;
+
+ for (i = CHIP_TAHITI; i < CHIP_LAST; i++) {
+ if (!strcmp(family, ac_get_llvm_processor_name(i))) {
+ /* Override family and chip_class. */
+ device->rad_info.family = i;
+
+ if (i >= CHIP_VEGA10)
+ device->rad_info.chip_class = GFX9;
+ else if (i >= CHIP_TONGA)
+ device->rad_info.chip_class = VI;
+ else if (i >= CHIP_BONAIRE)
+ device->rad_info.chip_class = CIK;
+ else
+ device->rad_info.chip_class = SI;
+
+ return;
+ }
+ }
+
+ fprintf(stderr, "radv: Unknown family: %s\n", family);
+ exit(1);
+}
+
static VkResult
radv_physical_device_init(struct radv_physical_device *device,
struct radv_instance *instance,
@@ -226,6 +257,8 @@ radv_physical_device_init(struct radv_physical_device *device,
device->local_fd = fd;
device->ws->query_info(device->ws, &device->rad_info);
+ radv_handle_env_var_force_family(device);
+
radv_get_device_name(device->rad_info.family, device->name, sizeof(device->name));
if (radv_device_get_cache_uuid(device->rad_info.family, device->cache_uuid)) {
More information about the mesa-commit
mailing list