Mesa (main): radv: report the marketing name as part of the device name

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 7 08:14:25 UTC 2022


Module: Mesa
Branch: main
Commit: f06da59fd75d7ce7708d159753fcdbc11de16f9e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f06da59fd75d7ce7708d159753fcdbc11de16f9e

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Thu May 27 09:03:24 2021 +0200

radv: report the marketing name as part of the device name

This now reports something like "AMD Radeon RX 5700 XT (RADV NAVI10)".

This introduces a new variable for storing the marketing name because
the existing device name is used by the shaders cache and must remain
the same to avoid any issues with precompilation.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4802
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11027>

---

 src/amd/vulkan/radv_debug.c   | 7 ++-----
 src/amd/vulkan/radv_device.c  | 6 +++++-
 src/amd/vulkan/radv_private.h | 1 +
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/amd/vulkan/radv_debug.c b/src/amd/vulkan/radv_debug.c
index 4da13f612a7..45ce0c4f933 100644
--- a/src/amd/vulkan/radv_debug.c
+++ b/src/amd/vulkan/radv_debug.c
@@ -621,18 +621,15 @@ radv_dump_device_name(struct radv_device *device, FILE *f)
    char kernel_version[128] = {0};
    struct utsname uname_data;
 #endif
-   const char *chip_name;
-
-   chip_name = device->ws->get_chip_name(device->ws);
 
 #ifdef _WIN32
-   fprintf(f, "Device name: %s (%s / DRM %i.%i.%i)\n\n", chip_name, device->physical_device->name,
+   fprintf(f, "Device name: %s (DRM %i.%i.%i)\n\n", device->physical_device->marketing_name,
            info->drm_major, info->drm_minor, info->drm_patchlevel);
 #else
    if (uname(&uname_data) == 0)
       snprintf(kernel_version, sizeof(kernel_version), " / %s", uname_data.release);
 
-   fprintf(f, "Device name: %s (%s / DRM %i.%i.%i%s)\n\n", chip_name, device->physical_device->name,
+   fprintf(f, "Device name: %s (DRM %i.%i.%i%s)\n\n", device->physical_device->marketing_name,
            info->drm_major, info->drm_minor, info->drm_patchlevel, kernel_version);
 #endif
 }
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 752683075f5..d19a41ae345 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -719,6 +719,10 @@ radv_physical_device_try_create(struct radv_instance *instance, drmDevicePtr drm
    snprintf(device->name, sizeof(device->name), "AMD RADV %s%s", device->rad_info.name,
             radv_get_compiler_string(device));
 
+   const char *marketing_name = device->ws->get_chip_name(device->ws);
+   snprintf(device->marketing_name, sizeof(device->name), "%s (RADV %s%s)",
+            marketing_name, device->rad_info.name, radv_get_compiler_string(device));
+
 #ifdef ENABLE_SHADER_CACHE
    if (radv_device_get_cache_uuid(device, device->cache_uuid)) {
       result = vk_errorf(instance, VK_ERROR_INITIALIZATION_FAILED, "cannot generate UUID");
@@ -1939,7 +1943,7 @@ radv_GetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice,
          },
    };
 
-   strcpy(pProperties->deviceName, pdevice->name);
+   strcpy(pProperties->deviceName, pdevice->marketing_name);
    memcpy(pProperties->pipelineCacheUUID, pdevice->cache_uuid, VK_UUID_SIZE);
 }
 
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index 898cb3a6778..02b4f6f16b8 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -271,6 +271,7 @@ struct radv_physical_device {
    struct radeon_winsys *ws;
    struct radeon_info rad_info;
    char name[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE];
+   char marketing_name[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE];
    uint8_t driver_uuid[VK_UUID_SIZE];
    uint8_t device_uuid[VK_UUID_SIZE];
    uint8_t cache_uuid[VK_UUID_SIZE];



More information about the mesa-commit mailing list