Commit c20da89e authored by Relja Vojvodic's avatar Relja Vojvodic Committed by Alex Deucher

drm/amd/display: 3DLUT non-DMA refactor

[Why]
Currently the handling for 3DLUT is found in multiple different
places, which causes issues when the different functions are not
in sync with each other.
Frequently bugs occur because the LUT handling is broken up, and
what has already been handled isn't kept track of well, which can
cause earlier changes to the LUT params to be overridden.

[How]
Remove DMA LUT handling from DCN401 and refactor legacy LUT
handling in one place to make it easier to keep track of what has
and needs to be done.
Reviewed-by: default avatarIlya Bakoulin <ilya.bakoulin@amd.com>
Signed-off-by: default avatarRelja Vojvodic <Relja.Vojvodic@amd.com>
Signed-off-by: default avatarTom Chung <chiahsuan.chung@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 782cef7f
...@@ -162,7 +162,6 @@ static const struct hwseq_private_funcs dcn32_private_funcs = { ...@@ -162,7 +162,6 @@ static const struct hwseq_private_funcs dcn32_private_funcs = {
.is_dp_dig_pixel_rate_div_policy = dcn32_is_dp_dig_pixel_rate_div_policy, .is_dp_dig_pixel_rate_div_policy = dcn32_is_dp_dig_pixel_rate_div_policy,
.apply_single_controller_ctx_to_hw = dce110_apply_single_controller_ctx_to_hw, .apply_single_controller_ctx_to_hw = dce110_apply_single_controller_ctx_to_hw,
.reset_back_end_for_pipe = dcn20_reset_back_end_for_pipe, .reset_back_end_for_pipe = dcn20_reset_back_end_for_pipe,
.populate_mcm_luts = dcn401_populate_mcm_luts,
}; };
void dcn32_hw_sequencer_init_functions(struct dc *dc) void dcn32_hw_sequencer_init_functions(struct dc *dc)
......
...@@ -670,46 +670,40 @@ bool dcn401_set_mcm_luts(struct pipe_ctx *pipe_ctx, ...@@ -670,46 +670,40 @@ bool dcn401_set_mcm_luts(struct pipe_ctx *pipe_ctx,
struct dpp *dpp_base = pipe_ctx->plane_res.dpp; struct dpp *dpp_base = pipe_ctx->plane_res.dpp;
int mpcc_id = pipe_ctx->plane_res.hubp->inst; int mpcc_id = pipe_ctx->plane_res.hubp->inst;
struct mpc *mpc = pipe_ctx->stream_res.opp->ctx->dc->res_pool->mpc; struct mpc *mpc = pipe_ctx->stream_res.opp->ctx->dc->res_pool->mpc;
bool result = true; bool result;
const struct pwl_params *lut_params = NULL; const struct pwl_params *lut_params = NULL;
bool rval; bool rval;
mpc->funcs->set_movable_cm_location(mpc, MPCC_MOVABLE_CM_LOCATION_BEFORE, mpcc_id); mpc->funcs->set_movable_cm_location(mpc, MPCC_MOVABLE_CM_LOCATION_BEFORE, mpcc_id);
pipe_ctx->plane_state->mcm_location = MPCC_MOVABLE_CM_LOCATION_BEFORE; pipe_ctx->plane_state->mcm_location = MPCC_MOVABLE_CM_LOCATION_BEFORE;
// 1D LUT // 1D LUT
if (plane_state->mcm_shaper_3dlut_setting == DC_CM2_SHAPER_3DLUT_SETTING_BYPASS_ALL) { if (plane_state->blend_tf.type == TF_TYPE_HWPWL)
if (plane_state->blend_tf.type == TF_TYPE_HWPWL) lut_params = &plane_state->blend_tf.pwl;
lut_params = &plane_state->blend_tf.pwl; else if (plane_state->blend_tf.type == TF_TYPE_DISTRIBUTED_POINTS) {
else if (plane_state->blend_tf.type == TF_TYPE_DISTRIBUTED_POINTS) { rval = cm3_helper_translate_curve_to_hw_format(&plane_state->blend_tf,
rval = cm3_helper_translate_curve_to_hw_format(&plane_state->blend_tf, &dpp_base->regamma_params, false);
&dpp_base->regamma_params, false); lut_params = rval ? &dpp_base->regamma_params : NULL;
lut_params = rval ? &dpp_base->regamma_params : NULL;
}
result = mpc->funcs->program_1dlut(mpc, lut_params, mpcc_id);
lut_params = NULL;
} }
result = mpc->funcs->program_1dlut(mpc, lut_params, mpcc_id);
lut_params = NULL;
// Shaper // Shaper
if (plane_state->mcm_shaper_3dlut_setting == DC_CM2_SHAPER_3DLUT_SETTING_BYPASS_ALL) { if (plane_state->in_shaper_func.type == TF_TYPE_HWPWL)
if (plane_state->in_shaper_func.type == TF_TYPE_HWPWL) lut_params = &plane_state->in_shaper_func.pwl;
lut_params = &plane_state->in_shaper_func.pwl; else if (plane_state->in_shaper_func.type == TF_TYPE_DISTRIBUTED_POINTS) {
else if (plane_state->in_shaper_func.type == TF_TYPE_DISTRIBUTED_POINTS) { // TODO: dpp_base replace
// TODO: dpp_base replace rval = cm3_helper_translate_curve_to_hw_format(&plane_state->in_shaper_func,
ASSERT(false); &dpp_base->shaper_params, true);
rval = cm3_helper_translate_curve_to_hw_format(&plane_state->in_shaper_func, lut_params = rval ? &dpp_base->shaper_params : NULL;
&dpp_base->shaper_params, true);
lut_params = rval ? &dpp_base->shaper_params : NULL;
}
result = mpc->funcs->program_shaper(mpc, lut_params, mpcc_id);
} }
result &= mpc->funcs->program_shaper(mpc, lut_params, mpcc_id);
// 3D // 3D
if (plane_state->mcm_shaper_3dlut_setting == DC_CM2_SHAPER_3DLUT_SETTING_BYPASS_ALL) { if (mpc->funcs->program_3dlut) {
if (plane_state->lut3d_func.state.bits.initialized == 1) if (plane_state->lut3d_func.state.bits.initialized == 1)
result = mpc->funcs->program_3dlut(mpc, &plane_state->lut3d_func.lut_3d, mpcc_id); result &= mpc->funcs->program_3dlut(mpc, &plane_state->lut3d_func.lut_3d, mpcc_id);
else else
result = mpc->funcs->program_3dlut(mpc, NULL, mpcc_id); result &= mpc->funcs->program_3dlut(mpc, NULL, mpcc_id);
} }
return result; return result;
......
...@@ -136,7 +136,7 @@ static const struct hwseq_private_funcs dcn401_private_funcs = { ...@@ -136,7 +136,7 @@ static const struct hwseq_private_funcs dcn401_private_funcs = {
.calculate_dccg_k1_k2_values = NULL, .calculate_dccg_k1_k2_values = NULL,
.apply_single_controller_ctx_to_hw = dce110_apply_single_controller_ctx_to_hw, .apply_single_controller_ctx_to_hw = dce110_apply_single_controller_ctx_to_hw,
.reset_back_end_for_pipe = dcn20_reset_back_end_for_pipe, .reset_back_end_for_pipe = dcn20_reset_back_end_for_pipe,
.populate_mcm_luts = dcn401_populate_mcm_luts, .populate_mcm_luts = NULL,
}; };
void dcn401_hw_sequencer_init_functions(struct dc *dc) void dcn401_hw_sequencer_init_functions(struct dc *dc)
......
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