diff --git a/dashboard/qml/Main.qml b/dashboard/qml/Main.qml index e28ab036..41d579a8 100644 --- a/dashboard/qml/Main.qml +++ b/dashboard/qml/Main.qml @@ -188,6 +188,14 @@ Kirigami.ApplicationWindow { ] } + Kirigami.InlineMessage { + Layout.fillWidth: true + text: Settings.flatpak ? i18n("Vulkan drivers cannot be found, you may need to run \"flatpak update\"") : i18n("Vulkan drivers cannot be found") + type: Kirigami.MessageType.Warning + showCloseButton: true + visible: DashboardSettings.show_system_checks && VulkanInfo.type == VulkanInfo.SoftGPU + } + Kirigami.InlineMessage { Layout.fillWidth: true text: i18n("Use the Mesa (radv) driver for AMD GPUs\nHardware encoding with vaapi does not work with AMDVLK and AMDGPU-PRO") diff --git a/dashboard/vulkan_info.cpp b/dashboard/vulkan_info.cpp index 52092eeb..16a85636 100644 --- a/dashboard/vulkan_info.cpp +++ b/dashboard/vulkan_info.cpp @@ -34,6 +34,25 @@ vulkan_info::vulkan_info() set_info(choose_device(devices)); } +static vulkan_info::gpu_type cast_type(vk::PhysicalDeviceType type) +{ + switch (type) + { + case vk::PhysicalDeviceType::eOther: + return vulkan_info::OtherGPU; + case vk::PhysicalDeviceType::eIntegratedGpu: + return vulkan_info::IGPU; + case vk::PhysicalDeviceType::eDiscreteGpu: + return vulkan_info::DGPU; + case vk::PhysicalDeviceType::eVirtualGpu: + return vulkan_info::VirtGPU; + case vk::PhysicalDeviceType::eCpu: + return vulkan_info::SoftGPU; + } + qCritical() << "invalid GPU type enum " << int(type); + return vulkan_info::OtherGPU; +} + vk::raii::PhysicalDevice & vulkan_info::choose_device(std::vector & devices) { for (vk::raii::PhysicalDevice & device: devices) @@ -70,5 +89,7 @@ void vulkan_info::set_info(vk::raii::PhysicalDevice & device) break; } + m_type = cast_type(prop.properties.deviceType); + qDebug() << "Driver" << m_driverId << m_driverVersion; } diff --git a/dashboard/vulkan_info.h b/dashboard/vulkan_info.h index 99c43f37..97b3f3a5 100644 --- a/dashboard/vulkan_info.h +++ b/dashboard/vulkan_info.h @@ -33,14 +33,26 @@ class vulkan_info : public QObject Q_OBJECT QML_NAMED_ELEMENT(VulkanInfo) QML_SINGLETON +public: + enum gpu_type + { + DGPU, + IGPU, + SoftGPU, + VirtGPU, + OtherGPU, + }; + Q_ENUM(gpu_type) Q_PROPERTY(QString driverId READ driverId CONSTANT) Q_PROPERTY(QString driverVersion READ driverVersion CONSTANT) Q_PROPERTY(uint32_t driverVersionCode READ driverVersionCode CONSTANT) + Q_PROPERTY(gpu_type type READ type CONSTANT) QString m_driverId; QString m_driverVersion; uint32_t m_driverVersionCode; + gpu_type m_type; vk::raii::PhysicalDevice & choose_device(std::vector & devices); void set_info(vk::raii::PhysicalDevice & device); @@ -62,4 +74,9 @@ public: { return m_driverVersionCode; } + + gpu_type type() const + { + return m_type; + } };