Mesa (main): venus: forward the host renderer hardware info

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 8 00:05:36 UTC 2021


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

Author: Yiwei Zhang <zzyiwei at chromium.org>
Date:   Thu Jun  3 20:46:08 2021 +0000

venus: forward the host renderer hardware info

Some game engines rely on the real hardware info to adjust default
graphics quality and other attributes.

Signed-off-by: Yiwei Zhang <zzyiwei at chromium.org>
Reviewed-by: Chia-I Wu <olvaffe at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11175>

---

 src/virtio/vulkan/vn_device.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/virtio/vulkan/vn_device.c b/src/virtio/vulkan/vn_device.c
index 7cf98a21c27..94465092646 100644
--- a/src/virtio/vulkan/vn_device.c
+++ b/src/virtio/vulkan/vn_device.c
@@ -1268,11 +1268,15 @@ vn_physical_device_init_properties(struct vn_physical_device *physical_dev)
    }
 
    props->driverVersion = vk_get_driver_version();
-   props->vendorID = instance->renderer_info.pci.vendor_id;
-   props->deviceID = instance->renderer_info.pci.device_id;
-   /* some apps don't like VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU */
-   props->deviceType = VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU;
-   snprintf(props->deviceName, sizeof(props->deviceName), "Virtio GPU");
+
+   char device_name[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE];
+   int device_name_len = snprintf(device_name, sizeof(device_name),
+                                  "Virtio-GPU Venus (%s)", props->deviceName);
+   if (device_name_len >= VK_MAX_PHYSICAL_DEVICE_NAME_SIZE) {
+      memcpy(device_name + VK_MAX_PHYSICAL_DEVICE_NAME_SIZE - 5, "...)", 4);
+      device_name_len = VK_MAX_PHYSICAL_DEVICE_NAME_SIZE - 1;
+   }
+   memcpy(props->deviceName, device_name, device_name_len + 1);
 
    vk12_props->driverID = 0;
    snprintf(vk12_props->driverName, sizeof(vk12_props->driverName), "venus");



More information about the mesa-commit mailing list