mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 07:28:11 +02:00
nvk: Silently fail to enumerate if not on nouveau
The NVIDIA proprietary driver exposes a DRM device these days and this can trip up NVK as it advertises an NVIDIA device id. We fail to enumerate but the check for nouveau happens too late and we throw a warning. This means tha if NVK is even installed side-by-side with the proprietary driver, we spam warnings on every device enumeration. It's better to fail silently. Fixes:83786bf1c9("nvk: add vulkan skeleton") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11441 Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30035> (cherry picked from commit73ec9f0183)
This commit is contained in:
parent
42e3099db9
commit
b3507e5290
2 changed files with 25 additions and 1 deletions
|
|
@ -44,7 +44,7 @@
|
|||
"description": "nvk: Silently fail to enumerate if not on nouveau",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "83786bf1c9c17250bc1a0533f03608d113eea50b",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -1068,6 +1068,27 @@ nvk_get_vram_heap_available(struct nvk_physical_device *pdev)
|
|||
return pdev->info.vram_size_B - used;
|
||||
}
|
||||
|
||||
static bool
|
||||
drm_device_is_nouveau(const char *path)
|
||||
{
|
||||
int fd = open(path, O_RDWR | O_CLOEXEC);
|
||||
if (fd < 0)
|
||||
return false;
|
||||
|
||||
drmVersionPtr ver = drmGetVersion(fd);
|
||||
if (!ver) {
|
||||
close(fd);
|
||||
return false;
|
||||
}
|
||||
|
||||
const bool is_nouveau = !strncmp("nouveau", ver->name, ver->name_len);
|
||||
|
||||
drmFreeVersion(ver);
|
||||
close(fd);
|
||||
|
||||
return is_nouveau;
|
||||
}
|
||||
|
||||
VkResult
|
||||
nvk_create_drm_physical_device(struct vk_instance *_instance,
|
||||
drmDevicePtr drm_device,
|
||||
|
|
@ -1104,6 +1125,9 @@ nvk_create_drm_physical_device(struct vk_instance *_instance,
|
|||
return VK_ERROR_INCOMPATIBLE_DRIVER;
|
||||
}
|
||||
|
||||
if (!drm_device_is_nouveau(drm_device->nodes[DRM_NODE_RENDER]))
|
||||
return VK_ERROR_INCOMPATIBLE_DRIVER;
|
||||
|
||||
struct nouveau_ws_device *ws_dev = nouveau_ws_device_new(drm_device);
|
||||
if (!ws_dev)
|
||||
return vk_error(instance, VK_ERROR_INCOMPATIBLE_DRIVER);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue