Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDR Streaming Very Dark After Plasma 6.2 Update #3298

Open
2 tasks done
JustPlainGarak opened this issue Oct 13, 2024 · 17 comments
Open
2 tasks done

HDR Streaming Very Dark After Plasma 6.2 Update #3298

JustPlainGarak opened this issue Oct 13, 2024 · 17 comments

Comments

@JustPlainGarak
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Is your issue described in the documentation?

  • I have read the documentation

Is your issue present in the latest beta/pre-release?

This issue is present in the latest pre-release

Describe the Bug

HDR streaming to HDR clients now produces an extremely dark image on the client that is not really usable after the recent Plasma 6.2 update that has come to Fedora over the past few days.
darkened-hdr

Expected Behavior

A normal HDR picture without black crush present.

Additional Context

I'm able to at least work around the issue by not streaming in HDR, so it's not showstopping. I have tested this on a Sep 30th build and the most recent lizardbyte/beta copr build that doesn't segfault (the version listed below).

Host Operating System

Linux

Operating System Version

Fedora Linux 40 (KDE Plasma)

Architecture

amd64/x86_64

Sunshine commit or version

2024.1006.230920-1

Package

Linux - Fedora Copr

GPU Type

AMD

GPU Model

AMD Radeon RX 7900 XTX

GPU Driver/Mesa Version

Mesa 24.1.7

Capture Method

KMX (Linux)

Config

wan_encryption_mode = 2
lan_encryption_mode = 2
key_rightalt_to_key_win = enabled
origin_pin_allowed = lan
resolutions = [
    1280x720,
    1920x1080,
    2560x1440
]
fps = [30,60,90,120,240]
sunshine_name = EmpokNor
channels = 2
#audio_sink = alsa_output.usb-M-Audio_AIR_192_4-00.analog-stereo
#output_name = 2

Apps

No response

Relevant log output

[2024-10-12 21:55:52.411]: Info: Found H.264 encoder: h264_vaapi [vaapi]
[2024-10-12 21:55:52.411]: Info: Found HEVC encoder: hevc_vaapi [vaapi]
[2024-10-12 21:55:52.411]: Info: Found AV1 encoder: av1_vaapi [vaapi]
[2024-10-12 21:55:52.411]: Info: Executing [Desktop]
[2024-10-12 21:55:52.543]: Info: Video encryption enabled
[2024-10-12 21:55:52.573]: Info: CLIENT CONNECTED
[2024-10-12 21:55:52.575]: Info: /dev/dri/card0 -> amdgpu
[2024-10-12 21:55:52.576]: Info: Found display [wayland-0]
[2024-10-12 21:55:52.576]: Info: Found interface: zxdg_output_manager_v1(31) version 3
[2024-10-12 21:55:52.576]: Info: Found interface: wl_output(65) version 4
[2024-10-12 21:55:52.576]: Info: Resolution: 2560x1440
[2024-10-12 21:55:52.576]: Info: Offset: 0x0
[2024-10-12 21:55:52.576]: Info: Logical size: 2560x1440
[2024-10-12 21:55:52.576]: Info: Name: DP-1
[2024-10-12 21:55:52.576]: Info: Found monitor: Samsung Electric Company LC32G7xT/H4ZN801004
[2024-10-12 21:55:52.576]: Info: -------- Start of KMS monitor list --------
[2024-10-12 21:55:52.576]: Info: Monitor 0 is DP-1: Samsung Electric Company LC32G7xT/H4ZN801004
[2024-10-12 21:55:52.576]: Info: --------- End of KMS monitor list ---------
[2024-10-12 21:55:52.576]: Info: Screencasting with KMS
[2024-10-12 21:55:52.576]: Info: /dev/dri/card0 -> amdgpu
[2024-10-12 21:55:52.577]: Info: Found monitor for DRM screencasting
[2024-10-12 21:55:52.577]: Info: Found connector ID [107]
[2024-10-12 21:55:52.577]: Info: Found cursor plane [90]
[2024-10-12 21:55:52.585]: Info: Creating encoder [av1_vaapi]
[2024-10-12 21:55:52.585]: Info: Color coding: HDR (Rec. 2020 + SMPTE 2084 PQ)
[2024-10-12 21:55:52.585]: Info: Color depth: 10-bit
[2024-10-12 21:55:52.585]: Info: Color range: JPEG
[2024-10-12 21:55:52.608]: Info: vaapi vendor: Mesa Gallium driver 24.1.7 for AMD Radeon RX 7900 XTX (radeonsi, navi31, LLVM 18.1.6, DRM 3.59, 6.11.3-cb1.0.fc40.x86_64)
[2024-10-12 21:55:52.609]: Error: [av1_vaapi @ 0x7f75b023e480] No usable encoding entrypoint found for profile VAProfileAV1Profile0 (32).
[2024-10-12 21:55:52.609]: Info: Retrying with fallback configuration options for [av1_vaapi] after error: Function not implemented
[2024-10-12 21:55:52.613]: Info: vaapi vendor: Mesa Gallium driver 24.1.7 for AMD Radeon RX 7900 XTX (radeonsi, navi31, LLVM 18.1.6, DRM 3.59, 6.11.3-cb1.0.fc40.x86_64)
[2024-10-12 21:55:52.614]: Warning: [av1_vaapi @ 0x7f75b0295080] Multiple slices were requested but this codec does not support controlling slices.
[2024-10-12 21:55:52.748]: Info: Gamepad 0 will be Xbox One controller (default)
[2024-10-12 21:55:53.032]: Info: Setting default sink to: [sink-sunshine-stereo]
[2024-10-12 21:55:53.032]: Info: Found default monitor by name: sink-sunshine-stereo.monitor
[2024-10-12 21:55:53.055]: Info: Opus initialized: 48 kHz, 2 channels, 512 kbps (total), LOWDELAY
[2024-10-12 21:57:22.482]: Info: CLIENT DISCONNECTED
[2024-10-12 21:57:22.483]: Info: Setting default sink to: [alsa_output.usb-M-Audio_AIR_192_4-00.analog-stereo]
@slagiewka
Copy link

