-
Notifications
You must be signed in to change notification settings - Fork 3k
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
WIP: DRM HDR support #10762
WIP: DRM HDR support #10762
Conversation
For the record, this can't be used with |
08870fc
to
a240ff0
Compare
454741b
to
75f2ace
Compare
9ab36e8
to
afb7950
Compare
cc1630d
to
dbc4f8b
Compare
6e33ddf
to
16ddbff
Compare
I have tested this on a very old GPU, Mesa Intel(R) HD Graphics 4600 (HSW GT2). It, surprisingly, can send the correct HDR metadata, but the playback via --vo=gpu is something like 1 frame per second. --vo=drm plays the same file smoothly, but without HDR metadata. Could you please add support for --vo=drm? |
Forget that. I added |
There's still some infrastructure required to get the correct HDR data sent to the screen. Right now that's not being done at all, it's sending image metadata but not HDR metadata. That being said, it can be added to |
Well, this is false in my case. Does Haswell support hardware-accelerated OpenGL for 10bpc formats? For some unknown reason, |
It's not false, it's the difference of rendering on the CPU vs. rendering on the GPU. The reason |
Quick rebase for the DRM changes, it compiles but I didn't check if it still works. No new comments addressed |
Additionally, wire it up in both vo_gpu and vo_gpu_next, before start_frame, which would be where vo_gpu receives the configured csp via fbo_csp.
This adds the ability to use colorspace hints in the drm context for opengl. This will be useful for sending HDR metadata to the screen.
This commit allows HDR metadata to be sent to the display when using mpv in a DRM context on Linux. This commit is based off of two former patches by medvedvvs and wsldankers. Their commit messages are below. This commit has been updated to build on meson and address other comments made in review on mpv-player#8648. This commit extends the previous ones by automatically setting the colorspace information and enabling HDR metadata by default. Co-Authored-By: medvedvvs <38043594+medvedvvs@users.noreply.github.com> Co-Authored-By: Wessel Dankers <wsl@fruit.je>
Just a warning - this branch broke for me. It worked before, now it doesn't switch the monitor to the HDR mode. I cannot say precisely when exactly it broke, because of the force-pushing that prevents the bisection. |
I'll try and work on this some more this week, at least to get it back to working status again. |
I guess this doesn't work on Nvidia yet? I've got a GTX1050 (driver version 530.41.03) and a GP27U monitor. My monitor doesn't switch to HDR on the latest version of this branch as well as commit 16d0be8. I did try with Nouveau, but it doesn't work due to Nouveau not having DRM atomic support. My guess is that the |
nvidia is unlikely to work for anything drm related until their driver is merged upstream. |
I had a look into this a few weeks ago and I can confirm.
Now that their blob drivers are partially open-source (see https://github.com/NVIDIA/open-gpu-kernel-modules/tree/main/kernel-open/nvidia-drm), it might be possible to get DRM in SDR working at least, (there's already a draft MR for |
I should probably clarify. The HDR videos I've tried do play in SDR using nvidia's DRM module. The monitor just doesn't switch to HDR. |
I have stupid question: does mpv's code use any of those DRM lease (from X) protocols? https://cgit.freedesktop.org/~keithp/kmscube/?h=drm-lease I ask because I have hard time understanding how windowed mode with HDR content should behave .... Tonemapped to SDR as usual, with switching to fullscreen drm (gles?) mode with metadata output to connector? edit: it seems to be in xrandr 1.6 ... Edit 2: ==== HMDs and potential other nonstandard display hardware like apple touchbar displays are hardcoded (by EDID data) in the kernel to have a property called non-desktop. Displays with the non-desktop property will be advertised as disconnected by X.org, which will cause the usual desktop configuration tools to ignore these displays, though it is still possible to enable them, set modes etc. with tools like xrandr. Applications that want to render to non-desktop displays (e.g. SteamVR compositor) use the Vulkan extension VK_EXT_direct_mode_display (optionally with EXT_acquire_xlib_display) to acquire access to the display through a drm-lease. Then the application can render directly to the display and bypass X.org, desktop compositors, window managers, ... In X.org the non-desktop property can be temporarily overwritten at runtime: xrandr --output HDMI-A-0 --set non-desktop 0 After this command the HMD display will be recognized by X as a newly connected standard display which can be enabled and managed with monitor configuration utilities. Likewise the property can be enabled: xrandr --output HDMI-A-0 --set non-desktop 1 This command even works on currently enabled displays and will cause X.org to advertise an event as if the display was manually disconnected. It can be used on any display, even those not tagged as non-display by the kernel, so direct mode can be potentially used on HMDs that have not been added to the kernel. ==== |
Also possibly related? https://patchwork.freedesktop.org/series/111864/ found via KODI's bugtracker on BT2020 support on Intel: |
Yes. It'll be necessary for proper HDR output. |
Could you please verify whether an older commit (248a7d0) works? If it does, the breakage is likely the same as on Intel. |
Yes, I've tried both (248a7d0) and the latest version of the branch. They both play videos just fine via (I may have forgotten to proof read my previous comment, because it looks like I wrote the wrong hash.) |
Nothing about Xorg or Wayland is relevant here, nothing. And it never will be, so any progress you see about Wayland and HDR is completely separate from this PR. This PR is not required for mpv to support any eventual Wayland HDR, either.
My rebase is still untested. There was a DRM refactor that changed how DRM atomic stuff worked. The next steps in this PR are to do the following:
If you don't know what these mean then please do not comment on this PR. I apologize for being delinquent with it but it's just not ready yet, so you will not be able to test it. Edit: Another point, that I'd really like to stress, nvidia will never be supported, so if you have an nvidia GPU and this doesn't work then that sucks but you'll have to take it up with them. This will be tested with intel and AMD which have usable, upstreamed drivers. |
Hey, I'd just like to chime in to say that I really really appreciate the work you are doing. <3 We have a home server / media center PC, connected to a 4K HDR OLED TV, and switching from kodi to mpv would be a great improvement to our home media experience, for watching HDR movies. If there is anything I could test or otherwise help with, please let me know! |
Curious if somebody tested with 545.xx driver from Nvidia.. it should work? |
There's a cleaner solution here for HDR passthrough on Linux through gamescope.
|
Don't you need something like this first: https://github.com/Zamundaaa/VK_hdr_layer/tree/work/frog-protocol ? |
No, Gamescope WSI layer shipped with Gamescope already does that |
Giving up on this. I learned a lot about DRM, but HDR is still a mystery to me and I don't have the time to learn it. For anyone wanting to pick this up, the next steps are
|
Thank you for this answer and your work on HDR! |
Actually, can I use this with current Plasma 5 or does it require the future Plasma 6? I'm asking because running it on 5 does not seem to work. Is there a better wayland compositor for mpv to work properly? Thanks! |
This is a rebase of #8648 and #8456 and supersedes them. It is not finished, so please do not spam this PR with "when will this be merged?", it won't be for a while.
Some TODOS:
--gpu-api=vulkan
?--vo=gpu-next
?--drm-format=
if needed--target-trc
, etc. like is done on windows@evelikov @emersion I believe I addressed most (all?) of your comments from the previous PRs, but I am a complete novice at drm so any drive-bys would be appreciated.
For others testing, the following command (in a tty) will work:
mpv --vo=gpu --gpu-api=opengl --gpu-context=drm $my_hdr_file
DRM metadata should be automatically sent.
Closes #8219