cm3_helper_translate_curve_to_hw_format() puts PQ, gamma 2.2, and HLG on 32 regions from 2^-25 to 2^7. Gamma 2.4 and 2.6 used the other layout, 12 regions from 2^-12 to 2^0.
cm_helper_translate_curve_to_hw_format() has the same split, for PQ and gamma 2.2 only. DCN 3.0, 3.01, 3.1, and 3.14 program the plane shaper through dcn20_set_shaper_3dlut(), which calls that helper. The inverse curve is the shaper, and its input is linear light from degamma. A 10-bit code v becomes (v/1023)^g. That is below 2^-12 for v = 1..31 at gamma 2.4 and v = 1..41 at gamma 2.6, so those codes come back as 0. On a gray ramp the round trip then misses the IGT bracket of 13. Gamma 2.4 needs a bracket of 33 and gamma 2.6 needs 41. Gamma 2.2 already uses the wide curve and its round trip is exact. Use the 32-region curve for gamma 2.4 and 2.6 in both helpers. Its low end is 2^-25, which covers those dark codes. On DCN 4.0.1 the gamma 2.4 round trip is exact and gamma 2.6 is off by one 10-bit code, so the original bracket of 13 passes. The DCN 3.0 family path was not tested. Signed-off-by: Harry Wentland <[email protected]> --- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c | 4 +++- drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c index 502a2d9b155f..6b3cc0d81e34 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c @@ -355,7 +355,9 @@ bool cm_helper_translate_curve_to_hw_format(struct dc_context *ctx, memset(lut_params, 0, sizeof(struct pwl_params)); memset(seg_distr, 0, sizeof(seg_distr)); - if (output_tf->tf == TRANSFER_FUNCTION_PQ || output_tf->tf == TRANSFER_FUNCTION_GAMMA22) { + if (output_tf->tf == TRANSFER_FUNCTION_PQ || output_tf->tf == TRANSFER_FUNCTION_GAMMA22 || + output_tf->tf == TRANSFER_FUNCTION_GAMMA24 || + output_tf->tf == TRANSFER_FUNCTION_GAMMA26) { /* 32 segments * segments are from 2^-25 to 2^7 */ diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c index eb299f7f9c41..8a76e985d359 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c +++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c @@ -133,6 +133,8 @@ bool cm3_helper_translate_curve_to_hw_format(struct dc_context *ctx, memset(seg_distr, 0, sizeof(seg_distr)); if (output_tf->tf == TRANSFER_FUNCTION_PQ || output_tf->tf == TRANSFER_FUNCTION_GAMMA22 || + output_tf->tf == TRANSFER_FUNCTION_GAMMA24 || + output_tf->tf == TRANSFER_FUNCTION_GAMMA26 || output_tf->tf == TRANSFER_FUNCTION_HLG) { /* 32 segments * segments are from 2^-25 to 2^7 -- 2.56.1
