1 /* Copyright 2012-17 Advanced Micro Devices, Inc.
3 * Permission is hereby granted, free of charge, to any person obtaining a
4 * copy of this software and associated documentation files (the "Software"),
5 * to deal in the Software without restriction, including without limitation
6 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 * and/or sell copies of the Software, and to permit persons to whom the
8 * Software is furnished to do so, subject to the following conditions:
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
17 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
18 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
19 * OTHER DEALINGS IN THE SOFTWARE.
28 #include "dal_types.h"
29 #include "dc_hw_types.h"
32 #define DWB_MCIF_BUF_COUNT 4
34 /* forward declaration of mcif_wb struct */
44 dwb_src_scl
= 0, /* for DCE7x/9x, DCN won't support. */
45 dwb_src_blnd
, /* for DCE7x/9x */
46 dwb_src_fmt
, /* for DCE7x/9x */
47 dwb_src_otg0
= 0x100, /* for DCN1.x/DCN2.x, register: mmDWB_SOURCE_SELECT */
48 dwb_src_otg1
, /* for DCN1.x/DCN2.x */
49 dwb_src_otg2
, /* for DCN1.x/DCN2.x */
50 dwb_src_otg3
, /* for DCN1.x/DCN2.x */
53 /* DCN1.x, DCN2.x support 2 pipes */
56 #if defined(CONFIG_DRM_AMD_DC_DCN)
62 enum dwb_frame_capture_enable
{
63 DWB_FRAME_CAPTURE_DISABLE
= 0,
64 DWB_FRAME_CAPTURE_ENABLE
= 1,
67 enum wbscl_coef_filter_type_sel
{
68 WBSCL_COEF_LUMA_VERT_FILTER
= 0,
69 WBSCL_COEF_CHROMA_VERT_FILTER
= 1,
70 WBSCL_COEF_LUMA_HORZ_FILTER
= 2,
71 WBSCL_COEF_CHROMA_HORZ_FILTER
= 3
75 #if defined(CONFIG_DRM_AMD_DC_DCN)
76 enum dwb_boundary_mode
{
77 DWBSCL_BOUNDARY_MODE_EDGE
= 0,
78 DWBSCL_BOUNDARY_MODE_BLACK
= 1
82 #if defined(CONFIG_DRM_AMD_DC_DCN)
83 enum dwb_output_csc_mode
{
84 DWB_OUTPUT_CSC_DISABLE
= 0,
85 DWB_OUTPUT_CSC_COEF_A
= 1,
86 DWB_OUTPUT_CSC_COEF_B
= 2
89 enum dwb_ogam_lut_mode
{
95 enum dwb_color_volume
{
96 DWB_SRGB_BT709
= 0, //SDR
101 enum dwb_color_space
{
104 DWB_BT2020
= 2, //HDR
107 struct dwb_efc_hdr_metadata
{
108 /*display chromaticities and white point in units of 0.00001 */
109 unsigned int chromaticity_green_x
;
110 unsigned int chromaticity_green_y
;
111 unsigned int chromaticity_blue_x
;
112 unsigned int chromaticity_blue_y
;
113 unsigned int chromaticity_red_x
;
114 unsigned int chromaticity_red_y
;
115 unsigned int chromaticity_white_point_x
;
116 unsigned int chromaticity_white_point_y
;
118 /*in units of candelas per square meter */
119 unsigned int min_luminance
;
120 unsigned int max_luminance
;
122 /*in units of nits */
123 unsigned int maximum_content_light_level
;
124 unsigned int maximum_frame_average_light_level
;
127 struct dwb_efc_display_settings
{
128 unsigned int inputColorVolume
;
129 unsigned int inputColorSpace
;
130 unsigned int inputBitDepthMinus8
;
131 struct dwb_efc_hdr_metadata hdr_metadata
;
132 unsigned int dwbOutputBlack
; // 0 - Normal, 1 - Output Black
136 struct dwb_warmup_params
{
137 bool warmup_en
; /* false: normal mode, true: enable pattern generator */
138 bool warmup_mode
; /* false: 420, true: 444 */
139 bool warmup_depth
; /* false: 8bit, true: 10bit */
140 int warmup_data
; /* Data to be sent by pattern generator (same for each pixel component) */
141 int warmup_width
; /* Pattern width (pixels) */
142 int warmup_height
; /* Pattern height (lines) */
146 enum dce_version hw_version
; /* DCN engine version. */
147 enum dwb_sw_version sw_version
; /* DWB sw implementation version. */
148 unsigned int reserved
[6]; /* Reserved for future use, MUST BE 0. */
149 unsigned int adapter_id
;
150 unsigned int num_pipes
; /* number of DWB pipes */
152 unsigned int support_dwb
:1;
153 unsigned int support_ogam
:1;
154 unsigned int support_wbscl
:1;
155 unsigned int support_ocsc
:1;
156 unsigned int support_stereo
:1;
158 unsigned int reserved2
[9]; /* Reserved for future use, MUST BE 0. */
162 const struct dwbc_funcs
*funcs
;
163 struct dc_context
*ctx
;
165 struct mcif_wb
*mcif
;
168 bool dwb_output_black
;
169 enum dc_transfer_func_predefined tf
;
170 enum dc_color_space output_color_space
;
171 bool dwb_is_efc_transition
;
173 int wb_src_plane_inst
;/*hubp, mpcc, inst*/
174 bool update_privacymask
;
183 struct dwb_caps
*caps
);
187 struct dc_dwb_params
*params
);
189 bool (*disable
)(struct dwbc
*dwbc
);
193 struct dc_dwb_params
*params
);
200 struct dwb_stereo_params
*stereo_params
);
202 void (*set_new_content
)(
204 bool is_new_content
);
209 struct dwb_warmup_params
*warmup_params
);
212 #if defined(CONFIG_DRM_AMD_DC_DCN)
214 void (*dwb_program_output_csc
)(
216 enum dc_color_space color_space
,
217 enum dwb_output_csc_mode mode
);
219 bool (*dwb_ogam_set_output_transfer_func
)(
221 const struct dc_transfer_func
*in_transfer_func_dwb_ogam
);
223 void (*get_privacy_mask
)(
224 struct dwbc
*dwbc
, uint32_t *mask_id
);
226 void (*set_privacy_mask
)(
227 struct dwbc
*dwbc
, uint32_t mask_id
);
229 //TODO: merge with output_transfer_func?
230 bool (*dwb_ogam_set_input_transfer_func
)(
232 const struct dc_transfer_func
*in_transfer_func_dwb_ogam
);
234 bool (*get_dwb_status
)(
236 void (*dwb_set_scaler
)(
238 struct dc_dwb_params
*params
);