Repository navigation
feat(agc): present BT.2100 PQ display buffers on an SDR output - #5696
Merged
Merged
Conversation
Accept the 10-bit BT.2100 PQ display formats 0x8100070422000000 (red in the low bits) and 0x8100070400000000 (blue in the low bits) and convert them to 8-bit sRGB when presented: PQ EOTF, BT.2020 to BT.709 primaries, a luminance tone map whose white level is the tone-map luminance sceSystemServiceGetHdrToneMapLuminance reports (reference white min(203 nits, white level)), and the sRGB encoding. The conversion runs on the CPU for linear buffers and DCC clear values, in the color transfer shader for tiled guest buffers, and in the presentation pass for resident images. The three share the PQ EOTF table computed once in double precision. AI-assisted: yes
11 tasks done
11 tasks done
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
|
Collaborator
|
Checked on the PR merged onto main: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Presents display buffers in the 10-bit BT.2100 PQ pixel formats
0x8100070422000000(red in the low bits) and0x8100070400000000(blue in the low bits) instead of throwingVideoOut: unsupported display pixel formatatsceVideoOutRegisterBuffers2.The format values come from open references: SharpProspero names both (
Rgb10A2Bt2100Pq,Bgr10A2Bt2100Pq) and KytyPS5 maps the first (VIDEO_OUT_PIXEL_FORMAT_R10_G10_B10_A2_BT2100_PQ). PPSA01317 registers the first itself. Main's output is SDR, so the texels are converted to 8-bit sRGB when presented:sceSystemServiceGetHdrToneMapLuminancereports. On main that is always 100 nits, which is now one shared constant (ToneMapLuminance.hpp), so the shoulder reduces to a clip at 100 nits. The follow-up HDR output PR makes the white level follow the luminance reported to the title.Every display path main has converts them:
DecodeDisplayBufferon the CPU.GpuColorTransfer::Detile, as a new mode ofColorTransfer.comp.PresentationPass.frag(perf(agc): present resident displays without the 4K convert chain #5311's resident present without the 4K convert chain).ResidentPresentPathreturns Convert for these formats, so a PQ image is never blitted.DisplayBufferClearPixel.The two shaders share
Graphics/shaders/PqToSdr.glslthroughGL_GOOGLE_include_directive. Other format values with PQ or BT.2020 bits (8-bit, float, linear transfer) still throw. The technical debt entry records the open references, and that the tone map is ours: how a console shows such a buffer on an SDR display is unknown.Overlap:
ColorTransfer.compand the descriptor setup inGpuColorTransfer.cppfor the half-float table. This PR adds binding 3 next to it. The changes touch neighbouring lines but different functions.Tested
Windows 11 (10.0.26220), MinGW-w64 GCC 15.2.0, Release,
BUILD_TESTING=ON, this branch onmaind8888df.linear_display_buffer(CPU):agc_display_buffer_dcc(CPU): fast-clear codes 0000 and 1111, and register clears in both orders.agc_resident_present(Vulkan): GPU detile of random tiled PQ texels from guest memory against the CPU conversion, within one level, at 100, 1000 and 150 nits.agc_driver_presentation_pass(Vulkan): resident PQ images in A2B10G10R10 and A2R10G10B10, both orders, at 100 and 1000 nits, against the CPU conversion:agc_driver_bda_deviceandguest_system_servicepass unchanged.mainthese tests fail:DisplayBufferSizethrows for both formats, andDisplayTexelFormat(0x8100070422000000)returns the blue-low format.agc_resident_present. A wrong knee or a hard-coded white level in the fragment shader failsagc_driver_presentation_passat 1000 nits.tools/check_conventions.py --base origin/mainpasses.mainran the title on Windows from a local tree, with the HDR output of the follow-up PR. This branch was not run in the title, and the SDR conversion has not been compared with the title's frames.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)