drm/amd/display: Handle interpolation for first data point

[Why]
If the first data point for a custom brightness curve is not 0% luminance
then the first few luminance values will be ignored.

[How]
Check signal is below first data point and if so do linear interpolation to
0 instead.

Reviewed-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Ivan Lipski <ivan.lipski@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Mario Limonciello
2025-09-04 13:49:35 -05:00
committed by Alex Deucher
parent 74d70e309d
commit 6cec25f5b5

View File

@@ -4828,6 +4828,16 @@ static void convert_custom_brightness(const struct amdgpu_dm_backlight_caps *cap
if (!caps->data_points)
return;
/*
* Handle the case where brightness is below the first data point
* Interpolate between (0,0) and (first_signal, first_lum)
*/
if (brightness < caps->luminance_data[0].input_signal) {
lum = DIV_ROUND_CLOSEST(caps->luminance_data[0].luminance * brightness,
caps->luminance_data[0].input_signal);
goto scale;
}
left = 0;
right = caps->data_points - 1;
while (left <= right) {