From 32e4dd69789d7febbcea80ee65949c7e799bf8c1 Mon Sep 17 00:00:00 2001 From: Erico Nunes Date: Thu, 25 Sep 2025 21:22:51 +0200 Subject: [PATCH] v3dv: rename primary_fd to display_fd In this current implementation, primary_fd refers to the display device, which can be confused with the primary node of the render device. In a followup we would like to use primary_fd as the primary node from v3d, prepare for that by renaming it here. Signed-off-by: Erico Nunes Reviewed-by: Iago Toral Quiroga Part-of: --- src/broadcom/vulkan/v3dv_device.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/broadcom/vulkan/v3dv_device.c b/src/broadcom/vulkan/v3dv_device.c index 9bf54267ea8..8ebb5046446 100644 --- a/src/broadcom/vulkan/v3dv_device.c +++ b/src/broadcom/vulkan/v3dv_device.c @@ -1249,7 +1249,7 @@ get_device_properties(const struct v3dv_physical_device *device, static VkResult create_physical_device(struct v3dv_instance *instance, - int32_t render_fd, int32_t primary_fd) + int32_t render_fd, int32_t display_fd) { VkResult result = VK_SUCCESS; @@ -1272,17 +1272,17 @@ create_physical_device(struct v3dv_instance *instance, if (result != VK_SUCCESS) goto fail; - struct stat primary_stat = {0}, render_stat = {0}; + struct stat display_stat = {0}, render_stat = {0}; - device->has_primary = primary_fd >= 0; + device->has_primary = display_fd >= 0; if (device->has_primary) { - if (fstat(primary_fd, &primary_stat) != 0) { + if (fstat(display_fd, &display_stat) != 0) { result = vk_errorf(instance, VK_ERROR_INITIALIZATION_FAILED, - "failed to stat DRM primary node"); + "failed to stat DRM display node"); goto fail; } - device->primary_devid = primary_stat.st_rdev; + device->primary_devid = display_stat.st_rdev; } if (fstat(render_fd, &render_stat) != 0) { @@ -1299,7 +1299,7 @@ create_physical_device(struct v3dv_instance *instance, #endif device->render_fd = render_fd; - device->display_fd = primary_fd; + device->display_fd = display_fd; if (!v3d_get_device_info(device->render_fd, &device->devinfo, &v3d_ioctl)) { result = vk_errorf(instance, VK_ERROR_INITIALIZATION_FAILED, @@ -1413,8 +1413,8 @@ fail: if (render_fd >= 0) close(render_fd); - if (primary_fd >= 0) - close(primary_fd); + if (display_fd >= 0) + close(display_fd); return result; } @@ -1544,7 +1544,7 @@ enumerate_devices(struct vk_instance *vk_instance) VkResult result = VK_SUCCESS; int32_t render_fd = -1; - int32_t primary_fd = -1; + int32_t display_fd = -1; for (unsigned i = 0; i < (unsigned)max_devices; i++) { #if USE_V3D_SIMULATOR /* In the simulator, we look for an Intel/AMD render node */ @@ -1554,7 +1554,7 @@ enumerate_devices(struct vk_instance *vk_instance) (devices[i]->deviceinfo.pci->vendor_id == 0x8086 || devices[i]->deviceinfo.pci->vendor_id == 0x1002)) { if (try_device(devices[i]->nodes[DRM_NODE_RENDER], &render_fd, NULL)) - try_device(devices[i]->nodes[DRM_NODE_PRIMARY], &primary_fd, NULL); + try_device(devices[i]->nodes[DRM_NODE_PRIMARY], &display_fd, NULL); } #else /* On actual hardware, we should have a gpu device (v3d) and a display @@ -1568,20 +1568,20 @@ enumerate_devices(struct vk_instance *vk_instance) if ((devices[i]->available_nodes & 1 << DRM_NODE_RENDER)) { try_device(devices[i]->nodes[DRM_NODE_RENDER], &render_fd, "v3d"); - } else if (primary_fd == -1 && + } else if (display_fd == -1 && (devices[i]->available_nodes & 1 << DRM_NODE_PRIMARY)) { - try_display_device(instance, devices[i]->nodes[DRM_NODE_PRIMARY], &primary_fd); + try_display_device(instance, devices[i]->nodes[DRM_NODE_PRIMARY], &display_fd); } #endif - if (render_fd >= 0 && primary_fd >= 0) + if (render_fd >= 0 && display_fd >= 0) break; } if (render_fd < 0) result = VK_ERROR_INCOMPATIBLE_DRIVER; else - result = create_physical_device(instance, render_fd, primary_fd); + result = create_physical_device(instance, render_fd, display_fd); drmFreeDevices(devices, max_devices);