Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/display: dce_ipp: add DCE6 specific macros,functions

[Why]
DCE6 does not have CURSOR2_DEGAMMA_MODE bit in DEGAMMA_CONTROL register

[How]
Add DCE6 specific macros definitions for IPP masks
DCE6 IPP macros will avoid buiding errors when using DCE6 headers
Add dce60_ipp_set_degamma() function w/o Cursor2 Degamma programming
Use dce60_ipp_set_degamma() in ipp_funcs dce60_ipp_funcs
Add DCE6 specific dce60_ipp_construct

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Mauro Rossi and committed by
Alex Deucher
89571d7c ff0649f8

+95
+46
drivers/gpu/drm/amd/display/dc/dce/dce_ipp.c
··· 231 231 CURSOR2_DEGAMMA_MODE, degamma_type); 232 232 } 233 233 234 + #if defined(CONFIG_DRM_AMD_DC_SI) 235 + static void dce60_ipp_set_degamma( 236 + struct input_pixel_processor *ipp, 237 + enum ipp_degamma_mode mode) 238 + { 239 + struct dce_ipp *ipp_dce = TO_DCE_IPP(ipp); 240 + uint32_t degamma_type = (mode == IPP_DEGAMMA_MODE_HW_sRGB) ? 1 : 0; 241 + 242 + ASSERT(mode == IPP_DEGAMMA_MODE_BYPASS || mode == IPP_DEGAMMA_MODE_HW_sRGB); 243 + /* DCE6 does not have CURSOR2_DEGAMMA_MODE bit in DEGAMMA_CONTROL reg */ 244 + REG_SET_2(DEGAMMA_CONTROL, 0, 245 + GRPH_DEGAMMA_MODE, degamma_type, 246 + CURSOR_DEGAMMA_MODE, degamma_type); 247 + } 248 + #endif 249 + 234 250 static const struct ipp_funcs dce_ipp_funcs = { 235 251 .ipp_cursor_set_attributes = dce_ipp_cursor_set_attributes, 236 252 .ipp_cursor_set_position = dce_ipp_cursor_set_position, ··· 254 238 .ipp_program_input_lut = dce_ipp_program_input_lut, 255 239 .ipp_set_degamma = dce_ipp_set_degamma 256 240 }; 241 + 242 + #if defined(CONFIG_DRM_AMD_DC_SI) 243 + static const struct ipp_funcs dce60_ipp_funcs = { 244 + .ipp_cursor_set_attributes = dce_ipp_cursor_set_attributes, 245 + .ipp_cursor_set_position = dce_ipp_cursor_set_position, 246 + .ipp_program_prescale = dce_ipp_program_prescale, 247 + .ipp_program_input_lut = dce_ipp_program_input_lut, 248 + .ipp_set_degamma = dce60_ipp_set_degamma 249 + }; 250 + #endif 251 + 257 252 258 253 /*****************************************/ 259 254 /* Constructor, Destructor */ ··· 286 259 ipp_dce->ipp_shift = ipp_shift; 287 260 ipp_dce->ipp_mask = ipp_mask; 288 261 } 262 + 263 + #if defined(CONFIG_DRM_AMD_DC_SI) 264 + void dce60_ipp_construct( 265 + struct dce_ipp *ipp_dce, 266 + struct dc_context *ctx, 267 + int inst, 268 + const struct dce_ipp_registers *regs, 269 + const struct dce_ipp_shift *ipp_shift, 270 + const struct dce_ipp_mask *ipp_mask) 271 + { 272 + ipp_dce->base.ctx = ctx; 273 + ipp_dce->base.inst = inst; 274 + ipp_dce->base.funcs = &dce60_ipp_funcs; 275 + 276 + ipp_dce->regs = regs; 277 + ipp_dce->ipp_shift = ipp_shift; 278 + ipp_dce->ipp_mask = ipp_mask; 279 + } 280 + #endif 289 281 290 282 void dce_ipp_destroy(struct input_pixel_processor **ipp) 291 283 {
+49
drivers/gpu/drm/amd/display/dc/dce/dce_ipp.h
··· 147 147 IPP_SF(DCP0_DEGAMMA_CONTROL, CURSOR_DEGAMMA_MODE, mask_sh), \ 148 148 IPP_SF(DCP0_DEGAMMA_CONTROL, CURSOR2_DEGAMMA_MODE, mask_sh) 149 149 150 + #if defined(CONFIG_DRM_AMD_DC_SI) 151 + #define IPP_DCE60_MASK_SH_LIST_DCE_COMMON_BASE(mask_sh) \ 152 + IPP_SF(CUR_UPDATE, CURSOR_UPDATE_LOCK, mask_sh), \ 153 + IPP_SF(CUR_CONTROL, CURSOR_EN, mask_sh), \ 154 + IPP_SF(CUR_CONTROL, CURSOR_MODE, mask_sh), \ 155 + IPP_SF(CUR_CONTROL, CURSOR_2X_MAGNIFY, mask_sh), \ 156 + IPP_SF(CUR_CONTROL, CUR_INV_TRANS_CLAMP, mask_sh), \ 157 + IPP_SF(CUR_POSITION, CURSOR_X_POSITION, mask_sh), \ 158 + IPP_SF(CUR_POSITION, CURSOR_Y_POSITION, mask_sh), \ 159 + IPP_SF(CUR_HOT_SPOT, CURSOR_HOT_SPOT_X, mask_sh), \ 160 + IPP_SF(CUR_HOT_SPOT, CURSOR_HOT_SPOT_Y, mask_sh), \ 161 + IPP_SF(CUR_COLOR1, CUR_COLOR1_BLUE, mask_sh), \ 162 + IPP_SF(CUR_COLOR1, CUR_COLOR1_GREEN, mask_sh), \ 163 + IPP_SF(CUR_COLOR1, CUR_COLOR1_RED, mask_sh), \ 164 + IPP_SF(CUR_COLOR2, CUR_COLOR2_BLUE, mask_sh), \ 165 + IPP_SF(CUR_COLOR2, CUR_COLOR2_GREEN, mask_sh), \ 166 + IPP_SF(CUR_COLOR2, CUR_COLOR2_RED, mask_sh), \ 167 + IPP_SF(CUR_SIZE, CURSOR_WIDTH, mask_sh), \ 168 + IPP_SF(CUR_SIZE, CURSOR_HEIGHT, mask_sh), \ 169 + IPP_SF(CUR_SURFACE_ADDRESS_HIGH, CURSOR_SURFACE_ADDRESS_HIGH, mask_sh), \ 170 + IPP_SF(CUR_SURFACE_ADDRESS, CURSOR_SURFACE_ADDRESS, mask_sh), \ 171 + IPP_SF(PRESCALE_GRPH_CONTROL, GRPH_PRESCALE_BYPASS, mask_sh), \ 172 + IPP_SF(PRESCALE_VALUES_GRPH_R, GRPH_PRESCALE_SCALE_R, mask_sh), \ 173 + IPP_SF(PRESCALE_VALUES_GRPH_R, GRPH_PRESCALE_BIAS_R, mask_sh), \ 174 + IPP_SF(PRESCALE_VALUES_GRPH_G, GRPH_PRESCALE_SCALE_G, mask_sh), \ 175 + IPP_SF(PRESCALE_VALUES_GRPH_G, GRPH_PRESCALE_BIAS_G, mask_sh), \ 176 + IPP_SF(PRESCALE_VALUES_GRPH_B, GRPH_PRESCALE_SCALE_B, mask_sh), \ 177 + IPP_SF(PRESCALE_VALUES_GRPH_B, GRPH_PRESCALE_BIAS_B, mask_sh), \ 178 + IPP_SF(INPUT_GAMMA_CONTROL, GRPH_INPUT_GAMMA_MODE, mask_sh), \ 179 + IPP_SF(DC_LUT_WRITE_EN_MASK, DC_LUT_WRITE_EN_MASK, mask_sh), \ 180 + IPP_SF(DC_LUT_RW_MODE, DC_LUT_RW_MODE, mask_sh), \ 181 + IPP_SF(DC_LUT_CONTROL, DC_LUT_DATA_R_FORMAT, mask_sh), \ 182 + IPP_SF(DC_LUT_CONTROL, DC_LUT_DATA_G_FORMAT, mask_sh), \ 183 + IPP_SF(DC_LUT_CONTROL, DC_LUT_DATA_B_FORMAT, mask_sh), \ 184 + IPP_SF(DC_LUT_RW_INDEX, DC_LUT_RW_INDEX, mask_sh), \ 185 + IPP_SF(DC_LUT_SEQ_COLOR, DC_LUT_SEQ_COLOR, mask_sh), \ 186 + IPP_SF(DEGAMMA_CONTROL, GRPH_DEGAMMA_MODE, mask_sh), \ 187 + IPP_SF(DEGAMMA_CONTROL, CURSOR_DEGAMMA_MODE, mask_sh) 188 + #endif 189 + 150 190 #define IPP_REG_FIELD_LIST(type) \ 151 191 type CURSOR_UPDATE_LOCK; \ 152 192 type CURSOR_EN; \ ··· 272 232 const struct dce_ipp_registers *regs, 273 233 const struct dce_ipp_shift *ipp_shift, 274 234 const struct dce_ipp_mask *ipp_mask); 235 + 236 + #if defined(CONFIG_DRM_AMD_DC_SI) 237 + void dce60_ipp_construct(struct dce_ipp *ipp_dce, 238 + struct dc_context *ctx, 239 + int inst, 240 + const struct dce_ipp_registers *regs, 241 + const struct dce_ipp_shift *ipp_shift, 242 + const struct dce_ipp_mask *ipp_mask); 243 + #endif 275 244 276 245 void dce_ipp_destroy(struct input_pixel_processor **ipp); 277 246