mirror of
https://github.com/torvalds/linux.git
synced 2026-09-11 20:13:02 +02:00
drm/amd/display: use halving distribution for all encode-to-linear curves
In encode-to-linear conversions, LUT entries should be uniformly
distributed across the input range: non-linear encodings are already
approximately perceptually uniform, so every input code carries the same
weight. A fixed count per region does the opposite, concentrating
entries on the darker values and leaving few for the bright end, whereas
halving distribution spaces all 256 entries uniformly. This holds for
any encoded input, so remove the PQ/sRGB condition from commit
"drm/amd/display: use halving distribution for PQ/sRGB linearizing LUT"
and apply halving to all encode-to-linear operations
(pre-defined TF or user LUTs).
It fixes the following IGT kms_colorop subtests:
- plane-XR30-XR30-srgb_inv_eotf_lut-srgb_eotf_lut
- plane-XR30-XR30-gamma_2_2-gamma_2_2_inv-gamma_2_2
Fixes: a71d2b051f ("drm/amd/display: use halving distribution for PQ/sRGB linearizing LUT")
Reviewed-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Melissa Wen <mwen@igalia.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 6df7c9c307e72e7f13829e94edc89134f0764775)
This commit is contained in:
parent
5a67d2e055
commit
4278d65a41
|
|
@ -320,6 +320,8 @@ static struct fixed31_32 interp_tf_pts(const struct fixed31_32 *output_tf_channe
|
|||
return value;
|
||||
}
|
||||
|
||||
#define NUM_DEGAMMA_REGIONS 9
|
||||
|
||||
bool cm3_helper_translate_curve_to_degamma_hw_format(
|
||||
const struct dc_transfer_func *output_tf,
|
||||
struct pwl_params *lut_params)
|
||||
|
|
@ -343,31 +345,15 @@ bool cm3_helper_translate_curve_to_degamma_hw_format(
|
|||
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_SRGB) {
|
||||
/* 9 segments
|
||||
* segments are from 2^-9 to 0
|
||||
*/
|
||||
const uint8_t SEG_COUNT = 9;
|
||||
seg_distr[0] = 0; // Since we only have one point in darkest region
|
||||
for (k = 1; k < SEG_COUNT; k++)
|
||||
seg_distr[k] = k - 1; // 2^(k-1) points per region; halves as k decreases
|
||||
/* 9 segments
|
||||
* segments are from 2^-9 to 2^0
|
||||
*/
|
||||
seg_distr[0] = 0; // Since we only have one point in darkest region
|
||||
for (k = 1; k < NUM_DEGAMMA_REGIONS; k++)
|
||||
seg_distr[k] = k - 1; // 2^(k-1) points per region; halves as k decreases
|
||||
|
||||
region_start = -SEG_COUNT;
|
||||
region_end = 0;
|
||||
} else {
|
||||
/* 12 segments
|
||||
* segments are from 2^-12 to 2^0
|
||||
* There are less than 256 points, for optimization
|
||||
*/
|
||||
const uint8_t SEG_COUNT = 12;
|
||||
|
||||
for (i = 0; i < SEG_COUNT; i++)
|
||||
seg_distr[i] = 4;
|
||||
|
||||
region_start = -SEG_COUNT;
|
||||
region_end = 0;
|
||||
}
|
||||
region_start = -NUM_DEGAMMA_REGIONS;
|
||||
region_end = 0;
|
||||
|
||||
for (i = region_end - region_start; i < MAX_REGIONS_NUMBER ; i++)
|
||||
seg_distr[i] = -1;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user