static void dce_transform_reset(struct transform *xfm) { struct dce_transform *xfm_dce = TO_DCE_TRANSFORM(xfm); xfm_dce->filter_h = NULL; xfm_dce->filter_v = NULL; }
void dce110_opp_set_regamma_mode(struct transform *xfm, enum opp_regamma mode) { struct dce_transform *xfm_dce = TO_DCE_TRANSFORM(xfm); REG_SET(REGAMMA_CONTROL, 0, GRPH_REGAMMA_MODE, mode); }
void dce110_opp_program_regamma_pwl(struct transform *xfm, const struct pwl_params *params) { struct dce_transform *xfm_dce = TO_DCE_TRANSFORM(xfm); /* Setup regions */ regamma_config_regions_and_segments(xfm_dce, params); /* Program PWL */ program_pwl(xfm_dce, params); }
static void dce_transform_set_pixel_storage_depth( struct transform *xfm, enum lb_pixel_depth depth, const struct bit_depth_reduction_params *bit_depth_params) { struct dce_transform *xfm_dce = TO_DCE_TRANSFORM(xfm); int pixel_depth, expan_mode; enum dc_color_depth color_depth; switch (depth) { case LB_PIXEL_DEPTH_18BPP: color_depth = COLOR_DEPTH_666; pixel_depth = 2; expan_mode = 1; break; case LB_PIXEL_DEPTH_24BPP: color_depth = COLOR_DEPTH_888; pixel_depth = 1; expan_mode = 1; break; case LB_PIXEL_DEPTH_30BPP: color_depth = COLOR_DEPTH_101010; pixel_depth = 0; expan_mode = 1; break; case LB_PIXEL_DEPTH_36BPP: color_depth = COLOR_DEPTH_121212; pixel_depth = 3; expan_mode = 0; break; default: color_depth = COLOR_DEPTH_101010; pixel_depth = 0; expan_mode = 1; BREAK_TO_DEBUGGER(); break; } set_denormalization(xfm_dce, color_depth); program_bit_depth_reduction(xfm_dce, color_depth, bit_depth_params); REG_UPDATE_2(LB_DATA_FORMAT, PIXEL_DEPTH, pixel_depth, PIXEL_EXPAN_MODE, expan_mode); if (!(xfm_dce->lb_pixel_depth_supported & depth)) { /*we should use unsupported capabilities * unless it is required by w/a*/ DC_LOG_WARNING("%s: Capability not supported", __func__); } }
void dce110_opp_v_set_csc_default( struct transform *xfm, const struct default_adjustment *default_adjust) { struct dce_transform *xfm_dce = TO_DCE_TRANSFORM(xfm); enum csc_color_mode config = CSC_COLOR_MODE_GRAPHICS_PREDEFINED; if (default_adjust->force_hw_default == false) { const struct out_csc_color_matrix *elm; /* currently parameter not in use */ enum grph_color_adjust_option option = GRPH_COLOR_MATRIX_HW_DEFAULT; uint32_t i; /* * HW default false we program locally defined matrix * HW default true we use predefined hw matrix and we * do not need to program matrix * OEM wants the HW default via runtime parameter. */ option = GRPH_COLOR_MATRIX_SW; for (i = 0; i < ARRAY_SIZE(global_color_matrix); ++i) { elm = &global_color_matrix[i]; if (elm->color_space != default_adjust->out_color_space) continue; /* program the matrix with default values from this * file */ program_color_matrix_v(xfm_dce, elm, option); config = CSC_COLOR_MODE_GRAPHICS_OUTPUT_CSC; break; } } program_input_csc(xfm, default_adjust->in_color_space); /* configure the what we programmed : * 1. Default values from this file * 2. Use hardware default from ROM_A and we do not need to program * matrix */ configure_graphics_mode_v(xfm_dce, config, default_adjust->csc_adjust_type, default_adjust->out_color_space); set_Denormalization(xfm, default_adjust->color_depth); }
void dce110_opp_power_on_regamma_lut(struct transform *xfm, bool power_on) { struct dce_transform *xfm_dce = TO_DCE_TRANSFORM(xfm); if (REG(DCFE_MEM_PWR_CTRL)) REG_UPDATE_2(DCFE_MEM_PWR_CTRL, DCP_REGAMMA_MEM_PWR_DIS, power_on, DCP_LUT_MEM_PWR_DIS, power_on); else REG_UPDATE_2(DCFE_MEM_LIGHT_SLEEP_CNTL, REGAMMA_LUT_LIGHT_SLEEP_DIS, power_on, DCP_LUT_LIGHT_SLEEP_DIS, power_on); }
void dce110_opp_set_csc_adjustment( struct transform *xfm, const struct out_csc_color_matrix *tbl_entry) { struct dce_transform *xfm_dce = TO_DCE_TRANSFORM(xfm); enum csc_color_mode config = CSC_COLOR_MODE_GRAPHICS_OUTPUT_CSC; program_color_matrix( xfm_dce, tbl_entry, GRPH_COLOR_MATRIX_SW); /* We did everything ,now program DxOUTPUT_CSC_CONTROL */ configure_graphics_mode(xfm_dce, config, GRAPHICS_CSC_ADJUST_TYPE_SW, tbl_entry->color_space); }
void dce110_opp_v_set_csc_adjustment( struct transform *xfm, const struct out_csc_color_matrix *tbl_entry) { struct dce_transform *xfm_dce = TO_DCE_TRANSFORM(xfm); enum csc_color_mode config = CSC_COLOR_MODE_GRAPHICS_OUTPUT_CSC; program_color_matrix_v( xfm_dce, tbl_entry, GRAPHICS_CSC_ADJUST_TYPE_SW); /* We did everything ,now program DxOUTPUT_CSC_CONTROL */ configure_graphics_mode_v(xfm_dce, config, GRAPHICS_CSC_ADJUST_TYPE_SW, tbl_entry->color_space); /*TODO: Check if denormalization is needed*/ /*set_Denormalization(opp, adjust->color_depth);*/ }
/** ***************************************************************************** * Function: dal_transform_wide_gamut_set_gamut_remap * * @param [in] const struct xfm_grph_csc_adjustment *adjust * * @return * void * * @note calculate and apply color temperature adjustment to in Rgb color space * * @see * ***************************************************************************** */ static void dce_transform_set_gamut_remap( struct transform *xfm, const struct xfm_grph_csc_adjustment *adjust) { struct dce_transform *xfm_dce = TO_DCE_TRANSFORM(xfm); int i = 0; if (adjust->gamut_adjust_type != GRAPHICS_GAMUT_ADJUST_TYPE_SW) /* Bypass if type is bypass or hw */ program_gamut_remap(xfm_dce, NULL); else { struct fixed31_32 arr_matrix[GAMUT_MATRIX_SIZE]; uint16_t arr_reg_val[GAMUT_MATRIX_SIZE]; for (i = 0; i < GAMUT_MATRIX_SIZE; i++) arr_matrix[i] = adjust->temperature_matrix[i]; convert_float_matrix( arr_reg_val, arr_matrix, GAMUT_MATRIX_SIZE); program_gamut_remap(xfm_dce, arr_reg_val); } }
void dce110_opp_program_regamma_pwl_v( struct transform *xfm, const struct pwl_params *params) { struct dce_transform *xfm_dce = TO_DCE_TRANSFORM(xfm); /* Setup regions */ regamma_config_regions_and_segments(xfm_dce, params); set_bypass_input_gamma(xfm_dce); /* Power on gamma LUT memory */ power_on_lut(xfm, true, false, true); /* Program PWL */ program_pwl(xfm_dce, params); /* program regamma config */ configure_regamma_mode(xfm_dce, 1); /* Power return to auto back */ power_on_lut(xfm, false, false, true); }
static void dce100_transform_destroy(struct transform **xfm) { kfree(TO_DCE_TRANSFORM(*xfm)); *xfm = NULL; }
bool dce_transform_get_optimal_number_of_taps( struct transform *xfm, struct scaler_data *scl_data, const struct scaling_taps *in_taps) { struct dce_transform *xfm_dce = TO_DCE_TRANSFORM(xfm); int pixel_width = scl_data->viewport.width; int max_num_of_lines; if (xfm_dce->prescaler_on && (scl_data->viewport.width > scl_data->recout.width)) pixel_width = scl_data->recout.width; max_num_of_lines = dce_transform_get_max_num_of_supported_lines( xfm_dce, scl_data->lb_params.depth, pixel_width); /* Fail if in_taps are impossible */ if (in_taps->v_taps >= max_num_of_lines) return false; /* * Set taps according to this policy (in this order) * - Use 1 for no scaling * - Use input taps * - Use 4 and reduce as required by line buffer size * - Decide chroma taps if chroma is scaled * * Ignore input chroma taps. Decide based on non-chroma */ scl_data->taps.h_taps = decide_taps(scl_data->ratios.horz, in_taps->h_taps, false); scl_data->taps.v_taps = decide_taps(scl_data->ratios.vert, in_taps->v_taps, false); scl_data->taps.h_taps_c = decide_taps(scl_data->ratios.horz_c, in_taps->h_taps, true); scl_data->taps.v_taps_c = decide_taps(scl_data->ratios.vert_c, in_taps->v_taps, true); if (!IDENTITY_RATIO(scl_data->ratios.vert)) { /* reduce v_taps if needed but ensure we have at least two */ if (in_taps->v_taps == 0 && max_num_of_lines <= scl_data->taps.v_taps && scl_data->taps.v_taps > 1) { scl_data->taps.v_taps = max_num_of_lines - 1; } if (scl_data->taps.v_taps <= 1) return false; } if (!IDENTITY_RATIO(scl_data->ratios.vert_c)) { /* reduce chroma v_taps if needed but ensure we have at least two */ if (max_num_of_lines <= scl_data->taps.v_taps_c && scl_data->taps.v_taps_c > 1) { scl_data->taps.v_taps_c = max_num_of_lines - 1; } if (scl_data->taps.v_taps_c <= 1) return false; } /* we've got valid taps */ return true; }
static void dce_transform_set_scaler( struct transform *xfm, const struct scaler_data *data) { struct dce_transform *xfm_dce = TO_DCE_TRANSFORM(xfm); bool is_scaling_required; bool filter_updated = false; const uint16_t *coeffs_v, *coeffs_h; /*Use all three pieces of memory always*/ REG_SET_2(LB_MEMORY_CTRL, 0, LB_MEMORY_CONFIG, 0, LB_MEMORY_SIZE, xfm_dce->lb_memory_size); /* Clear SCL_F_SHARP_CONTROL value to 0 */ REG_WRITE(SCL_F_SHARP_CONTROL, 0); /* 1. Program overscan */ program_overscan(xfm_dce, data); /* 2. Program taps and configuration */ is_scaling_required = setup_scaling_configuration(xfm_dce, data); if (is_scaling_required) { /* 3. Calculate and program ratio, filter initialization */ struct scl_ratios_inits inits = { 0 }; calculate_inits(xfm_dce, data, &inits); program_scl_ratios_inits(xfm_dce, &inits); coeffs_v = get_filter_coeffs_16p(data->taps.v_taps, data->ratios.vert); coeffs_h = get_filter_coeffs_16p(data->taps.h_taps, data->ratios.horz); if (coeffs_v != xfm_dce->filter_v || coeffs_h != xfm_dce->filter_h) { /* 4. Program vertical filters */ if (xfm_dce->filter_v == NULL) REG_SET(SCL_VERT_FILTER_CONTROL, 0, SCL_V_2TAP_HARDCODE_COEF_EN, 0); program_multi_taps_filter( xfm_dce, data->taps.v_taps, coeffs_v, FILTER_TYPE_RGB_Y_VERTICAL); program_multi_taps_filter( xfm_dce, data->taps.v_taps, coeffs_v, FILTER_TYPE_ALPHA_VERTICAL); /* 5. Program horizontal filters */ if (xfm_dce->filter_h == NULL) REG_SET(SCL_HORZ_FILTER_CONTROL, 0, SCL_H_2TAP_HARDCODE_COEF_EN, 0); program_multi_taps_filter( xfm_dce, data->taps.h_taps, coeffs_h, FILTER_TYPE_RGB_Y_HORIZONTAL); program_multi_taps_filter( xfm_dce, data->taps.h_taps, coeffs_h, FILTER_TYPE_ALPHA_HORIZONTAL); xfm_dce->filter_v = coeffs_v; xfm_dce->filter_h = coeffs_h; filter_updated = true; } } /* 6. Program the viewport */ program_viewport(xfm_dce, &data->viewport); /* 7. Set bit to flip to new coefficient memory */ if (filter_updated) REG_UPDATE(SCL_UPDATE, SCL_COEF_UPDATE_COMPLETE, 1); REG_UPDATE(LB_DATA_FORMAT, ALPHA_EN, data->lb_params.alpha_en); }