2 * Copyright 2012-15 Advanced Micro Devices, Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
30 #include "transform.h"
33 const struct dpp_funcs *funcs;
34 struct dc_context *ctx;
36 struct dpp_caps *caps;
37 struct pwl_params regamma_params;
38 struct pwl_params degamma_params;
42 struct dpp_input_csc_matrix {
43 enum dc_color_space color_space;
47 struct dpp_grph_csc_adjustment {
48 struct fixed31_32 temperature_matrix[CSC_TEMPERATURE_MATRIX_SIZE];
49 enum graphics_gamut_adjust_type gamut_adjust_type;
52 struct dcn_dpp_state {
54 uint32_t igam_lut_mode;
55 uint32_t igam_input_format;
56 uint32_t dgam_lut_mode;
57 uint32_t rgam_lut_mode;
58 uint32_t gamut_remap_mode;
59 uint32_t gamut_remap_c11_c12;
60 uint32_t gamut_remap_c13_c14;
61 uint32_t gamut_remap_c21_c22;
62 uint32_t gamut_remap_c23_c24;
63 uint32_t gamut_remap_c31_c32;
64 uint32_t gamut_remap_c33_c34;
68 void (*dpp_read_state)(struct dpp *dpp, struct dcn_dpp_state *s);
70 void (*dpp_reset)(struct dpp *dpp);
72 void (*dpp_set_scaler)(struct dpp *dpp,
73 const struct scaler_data *scl_data);
75 void (*dpp_set_pixel_storage_depth)(
77 enum lb_pixel_depth depth,
78 const struct bit_depth_reduction_params *bit_depth_params);
80 bool (*dpp_get_optimal_number_of_taps)(
82 struct scaler_data *scl_data,
83 const struct scaling_taps *in_taps);
85 void (*dpp_set_gamut_remap)(
87 const struct dpp_grph_csc_adjustment *adjust);
89 void (*dpp_set_csc_default)(
91 enum dc_color_space colorspace);
93 void (*dpp_set_csc_adjustment)(
95 const uint16_t *regval);
97 void (*dpp_power_on_regamma_lut)(
101 void (*dpp_program_regamma_lut)(
103 const struct pwl_result_data *rgb,
106 void (*dpp_configure_regamma_lut)(
110 void (*dpp_program_regamma_lutb_settings)(
112 const struct pwl_params *params);
114 void (*dpp_program_regamma_luta_settings)(
116 const struct pwl_params *params);
118 void (*dpp_program_regamma_pwl)(
120 const struct pwl_params *params,
121 enum opp_regamma mode);
123 void (*dpp_program_bias_and_scale)(
125 struct dc_bias_and_scale *params);
127 void (*dpp_set_degamma)(
128 struct dpp *dpp_base,
129 enum ipp_degamma_mode mode);
131 void (*dpp_program_input_lut)(
132 struct dpp *dpp_base,
133 const struct dc_gamma *gamma);
135 void (*dpp_program_degamma_pwl)(struct dpp *dpp_base,
136 const struct pwl_params *params);
139 struct dpp *dpp_base,
140 enum surface_pixel_format format,
141 enum expansion_mode mode,
142 struct dc_csc_transform input_csc_color_matrix,
143 enum dc_color_space input_color_space);
145 void (*dpp_full_bypass)(struct dpp *dpp_base);
147 void (*set_cursor_attributes)(
148 struct dpp *dpp_base,
149 enum dc_cursor_color_format color_format);
151 void (*set_cursor_position)(
152 struct dpp *dpp_base,
153 const struct dc_cursor_position *pos,
154 const struct dc_cursor_mi_param *param,
158 void (*dpp_set_hdr_multiplier)(
159 struct dpp *dpp_base,
160 uint32_t multiplier);
161 void (*set_optional_cursor_attributes)(
162 struct dpp *dpp_base,
163 struct dpp_cursor_attributes *attr);
165 void (*dpp_dppclk_control)(
166 struct dpp *dpp_base,