Mesa (main): v3dv: store device_id on device init
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Apr 27 15:07:46 UTC 2022
Module: Mesa
Branch: main
Commit: 9c3144d2efc5fec477be0f6491e8dc4f5fc01569
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9c3144d2efc5fec477be0f6491e8dc4f5fc01569
Author: Juan A. Suarez Romero <jasuarez at igalia.com>
Date: Wed Apr 27 11:30:06 2022 +0200
v3dv: store device_id on device init
Instead of calling later an ioctl to get the device id, let's store it
while initializing the physical device.
Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>
Reviewed-by: Alejandro Piñeiro <apinheiro at igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16187>
---
src/broadcom/vulkan/v3dv_device.c | 36 +++++-------------------------------
src/broadcom/vulkan/v3dv_private.h | 4 ++++
2 files changed, 9 insertions(+), 31 deletions(-)
diff --git a/src/broadcom/vulkan/v3dv_device.c b/src/broadcom/vulkan/v3dv_device.c
index 937d85fad92..0ff57deedc1 100644
--- a/src/broadcom/vulkan/v3dv_device.c
+++ b/src/broadcom/vulkan/v3dv_device.c
@@ -63,10 +63,6 @@
#include "wayland-drm-client-protocol.h"
#endif
-#ifdef USE_V3D_SIMULATOR
-#include "drm-uapi/i915_drm.h"
-#endif
-
#define V3DV_API_VERSION VK_MAKE_VERSION(1, 1, VK_HEADER_VERSION)
VKAPI_ATTR VkResult VKAPI_CALL
@@ -770,6 +766,10 @@ physical_device_init(struct v3dv_physical_device *device,
device->has_render = true;
device->render_devid = render_stat.st_rdev;
+#if using_v3d_simulator
+ device->device_id = drm_render_device->deviceinfo.pci->device_id;
+#endif
+
if (instance->vk.enabled_extensions.KHR_display) {
#if !using_v3d_simulator
/* Open the primary node on the vc4 display device */
@@ -1282,37 +1282,11 @@ v3dv_physical_device_vendor_id(struct v3dv_physical_device *dev)
return 0x14E4; /* Broadcom */
}
-
-#if using_v3d_simulator
-static bool
-get_i915_param(int fd, uint32_t param, int *value)
-{
- int tmp;
-
- struct drm_i915_getparam gp = {
- .param = param,
- .value = &tmp,
- };
-
- int ret = drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp);
- if (ret != 0)
- return false;
-
- *value = tmp;
- return true;
-}
-#endif
-
uint32_t
v3dv_physical_device_device_id(struct v3dv_physical_device *dev)
{
#if using_v3d_simulator
- int devid = 0;
-
- if (!get_i915_param(dev->render_fd, I915_PARAM_CHIPSET_ID, &devid))
- fprintf(stderr, "Error getting device_id\n");
-
- return devid;
+ return dev->device_id;
#else
switch (dev->devinfo.ver) {
case 42:
diff --git a/src/broadcom/vulkan/v3dv_private.h b/src/broadcom/vulkan/v3dv_private.h
index c922c8dbcd1..b8bb4254d6b 100644
--- a/src/broadcom/vulkan/v3dv_private.h
+++ b/src/broadcom/vulkan/v3dv_private.h
@@ -137,6 +137,10 @@ struct v3dv_physical_device {
dev_t primary_devid;
dev_t render_devid;
+#if using_v3d_simulator
+ uint32_t device_id;
+#endif
+
uint8_t driver_build_sha1[20];
uint8_t pipeline_cache_uuid[VK_UUID_SIZE];
uint8_t device_uuid[VK_UUID_SIZE];
More information about the mesa-commit
mailing list