Commit 4a69244e authored by Anthony Koo's avatar Anthony Koo Committed by Alex Deucher

drm/amd/display: Fix distribution of segments for PQ

For PQ case, redistribution of segments should be done differently
for FP16 case in order to handle content above FP16 value of 1.0
Signed-off-by: default avatarAnthony Koo <anthony.koo@amd.com>
Reviewed-by: default avatarAric Cyr <Aric.Cyr@amd.com>
Acked-by: default avatarHarry Wentland <Harry.Wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent ab3ee7a5
...@@ -387,6 +387,49 @@ static bool build_hw_curve_configuration( ...@@ -387,6 +387,49 @@ static bool build_hw_curve_configuration(
return result; return result;
} }
static bool setup_distribution_points_pq(
struct gamma_curve *arr_curve_points,
struct curve_points *arr_points,
uint32_t *hw_points_num,
struct hw_x_point *coordinates_x,
enum surface_pixel_format format)
{
struct curve_config cfg;
cfg.offset = 0;
cfg.segments[0] = 2;
cfg.segments[1] = 2;
cfg.segments[2] = 2;
cfg.segments[3] = 2;
cfg.segments[4] = 2;
cfg.segments[5] = 2;
cfg.segments[6] = 3;
cfg.segments[7] = 4;
cfg.segments[8] = 4;
cfg.segments[9] = 4;
cfg.segments[10] = 4;
cfg.segments[11] = 5;
cfg.segments[12] = 5;
cfg.segments[13] = 5;
cfg.segments[14] = 5;
cfg.segments[15] = 5;
if (format == SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616F ||
format == SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616F)
cfg.begin = -11;
else
cfg.begin = -16;
if (!build_hw_curve_configuration(
&cfg, arr_curve_points,
arr_points,
coordinates_x, hw_points_num)) {
ASSERT_CRITICAL(false);
return false;
}
return true;
}
static bool setup_distribution_points( static bool setup_distribution_points(
struct gamma_curve *arr_curve_points, struct gamma_curve *arr_curve_points,
struct curve_points *arr_points, struct curve_points *arr_points,
...@@ -1414,15 +1457,17 @@ bool calculate_regamma_params(struct pwl_params *params, ...@@ -1414,15 +1457,17 @@ bool calculate_regamma_params(struct pwl_params *params,
scale_gamma(rgb_user, ramp, dividers); scale_gamma(rgb_user, ramp, dividers);
setup_distribution_points(arr_curve_points, arr_points,
&params->hw_points_num, coordinates_x);
if (stream->public.out_transfer_func && if (stream->public.out_transfer_func &&
stream->public.out_transfer_func->tf == TRANSFER_FUNCTION_PQ) { stream->public.out_transfer_func->tf == TRANSFER_FUNCTION_PQ) {
setup_distribution_points_pq(arr_curve_points, arr_points,
&params->hw_points_num, coordinates_x,
surface->public.format);
build_regamma_curve_pq(rgb_regamma, rgb_oem, coeff128_oem, build_regamma_curve_pq(rgb_regamma, rgb_oem, coeff128_oem,
ramp, surface, params->hw_points_num, ramp, surface, params->hw_points_num,
coordinates_x, axix_x_256, dividers); coordinates_x, axix_x_256, dividers);
} else { } else {
setup_distribution_points(arr_curve_points, arr_points,
&params->hw_points_num, coordinates_x);
build_regamma_curve(rgb_regamma, rgb_oem, coeff128_oem, build_regamma_curve(rgb_regamma, rgb_oem, coeff128_oem,
ramp, surface, params->hw_points_num, ramp, surface, params->hw_points_num,
coordinates_x, axix_x_256, dividers); coordinates_x, axix_x_256, dividers);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment