support HDR on SDR displays
When we need to present HDR content, this makes KWin increase the backlight brightness, while also reducing the pixel values in a way that keeps the brightness of SDR content roughly the same. The resulting headroom is then used to present HDR content properly.
Phone cameras are incredibly bad at capturing HDR content, but because of the lack of proper tone mapping in KWin (which I intend to improve soon) the result is still very obvious:
If you want to see the real result, it's best to test it yourself though. To do that,
- compile this MR and also powerdevil!407 (merged) to significantly reduce brightness flicker
- reduce your display brightness to something below 100%; the ideal brightness depends on the video but 30% should always be enough
- download some HDR video to watch (https://4kmedia.org/ has a few; I used "Samsung: Travel With My Pet HDR")
- install my Vulkan layer: https://github.com/Zamundaaa/VK_hdr_layer
- play the HDR video with
ENABLE_HDR_WSI=1 mpv --vo=gpu-next --target-colorspace-hint --gpu-api=vulkan --gpu-context=waylandvk "/path/to/video"
on an internal display - with the MR in its current state, this feature is active only while the video is focused, so compare how it looks with the window focused vs. not
Draft because
-
this should be tested on more devices, to make sure the change in backlight brightness doesn't cause noticeable flicker -
we need sane default settings. Allowing to triple the backlight brightness is probably too much -> can be adjusted later -
the max. HDR headroom should probably depend on the current power management state. On AC we can make it as big as possible, but on the go it could have a pretty big impact on battery life (if you regularly watch HDR content, which, granted, is not a common thing right now) -> can be done later -
it probably needs to be restricted to laptop displays (at least by default); external displays with DDC/CI brightness control sometimes apply very slow animations -
this should also be made to work on devices without a "backlight" to adjust, we're applying the brightness change in software anyways -> done with !6516 (merged)
Edited by Xaver Hugl