v3dv: don't overwrite the primary fd if it's already set
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

If a valid primary file descriptor is already set (e.g. from vc4),
don't overwrite it with -1.

This prevents losing a valid primary fd and resolves issues arising
when vc4 is the first node returned by `drmGetDevices2()` and v3d is
the second.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12777
Fixes: 188f1c6cbe ("v3dv: rewrite device identification")
Signed-off-by: Maíra Canal <mcanal@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33958>
This commit is contained in:
Maíra Canal 2025-03-08 12:28:26 -03:00 committed by Marge Bot
parent 2983ca0d20
commit 7775c79035

View file

@ -1594,10 +1594,12 @@ enumerate_devices(struct vk_instance *vk_instance)
if (devices[i]->bustype != DRM_BUS_PLATFORM)
continue;
if ((devices[i]->available_nodes & 1 << DRM_NODE_RENDER))
if ((devices[i]->available_nodes & 1 << DRM_NODE_RENDER)) {
try_device(devices[i]->nodes[DRM_NODE_RENDER], &render_fd, "v3d");
if ((devices[i]->available_nodes & 1 << DRM_NODE_PRIMARY))
} else if (primary_fd == -1 &&
(devices[i]->available_nodes & 1 << DRM_NODE_PRIMARY)) {
try_display_device(instance, devices[i]->nodes[DRM_NODE_PRIMARY], &primary_fd);
}
#endif
if (render_fd >= 0 && primary_fd >= 0)