Repository navigation
vo/opengl/android: add HDR10/HLG output - #18814
clemenswasser wants to merge 2 commits into
Conversation
Implement the ra_swapchain set_color hook: switch the ANativeWindow dataspace to BT.2020/PQ or HLG and recreate the EGL surface with the matching EGL_GL_COLORSPACE_*_EXT. Previously the window stayed in sRGB and gpu-next always tone-mapped to SDR. Implement ra_ctx_params.preferred_csp() through JNI (ActivityThread -> DisplayManager -> getHdrCapabilities, there is no NDK API for this), so --target-colorspace-hint=auto detects the display and tone maps to the panel peak without the application passing anything.
HDR output is limited to 8 bits unless the window surface is 10-bit. The surface and the context must share an EGLConfig, so this has to happen at context creation.
|
Duplicate of: #18710 And my review does not change from the other one. This should be implemented using EGL extensions (which are builtin on Android) in libplacebo as colorspace hint, which the same way as Vulkan and d3d11. Then there is zero changes needed in mpv. |
|
@kasper93 Sorry, I did not check for duplicates before opening this. I'll close this and redo the On Android, So I plan to pass the native window to the GL swapchain, which lets Does that work for you? |
I cannot comment on the details, because I would have to look closely into it. But the general idea is that we implement Then indeed like you said the We can discuss the details after there is better initial shape. |
|
@kasper93 Implemented in libplacebo: https://code.videolan.org/videolan/libplacebo/-/merge_requests/940 |
Adds HDR10/HLG output to the Android GL backend:
set_colorswitches theANativeWindowdataspace and recreates the EGL surface with the matchingEGL_GL_COLORSPACE_*_EXT, andpreferred_cspdetects HDR displays so--target-colorspace-hint=autoworks without the embedding app passinganything.
Android always reports the panel capability, so the default
targethintmode also renders SDR into the HDR container.
--target-colorspace-hint-mode=sourcekeeps SDR as SDR.The NDK has no HDR capability query, so this goes through JNI and depends on
the hidden
ActivityThread.currentApplication()API.Tested on a Galaxy Tab S9: DV/HDR10 -> BT2020/PQ at 540 nits,
HLG -> BT2020/HLG.
AI disclosure: developed with DeepSeek V4.1 Flash 1017 running in OpenCode.
I reviewed the changes and ran the tests above on the device.