-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
[Windows] fix playback of HDR material when Windows is already in HDR mode #23241
Conversation
I'm sure it's just AMD. This does not happen on Nvidia or Intel. With Windows HDR ON all the time the picture is correct even in the case of the first video played is HDR. If the requirement for AMD is set initial swap chain color space probably is more easy do it here: xbmc/xbmc/rendering/dx/DeviceResources.cpp Line 714 in a46a420
Insert Most of the others changes seems to me redundant or unnecessary: e.g. in debug info OSD is already tracked if color space is SDR or PQ. Note there are two different things: Windows HDR on/off and transfer PQ on/off Windows HDR on - EOTF SDR ---> plays SDR video with Windows HDR on |
Setting an initial value is not enough, I would have stopped there :-) It could be AMD drivers yes, Windows is also manipulating the color spaces to get multiple apps to share the system. Setting SDR mode initially could be omitted, it's there only so that m_swapChainColorSpace is initialized when Kodi starts. Yes it looked like an overlap between m_IsTransferPQ and m_swapChainColorSpace because one commit to clean it up was missing. Now pushed. |
Now looks much worse :( As this is a fix I not understand by is need change things in debug Info OSD and I'd like to see first the minimal changes that fix the problem on AMD without touching anything else. Then maybe I'll understand why it happens. There are other reasons: if it's really just a fix, backport to Nexus would be desirable but then you shouldn't include changes that aren't necessary (like adding color space in debug Info OSD or changing how m_IsTransferPQ works). |
You men that full screen windowed works fine? (Use fullscreen window setting ON) Maybe AMD driver not supports full screen exclusive. Anyway today there is no advantage to use full screen exclusive on Windows 11. Formerly improve performance a little but there are no differences anymore. |
I was not thinking about a backport, but here you go, minimal version that still doesn't unnecessarily recreate the swap chain twice in a row when Windows HDR mode switching is used. Both windowed fullscreen (most common) and fullscreen exclusive fail. Windowed non-fullscreen mode was OK. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now looks much better and changes are clear. If this is enough to fix these AMD issues go ahead.
yes it's enough. I'll hold on a bit on the merge and will create a bug report with AMD just in case. |
Description
The current code sets the color space matching the played media long after the creation of the swap chain, except when Kodi switches the Windows HDR mode, forcing the creation of a new swap chain (the only case that works properly).
After some experiments, it seems that setting a colorspace has no effect on a used swap chain, at least on recent AMD GPU. That is not mentioned in MS documentation.
Made changes to:
(untested: this change may also help with the setting of the HDR10 metadata)
Motivation and context
Blown out picture for HDR video when the screen is in HDR mode when Kodi starts.
The issue sort of self-corrects when "Use display HDR capabilities" is enabled but it's not ideal. Play HDR 1st time: bad picture, Kodi switches screen to SDR when playback stops, play HDR 2nd time: Kodi switches HDR on, playback ok
The problem is possibly limited to AMD. I don't think it was reported before and I don't have other HDR-capable hardware to check.
How has this been tested?
Windows 10 x64, AMD GPU
Combinations of:
Other than pre-existing problems when Windows HDR is switched while Kodi is running, things worked as expected (good picture).
What is the effect on users?
Maybe recent AMD only.
Kodi plays HDR correctly when the screen is already in HDR mode.
=> it's possible to set and leave the screen in HDR mode and Kodi will play any media SDR/HDR correctly.
Screenshots (if appropriate):
Before:
unable to capture, taking a screenshots fixes the problem.
After: normal image
Types of change
Checklist: