mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 06:01:57 +00:00
drm/amd/display: Implement bias and scale pre scl
why: New scaler needs the input to be full range color space. This will also fix issues that come up due to not having a predefined limited color space matrix for certain color spaces how: Use bias and scale HW to expand the range of limited color spaces to full before the scaler Reviewed-by: Krunoslav Kovac <krunoslav.kovac@amd.com> Signed-off-by: Jerry Zuo <jerry.zuo@amd.com> Signed-off-by: Relja Vojvodic <relja.vojvodic@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
5fc77c2697
commit
c83ecc0bee
@ -901,12 +901,12 @@ void hwss_program_bias_and_scale(union block_sequence_params *params)
|
||||
struct pipe_ctx *pipe_ctx = params->program_bias_and_scale_params.pipe_ctx;
|
||||
struct dpp *dpp = pipe_ctx->plane_res.dpp;
|
||||
struct dc_plane_state *plane_state = pipe_ctx->plane_state;
|
||||
struct dc_bias_and_scale bns_params = {0};
|
||||
struct dc_bias_and_scale bns_params = plane_state->bias_and_scale;
|
||||
|
||||
//TODO :for CNVC set scale and bias registers if necessary
|
||||
build_prescale_params(&bns_params, plane_state);
|
||||
if (dpp->funcs->dpp_program_bias_and_scale)
|
||||
if (dpp->funcs->dpp_program_bias_and_scale) {
|
||||
dpp->funcs->dpp_program_bias_and_scale(dpp, &bns_params);
|
||||
}
|
||||
}
|
||||
|
||||
void hwss_power_on_mpc_mem_pwr(union block_sequence_params *params)
|
||||
|
@ -1292,7 +1292,7 @@ struct dc_plane_state {
|
||||
|
||||
struct dc_gamma gamma_correction;
|
||||
struct dc_transfer_func in_transfer_func;
|
||||
struct dc_bias_and_scale *bias_and_scale;
|
||||
struct dc_bias_and_scale bias_and_scale;
|
||||
struct dc_csc_transform input_csc_color_matrix;
|
||||
struct fixed31_32 coeff_reduction_factor;
|
||||
struct fixed31_32 hdr_mult;
|
||||
|
@ -59,6 +59,31 @@ void dpp35_dppclk_control(
|
||||
DISPCLK_R_GATE_DISABLE, 0);
|
||||
}
|
||||
|
||||
void dpp35_program_bias_and_scale_fcnv(
|
||||
struct dpp *dpp_base,
|
||||
struct dc_bias_and_scale *params)
|
||||
{
|
||||
struct dcn20_dpp *dpp = TO_DCN20_DPP(dpp_base);
|
||||
|
||||
if (!params->bias_and_scale_valid) {
|
||||
REG_SET(FCNV_FP_BIAS_R, 0, FCNV_FP_BIAS_R, 0);
|
||||
REG_SET(FCNV_FP_BIAS_G, 0, FCNV_FP_BIAS_G, 0);
|
||||
REG_SET(FCNV_FP_BIAS_B, 0, FCNV_FP_BIAS_B, 0);
|
||||
|
||||
REG_SET(FCNV_FP_SCALE_R, 0, FCNV_FP_SCALE_R, 0x1F000);
|
||||
REG_SET(FCNV_FP_SCALE_G, 0, FCNV_FP_SCALE_G, 0x1F000);
|
||||
REG_SET(FCNV_FP_SCALE_B, 0, FCNV_FP_SCALE_B, 0x1F000);
|
||||
} else {
|
||||
REG_SET(FCNV_FP_BIAS_R, 0, FCNV_FP_BIAS_R, params->bias_red);
|
||||
REG_SET(FCNV_FP_BIAS_G, 0, FCNV_FP_BIAS_G, params->bias_green);
|
||||
REG_SET(FCNV_FP_BIAS_B, 0, FCNV_FP_BIAS_B, params->bias_blue);
|
||||
|
||||
REG_SET(FCNV_FP_SCALE_R, 0, FCNV_FP_SCALE_R, params->scale_red);
|
||||
REG_SET(FCNV_FP_SCALE_G, 0, FCNV_FP_SCALE_G, params->scale_green);
|
||||
REG_SET(FCNV_FP_SCALE_B, 0, FCNV_FP_SCALE_B, params->scale_blue);
|
||||
}
|
||||
}
|
||||
|
||||
static struct dpp_funcs dcn35_dpp_funcs = {
|
||||
.dpp_program_gamcor_lut = dpp3_program_gamcor_lut,
|
||||
.dpp_read_state = dpp30_read_state,
|
||||
@ -81,7 +106,7 @@ static struct dpp_funcs dcn35_dpp_funcs = {
|
||||
.dpp_program_shaper_lut = NULL, // CM SHAPER block is removed in DCN3.2 DPP, (it is in MPCC, programmable before or after BLND)
|
||||
.dpp_program_3dlut = NULL, // CM 3DLUT block is removed in DCN3.2 DPP, (it is in MPCC, programmable before or after BLND)
|
||||
|
||||
.dpp_program_bias_and_scale = NULL,
|
||||
.dpp_program_bias_and_scale = dpp35_program_bias_and_scale_fcnv,
|
||||
.dpp_cnv_set_alpha_keyer = dpp2_cnv_set_alpha_keyer,
|
||||
.set_cursor_attributes = dpp3_set_cursor_attributes,
|
||||
.set_cursor_position = dpp1_set_cursor_position,
|
||||
|
@ -61,4 +61,7 @@ bool dpp35_construct(struct dcn3_dpp *dpp3, struct dc_context *ctx,
|
||||
|
||||
void dpp35_set_fgcg(struct dcn3_dpp *dpp, bool enable);
|
||||
|
||||
void dpp35_program_bias_and_scale_fcnv(struct dpp *dpp_base,
|
||||
struct dc_bias_and_scale *bias_and_scale);
|
||||
|
||||
#endif // __DCN35_DPP_H
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "basics/conversion.h"
|
||||
#include "dcn30/dcn30_cm_common.h"
|
||||
#include "dcn32/dcn32_dpp.h"
|
||||
#include "dcn35/dcn35_dpp.h"
|
||||
|
||||
#define REG(reg)\
|
||||
dpp->tf_regs->reg
|
||||
@ -240,7 +241,7 @@ static struct dpp_funcs dcn401_dpp_funcs = {
|
||||
.dpp_program_shaper_lut = NULL, // CM SHAPER block is removed in DCN3.2 DPP, (it is in MPCC, programmable before or after BLND)
|
||||
.dpp_program_3dlut = NULL, // CM 3DLUT block is removed in DCN3.2 DPP, (it is in MPCC, programmable before or after BLND)
|
||||
|
||||
.dpp_program_bias_and_scale = NULL,
|
||||
.dpp_program_bias_and_scale = dpp35_program_bias_and_scale_fcnv,
|
||||
.dpp_cnv_set_alpha_keyer = dpp2_cnv_set_alpha_keyer,
|
||||
.set_cursor_attributes = dpp401_set_cursor_attributes,
|
||||
.set_cursor_position = dpp401_set_cursor_position,
|
||||
|
@ -1698,7 +1698,7 @@ static void dcn20_update_dchubp_dpp(
|
||||
plane_state->update_flags.bits.input_csc_change ||
|
||||
plane_state->update_flags.bits.color_space_change ||
|
||||
plane_state->update_flags.bits.coeff_reduction_change) {
|
||||
struct dc_bias_and_scale bns_params = {0};
|
||||
struct dc_bias_and_scale bns_params = plane_state->bias_and_scale;
|
||||
|
||||
// program the input csc
|
||||
dpp->funcs->dpp_setup(dpp,
|
||||
@ -1715,7 +1715,6 @@ static void dcn20_update_dchubp_dpp(
|
||||
}
|
||||
if (dpp->funcs->dpp_program_bias_and_scale) {
|
||||
//TODO :for CNVC set scale and bias registers if necessary
|
||||
build_prescale_params(&bns_params, plane_state);
|
||||
dpp->funcs->dpp_program_bias_and_scale(dpp, &bns_params);
|
||||
}
|
||||
}
|
||||
|
@ -217,12 +217,13 @@ enum optc_dsc_mode {
|
||||
};
|
||||
|
||||
struct dc_bias_and_scale {
|
||||
uint16_t scale_red;
|
||||
uint16_t bias_red;
|
||||
uint16_t scale_green;
|
||||
uint16_t bias_green;
|
||||
uint16_t scale_blue;
|
||||
uint16_t bias_blue;
|
||||
uint32_t scale_red;
|
||||
uint32_t bias_red;
|
||||
uint32_t scale_green;
|
||||
uint32_t bias_green;
|
||||
uint32_t scale_blue;
|
||||
uint32_t bias_blue;
|
||||
bool bias_and_scale_valid;
|
||||
};
|
||||
|
||||
enum test_pattern_dyn_range {
|
||||
|
Loading…
Reference in New Issue
Block a user