1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
|
/*
* Copyright 2012-15 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: AMD
*
*/
#ifndef __DAL_TRANSFORM_H__
#define __DAL_TRANSFORM_H__
#include "hw_shared.h"
#include "dc_hw_types.h"
#include "fixed31_32.h"
#define CSC_TEMPERATURE_MATRIX_SIZE 9
struct bit_depth_reduction_params;
struct transform {
const struct transform_funcs *funcs;
struct dc_context *ctx;
int inst;
struct dpp_caps *caps;
struct pwl_params regamma_params;
};
/* Colorimetry */
enum colorimetry {
COLORIMETRY_NO_DATA = 0,
COLORIMETRY_ITU601 = 1,
COLORIMETRY_ITU709 = 2,
COLORIMETRY_EXTENDED = 3
};
enum colorimetry_ext {
COLORIMETRYEX_XVYCC601 = 0,
COLORIMETRYEX_XVYCC709 = 1,
COLORIMETRYEX_SYCC601 = 2,
COLORIMETRYEX_ADOBEYCC601 = 3,
COLORIMETRYEX_ADOBERGB = 4,
COLORIMETRYEX_BT2020YCC = 5,
COLORIMETRYEX_BT2020RGBYCBCR = 6,
COLORIMETRYEX_RESERVED = 7
};
enum active_format_info {
ACTIVE_FORMAT_NO_DATA = 0,
ACTIVE_FORMAT_VALID = 1
};
/* Active format aspect ratio */
enum active_format_aspect_ratio {
ACTIVE_FORMAT_ASPECT_RATIO_SAME_AS_PICTURE = 8,
ACTIVE_FORMAT_ASPECT_RATIO_4_3 = 9,
ACTIVE_FORMAT_ASPECT_RATIO_16_9 = 0XA,
ACTIVE_FORMAT_ASPECT_RATIO_14_9 = 0XB
};
enum bar_info {
BAR_INFO_NOT_VALID = 0,
BAR_INFO_VERTICAL_VALID = 1,
BAR_INFO_HORIZONTAL_VALID = 2,
BAR_INFO_BOTH_VALID = 3
};
enum picture_scaling {
PICTURE_SCALING_UNIFORM = 0,
PICTURE_SCALING_HORIZONTAL = 1,
PICTURE_SCALING_VERTICAL = 2,
PICTURE_SCALING_BOTH = 3
};
/* RGB quantization range */
enum rgb_quantization_range {
RGB_QUANTIZATION_DEFAULT_RANGE = 0,
RGB_QUANTIZATION_LIMITED_RANGE = 1,
RGB_QUANTIZATION_FULL_RANGE = 2,
RGB_QUANTIZATION_RESERVED = 3
};
/* YYC quantization range */
enum yyc_quantization_range {
YYC_QUANTIZATION_LIMITED_RANGE = 0,
YYC_QUANTIZATION_FULL_RANGE = 1,
YYC_QUANTIZATION_RESERVED2 = 2,
YYC_QUANTIZATION_RESERVED3 = 3
};
enum graphics_gamut_adjust_type {
GRAPHICS_GAMUT_ADJUST_TYPE_BYPASS = 0,
GRAPHICS_GAMUT_ADJUST_TYPE_HW, /* without adjustments */
GRAPHICS_GAMUT_ADJUST_TYPE_SW /* use adjustments */
};
enum lb_memory_config {
/* Enable all 3 pieces of memory */
LB_MEMORY_CONFIG_0 = 0,
/* Enable only the first piece of memory */
LB_MEMORY_CONFIG_1 = 1,
/* Enable only the second piece of memory */
LB_MEMORY_CONFIG_2 = 2,
/* Only applicable in 4:2:0 mode, enable all 3 pieces of memory and the
* last piece of chroma memory used for the luma storage
*/
LB_MEMORY_CONFIG_3 = 3
};
struct xfm_grph_csc_adjustment {
struct fixed31_32 temperature_matrix[CSC_TEMPERATURE_MATRIX_SIZE];
enum graphics_gamut_adjust_type gamut_adjust_type;
};
struct overscan_info {
int left;
int right;
int top;
int bottom;
};
struct scaling_ratios {
struct fixed31_32 horz;
struct fixed31_32 vert;
struct fixed31_32 horz_c;
struct fixed31_32 vert_c;
};
struct sharpness_adj {
int horz;
int vert;
};
struct line_buffer_params {
bool alpha_en;
bool pixel_expan_mode;
bool interleave_en;
int dynamic_pixel_depth;
enum lb_pixel_depth depth;
};
struct scl_inits {
struct fixed31_32 h;
struct fixed31_32 h_c;
struct fixed31_32 v;
struct fixed31_32 v_bot;
struct fixed31_32 v_c;
struct fixed31_32 v_c_bot;
};
struct scaler_data {
int h_active;
int v_active;
struct scaling_taps taps;
struct rect viewport;
struct rect viewport_c;
struct rect recout;
struct scaling_ratios ratios;
struct scl_inits inits;
struct sharpness_adj sharpness;
enum pixel_format format;
struct line_buffer_params lb_params;
};
struct transform_funcs {
void (*transform_reset)(struct transform *xfm);
void (*transform_set_scaler)(struct transform *xfm,
const struct scaler_data *scl_data);
void (*transform_set_pixel_storage_depth)(
struct transform *xfm,
enum lb_pixel_depth depth,
const struct bit_depth_reduction_params *bit_depth_params);
bool (*transform_get_optimal_number_of_taps)(
struct transform *xfm,
struct scaler_data *scl_data,
const struct scaling_taps *in_taps);
void (*transform_set_gamut_remap)(
struct transform *xfm,
const struct xfm_grph_csc_adjustment *adjust);
void (*opp_set_csc_default)(
struct transform *xfm,
const struct default_adjustment *default_adjust);
void (*opp_set_csc_adjustment)(
struct transform *xfm,
const struct out_csc_color_matrix *tbl_entry);
void (*opp_power_on_regamma_lut)(
struct transform *xfm,
bool power_on);
void (*opp_program_regamma_lut)(
struct transform *xfm,
const struct pwl_result_data *rgb,
uint32_t num);
void (*opp_configure_regamma_lut)(
struct transform *xfm,
bool is_ram_a);
void (*opp_program_regamma_lutb_settings)(
struct transform *xfm,
const struct pwl_params *params);
void (*opp_program_regamma_luta_settings)(
struct transform *xfm,
const struct pwl_params *params);
void (*opp_program_regamma_pwl)(
struct transform *xfm, const struct pwl_params *params);
void (*opp_set_regamma_mode)(
struct transform *xfm_base,
enum opp_regamma mode);
void (*ipp_set_degamma)(
struct transform *xfm_base,
enum ipp_degamma_mode mode);
void (*ipp_program_input_lut)(
struct transform *xfm_base,
const struct dc_gamma *gamma);
void (*ipp_program_degamma_pwl)(struct transform *xfm_base,
const struct pwl_params *params);
void (*ipp_setup)(
struct transform *xfm_base,
enum surface_pixel_format format,
enum expansion_mode mode,
struct csc_transform input_csc_color_matrix,
enum dc_color_space input_color_space);
void (*ipp_full_bypass)(struct transform *xfm_base);
void (*set_cursor_attributes)(
struct transform *xfm_base,
const struct dc_cursor_attributes *attr);
};
const uint16_t *get_filter_2tap_16p(void);
const uint16_t *get_filter_2tap_64p(void);
const uint16_t *get_filter_3tap_16p(struct fixed31_32 ratio);
const uint16_t *get_filter_3tap_64p(struct fixed31_32 ratio);
const uint16_t *get_filter_4tap_16p(struct fixed31_32 ratio);
const uint16_t *get_filter_4tap_64p(struct fixed31_32 ratio);
const uint16_t *get_filter_5tap_64p(struct fixed31_32 ratio);
const uint16_t *get_filter_6tap_64p(struct fixed31_32 ratio);
const uint16_t *get_filter_7tap_64p(struct fixed31_32 ratio);
const uint16_t *get_filter_8tap_64p(struct fixed31_32 ratio);
/* Defines the pixel processing capability of the DSCL */
enum dscl_data_processing_format {
DSCL_DATA_PRCESSING_FIXED_FORMAT, /* The DSCL processes pixel data in fixed format */
DSCL_DATA_PRCESSING_FLOAT_FORMAT, /* The DSCL processes pixel data in float format */
};
/*
* The DPP capabilities structure contains enumerations to specify the
* HW processing features and an associated function pointers to
* provide the function interface that can be overloaded for implementations
* based on different capabilities
*/
struct dpp_caps {
/* DSCL processing pixel data in fixed or float format */
enum dscl_data_processing_format dscl_data_proc_format;
/* Calculates the number of partitions in the line buffer.
* The implementation of this function is overloaded for
* different versions of DSCL LB.
*/
void (*dscl_calc_lb_num_partitions)(
const struct scaler_data *scl_data,
enum lb_memory_config lb_config,
int *num_part_y,
int *num_part_c);
};
#endif
|