I have the same experience, but I my first guess would be that it's something on KWin side. Maybe issues such as these are related https://bugs.kde.org/show_bug.cgi?id=494502

In my case, host looks OK (but M28U is not the best display) but guest is just wrong (tested Moonlight on Android TV and Steam Deck).

@JustPlainGarak
Copy link
Author

I have the same experience, but I my first guess would be that it's something on KWin side. Maybe issues such as these are related https://bugs.kde.org/show_bug.cgi?id=494502

In my case, host looks OK (but M28U is not the best display) but guest is just wrong (tested Moonlight on Android TV and Steam Deck).

I figured it was a change on KWin, but maybe not a bug, but "max nits 100000" seems like a bug lol. I will try setting a max nits with kscreen and see if that at least works around it, otherwise, yeah, this def looks like a KWin bug that KDE needs to fix.

@joeknock90
Copy link

I experienced this and thought it was me. As a workaround turning off HDR on moonlight returns things to normal it seems, but I'd really like to have it on!

@JustPlainGarak
Copy link
Author

I played around with brightness ranges for kscreen-doctor a bit but that didn't do anything useful to the streamed image. I took a debug log which appears to simply pull the provided HDR gamut info from kwin and start, as it did before. I'm gonna sit on the log for the night (cause I don't feel like making a new account at 11:10 PM lol) and add probably add to that KDE bug report that @slagiewka linked in the morning. Can't hurt for them to have more information on the issue.

@JustPlainGarak
Copy link
Author

I've checked back on that KDE bug report and it looks to me that its less a KDE bug than a normal change that reveals a bug in applications communicating metadata to Kwin.

Plasma 6.1 ignored HDR metadata whereas Plasma 6.2 does not and their findings appear to show that applications were passing way out of whack HDR metadata to Kwin (10 million peak brightness, for example) causing the resulting image to come out exceptionally dark. The KDE devs have added a check for "obviously wrong HDR metadata" that should fix the issue in 6.2.1, so I'm hopeful that HDR streaming on Linux will be back to normal once that commit hits Fedora 40.

Given that information, is it possible that Sunshine is doing the same thing when it runs the screen capture with KMS? KDE seems to have a fix of sorts going in, but it does seem that the true root cause of the issue is that applications are communicating extremely wrong metadata to Kwin.

@slagiewka
Copy link

The KDE devs have added a check for "obviously wrong HDR metadata" that should fix the issue in 6.2.1

That didn't make the cut for 6.2.1.
image

It should be in 6.2.2. It will be released on October 22nd.

@ReenigneArcher
Copy link
Member

Closing this as there it seems there is nothing do on Sunshine side of things. If 6.2.2 doesn't resolve it, please let me know and I will re-open this.

@ReenigneArcher ReenigneArcher closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2024
@BlazeKl
Copy link

BlazeKl commented Oct 23, 2024

It seems 6.2.2 didn't fix the issue, I still get a very dark and saturated image on latest kwin when streaming to my Steam Deck or Tablet with HDR, downgraded to kwin 6.1.5 as a workaround. 6.1.99 has the same issue as 6.2.2

@JustPlainGarak
Copy link
Author

It seems 6.2.2 didn't fix the issue, I still get a very dark and saturated image on latest kwin when streaming to my Steam Deck or Tablet with HDR, downgraded to kwin 6.1.5 as a workaround. 6.1.99 has the same issue as 6.2.2

What OS are you running where you have 6.2.2 already? I'm on Fedora 41 (now) and I'm still on 6.2.1 and don't expect to see 6.2.2 until at least Sunday.

@BlazeKl
Copy link

BlazeKl commented Oct 23, 2024

It seems 6.2.2 didn't fix the issue, I still get a very dark and saturated image on latest kwin when streaming to my Steam Deck or Tablet with HDR, downgraded to kwin 6.1.5 as a workaround. 6.1.99 has the same issue as 6.2.2

What OS are you running where you have 6.2.2 already? I'm on Fedora 41 (now) and I'm still on 6.2.1 and don't expect to see 6.2.2 until at least Sunday.

Running Arch, plasma was updated today to 6.2.2 https://archlinux.org/packages/extra/x86_64/kwin/

@slagiewka
Copy link

KDE will not fix it:

Question: is there any report yet?

No, and I will close all bug reports in [bugs.kde.org](http://bugs.kde.org/) about anything using kmsgrab breaking
It's not something we can support, and it is expected to break worse in the future

@ReenigneArcher
Copy link
Member

I've re-opened this, and opened a dedicated issue about migrating the capture protocol. #3327

@JustPlainGarak
Copy link
Author

I unfortunately have no coding skills, but I am a veteran sysadmin with a penchant for tinkering and testing so feel 100% free to tag me in any testing efforts required for the new capture protocol in either issue.

@Kane-Kuroneko
Copy link

I unfortunately have no coding skills, but I am a veteran sysadmin with a penchant for tinkering and testing so feel 100% free to tag me in any testing efforts required for the new capture protocol in either issue.

Oh, I suppose coding is not a really hard skill. Commanding machines to work for you is really fun! Just take a little time to try it!

@dec05eba
Copy link

I have the same issue in my software, gpu screen recorder. I didn't find a proper solution for it yet, but applying gamma correction (1.8) seems to fix it. Need a proper fix though.

@JustPlainGarak
Copy link
Author

I have the same issue in my software, gpu screen recorder. I didn't find a proper solution for it yet, but applying gamma correction (1.8) seems to fix it. Need a proper fix though.

If the application you're using is also using kmsgrab (as Sunshine is) then the solution is going to have to be to switch to an interface that Wayland/KDE will support going forward. I believe the two main candidates are the pipewire portal (which I believe doesn't support HDR capture in Kwin yet) or the new Wayland screencopy portal (though I think merging of this feature is limited to wlroots for the moment).

@DistantThunder
Copy link

Hello do we still need to stay on KDE <= 6.2 for HDR streaming to work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants