Commit a97fdabc authored by Dave Airlie's avatar Dave Airlie

Merge tag 'amd-drm-fixes-5.12-2021-03-18' of...

Merge tag 'amd-drm-fixes-5.12-2021-03-18' of https://gitlab.freedesktop.org/agd5f/linux into drm-fixes

amdgpu:
- DCN 3.0 gamma fixes
- DCN 2.1 corrupt screen fix
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
From: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210318042858.3810-1-alexander.deucher@amd.com
parents db3f0d8e beb6b2f9
...@@ -1507,36 +1507,6 @@ static void dcn20_update_dchubp_dpp( ...@@ -1507,36 +1507,6 @@ static void dcn20_update_dchubp_dpp(
if (pipe_ctx->update_flags.bits.enable || pipe_ctx->update_flags.bits.opp_changed if (pipe_ctx->update_flags.bits.enable || pipe_ctx->update_flags.bits.opp_changed
|| pipe_ctx->stream->update_flags.bits.gamut_remap || pipe_ctx->stream->update_flags.bits.gamut_remap
|| pipe_ctx->stream->update_flags.bits.out_csc) { || pipe_ctx->stream->update_flags.bits.out_csc) {
struct mpc *mpc = pipe_ctx->stream_res.opp->ctx->dc->res_pool->mpc;
if (mpc->funcs->set_gamut_remap) {
int i;
int mpcc_id = hubp->inst;
struct mpc_grph_gamut_adjustment adjust;
bool enable_remap_dpp = false;
memset(&adjust, 0, sizeof(adjust));
adjust.gamut_adjust_type = GRAPHICS_GAMUT_ADJUST_TYPE_BYPASS;
/* save the enablement of gamut remap for dpp */
enable_remap_dpp = pipe_ctx->stream->gamut_remap_matrix.enable_remap;
/* force bypass gamut remap for dpp/cm */
pipe_ctx->stream->gamut_remap_matrix.enable_remap = false;
dc->hwss.program_gamut_remap(pipe_ctx);
/* restore gamut remap flag and use this remap into mpc */
pipe_ctx->stream->gamut_remap_matrix.enable_remap = enable_remap_dpp;
/* build remap matrix for top plane if enabled */
if (enable_remap_dpp && pipe_ctx->top_pipe == NULL) {
adjust.gamut_adjust_type = GRAPHICS_GAMUT_ADJUST_TYPE_SW;
for (i = 0; i < CSC_TEMPERATURE_MATRIX_SIZE; i++)
adjust.temperature_matrix[i] =
pipe_ctx->stream->gamut_remap_matrix.matrix[i];
}
mpc->funcs->set_gamut_remap(mpc, mpcc_id, &adjust);
} else
/* dpp/cm gamut remap*/ /* dpp/cm gamut remap*/
dc->hwss.program_gamut_remap(pipe_ctx); dc->hwss.program_gamut_remap(pipe_ctx);
......
...@@ -1595,6 +1595,11 @@ static void update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_param ...@@ -1595,6 +1595,11 @@ static void update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_param
dcn2_1_soc.num_chans = bw_params->num_channels; dcn2_1_soc.num_chans = bw_params->num_channels;
ASSERT(clk_table->num_entries); ASSERT(clk_table->num_entries);
/* Copy dcn2_1_soc.clock_limits to clock_limits to avoid copying over null states later */
for (i = 0; i < dcn2_1_soc.num_states + 1; i++) {
clock_limits[i] = dcn2_1_soc.clock_limits[i];
}
for (i = 0; i < clk_table->num_entries; i++) { for (i = 0; i < clk_table->num_entries; i++) {
/* loop backwards*/ /* loop backwards*/
for (closest_clk_lvl = 0, j = dcn2_1_soc.num_states - 1; j >= 0; j--) { for (closest_clk_lvl = 0, j = dcn2_1_soc.num_states - 1; j >= 0; j--) {
......
...@@ -113,6 +113,7 @@ bool cm3_helper_translate_curve_to_hw_format( ...@@ -113,6 +113,7 @@ bool cm3_helper_translate_curve_to_hw_format(
struct pwl_result_data *rgb_resulted; struct pwl_result_data *rgb_resulted;
struct pwl_result_data *rgb; struct pwl_result_data *rgb;
struct pwl_result_data *rgb_plus_1; struct pwl_result_data *rgb_plus_1;
struct pwl_result_data *rgb_minus_1;
struct fixed31_32 end_value; struct fixed31_32 end_value;
int32_t region_start, region_end; int32_t region_start, region_end;
...@@ -140,7 +141,7 @@ bool cm3_helper_translate_curve_to_hw_format( ...@@ -140,7 +141,7 @@ bool cm3_helper_translate_curve_to_hw_format(
region_start = -MAX_LOW_POINT; region_start = -MAX_LOW_POINT;
region_end = NUMBER_REGIONS - MAX_LOW_POINT; region_end = NUMBER_REGIONS - MAX_LOW_POINT;
} else { } else {
/* 10 segments /* 11 segments
* segment is from 2^-10 to 2^0 * segment is from 2^-10 to 2^0
* There are less than 256 points, for optimization * There are less than 256 points, for optimization
*/ */
...@@ -154,9 +155,10 @@ bool cm3_helper_translate_curve_to_hw_format( ...@@ -154,9 +155,10 @@ bool cm3_helper_translate_curve_to_hw_format(
seg_distr[7] = 4; seg_distr[7] = 4;
seg_distr[8] = 4; seg_distr[8] = 4;
seg_distr[9] = 4; seg_distr[9] = 4;
seg_distr[10] = 1;
region_start = -10; region_start = -10;
region_end = 0; region_end = 1;
} }
for (i = region_end - region_start; i < MAX_REGIONS_NUMBER ; i++) for (i = region_end - region_start; i < MAX_REGIONS_NUMBER ; i++)
...@@ -189,6 +191,10 @@ bool cm3_helper_translate_curve_to_hw_format( ...@@ -189,6 +191,10 @@ bool cm3_helper_translate_curve_to_hw_format(
rgb_resulted[hw_points - 1].green = output_tf->tf_pts.green[start_index]; rgb_resulted[hw_points - 1].green = output_tf->tf_pts.green[start_index];
rgb_resulted[hw_points - 1].blue = output_tf->tf_pts.blue[start_index]; rgb_resulted[hw_points - 1].blue = output_tf->tf_pts.blue[start_index];
rgb_resulted[hw_points].red = rgb_resulted[hw_points - 1].red;
rgb_resulted[hw_points].green = rgb_resulted[hw_points - 1].green;
rgb_resulted[hw_points].blue = rgb_resulted[hw_points - 1].blue;
// All 3 color channels have same x // All 3 color channels have same x
corner_points[0].red.x = dc_fixpt_pow(dc_fixpt_from_int(2), corner_points[0].red.x = dc_fixpt_pow(dc_fixpt_from_int(2),
dc_fixpt_from_int(region_start)); dc_fixpt_from_int(region_start));
...@@ -259,15 +265,18 @@ bool cm3_helper_translate_curve_to_hw_format( ...@@ -259,15 +265,18 @@ bool cm3_helper_translate_curve_to_hw_format(
rgb = rgb_resulted; rgb = rgb_resulted;
rgb_plus_1 = rgb_resulted + 1; rgb_plus_1 = rgb_resulted + 1;
rgb_minus_1 = rgb;
i = 1; i = 1;
while (i != hw_points + 1) { while (i != hw_points + 1) {
if (i >= hw_points - 1) {
if (dc_fixpt_lt(rgb_plus_1->red, rgb->red)) if (dc_fixpt_lt(rgb_plus_1->red, rgb->red))
rgb_plus_1->red = rgb->red; rgb_plus_1->red = dc_fixpt_add(rgb->red, rgb_minus_1->delta_red);
if (dc_fixpt_lt(rgb_plus_1->green, rgb->green)) if (dc_fixpt_lt(rgb_plus_1->green, rgb->green))
rgb_plus_1->green = rgb->green; rgb_plus_1->green = dc_fixpt_add(rgb->green, rgb_minus_1->delta_green);
if (dc_fixpt_lt(rgb_plus_1->blue, rgb->blue)) if (dc_fixpt_lt(rgb_plus_1->blue, rgb->blue))
rgb_plus_1->blue = rgb->blue; rgb_plus_1->blue = dc_fixpt_add(rgb->blue, rgb_minus_1->delta_blue);
}
rgb->delta_red = dc_fixpt_sub(rgb_plus_1->red, rgb->red); rgb->delta_red = dc_fixpt_sub(rgb_plus_1->red, rgb->red);
rgb->delta_green = dc_fixpt_sub(rgb_plus_1->green, rgb->green); rgb->delta_green = dc_fixpt_sub(rgb_plus_1->green, rgb->green);
...@@ -283,6 +292,7 @@ bool cm3_helper_translate_curve_to_hw_format( ...@@ -283,6 +292,7 @@ bool cm3_helper_translate_curve_to_hw_format(
} }
++rgb_plus_1; ++rgb_plus_1;
rgb_minus_1 = rgb;
++rgb; ++rgb;
++i; ++i;
} }
......
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