0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025 #ifndef __DC_DWBC_H__
0026 #define __DC_DWBC_H__
0027
0028 #include "dal_types.h"
0029 #include "dc_hw_types.h"
0030
0031 #define DWB_SW_V2 1
0032 #define DWB_MCIF_BUF_COUNT 4
0033
0034
0035 struct mcif_wb;
0036
0037
0038 enum dwb_sw_version {
0039 dwb_ver_1_0 = 1,
0040 dwb_ver_2_0 = 2,
0041 };
0042
0043 enum dwb_source {
0044 dwb_src_scl = 0,
0045 dwb_src_blnd,
0046 dwb_src_fmt,
0047 dwb_src_otg0 = 0x100,
0048 dwb_src_otg1,
0049 dwb_src_otg2,
0050 dwb_src_otg3,
0051 };
0052
0053
0054 enum dwb_pipe {
0055 dwb_pipe0 = 0,
0056 #if defined(CONFIG_DRM_AMD_DC_DCN)
0057 dwb_pipe1,
0058 #endif
0059 dwb_pipe_max_num,
0060 };
0061
0062 enum dwb_frame_capture_enable {
0063 DWB_FRAME_CAPTURE_DISABLE = 0,
0064 DWB_FRAME_CAPTURE_ENABLE = 1,
0065 };
0066
0067 enum wbscl_coef_filter_type_sel {
0068 WBSCL_COEF_LUMA_VERT_FILTER = 0,
0069 WBSCL_COEF_CHROMA_VERT_FILTER = 1,
0070 WBSCL_COEF_LUMA_HORZ_FILTER = 2,
0071 WBSCL_COEF_CHROMA_HORZ_FILTER = 3
0072 };
0073
0074
0075 #if defined(CONFIG_DRM_AMD_DC_DCN)
0076 enum dwb_boundary_mode {
0077 DWBSCL_BOUNDARY_MODE_EDGE = 0,
0078 DWBSCL_BOUNDARY_MODE_BLACK = 1
0079 };
0080 #endif
0081
0082 #if defined(CONFIG_DRM_AMD_DC_DCN)
0083 enum dwb_output_csc_mode {
0084 DWB_OUTPUT_CSC_DISABLE = 0,
0085 DWB_OUTPUT_CSC_COEF_A = 1,
0086 DWB_OUTPUT_CSC_COEF_B = 2
0087 };
0088
0089 enum dwb_ogam_lut_mode {
0090 DWB_OGAM_MODE_BYPASS,
0091 DWB_OGAM_RAMA_LUT,
0092 DWB_OGAM_RAMB_LUT
0093 };
0094
0095 enum dwb_color_volume {
0096 DWB_SRGB_BT709 = 0,
0097 DWB_PQ = 1,
0098 DWB_HLG = 2,
0099 };
0100
0101 enum dwb_color_space {
0102 DWB_SRGB = 0,
0103 DWB_BT709 = 1,
0104 DWB_BT2020 = 2,
0105 };
0106
0107 struct dwb_efc_hdr_metadata {
0108
0109 unsigned int chromaticity_green_x;
0110 unsigned int chromaticity_green_y;
0111 unsigned int chromaticity_blue_x;
0112 unsigned int chromaticity_blue_y;
0113 unsigned int chromaticity_red_x;
0114 unsigned int chromaticity_red_y;
0115 unsigned int chromaticity_white_point_x;
0116 unsigned int chromaticity_white_point_y;
0117
0118
0119 unsigned int min_luminance;
0120 unsigned int max_luminance;
0121
0122
0123 unsigned int maximum_content_light_level;
0124 unsigned int maximum_frame_average_light_level;
0125 };
0126
0127 struct dwb_efc_display_settings {
0128 unsigned int inputColorVolume;
0129 unsigned int inputColorSpace;
0130 unsigned int inputBitDepthMinus8;
0131 struct dwb_efc_hdr_metadata hdr_metadata;
0132 unsigned int dwbOutputBlack;
0133 };
0134
0135 #endif
0136 struct dwb_warmup_params {
0137 bool warmup_en;
0138 bool warmup_mode;
0139 bool warmup_depth;
0140 int warmup_data;
0141 int warmup_width;
0142 int warmup_height;
0143 };
0144
0145 struct dwb_caps {
0146 enum dce_version hw_version;
0147 enum dwb_sw_version sw_version;
0148 unsigned int reserved[6];
0149 unsigned int adapter_id;
0150 unsigned int num_pipes;
0151 struct {
0152 unsigned int support_dwb :1;
0153 unsigned int support_ogam :1;
0154 unsigned int support_wbscl :1;
0155 unsigned int support_ocsc :1;
0156 unsigned int support_stereo :1;
0157 } caps;
0158 unsigned int reserved2[9];
0159 };
0160
0161 struct dwbc {
0162 const struct dwbc_funcs *funcs;
0163 struct dc_context *ctx;
0164 int inst;
0165 struct mcif_wb *mcif;
0166 bool status;
0167 int inputSrcSelect;
0168 bool dwb_output_black;
0169 enum dc_transfer_func_predefined tf;
0170 enum dc_color_space output_color_space;
0171 bool dwb_is_efc_transition;
0172 bool dwb_is_drc;
0173 int wb_src_plane_inst;
0174 uint32_t mask_id;
0175 int otg_inst;
0176 bool mvc_cfg;
0177 };
0178
0179 struct dwbc_funcs {
0180 bool (*get_caps)(
0181 struct dwbc *dwbc,
0182 struct dwb_caps *caps);
0183
0184 bool (*enable)(
0185 struct dwbc *dwbc,
0186 struct dc_dwb_params *params);
0187
0188 bool (*disable)(struct dwbc *dwbc);
0189
0190 bool (*update)(
0191 struct dwbc *dwbc,
0192 struct dc_dwb_params *params);
0193
0194 bool (*is_enabled)(
0195 struct dwbc *dwbc);
0196
0197 void (*set_stereo)(
0198 struct dwbc *dwbc,
0199 struct dwb_stereo_params *stereo_params);
0200
0201 void (*set_new_content)(
0202 struct dwbc *dwbc,
0203 bool is_new_content);
0204
0205
0206 void (*set_warmup)(
0207 struct dwbc *dwbc,
0208 struct dwb_warmup_params *warmup_params);
0209
0210
0211 #if defined(CONFIG_DRM_AMD_DC_DCN)
0212
0213 void (*dwb_program_output_csc)(
0214 struct dwbc *dwbc,
0215 enum dc_color_space color_space,
0216 enum dwb_output_csc_mode mode);
0217
0218 bool (*dwb_ogam_set_output_transfer_func)(
0219 struct dwbc *dwbc,
0220 const struct dc_transfer_func *in_transfer_func_dwb_ogam);
0221
0222
0223 bool (*dwb_ogam_set_input_transfer_func)(
0224 struct dwbc *dwbc,
0225 const struct dc_transfer_func *in_transfer_func_dwb_ogam);
0226 #endif
0227 bool (*get_dwb_status)(
0228 struct dwbc *dwbc);
0229 void (*dwb_set_scaler)(
0230 struct dwbc *dwbc,
0231 struct dc_dwb_params *params);
0232 };
0233
0234 #endif