diff --git a/src/nouveau/vulkan/nvk_physical_device.c b/src/nouveau/vulkan/nvk_physical_device.c index 22cd45d8394..23de0f3e7ab 100644 --- a/src/nouveau/vulkan/nvk_physical_device.c +++ b/src/nouveau/vulkan/nvk_physical_device.c @@ -1095,6 +1095,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, @@ -1131,6 +1152,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);