Show server error on GUI (encoders currently)

This commit is contained in:
Patrick Nicolas
2025-10-05 20:26:07 +02:00
parent 98fc4ad4bb
commit aca45420dd
7 changed files with 152 additions and 101 deletions
+113 -100
View File
@@ -25,6 +25,21 @@ Kirigami.ApplicationWindow {
icon.source: Qt.resolvedUrl("wivrn.svg")
onActivated: root.visible = !root.visible
}
Component{
id: error_template
Kirigami.InlineMessage{
visible: true
property string where
property string message
Layout.fillWidth: true
text: where + (where ? "\n" : "") + message
type: Kirigami.MessageType.Error
showCloseButton: true
}
}
onClosing: Qt.quit()
Core.Settings {
@@ -72,18 +87,21 @@ Kirigami.ApplicationWindow {
switch_pairing.checked = WivrnServer.pairingEnabled;
}
// function onHeadsetConnectedChanged(value) {
// if (value != root.prev_headset_connected) {
// root.prev_headset_connected = value;
//
// if (value && root.pageStack.depth == 1)
// root.pageStack.push(Qt.resolvedUrl("HeadsetStatsPage.qml"));
// }
// }
function onJsonConfigurationChanged() {
config.load(WivrnServer);
}
function onServerError(info) {
console.log(info.where);
console.log(info.message);
messages.append(error_template.createObject(
null,
{
where: info.where,
message: info.message
}
));
}
}
Component.onCompleted: {
@@ -102,107 +120,102 @@ Kirigami.ApplicationWindow {
pageStack.initialPage: Kirigami.ScrollablePage {
ColumnLayout {
anchors.fill: parent
Kirigami.InlineMessage {
Layout.fillWidth: true
text: i18n("The server does not have CAP_SYS_NICE capabilities.")
// type: Kirigami.MessageType.Warning
type: Kirigami.MessageType.Information
showCloseButton: true
visible: !WivrnServer.capSysNice
actions: [
Kirigami.Action {
text: i18n("Fix it")
onTriggered: WivrnServer.grant_cap_sys_nice()
Repeater{
model: ObjectModel {
id: messages
Kirigami.InlineMessage {
Layout.fillWidth: true
text: i18n("The server does not have CAP_SYS_NICE capabilities.")
// type: Kirigami.MessageType.Warning
type: Kirigami.MessageType.Information
showCloseButton: true
visible: !WivrnServer.capSysNice
actions: [
Kirigami.Action {
text: i18n("Fix it")
onTriggered: WivrnServer.grant_cap_sys_nice()
}
]
}
]
}
Kirigami.InlineMessage {
Layout.fillWidth: true
text: i18n("Firewall may not allow port 9757.")
type: Kirigami.MessageType.Warning
showCloseButton: true
visible: Firewall.needSetup
actions: [
Kirigami.Action {
text: i18n("Fix it")
onTriggered: Firewall.doSetup()
Kirigami.InlineMessage {
Layout.fillWidth: true
text: i18n("Firewall may not allow port 9757.")
type: Kirigami.MessageType.Warning
showCloseButton: true
visible: Firewall.needSetup
actions: [
Kirigami.Action {
text: i18n("Fix it")
onTriggered: Firewall.doSetup()
}
]
}
]
}
Kirigami.InlineMessage {
id: restart_capsysnice
Layout.fillWidth: true
text: i18n("The CAP_SYS_NICE capability will be used when the server is restarted.")
type: Kirigami.MessageType.Information
showCloseButton: true
visible: false
actions: [
Kirigami.Action {
text: i18nc("restart the server", "Restart now")
onTriggered: {
WivrnServer.restart_server();
restart_capsysnice.visible = false;
}
Kirigami.InlineMessage {
id: restart_capsysnice
Layout.fillWidth: true
text: i18n("The CAP_SYS_NICE capability will be used when the server is restarted.")
type: Kirigami.MessageType.Information
showCloseButton: true
visible: false
actions: [
Kirigami.Action {
text: i18nc("restart the server", "Restart now")
onTriggered: {
WivrnServer.restart_server();
restart_capsysnice.visible = false;
}
}
]
}
]
}
Kirigami.InlineMessage {
Layout.fillWidth: true
text: i18n("NVIDIA GPUs require at least driver version 565.77, current version is %1", VulkanInfo.driverVersion)
type: Kirigami.MessageType.Error
showCloseButton: true
visible: VulkanInfo.driverId == "NvidiaProprietary" && VulkanInfo.driverVersionCode < 2371043328 /* Version 565.77 */
actions: [
Kirigami.Action {
text: i18n("More info")
onTriggered: Qt.openUrlExternally("https://github.com/WiVRn/WiVRn/issues/180")
Kirigami.InlineMessage {
Layout.fillWidth: true
text: i18n("NVIDIA GPUs require at least driver version 565.77, current version is %1", VulkanInfo.driverVersion)
type: Kirigami.MessageType.Error
showCloseButton: true
visible: VulkanInfo.driverId == "NvidiaProprietary" && VulkanInfo.driverVersionCode < 2371043328 /* Version 565.77 */
actions: [
Kirigami.Action {
text: i18n("More info")
onTriggered: Qt.openUrlExternally("https://github.com/WiVRn/WiVRn/issues/180")
}
]
}
]
}
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")
type: Kirigami.MessageType.Warning
showCloseButton: true
visible: VulkanInfo.driverId == "AmdProprietary" || VulkanInfo.driverId == "AmdOpenSource"
}
Kirigami.InlineMessage {
Layout.fillWidth: true
text: i18n("No OpenVR compatibility detected, Steam games won't be able to load VR.\nInstall xrizer or OpenComposite.")
type: Kirigami.MessageType.Warning
showCloseButton: true
visible: WivrnServer.openVRCompat.length == 0 && config.openvr == ""
}
Kirigami.InlineMessage {
id: message_failed_to_start
Layout.fillWidth: true
text: i18n("Server failed to start")
type: Kirigami.MessageType.Error
showCloseButton: true
// visible: WivrnServer.serverStatus == WivrnServer.FailedToStart
actions: [
Kirigami.Action {
text: i18n("Open server logs")
onTriggered: WivrnServer.open_server_logs()
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")
type: Kirigami.MessageType.Warning
showCloseButton: true
visible: VulkanInfo.driverId == "AmdProprietary" || VulkanInfo.driverId == "AmdOpenSource"
}
]
}
// RowLayout {
// Controls.Button {
// text: "refresh latest version"
// onClicked: ApkInstaller.refreshLatestVersion()
// }
// Controls.Label {
// text: "current version " + ApkInstaller.currentVersion + "\nlatest version " + ApkInstaller.latestVersion
// }
// }
Kirigami.InlineMessage {
Layout.fillWidth: true
text: i18n("No OpenVR compatibility detected, Steam games won't be able to load VR.\nInstall xrizer or OpenComposite.")
type: Kirigami.MessageType.Warning
showCloseButton: true
visible: WivrnServer.openVRCompat.length == 0 && config.openvr == ""
}
Kirigami.InlineMessage {
id: message_failed_to_start
Layout.fillWidth: true
text: i18n("Server failed to start")
type: Kirigami.MessageType.Error
showCloseButton: true
// visible: WivrnServer.serverStatus == WivrnServer.FailedToStart
actions: [
Kirigami.Action {
text: i18n("Open server logs")
onTriggered: WivrnServer.open_server_logs()
}
]
}
}
}
GridLayout {
columns: 2
+1
View File
@@ -257,6 +257,7 @@ void wivrn_server::on_server_dbus_registered()
server_properties_interface = std::make_unique<OrgFreedesktopDBusPropertiesInterface>("io.github.wivrn.Server", "/io/github/wivrn/Server", QDBusConnection::sessionBus(), this);
connect(server_properties_interface.get(), &OrgFreedesktopDBusPropertiesInterface::PropertiesChanged, this, &wivrn_server::on_server_properties_changed);
connect(server_interface.get(), &IoGithubWivrnServerInterface::ServerError, [this](const QString & w, const QString & m) { serverError(serverErrorData(w, m)); });
serverStatusChanged(m_serverStatus = Status::Started);
refresh_server_properties();
+18
View File
@@ -122,6 +122,23 @@ public:
}
};
class serverErrorData
{
Q_GADGET
QML_VALUE_TYPE(serverError)
Q_PROPERTY(QString where MEMBER m_where CONSTANT)
Q_PROPERTY(QString message MEMBER m_message CONSTANT)
QString m_where;
QString m_message;
public:
serverErrorData() = default;
serverErrorData(QString where, QString message) :
m_where(where), m_message(message) {}
};
class wivrn_server : public QObject
{
Q_OBJECT
@@ -380,4 +397,5 @@ Q_SIGNALS:
void supportedCodecsChanged(QStringList);
void steamCommandChanged(QString);
void serverLogsChanged(QString);
void serverError(serverErrorData);
};
+5
View File
@@ -73,5 +73,10 @@
</property>
<property name="PairingEnabled" type="b" access="read"/>
<property name="EncryptionEnabled" type="b" access="read"/>
<signal name="ServerError">
<arg type="s" name="where"/>
<arg type="s" name="message"/>
</signal>
</interface>
</node>
+4
View File
@@ -326,6 +326,10 @@ static bool comp_wivrn_init_post_vulkan(struct comp_target * ct, uint32_t prefer
}
catch (const std::exception & e)
{
wivrn_ipc_socket_monado->send(from_monado::server_error{
.where = "Error creating encoder",
.message = e.what(),
});
U_LOG_E("Failed to create video encoder: %s", e.what());
return false;
}
+3
View File
@@ -534,6 +534,9 @@ gboolean control_received(gint fd, GIOCondition condition, gpointer user_data)
[&](const from_monado::bitrate_changed & value) {
wivrn_server_set_bitrate(dbus_server, value.bitrate_bps);
},
[&](const from_monado::server_error & e) {
wivrn_server_emit_server_error(dbus_server, e.where.c_str(), e.message.c_str());
},
},
*packet);
}
+8 -1
View File
@@ -47,12 +47,19 @@ struct bitrate_changed
uint32_t bitrate_bps;
};
struct server_error
{
std::string where;
std::string message;
};
using packets = std::variant<
wivrn::from_headset::headset_info_packet,
wivrn::from_headset::start_app,
headset_connected,
headset_disconnected,
bitrate_changed>;
bitrate_changed,
server_error>;
} // namespace from_monado
namespace to_monado