Re: [PATCH v4 11/11] drm/amd/display: Force GAMCOR for subsampled surfaces with PQ/Gamma22/HLG
Robert Mader <[email protected]> Tue, 28 Jul 2026 18:04:16 +0200
| Newsgroups | org.freedesktop.lists.amd-gfx,org.freedesktop.lists.dri-devel,org.kernel.vger.stable |
|---|---|
| Message-ID | <[email protected]> |
Tested-by: Robert Mader <[email protected]> On 22.07.26 15:46, Harry Wentland wrote: > The ROM early-return checks for PQ, Gamma 2.2, and HLG in > mod_color_calculate_degamma_params() do not consider the map_user_ramp > parameter. When map_user_ramp is true (indicating a subsampled surface > that requires post-scaler degamma via GAMCOR), the function still takes > the ROM path, programming PRE_DEGAM instead. > > For subsampled formats the chroma channels must be upsampled by the > scaler before degamma is applied. PRE_DEGAM sits before the scaler in > the pipeline (CNVC domain), while GAMCOR sits after it (CM domain). > Using the ROM for subsampled surfaces means degamma is applied to > subsampled chroma before upsampling, producing incorrect results. > > Fix by gating the dcn_arch ROM capability checks on !map_user_ramp, > forcing PQ/Gamma22/HLG through the GAMCOR LUT path when the surface > is subsampled. > > Fixes: a8bf71649088 ("drm/amd/display: Internal refactoring to abstract color caps") > Cc: [email protected] > Assisted-by: Copilot:claude-opus-4.6 > Signed-off-by: Harry Wentland <[email protected]> > --- > drivers/gpu/drm/amd/display/modules/color/color_gamma.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c > index 03d88e78165d..5786ef5787ac 100644 > --- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c > +++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c > @@ -1696,7 +1696,8 @@ bool mod_color_calculate_degamma_params(struct dc_color_caps *dc_caps, > return true; > > if (dc_caps != NULL && > - dc_caps->dpp.dcn_arch == 1) { > + dc_caps->dpp.dcn_arch == 1 && > + !map_user_ramp) { > > if (input_tf->tf == TRANSFER_FUNCTION_PQ && > dc_caps->dpp.dgam_rom_caps.pq == 1) -- Robert Mader Consultant Software Developer Collabora Ltd. Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK Registered in England & Wales, no. 5513718