streetpea / chiaki4deck

Fork of Chiaki (Open Source Playstation Remote Play) with Enhancements for Steam Deck and Documentation around how to use
https://streetpea.github.io/chiaki4deck/
GNU Affero General Public License v3.0
846 stars 50 forks source link

[BUG] Stlying improperly applied under KDE Plasma 6 #314

Closed Sn0wCrack closed 1 week ago

Sn0wCrack commented 4 weeks ago

Describe the bug It seems the Flatpak version of Chiaki4deck currently published fails to fully chnage into Dark Mode or apply certain styling under KDE Plasma 6.

Using Breeze Light makes the issue better, however the styling still does not properly match how the application works when using the AppImage or on other operating systems.

I've tried a few tweaks via environment variables such as QT_QPA_PLATFORMTHEME, QT_QUICK_CONTROLS_STYLE and QT_STYLE_OVERRIDE, none of which really gave me any different results.

Changing between light and dark Breeze seems to at least change the inputs color scheme and make the app usable, as some text is completely unreadable in Breeze dark.

Debug Log N/A

To Reproduce Install flatpak version of Chiaki4deck while using KDE Plasma 6 with the "Breeze Dark" theme set

Expected behavior Whole app would apply dark mode theming like the AppImage build does if possible.

Screenshots Screenshot_20240420_200134

Left: AppImage, Right: Flatpak

Desktop (please complete the following information):

Sn0wCrack commented 4 weeks ago

Unclear if it's related, but I think the Flatpak isn't getting hardware acceleration hints as vaapi and vulkan decoders do not work.

Still running an NVIDIA card and I'm using the proprietary driver so that maybe related, I know Nvidia drivers require their own Flatpak dependency.

EDIT:

I have managed to get further with vaapi but when using it receive "Failed to map AVFrame to Placebo frame!" in the logs and a black screen, audio seems to work fine.

Vulkan, similarly to my experience on Windows, just crashes.

Sn0wCrack commented 3 weeks ago

So I've done some more digging and have decided to build chiaki4deck myself and it looks like the styling settings setup in qtquickcontrols2.conf are being overridden by something else.

Trying to use various environment variables related to setting the style and the -style argument do not work.

More info on these options here: https://doc.qt.io/qt-6/qtquickcontrols-styles.html#run-time-style-selection

I'm thinking it's related to qqc2-desktop-style or some kind of global configuration KDE has setup, as when I strace the process I see it opening my kdeglobals file, which sets my default Qt widget style to Breeze.

Importing the Material controls style into all QML files and then setting the theme, accent colour and default font size in the main QML file seems to force the application to run with the correct styling as intended by the qtquickcontrols2.conf without issue.

I'd also like to note that on my build I'm still unable to use vaapi, however I am able to use cuda.

streetpea commented 3 weeks ago

If you want to use vaapi with nvidia I believe you’ll need something like this https://www.phoronix.com/news/NVIDIA-VAAPI-Driver-0.0.11

Sn0wCrack commented 3 weeks ago

If you want to use vaapi with nvidia I believe you’ll need something like this https://www.phoronix.com/news/NVIDIA-VAAPI-Driver-0.0.11

I do have that installed already and it's working with Firefox (flatpak), Chrome (flatpak) and ffmpeg (native).

When using the EGL backend of libva-nvidia-driver it just fails to decode each frame and the whole UI bugs out and I have to terminate chiaki4deck. It seems to be an issue with libva-nvidia-driver itself as enabling logging for the library it mentions errors with CUDA and ffmpeg itself throws up errors in the log when decoding the HEVC frame.

[hevc @ 0x5f012f8a4700] get_buffer() failed
[hevc @ 0x5f012f8a4700] Error parsing NAL unit #0.
[E] Failed to push frame: Cannot allocate memory
[W] Video callback did not process frame successfully.
[W] Detected missing or corrupt frame(s) from 23 to 1558
[D] StreamConnection reporting corrupt frame(s) from 23 to 1557
[W] Missing reference frame 1557 for decoding frame 1558
[W] Detected missing or corrupt frame(s) from 23 to 1559
[D] StreamConnection reporting corrupt frame(s) from 23 to 1558
[W] Missing reference frame 1558 for decoding frame 1559
[W] Detected missing or corrupt frame(s) from 23 to 1560
[D] StreamConnection reporting corrupt frame(s) from 23 to 1559

When using the Direct backend of libva-nvidia-driver either libplacebo seems to fail to understand the decoded frame as the error that is produced is: Failed to map AVFrame to Placebo frame!

streetpea commented 1 week ago

@Sn0wCrack I can include the patch @nowrep made for Vulkan on the nvidia 30 series gpu and you should be able to use Vulkan. Vulkan is what you should use if possible anyway.

What do you mean by Importing the Material controls style into all QML files and then setting the theme, accent colour and default font size in the main QML? Did you add material controls style even to files that don’t use material?

Sn0wCrack commented 1 week ago

What do you mean by Importing the Material controls style into all QML files and then setting the theme, accent colour and default font size in the main QML? Did you add material controls style even to files that don’t use material?

I added the following import to the every QML file if they did not already gave it:

import QtQuick.Controls.Material

Then in Main.qml I added the following to the Item block:

Material.theme: Material.Dark
Material.accent: "#00a7ff"

Also in Main.qml added the following to the StackView block:

font.pixelSize: 20

After recompiling with those changes, all components and styling seemed to work the same way as they did when I had used chiaki4deck on Windows.

streetpea commented 1 week ago

That makes sense the qtquickcontrols2.conf selected theme should import the theme automatically but since that’s not working you would need to add manually. I’ll do this so it works with the flatpak on kde, thanks for the update

nowrep commented 1 week ago

I think you can just unset everything from https://doc.qt.io/qt-5/qtquickcontrols2-environment.html at start and it would work too. And KDE apps shouldn't be setting this system-wide as that seems like it would break more apps than just chiaki. Or does the override come from platform theme plugin?

Sn0wCrack commented 1 week ago

I think you can just unset everything from https://doc.qt.io/qt-5/qtquickcontrols2-environment.html at start and it would work too. And KDE apps shouldn't be setting this system-wide as that seems like it would break more apps than just chiaki. Or does the override come from platform theme plugin?

My theme is actually set to Breeze Dark, and running a freshly compiled version using master or the flatpak both have use the light theme and some components do not get styled to Material at all such as the dropdowns and checkboxes, which ironically are dark themed as they're using the default Breeze styling.

It's a basically vanilla KDE 6 install as well, no Kvantum or anything like that, just have Breeze Dark set and none of those environment variables are displayed when running printenv. I had also tried setting those manually on the flatpak environment variable and it didn't really a difference to the styling.

I know KDE 6 did change how light and dark themes are handled, but I'm unclear on the details of what this affects and if it relates to this issue at all.

Sn0wCrack commented 1 day ago

I can confirm on the latest flatpak the styling looks correct and the Vulkan decoder now works on my 30-series GPU in it too (after the Nvidia driver flatpak also updated today)

Thanks for all of that, some awesome work!