drm/amd/display: Implement CM dealpha and bias interfaces
[linux-2.6-microblaze.git] / drivers / gpu / drm / amd / display / dc / inc / hw / dpp.h
1 /*
2  * Copyright 2012-15 Advanced Micro Devices, Inc.
3  *
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:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
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.
21  *
22  * Authors: AMD
23  *
24  */
25
26
27 #ifndef __DAL_DPP_H__
28 #define __DAL_DPP_H__
29
30 #include "transform.h"
31
32 struct dpp {
33         const struct dpp_funcs *funcs;
34         struct dc_context *ctx;
35         int inst;
36         struct dpp_caps *caps;
37         struct pwl_params regamma_params;
38         struct pwl_params degamma_params;
39
40 };
41
42 struct dpp_input_csc_matrix {
43         enum dc_color_space color_space;
44         uint16_t regval[12];
45 };
46
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;
50 };
51
52 struct dcn_dpp_state {
53         uint32_t is_enabled;
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;
65 };
66
67 struct CM_bias_params {
68         uint32_t cm_bias_cr_r;
69         uint32_t cm_bias_y_g;
70         uint32_t cm_bias_cb_b;
71         uint32_t cm_bias_format;
72 };
73
74 struct dpp_funcs {
75
76         void (*dpp_program_cm_dealpha)(struct dpp *dpp_base,
77                 uint32_t enable, uint32_t additive_blending);
78
79         void (*dpp_program_cm_bias)(
80                 struct dpp *dpp_base,
81                 struct CM_bias_params *bias_params);
82
83         void (*dpp_read_state)(struct dpp *dpp, struct dcn_dpp_state *s);
84
85         void (*dpp_reset)(struct dpp *dpp);
86
87         void (*dpp_set_scaler)(struct dpp *dpp,
88                         const struct scaler_data *scl_data);
89
90         void (*dpp_set_pixel_storage_depth)(
91                         struct dpp *dpp,
92                         enum lb_pixel_depth depth,
93                         const struct bit_depth_reduction_params *bit_depth_params);
94
95         bool (*dpp_get_optimal_number_of_taps)(
96                         struct dpp *dpp,
97                         struct scaler_data *scl_data,
98                         const struct scaling_taps *in_taps);
99
100         void (*dpp_set_gamut_remap)(
101                         struct dpp *dpp,
102                         const struct dpp_grph_csc_adjustment *adjust);
103
104         void (*dpp_set_csc_default)(
105                 struct dpp *dpp,
106                 enum dc_color_space colorspace);
107
108         void (*dpp_set_csc_adjustment)(
109                 struct dpp *dpp,
110                 const uint16_t *regval);
111
112         void (*dpp_power_on_regamma_lut)(
113                 struct dpp *dpp,
114                 bool power_on);
115
116         void (*dpp_program_regamma_lut)(
117                         struct dpp *dpp,
118                         const struct pwl_result_data *rgb,
119                         uint32_t num);
120
121         void (*dpp_configure_regamma_lut)(
122                         struct dpp *dpp,
123                         bool is_ram_a);
124
125         void (*dpp_program_regamma_lutb_settings)(
126                         struct dpp *dpp,
127                         const struct pwl_params *params);
128
129         void (*dpp_program_regamma_luta_settings)(
130                         struct dpp *dpp,
131                         const struct pwl_params *params);
132
133         void (*dpp_program_regamma_pwl)(
134                 struct dpp *dpp,
135                 const struct pwl_params *params,
136                 enum opp_regamma mode);
137
138         void (*dpp_program_bias_and_scale)(
139                         struct dpp *dpp,
140                         struct dc_bias_and_scale *params);
141
142         void (*dpp_set_degamma)(
143                         struct dpp *dpp_base,
144                         enum ipp_degamma_mode mode);
145
146         void (*dpp_program_input_lut)(
147                         struct dpp *dpp_base,
148                         const struct dc_gamma *gamma);
149
150         void (*dpp_program_degamma_pwl)(struct dpp *dpp_base,
151                                                                          const struct pwl_params *params);
152
153         void (*dpp_setup)(
154                         struct dpp *dpp_base,
155                         enum surface_pixel_format format,
156                         enum expansion_mode mode,
157                         struct dc_csc_transform input_csc_color_matrix,
158                         enum dc_color_space input_color_space);
159
160         void (*dpp_full_bypass)(struct dpp *dpp_base);
161
162         void (*set_cursor_attributes)(
163                         struct dpp *dpp_base,
164                         enum dc_cursor_color_format color_format);
165
166         void (*set_cursor_position)(
167                         struct dpp *dpp_base,
168                         const struct dc_cursor_position *pos,
169                         const struct dc_cursor_mi_param *param,
170                         uint32_t width,
171                         uint32_t height
172                         );
173
174         void (*dpp_set_hdr_multiplier)(
175                         struct dpp *dpp_base,
176                         uint32_t multiplier);
177
178         void (*set_optional_cursor_attributes)(
179                         struct dpp *dpp_base,
180                         struct dpp_cursor_attributes *attr);
181
182         void (*dpp_dppclk_control)(
183                         struct dpp *dpp_base,
184                         bool dppclk_div,
185                         bool enable);
186
187 };
188
189
190
191 #endif