DC Patches Oct 25, 2018
Subsystems (6)
cover DC Patches Oct 25, 2018
From: Leo Li <[email protected]>
Summary of change:
* Initial documentation of AMDgpu DM
* Clean-up output CSC programming code
* Some coverity fixes
* Fix for possible null derefs in crc configuration and plane update paths
Anthony Koo (3):
drm/amd/display: Expand dc to use 16.16 bit backlight drm/amd/display: Fix some backlight variable styling drm/amd/display: Expose target backlight level
Aric Cyr (1):
drm/amd/display: Fix up coverity issues
Bhawanpreet Lakha (1):
drm/amd/display: Fix potential nullptr error
Charlene Liu (1):
drm/amd/display: remove CRTC_3D_STRUCTURE_V_UPDATE_MODE bit
programming.
Dmytro Laktyushkin (3):
drm/amd/display: fix dml max voltage state drm/amd/display: remove interlace scaling adjustment drm/amd/display: fix mirror rotation scaling math
Eric Bernstein (1):
drm/amd/display: Remove some old TODO's
Fatemeh Darbehani (2):
drm/amd/display: Retiring set_display_requirements in dm_pp_smu.h -
part4
drm/amd/display: Remove the check to see if pp_display_cfg is changed
Krunoslav Kovac (2):
drm/amd/display: Set gamma not working on MPO planes drm/amd/display: Remove program_csc_matrix
Leo Li (1):
drm/amd/display: Initial documentation for AMDgpu DC
Lewis Huang (1):
drm/amd/display: Add condition to sync eDP SW status and HW status
Nevenko Stupar (1):
drm/amd/display: Add missing pipes registers for VGA enable/disable
Nicholas Kazlauskas (1):
drm/amd/display: Guard against null stream_state in set_crc_source
SivapiriyanKumarasamy (2):
drm/amd/display: 3.2.03
drm/amd/display: Clip all remaining regamma points after first clipped
point
Steven Chiu (1):
drm/amd/display: 3.2.04
Documentation/gpu/amdgpu-dc.rst | 68 ++++++ Documentation/gpu/drivers.rst | 1 + drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 114 ++++++++-- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 76 +++++-- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c | 5 + .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c | 115 ++++++++-- .../drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c | 20 +- drivers/gpu/drm/amd/display/dc/bios/bios_parser.c | 2 +- drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c | 2 + .../drm/amd/display/dc/bios/bios_parser_helper.c | 93 ++++++++ .../drm/amd/display/dc/bios/bios_parser_helper.h | 4 + drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c | 32 +-- drivers/gpu/drm/amd/display/dc/core/dc.c | 8 +- drivers/gpu/drm/amd/display/dc/core/dc_debug.c | 7 +- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 34 +-- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 74 ++---- drivers/gpu/drm/amd/display/dc/dc.h | 2 +- drivers/gpu/drm/amd/display/dc/dc_bios_types.h | 5 + drivers/gpu/drm/amd/display/dc/dc_link.h | 11 +- drivers/gpu/drm/amd/display/dc/dce/dce_abm.c | 104 ++++----- drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.h | 2 + .../amd/display/dc/dce110/dce110_hw_sequencer.c | 45 ++-- .../gpu/drm/amd/display/dc/dcn10/dcn10_clk_mgr.c | 9 +- .../gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c | 251 +++++++++++++-------- .../gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.h | 2 +- .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 30 +-- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c | 6 +- .../gpu/drm/amd/display/dc/dcn10/dcn10_resource.c | 1 + drivers/gpu/drm/amd/display/dc/dm_pp_smu.h | 16 +- drivers/gpu/drm/amd/display/dc/dm_services_types.h | 18 +- .../drm/amd/display/dc/dml/display_mode_structs.h | 3 +- drivers/gpu/drm/amd/display/dc/inc/hw/abm.h | 12 +- drivers/gpu/drm/amd/display/dc/inc/hw/hw_shared.h | 16 +- drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h | 7 - .../drm/amd/display/modules/color/color_gamma.c | 46 ++-- 35 files changed, 844 insertions(+), 397 deletions(-) create mode 100644 Documentation/gpu/amdgpu-dc.rst
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1540473518-19717-1-git-send-email-sunpeng.li-5C7GfCeVMHo@public.gmane.org
PATCH 1/21 drm/amd/display: Set gamma not working on MPO planes
From: Krunoslav Kovac <[email protected]>
[Why]
Set gamma not working on certain planes in MPO configuration Root cause is that video format (YUV-420) isn't allowed for IGAM where gamma is applied.
Fix is not easy though:
1. allowing will not work because IGAM is before ICSC so RGB gamma would be applied on YUV pixels.
2. Moving OS gamma to DGAM or RGAM resulted in weird artifacts.
Ultimately the root cause for these artifacts was due to handling end points and the fact that YUV->RGB conversion will frequently "overshoot" FP 1.0 value. DCE has a single end point and slope, so we would take max. In nightlight mode, blue channel is reduced, sometimes to flat 0 line, but red is virtually unchanged. Any "overshot" in blue will be clipped to 1 (max R,G,B) instead of max blue value.
[How]
Fortunately, this can be fixed on DCN where we have end point and slope for all three color channels. We cannot fix this problem on DCE.
Other things fixed:
- switch (back) to using RGAM for OS gamma instead of IGAM
- add coeffs for 709 YUV->RGB (we used RGB->YUV for both conversions)
- switch color temperature method to scaled bradford - otherwise we would have clipping problems that caused us to switch to IGAM for OS gamma in the first place.
- comments and some minor improvements - there are some more issues but they will be addressed in separate commits.
--- .../gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c | 251 +++++++++++++-------- .../gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.h | 2 +- drivers/gpu/drm/amd/display/dc/inc/hw/hw_shared.h | 16 +- .../drm/amd/display/modules/color/color_gamma.c | 2 +- 4 files changed, 180 insertions(+), 91 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c +163 -88
@@ -71,39 +71,39 @@ void cm_helper_program_xfer_func(unsigned int i =0 ;REG_SET_2 (reg->start_cntl_b,0 , - exp_region_start, params->arr_points[0 ].custom_float_x, + exp_region_start, params->corner_points[0 ].blue.custom_float_x, exp_resion_start_segment,0 );REG_SET_2 (reg->start_cntl_g,0 , - exp_region_start, params->arr_points[0 ].custom_float_x, + exp_region_start, params->corner_points[0 ].green.custom_float_x, exp_resion_start_segment,0 );REG_SET_2 (reg->start_cntl_r,0 , - exp_region_start, params->arr_points[0 ].custom_float_x, + exp_region_start, params->corner_points[0 ].red.custom_float_x, exp_resion_start_segment,0 );REG_SET (reg->start_slope_cntl_b,0 , - field_region_linear_slope, params->arr_points[0 ].custom_float_slope); + field_region_linear_slope, params->corner_points[0 ].blue.custom_float_slope);REG_SET (reg->start_slope_cntl_g,0 , - field_region_linear_slope, params->arr_points[0 ].custom_float_slope); + field_region_linear_slope, params->corner_points[0 ].green.custom_float_slope);REG_SET (reg->start_slope_cntl_r,0 , - field_region_linear_slope, params->arr_points[0 ].custom_float_slope); + field_region_linear_slope, params->corner_points[0 ].red.custom_float_slope);REG_SET (reg->start_end_cntl1_b,0 , - field_region_end, params->arr_points[1 ].custom_float_x); + field_region_end, params->corner_points[1 ].blue.custom_float_x);REG_SET_2 (reg->start_end_cntl2_b,0 , - field_region_end_slope, params->arr_points[1 ].custom_float_slope, - field_region_end_base, params->arr_points[1 ].custom_float_y); + field_region_end_slope, params->corner_points[1 ].blue.custom_float_slope, + field_region_end_base, params->corner_points[1 ].blue.custom_float_y);REG_SET (reg->start_end_cntl1_g,0 , - field_region_end, params->arr_points[1 ].custom_float_x); + field_region_end, params->corner_points[1 ].green.custom_float_x);REG_SET_2 (reg->start_end_cntl2_g,0 , - field_region_end_slope, params->arr_points[1 ].custom_float_slope, - field_region_end_base, params->arr_points[1 ].custom_float_y); + field_region_end_slope, params->corner_points[1 ].green.custom_float_slope, + field_region_end_base, params->corner_points[1 ].green.custom_float_y);REG_SET (reg->start_end_cntl1_r,0 , - field_region_end, params->arr_points[1 ].custom_float_x); + field_region_end, params->corner_points[1 ].red.custom_float_x);REG_SET_2 (reg->start_end_cntl2_r,0 , - field_region_end_slope, params->arr_points[1 ].custom_float_slope, - field_region_end_base, params->arr_points[1 ].custom_float_y); + field_region_end_slope, params->corner_points[1 ].red.custom_float_slope, + field_region_end_base, params->corner_points[1 ].red.custom_float_y); for (reg_region_cur = reg->region_start; reg_region_cur <= reg->region_end;
@@ -127,7 +127,7 @@ void cm_helper_program_xfer_func(bool cm_helper_convert_to_custom_float (struct pwl_result_data *rgb_resulted, -struct curve_points *arr_points, +struct curve_points3 *corner_points,uint32_t hw_points_num,bool fixpoint) {
@@ -141,20 +141,53 @@ bool cm_helper_convert_to_custom_float( fmt.mantissa_bits =12 ; fmt.sign = false; -if (!convert_to_custom_float_format (arr_points[0 ].x, &fmt, - &arr_points[0 ].custom_float_x)) { +/* corner_points[0] - beginning base, slope offset for R,G,B +* corner_points[1] - end base, slope offset for R,G,B +*/ +if (!convert_to_custom_float_format (corner_points[0 ].red.x, &fmt, + &corner_points[0 ].red.custom_float_x)) { +BREAK_TO_DEBUGGER (); +return false; + } +if (!convert_to_custom_float_format (corner_points[0 ].green.x, &fmt, + &corner_points[0 ].green.custom_float_x)) { +BREAK_TO_DEBUGGER (); +return false; + } +if (!convert_to_custom_float_format (corner_points[0 ].blue.x, &fmt, + &corner_points[0 ].blue.custom_float_x)) {BREAK_TO_DEBUGGER ();return false; } -if (!convert_to_custom_float_format (arr_points[0 ].offset, &fmt, - &arr_points[0 ].custom_float_offset)) { +if (!convert_to_custom_float_format (corner_points[0 ].red.offset, &fmt, + &corner_points[0 ].red.custom_float_offset)) { +BREAK_TO_DEBUGGER (); +return false; + } +if (!convert_to_custom_float_format (corner_points[0 ].green.offset, &fmt, + &corner_points[0 ].green.custom_float_offset)) { +BREAK_TO_DEBUGGER (); +return false; + } +if (!convert_to_custom_float_format (corner_points[0 ].blue.offset, &fmt, + &corner_points[0 ].blue.custom_float_offset)) {BREAK_TO_DEBUGGER ();return false; } -if (!convert_to_custom_float_format (arr_points[0 ].slope, &fmt, - &arr_points[0 ].custom_float_slope)) { +if (!convert_to_custom_float_format (corner_points[0 ].red.slope, &fmt, + &corner_points[0 ].red.custom_float_slope)) { +BREAK_TO_DEBUGGER (); +return false; + } +if (!convert_to_custom_float_format (corner_points[0 ].green.slope, &fmt, + &corner_points[0 ].green.custom_float_slope)) { +BREAK_TO_DEBUGGER (); +return false; + } +if (!convert_to_custom_float_format (corner_points[0 ].blue.slope, &fmt, + &corner_points[0 ].blue.custom_float_slope)) {BREAK_TO_DEBUGGER ();return false; }
@@ -162,22 +195,59 @@ bool cm_helper_convert_to_custom_float( fmt.mantissa_bits =10 ; fmt.sign = false; -if (!convert_to_custom_float_format (arr_points[1 ].x, &fmt, - &arr_points[1 ].custom_float_x)) { +if (!convert_to_custom_float_format (corner_points[1 ].red.x, &fmt, + &corner_points[1 ].red.custom_float_x)) {BREAK_TO_DEBUGGER ();return false; } - -if (fixpoint == true) - arr_points[1 ].custom_float_y =dc_fixpt_clamp_u0d14 (arr_points[1 ].y); -else if (!convert_to_custom_float_format (arr_points[1 ].y, &fmt, - &arr_points[1 ].custom_float_y)) { +if (!convert_to_custom_float_format (corner_points[1 ].green.x, &fmt, + &corner_points[1 ].green.custom_float_x)) { +BREAK_TO_DEBUGGER (); +return false; + } +if (!convert_to_custom_float_format (corner_points[1 ].blue.x, &fmt, + &corner_points[1 ].blue.custom_float_x)) {BREAK_TO_DEBUGGER ();return false; } -if (!convert_to_custom_float_format (arr_points[1 ].slope, &fmt, - &arr_points[1 ].custom_float_slope)) { +if (fixpoint == true) { + corner_points[1 ].red.custom_float_y = +dc_fixpt_clamp_u0d14 (corner_points[1 ].red.y); + corner_points[1 ].green.custom_float_y = +dc_fixpt_clamp_u0d14 (corner_points[1 ].green.y); + corner_points[1 ].blue.custom_float_y = +dc_fixpt_clamp_u0d14 (corner_points[1 ].blue.y); + }else { +if (!convert_to_custom_float_format (corner_points[1 ].red.y, + &fmt, &corner_points[1 ].red.custom_float_y)) { +BREAK_TO_DEBUGGER (); +return false; + } +if (!convert_to_custom_float_format (corner_points[1 ].green.y, + &fmt, &corner_points[1 ].green.custom_float_y)) { +BREAK_TO_DEBUGGER (); +return false; + } +if (!convert_to_custom_float_format (corner_points[1 ].blue.y, + &fmt, &corner_points[1 ].blue.custom_float_y)) { +BREAK_TO_DEBUGGER (); +return false; + } + } + +if (!convert_to_custom_float_format (corner_points[1 ].red.slope, &fmt, + &corner_points[1 ].red.custom_float_slope)) { +BREAK_TO_DEBUGGER (); +return false; + } +if (!convert_to_custom_float_format (corner_points[1 ].green.slope, &fmt, + &corner_points[1 ].green.custom_float_slope)) { +BREAK_TO_DEBUGGER (); +return false; + } +if (!convert_to_custom_float_format (corner_points[1 ].blue.slope, &fmt, + &corner_points[1 ].blue.custom_float_slope)) {BREAK_TO_DEBUGGER ();return false; }
@@ -242,15 +312,10 @@ bool cm_helper_translate_curve_to_hw_format(const struct dc_transfer_func *output_tf, struct pwl_params *lut_params, bool fixpoint) { - struct curve_points *arr_points; + struct curve_points3 *corner_points;struct pwl_result_data *rgb_resulted;struct pwl_result_data *rgb;struct pwl_result_data *rgb_plus_1; -struct fixed31_32 y_r; -struct fixed31_32 y_g; -struct fixed31_32 y_b; -struct fixed31_32 y1_min; -struct fixed31_32 y3_max;int32_t region_start, region_end;int32_t i;
@@ -261,7 +326,7 @@ bool cm_helper_translate_curve_to_hw_format(PERF_TRACE (); - arr_points = lut_params->arr_points; + corner_points = lut_params->corner_points; rgb_resulted = lut_params->rgb_resulted; hw_points =0 ;
@@ -327,31 +392,37 @@ bool cm_helper_translate_curve_to_hw_format( rgb_resulted[hw_points -1 ].green = output_tf->tf_pts.green[start_index]; rgb_resulted[hw_points -1 ].blue = output_tf->tf_pts.blue[start_index]; - arr_points[0 ].x =dc_fixpt_pow (dc_fixpt_from_int (2 ), +// All 3 color channels have same x + corner_points[0 ].red.x =dc_fixpt_pow (dc_fixpt_from_int (2 ),dc_fixpt_from_int (region_start)); - arr_points[1 ].x =dc_fixpt_pow (dc_fixpt_from_int (2 ), -dc_fixpt_from_int (region_end)); + corner_points[0 ].green.x = corner_points[0 ].red.x; + corner_points[0 ].blue.x = corner_points[0 ].red.x; - y_r = rgb_resulted[0 ].red; - y_g = rgb_resulted[0 ].green; - y_b = rgb_resulted[0 ].blue; + corner_points[1 ].red.x =dc_fixpt_pow (dc_fixpt_from_int (2 ), +dc_fixpt_from_int (region_end)); + corner_points[1 ].green.x = corner_points[1 ].red.x; + corner_points[1 ].blue.x = corner_points[1 ].red.x; - y1_min =dc_fixpt_min (y_r,dc_fixpt_min (y_g, y_b)); + corner_points[0 ].red.y = rgb_resulted[0 ].red; + corner_points[0 ].green.y = rgb_resulted[0 ].green; + corner_points[0 ].blue.y = rgb_resulted[0 ].blue; - arr_points[0 ].y = y1_min; - arr_points[0 ].slope =dc_fixpt_div (arr_points[0 ].y, arr_points[0 ].x); - y_r = rgb_resulted[hw_points -1 ].red; - y_g = rgb_resulted[hw_points -1 ].green; - y_b = rgb_resulted[hw_points -1 ].blue; + corner_points[0 ].red.slope =dc_fixpt_div (corner_points[0 ].red.y, + corner_points[0 ].red.x); + corner_points[0 ].green.slope =dc_fixpt_div (corner_points[0 ].green.y, + corner_points[0 ].green.x); + corner_points[0 ].blue.slope =dc_fixpt_div (corner_points[0 ].blue.y, + corner_points[0 ].blue.x);/* see comment above, m_arrPoints[1].y should be the Y value for the * region end (m_numOfHwPoints), not last HW point(m_numOfHwPoints - 1) */ - y3_max =dc_fixpt_max (y_r,dc_fixpt_max (y_g, y_b)); - - arr_points[1 ].y = y3_max; - - arr_points[1 ].slope = dc_fixpt_zero; + corner_points[1 ].red.y = rgb_resulted[hw_points -1 ].red; + corner_points[1 ].green.y = rgb_resulted[hw_points -1 ].green; + corner_points[1 ].blue.y = rgb_resulted[hw_points -1 ].blue; + corner_points[1 ].red.slope = dc_fixpt_zero; + corner_points[1 ].green.slope = dc_fixpt_zero; + corner_points[1 ].blue.slope = dc_fixpt_zero;if (output_tf->tf ==TRANSFER_FUNCTION_PQ ) {/* for PQ, we want to have a straight line from last HW X point,
@@ -360,9 +431,15 @@ bool cm_helper_translate_curve_to_hw_format(const struct fixed31_32 end_value =dc_fixpt_from_int (125 ); - arr_points[1 ].slope =dc_fixpt_div ( -dc_fixpt_sub (dc_fixpt_one, arr_points[1 ].y), -dc_fixpt_sub (end_value, arr_points[1 ].x)); + corner_points[1 ].red.slope =dc_fixpt_div ( +dc_fixpt_sub (dc_fixpt_one, corner_points[1 ].red.y), +dc_fixpt_sub (end_value, corner_points[1 ].red.x)); + corner_points[1 ].green.slope =dc_fixpt_div ( +dc_fixpt_sub (dc_fixpt_one, corner_points[1 ].green.y), +dc_fixpt_sub (end_value, corner_points[1 ].green.x)); + corner_points[1 ].blue.slope =dc_fixpt_div ( +dc_fixpt_sub (dc_fixpt_one, corner_points[1 ].blue.y), +dc_fixpt_sub (end_value, corner_points[1 ].blue.x)); } lut_params->hw_points_num = hw_points;
@@ -411,7 +488,7 @@ bool cm_helper_translate_curve_to_hw_format( ++i; }cm_helper_convert_to_custom_float (rgb_resulted, - lut_params->arr_points, + lut_params->corner_points, hw_points, fixpoint);return true;
@@ -424,15 +501,10 @@ bool cm_helper_translate_curve_to_degamma_hw_format(const struct dc_transfer_func *output_tf, struct pwl_params *lut_params) { - struct curve_points *arr_points; + struct curve_points3 *corner_points;struct pwl_result_data *rgb_resulted;struct pwl_result_data *rgb;struct pwl_result_data *rgb_plus_1; -struct fixed31_32 y_r; -struct fixed31_32 y_g; -struct fixed31_32 y_b; -struct fixed31_32 y1_min; -struct fixed31_32 y3_max;int32_t region_start, region_end;int32_t i;
@@ -443,7 +515,7 @@ bool cm_helper_translate_curve_to_degamma_hw_format(PERF_TRACE (); - arr_points = lut_params->arr_points; + corner_points = lut_params->corner_points; rgb_resulted = lut_params->rgb_resulted; hw_points =0 ;
@@ -489,31 +561,28 @@ bool cm_helper_translate_curve_to_degamma_hw_format( rgb_resulted[hw_points -1 ].green = output_tf->tf_pts.green[start_index]; rgb_resulted[hw_points -1 ].blue = output_tf->tf_pts.blue[start_index]; - arr_points[0 ].x =dc_fixpt_pow (dc_fixpt_from_int (2 ), + corner_points[0 ].red.x =dc_fixpt_pow (dc_fixpt_from_int (2 ),dc_fixpt_from_int (region_start)); - arr_points[1 ].x =dc_fixpt_pow (dc_fixpt_from_int (2 ), + corner_points[0 ].green.x = corner_points[0 ].red.x; + corner_points[0 ].blue.x = corner_points[0 ].red.x; + corner_points[1 ].red.x =dc_fixpt_pow (dc_fixpt_from_int (2 ),dc_fixpt_from_int (region_end)); + corner_points[1 ].green.x = corner_points[1 ].red.x; + corner_points[1 ].blue.x = corner_points[1 ].red.x; - y_r = rgb_resulted[0 ].red; - y_g = rgb_resulted[0 ].green; - y_b = rgb_resulted[0 ].blue; - - y1_min =dc_fixpt_min (y_r,dc_fixpt_min (y_g, y_b)); - - arr_points[0 ].y = y1_min; - arr_points[0 ].slope =dc_fixpt_div (arr_points[0 ].y, arr_points[0 ].x); - y_r = rgb_resulted[hw_points -1 ].red; - y_g = rgb_resulted[hw_points -1 ].green; - y_b = rgb_resulted[hw_points -1 ].blue; + corner_points[0 ].red.y = rgb_resulted[0 ].red; + corner_points[0 ].green.y = rgb_resulted[0 ].green; + corner_points[0 ].blue.y = rgb_resulted[0 ].blue;/* see comment above, m_arrPoints[1].y should be the Y value for the * region end (m_numOfHwPoints), not last HW point(m_numOfHwPoints - 1) */ - y3_max =dc_fixpt_max (y_r,dc_fixpt_max (y_g, y_b)); - - arr_points[1 ].y = y3_max; - - arr_points[1 ].slope = dc_fixpt_zero; + corner_points[1 ].red.y = rgb_resulted[hw_points -1 ].red; + corner_points[1 ].green.y = rgb_resulted[hw_points -1 ].green; + corner_points[1 ].blue.y = rgb_resulted[hw_points -1 ].blue; + corner_points[1 ].red.slope = dc_fixpt_zero; + corner_points[1 ].green.slope = dc_fixpt_zero; + corner_points[1 ].blue.slope = dc_fixpt_zero;if (output_tf->tf ==TRANSFER_FUNCTION_PQ ) {/* for PQ, we want to have a straight line from last HW X point,
@@ -522,9 +591,15 @@ bool cm_helper_translate_curve_to_degamma_hw_format(const struct fixed31_32 end_value =dc_fixpt_from_int (125 ); - arr_points[1 ].slope =dc_fixpt_div ( -dc_fixpt_sub (dc_fixpt_one, arr_points[1 ].y), -dc_fixpt_sub (end_value, arr_points[1 ].x)); + corner_points[1 ].red.slope =dc_fixpt_div ( +dc_fixpt_sub (dc_fixpt_one, corner_points[1 ].red.y), +dc_fixpt_sub (end_value, corner_points[1 ].red.x)); + corner_points[1 ].green.slope =dc_fixpt_div ( +dc_fixpt_sub (dc_fixpt_one, corner_points[1 ].green.y), +dc_fixpt_sub (end_value, corner_points[1 ].green.x)); + corner_points[1 ].blue.slope =dc_fixpt_div ( +dc_fixpt_sub (dc_fixpt_one, corner_points[1 ].blue.y), +dc_fixpt_sub (end_value, corner_points[1 ].blue.x)); } lut_params->hw_points_num = hw_points;
@@ -564,7 +639,7 @@ bool cm_helper_translate_curve_to_degamma_hw_format( ++i; }cm_helper_convert_to_custom_float (rgb_resulted, - lut_params->arr_points, + lut_params->corner_points, hw_points, false);return true;
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.h +1 -1
@@ -98,7 +98,7 @@ void cm_helper_program_xfer_func(bool cm_helper_convert_to_custom_float (struct pwl_result_data *rgb_resulted, -struct curve_points *arr_points, +struct curve_points3 *corner_points,uint32_t hw_points_num,bool fixpoint);
drivers/gpu/drm/amd/display/dc/inc/hw/hw_shared.h +15 -1
@@ -53,6 +53,12 @@ struct curve_points {uint32_t custom_float_slope; }; +struct curve_points3 { +struct curve_points red; +struct curve_points green; +struct curve_points blue; +}; +struct pwl_result_data {struct fixed31_32 red;struct fixed31_32 green;
@@ -71,9 +77,17 @@ struct pwl_result_data {uint32_t delta_blue_reg; }; +/* arr_curve_points - regamma regions/segments specification +* arr_points - beginning and end point specified separately (only one on DCE) +* corner_points - beginning and end point for all 3 colors (DCN) +* rgb_resulted - final curve +*/ struct pwl_params {struct gamma_curve arr_curve_points[34 ]; -struct curve_points arr_points[2 ]; +union { +struct curve_points arr_points[2 ]; +struct curve_points3 corner_points[2 ]; + };struct pwl_result_data rgb_resulted[256 +3 ];uint32_t hw_points_num; };
drivers/gpu/drm/amd/display/modules/color/color_gamma.c +1 -1
@@ -1542,7 +1542,7 @@ bool mod_color_calculate_regamma_params(struct dc_transfer_func *output_tf,/* we can use hardcoded curve for plain SRGB TF */ if (output_tf->type ==TF_TYPE_PREDEFINED && canRomBeUsed == true && output_tf->tf ==TRANSFER_FUNCTION_SRGB && - (!mapUserRamp && ramp->type ==GAMMA_RGB_256 )) + (ramp->is_identity || (!mapUserRamp && ramp->type ==GAMMA_RGB_256 )))return true; output_tf->type =TF_TYPE_DISTRIBUTED_POINTS ;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/21 drm/amd/display: 3.2.03
In reply to a message not in the archiveFrom: SivapiriyanKumarasamy <[email protected]>
--- drivers/gpu/drm/amd/display/dc/dc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc.h +1 -1
@@ -38,7 +38,7 @@#include "inc/compressor.h" #include "dml/display_mode_lib.h" -#define DC_VER "3.2.02" +#define DC_VER "3.2.03"#define MAX_SURFACES 3#define MAX_STREAMS 6
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/21 drm/amd/display: Clip all remaining regamma points after first clipped point
In reply to a message not in the archiveFrom: SivapiriyanKumarasamy <[email protected]>
[Why]
All values computed in the gamma curve after the first upperbound clipped point will need to be clipped anyways. We can avoid unnecessary computations and potential fixed point overflow by instead clipping these values to 1 automatically.
[How]
Track if upper-bound clipping has been done, and clip all values after this threshold is reached without computing the output gamma point.
--- .../drm/amd/display/modules/color/color_gamma.c | 44 +++++++++++++--------- 1 file changed, 26 insertions(+), 18 deletions(-)
drivers/gpu/drm/amd/display/modules/color/color_gamma.c +26 -18
@@ -820,6 +820,7 @@ static bool build_freesync_hdr(struct pwl_float_data_ex *rgb_regamma,struct fixed31_32 clip = dc_fixpt_one;struct fixed31_32 output;bool use_eetf = false; +bool is_clipped = false;struct fixed31_32 sdr_white_level =dc_fixpt_from_int (fs_params->sdr_white_level); if (fs_params == NULL || fs_params->max_content == 0 ||
@@ -844,25 +845,32 @@ static bool build_freesync_hdr(struct pwl_float_data_ex *rgb_regamma, rgb +=32 ;// first 32 points have problems with fixed point, too small coord_x +=32 ;for (i =32 ; i <= hw_points_num; i++) { -if (use_eetf) { -/*max content is equal 1 */ - scaledX1 =dc_fixpt_div (coord_x->x, -dc_fixpt_div (max_content, sdr_white_level)); -hermite_spline_eetf (scaledX1, max_display, min_display, - max_content, &scaledX); - }else - scaledX =dc_fixpt_div (coord_x->x, -dc_fixpt_div (max_display, sdr_white_level)); - -if (dc_fixpt_lt (scaledX, clip)) { -if (dc_fixpt_lt (scaledX, dc_fixpt_zero)) - output = dc_fixpt_zero; -else - output =calculate_gamma22 (scaledX); +if (!is_clipped) { +if (use_eetf) { +/*max content is equal 1 */ + scaledX1 =dc_fixpt_div (coord_x->x, +dc_fixpt_div (max_content, sdr_white_level)); +hermite_spline_eetf (scaledX1, max_display, min_display, + max_content, &scaledX); + }else + scaledX =dc_fixpt_div (coord_x->x, +dc_fixpt_div (max_display, sdr_white_level)); + +if (dc_fixpt_lt (scaledX, clip)) { +if (dc_fixpt_lt (scaledX, dc_fixpt_zero)) + output = dc_fixpt_zero; +else + output =calculate_gamma22 (scaledX); - rgb->r = output; - rgb->g = output; - rgb->b = output; + rgb->r = output; + rgb->g = output; + rgb->b = output; + }else { + is_clipped = true; + rgb->r = clip; + rgb->g = clip; + rgb->b = clip; + } }else { rgb->r = clip; rgb->g = clip;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/21 drm/amd/display: fix dml max voltage state
In reply to a message not in the archiveFrom: Dmytro Laktyushkin <[email protected]>
Gabe's formula sometimes uses values from non-existent 'unsupported' state to do validation.
This change adds this extra state so validation can work correctly.
--- drivers/gpu/drm/amd/display/dc/dml/display_mode_structs.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml/display_mode_structs.h +2 -1
@@ -113,7 +113,8 @@ struct _vcs_dpi_soc_bounding_box_st {int use_urgent_burst_bw;double max_hscl_ratio;double max_vscl_ratio; -struct _vcs_dpi_voltage_scaling_st clock_limits[7 ]; +unsigned int num_states; +struct _vcs_dpi_voltage_scaling_st clock_limits[8 ]; };struct _vcs_dpi_ip_params_st {
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/21 drm/amd/display: Add missing pipes registers for VGA enable/disable
In reply to a message not in the archiveFrom: Nevenko Stupar <[email protected]>
--- drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.h | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.h +2 -0
@@ -282,6 +282,8 @@ struct dce_hwseq_registers {uint32_t D2VGA_CONTROL ;uint32_t D3VGA_CONTROL ;uint32_t D4VGA_CONTROL ; +uint32_t D5VGA_CONTROL ; +uint32_t D6VGA_CONTROL ;uint32_t VGA_TEST_CONTROL ;/* MMHUB registers. read only. temporary hack */ uint32_t VM_CONTEXT0_PAGE_TABLE_BASE_ADDR_HI32 ;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 6/21 drm/amd/display: remove interlace scaling adjustment
In reply to a message not in the archiveFrom: Dmytro Laktyushkin <[email protected]>
We do not need to adjust surface scaling when p2i is enabled and we do not support interlaced timing otherwise
--- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +0 -9
@@ -1115,9 +1115,6 @@ bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx) pipe_ctx->plane_res.scl_data.format =convert_pixel_format_to_dalsurface ( pipe_ctx->plane_state->format); -if (pipe_ctx->stream->timing.flags.INTERLACE) - pipe_ctx->stream->dst.height *=2 ; -calculate_scaling_ratios (pipe_ctx);calculate_viewport (pipe_ctx);
@@ -1138,9 +1135,6 @@ bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx) pipe_ctx->plane_res.scl_data.h_active = timing->h_addressable + timing->h_border_left + timing->h_border_right; pipe_ctx->plane_res.scl_data.v_active = timing->v_addressable + timing->v_border_top + timing->v_border_bottom; -if (pipe_ctx->stream->timing.flags.INTERLACE) - pipe_ctx->plane_res.scl_data.v_active *=2 ; -/* Taps calculations */ if (pipe_ctx->plane_res.xfm !=NULL )
@@ -1185,9 +1179,6 @@ bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx) plane_state->dst_rect.x, plane_state->dst_rect.y); -if (pipe_ctx->stream->timing.flags.INTERLACE) - pipe_ctx->stream->dst.height /=2 ; -return res; }
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 7/21 drm/amd/display: Fix up coverity issues
In reply to a message not in the archiveFrom: Aric Cyr <[email protected]>
[Why]
Coverity found various high-impact issues that need resolving.
[How]
Fix some buffer overruns and uninitialized variables.
--- drivers/gpu/drm/amd/display/dc/bios/bios_parser.c | 2 +- drivers/gpu/drm/amd/display/dc/core/dc_debug.c | 7 +++---- drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c | 6 +++--- 3 files changed, 7 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/display/dc/bios/bios_parser.c +1 -1
@@ -2030,7 +2030,7 @@ static uint32_t get_src_obj_list(struct bios_parser *bp, ATOM_OBJECT *object,static struct device_id device_type_from_device_id (uint16_t device_id) { -struct device_id result_device_id; +struct device_id result_device_id = {0 };switch (device_id) {case ATOM_DEVICE_LCD1_SUPPORT :
drivers/gpu/drm/amd/display/dc/core/dc_debug.c +3 -4
@@ -311,7 +311,7 @@ void context_timing_trace( {int i;struct dc *core_dc = dc; -int h_pos[MAX_PIPES ], v_pos[MAX_PIPES ]; +int h_pos[MAX_PIPES ] = {0 }, v_pos[MAX_PIPES ] = {0 };struct crtc_position position;unsigned int underlay_idx = core_dc->res_pool->underlay_pipe_index;DC_LOGGER_INIT (dc->ctx->logger);
@@ -322,8 +322,7 @@ void context_timing_trace(/* get_position() returns CRTC vertical/horizontal counter * hence not applicable for underlay pipe */ -if (pipe_ctx->stream ==NULL - || pipe_ctx->pipe_idx == underlay_idx) +if (pipe_ctx->stream ==NULL || pipe_ctx->pipe_idx == underlay_idx)continue ; pipe_ctx->stream_res.tg->funcs->get_position (pipe_ctx->stream_res.tg, &position);
@@ -333,7 +332,7 @@ void context_timing_trace(for (i =0 ; i < core_dc->res_pool->pipe_count; i++) {struct pipe_ctx *pipe_ctx = &res_ctx->pipe_ctx[i]; -if (pipe_ctx->stream ==NULL ) +if (pipe_ctx->stream ==NULL || pipe_ctx->pipe_idx == underlay_idx)continue ; TIMING_TRACE("OTG_%d H_tot:%d V_tot:%d H_pos:%d V_pos:%d\n",
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +3 -3
@@ -548,14 +548,14 @@ dce110_translate_regamma_to_hw_format(const struct dc_transfer_func *output_tf, regamma_params->hw_points_num = hw_points; - i =1 ; -for (k =0 ; k <16 && i <16 ; k++) { + k =0 ; +for (i =1 ; i <16 ; i++) {if (seg_distr[k] !=-1 ) { regamma_params->arr_curve_points[k].segments_num = seg_distr[k]; regamma_params->arr_curve_points[i].offset = regamma_params->arr_curve_points[k].offset + (1 << seg_distr[k]); } - i++; + k++; }if (seg_distr[k] !=-1 )
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 8/21 drm/amd/display: 3.2.04
In reply to a message not in the archiveFrom: Steven Chiu <[email protected]>
--- drivers/gpu/drm/amd/display/dc/dc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc.h +1 -1
@@ -38,7 +38,7 @@#include "inc/compressor.h" #include "dml/display_mode_lib.h" -#define DC_VER "3.2.03" +#define DC_VER "3.2.04"#define MAX_SURFACES 3#define MAX_STREAMS 6
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 9/21 drm/amd/display: Fix potential nullptr error
In reply to a message not in the archiveFrom: Bhawanpreet Lakha <[email protected]>
[Why]
Fix surface/plane potential nullptr
[How]
add null check
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +6 -0
@@ -5321,6 +5321,12 @@ enum surface_update_type dm_determine_update_type_for_commit(struct dc *dc, strustruct dc_stream_update stream_update;enum surface_update_type update_type =UPDATE_TYPE_FAST ; +if (!updates || !surface) { +DRM_ERROR ("Plane or surface update failed to allocate" ); +/* Set type to FULL to avoid crashing in DC*/ + update_type =UPDATE_TYPE_FULL ; + goto ret; + }for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) { new_dm_crtc_state =to_dm_crtc_state (new_crtc_state);
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 10/21 drm/amd/display: Initial documentation for AMDgpu DC
In reply to a message not in the archiveFrom: Leo Li <[email protected]>
[Why]
Documentation is helpful for the community to understand our code. This change does some high-level documentation of some DM interfaces with DRM, and the amdgpu base driver.
[How]
An entry for AMDgpu DC has been added to Documentation/gpu/drivers.rst TOC. amdgpu-dc.rst is created to pull in inline doc-strings, which:
- Provides an overview for "What is DM?"
- Documents AMDgpu DM lifecyle
- Documents IRQ management
- Documents atomic_check and commit_tail interfaces
--- Documentation/gpu/amdgpu-dc.rst | 68 ++++++++++++ Documentation/gpu/drivers.rst | 1 + drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 101 +++++++++++++++--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 76 +++++++++++--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c | 115 ++++++++++++++++++--- 5 files changed, 320 insertions(+), 41 deletions(-) create mode 100644 Documentation/gpu/amdgpu-dc.rst
Documentation/gpu/amdgpu-dc.rst new file +68 -0
@@ -0,0 +1,68 @@ +=================================== +drm/amd/display - Display Core (DC) +=================================== + +*placeholder - general description of supported platforms, what dc is, etc.* + +Because it is partially shared with other operating systems, the Display Core +Driver is divided in two pieces. + +1. **Display Core (DC)** contains the OS-agnostic components. Things like + hardware programming and resource management are handled here. +2. **Display Manager (DM)** contains the OS-dependent components. Hooks to the + amdgpu base driver and DRM are implemented here. + +It doesn't help that the entire package is frequently referred to as DC. But +with the context in mind, it should be clear. + +When CONFIG_DRM_AMD_DC is enabled, DC will be initialized by default for +supported ASICs. To force disable, set `amdgpu.dc=0` on kernel command line. +Likewise, to force enable on unsupported ASICs, set `amdgpu.dc=1`. + +To determine if DC is loaded, search dmesg for the following entry: + +``Display Core initialized with <version number here>`` + +AMDgpu Display Manager +====================== + +.. kernel-doc:: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c + :doc: overview + +.. kernel-doc:: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h + :internal: + +Lifecycle +--------- + +.. kernel-doc:: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c + :doc: DM Lifecycle + +.. kernel-doc:: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c + :functions: dm_hw_init dm_hw_fini + +Interrupts +---------- + +.. kernel-doc:: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c + :doc: overview + +.. kernel-doc:: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c + :internal: + +.. kernel-doc:: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c + :functions: register_hpd_handlers dm_crtc_high_irq dm_pflip_high_irq + +Atomic Implementation +--------------------- + +.. kernel-doc:: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c + :doc: atomic + +.. kernel-doc:: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c + :functions: amdgpu_dm_atomic_check amdgpu_dm_atomic_commit_tail + +Display Core +============ + +**WIP**
Documentation/gpu/drivers.rst +1 -0
@@ -5,6 +5,7 @@ GPU Driver Documentation .. toctree:: amdgpu + amdgpu-dc i915 meson pl111
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +87 -14
155 lines not on this page · raw message
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +62 -14
120 lines not on this page · raw message
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c +102 -13
191 lines not on this page · raw message
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 11/21 drm/amd/display: Remove some old TODO's
In reply to a message not in the archiveFrom: Eric Bernstein <[email protected]>
They are no longer relevant
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +0 -6
@@ -1944,10 +1944,6 @@ static void dcn10_update_mpcc(struct dc *dc, struct pipe_ctx *pipe_ctx)struct mpc *mpc = dc->res_pool->mpc;struct mpc_tree *mpc_tree_params = &(pipe_ctx->stream_res.opp->mpc_tree_params); - - -/* TODO: proper fix once fpga works */ -if (dc->debug.visual_confirm ==VISUAL_CONFIRM_HDR ) {dcn10_get_hdr_visual_confirm_color ( pipe_ctx, &blnd_cfg.black_color);
@@ -2027,8 +2023,6 @@ static void update_scaler(struct pipe_ctx *pipe_ctx)bool per_pixel_alpha = pipe_ctx->plane_state->per_pixel_alpha && pipe_ctx->bottom_pipe; -/* TODO: proper fix once fpga works */ - pipe_ctx->plane_res.scl_data.lb_params.alpha_en = per_pixel_alpha; pipe_ctx->plane_res.scl_data.lb_params.depth =LB_PIXEL_DEPTH_30BPP ;/* scaler configuration */
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 12/21 drm/amd/display: Expand dc to use 16.16 bit backlight
In reply to a message not in the archiveFrom: Anthony Koo <[email protected]>
[Why] We want to increase precision for backlight setting. But DC interface takes 8 bit backlight level value only.
[How] DMCU already takes 16 bit backlight level. Expand the DC interface to take 16.16 bit value. Max 32 bit backlight value (0xFFFF) will represent max backlight (100%)
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 +- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 34 ++++---- drivers/gpu/drm/amd/display/dc/dc_link.h | 11 ++- drivers/gpu/drm/amd/display/dc/dce/dce_abm.c | 92 +++++++++------------- .../amd/display/dc/dce110/dce110_hw_sequencer.c | 1 - drivers/gpu/drm/amd/display/dc/inc/hw/abm.h | 11 ++- drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h | 2 - 7 files changed, 79 insertions(+), 79 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +6 -1
@@ -1567,8 +1567,13 @@ static int amdgpu_dm_backlight_update_status(struct backlight_device *bd) {struct amdgpu_display_manager *dm =bl_get_data (bd); +/* backlight_pwm_u16_16 parameter is in unsigned 32 bit, 16 bit integer +* and 16 bit fractional, where 1.0 is max backlight value. +* bd->props.brightness is 8 bit format and needs to be converted by +* scaling via copy lower byte to upper byte of 16 bit value. +*/ if (dc_link_set_backlight_level (dm->backlight_link, - bd->props.brightness,0 ,0 )) + (bd->props.brightness *0x101 ),0 ,0 ))return 0 ;else return 1 ;
drivers/gpu/drm/amd/display/dc/core/dc_link.c +19 -15
@@ -2141,14 +2141,16 @@ int dc_link_get_backlight_level(const struct dc_link *link) {struct abm *abm = link->ctx->dc->res_pool->abm; -if (abm ==NULL || abm->funcs->get_current_backlight_8_bit ==NULL ) +if (abm ==NULL || abm->funcs->get_current_backlight ==NULL )return DC_ERROR_UNEXPECTED ; -return (int ) abm->funcs->get_current_backlight_8_bit (abm); +return (int ) abm->funcs->get_current_backlight (abm); } -bool dc_link_set_backlight_level (const struct dc_link *link,uint32_t level, -uint32_t frame_ramp,const struct dc_stream_state *stream) +bool dc_link_set_backlight_level (const struct dc_link *link, +uint32_t backlight_pwm_u16_16, +uint32_t frame_ramp, +const struct dc_stream_state *stream) {struct dc *core_dc = link->ctx->dc;struct abm *abm = core_dc->res_pool->abm;
@@ -2160,19 +2162,17 @@ bool dc_link_set_backlight_level(const struct dc_link *link, uint32_t level,if ((dmcu ==NULL ) || (abm ==NULL ) || - (abm->funcs->set_backlight_level ==NULL )) + (abm->funcs->set_backlight_level_pwm ==NULL ))return false; -if (stream) { -if (stream->bl_pwm_level ==EDP_BACKLIGHT_RAMP_DISABLE_LEVEL ) - frame_ramp =0 ; - - ((struct dc_stream_state *)stream)->bl_pwm_level = level; - } +if (stream) + ((struct dc_stream_state *)stream)->bl_pwm_level = + backlight_pwm_u16_16; use_smooth_brightness = dmcu->funcs->is_dmcu_initialized (dmcu); -DC_LOG_BACKLIGHT ("New Backlight level: %d (0x%X)\n" , level, level); +DC_LOG_BACKLIGHT ("New Backlight level: %d (0x%X)\n" , + backlight_pwm_u16_16, backlight_pwm_u16_16);if (dc_is_embedded_signal (link->connector_signal)) {if (stream !=NULL ) {
@@ -2189,9 +2189,9 @@ bool dc_link_set_backlight_level(const struct dc_link *link, uint32_t level,1 ; } } - abm->funcs->set_backlight_level ( + abm->funcs->set_backlight_level_pwm ( abm, - level, + backlight_pwm_u16_16, frame_ramp, controller_id, use_smooth_brightness);
@@ -2205,7 +2205,7 @@ bool dc_link_set_abm_disable(const struct dc_link *link)struct dc *core_dc = link->ctx->dc;struct abm *abm = core_dc->res_pool->abm; -if ((abm ==NULL ) || (abm->funcs->set_backlight_level ==NULL )) +if ((abm ==NULL ) || (abm->funcs->set_backlight_level_pwm ==NULL ))return false; abm->funcs->set_abm_immediate_disable (abm);
@@ -2594,6 +2594,10 @@ void core_link_enable_stream( core_dc->hwss.unblank_stream (pipe_ctx, &pipe_ctx->stream->sink->link->cur_link_settings); +dc_link_set_backlight_level (pipe_ctx->stream->sink->link, + pipe_ctx->stream->bl_pwm_level, +0 , + pipe_ctx->stream); } }
drivers/gpu/drm/amd/display/dc/dc_link.h +8 -3
@@ -138,9 +138,14 @@ static inline struct dc_link *dc_get_link_at_index(struct dc *dc, uint32_t link_return dc->links[link_index]; } -/* Set backlight level of an embedded panel (eDP, LVDS). */ -bool dc_link_set_backlight_level (const struct dc_link *dc_link,uint32_t level, -uint32_t frame_ramp,const struct dc_stream_state *stream); +/* Set backlight level of an embedded panel (eDP, LVDS). +* backlight_pwm_u16_16 is unsigned 32 bit with 16 bit integer +* and 16 bit fractional, where 1.0 is max backlight value. +*/ +bool dc_link_set_backlight_level (const struct dc_link *dc_link, +uint32_t backlight_pwm_u16_16, +uint32_t frame_ramp, +const struct dc_stream_state *stream);int dc_link_get_backlight_level (const struct dc_link *dc_link);
drivers/gpu/drm/amd/display/dc/dce/dce_abm.c +38 -54
210 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +0 -1
@@ -1085,7 +1085,6 @@ void dce110_unblank_stream(struct pipe_ctx *pipe_ctx,if (link->local_sink && link->local_sink->sink_signal ==SIGNAL_TYPE_EDP ) { link->dc->hwss.edp_backlight_control (link, true); - stream->bl_pwm_level =EDP_BACKLIGHT_RAMP_DISABLE_LEVEL ; } }void dce110_blank_stream (struct pipe_ctx *pipe_ctx)
drivers/gpu/drm/amd/display/dc/inc/hw/abm.h +8 -3
@@ -47,12 +47,17 @@ struct abm_funcs {bool (*set_abm_level)(struct abm *abm,unsigned int abm_level);bool (*set_abm_immediate_disable)(struct abm *abm);bool (*init_backlight)(struct abm *abm); -bool (*set_backlight_level)(struct abm *abm, -unsigned int backlight_level, + +/* backlight_pwm_u16_16 is unsigned 32 bit, +* 16 bit integer + 16 fractional, where 1.0 is max backlight value. +*/ +bool (*set_backlight_level_pwm)(struct abm *abm, +unsigned int backlight_pwm_u16_16,unsigned int frame_ramp,unsigned int controller_id,bool use_smooth_brightness); - unsigned int (*get_current_backlight_8_bit)(struct abm *abm); + + unsigned int (*get_current_backlight)(struct abm *abm); };#endif
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h +0 -2
@@ -32,8 +32,6 @@#include "inc/hw/link_encoder.h" #include "core_status.h" -#define EDP_BACKLIGHT_RAMP_DISABLE_LEVEL 0xFFFFFFFF -enum pipe_gating_control {PIPE_GATING_CONTROL_DISABLE =0 ,PIPE_GATING_CONTROL_ENABLE ,
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 13/21 drm/amd/display: Fix some backlight variable styling
In reply to a message not in the archiveFrom: Anthony Koo <[email protected]>
variableNamingsLikeSo aren't to convention. use_this_instead.
--- drivers/gpu/drm/amd/display/dc/dm_services_types.h | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/display/dc/dm_services_types.h +8 -10
@@ -208,22 +208,20 @@ struct dm_bl_data_point {/* Brightness level as effective value in range 0-255, * corresponding to above percentage */ -uint8_t signalLevel; +uint8_t signal_level; };/* Total size of the structure should not exceed 256 bytes */ struct dm_acpi_atif_backlight_caps { - -uint16_t size;/* Bytes 0-1 (2 bytes) */ uint16_t flags;/* Byted 2-3 (2 bytes) */ -uint8_t errorCode;/* Byte 4 */ -uint8_t acLevelPercentage;/* Byte 5 */ -uint8_t dcLevelPercentage;/* Byte 6 */ -uint8_t minInputSignal;/* Byte 7 */ -uint8_t maxInputSignal;/* Byte 8 */ -uint8_t numOfDataPoints;/* Byte 9 */ -struct dm_bl_data_point dataPoints[99 ];/* Bytes 10-207 (198 bytes)*/ +uint8_t error_code;/* Byte 4 */ +uint8_t ac_level_percentage;/* Byte 5 */ +uint8_t dc_level_percentage;/* Byte 6 */ +uint8_t min_input_signal;/* Byte 7 */ +uint8_t max_input_signal;/* Byte 8 */ +uint8_t num_data_points;/* Byte 9 */ +struct dm_bl_data_point data_points[99 ];/* Bytes 10-207 (198 bytes)*/ };enum dm_acpi_display_type {
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 14/21 drm/amd/display: Remove program_csc_matrix
In reply to a message not in the archiveFrom: Krunoslav Kovac <[email protected]>
[Why] On DCN1/DCE, There are two functions programming OCSC:program_csc_matrix and program_output_csc. They do the same thing.
[How] Consolidate to use only program_output_csc.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 8 +++++--- .../amd/display/dc/dce110/dce110_hw_sequencer.c | 23 --------------------- .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 24 ++++++---------------- drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h | 5 ----- 4 files changed, 11 insertions(+), 49 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +5 -3
@@ -391,9 +391,11 @@ bool dc_stream_program_csc_matrix(struct dc *dc, struct dc_stream_state *stream) == stream) { pipes = &dc->current_state->res_ctx.pipe_ctx[i]; - dc->hwss.program_csc_matrix (pipes, - stream->output_color_space, - stream->csc_color_matrix.matrix); + dc->hwss.program_output_csc (dc, + pipes, + stream->output_color_space, + stream->csc_color_matrix.matrix, + pipes->plane_res.hubp->opp_id); ret = true; } }
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +0 -23
@@ -2582,28 +2582,6 @@ static void dce110_wait_for_mpcc_disconnect(/* do nothing*/ } -static void program_csc_matrix (struct pipe_ctx *pipe_ctx, -enum dc_color_space colorspace, -uint16_t *matrix) -{ -int i; -struct out_csc_color_matrix tbl_entry; - -if (pipe_ctx->stream->csc_color_matrix.enable_adjustment - == true) { -enum dc_color_space color_space = - pipe_ctx->stream->output_color_space; - -//uint16_t matrix[12]; -for (i =0 ; i <12 ; i++) - tbl_entry.regval[i] = pipe_ctx->stream->csc_color_matrix.matrix[i]; - - tbl_entry.color_space = color_space; -//tbl_entry.regval = matrix; - pipe_ctx->plane_res.xfm->funcs->opp_set_csc_adjustment (pipe_ctx->plane_res.xfm, &tbl_entry); - } -} -void dce110_set_cursor_position (struct pipe_ctx *pipe_ctx) {struct dc_cursor_position pos_cpy = pipe_ctx->stream->cursor_position;
@@ -2654,7 +2632,6 @@ void dce110_set_cursor_attribute(struct pipe_ctx *pipe_ctx)static const struct hw_sequencer_funcs dce110_funcs = { .program_gamut_remap = program_gamut_remap, - .program_csc_matrix = program_csc_matrix, .init_hw = init_hw, .apply_ctx_to_hw = dce110_apply_ctx_to_hw, .apply_ctx_for_surface = dce110_apply_ctx_for_surface,
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +6 -18
@@ -1704,32 +1704,21 @@ static void program_gamut_remap(struct pipe_ctx *pipe_ctx) pipe_ctx->plane_res.dpp->funcs->dpp_set_gamut_remap (pipe_ctx->plane_res.dpp, &adjust); } - -static void program_csc_matrix (struct pipe_ctx *pipe_ctx, +static void dcn10_program_output_csc (struct dc *dc, +struct pipe_ctx *pipe_ctx,enum dc_color_space colorspace, -uint16_t *matrix) +uint16_t *matrix, +int opp_id) {if (pipe_ctx->stream->csc_color_matrix.enable_adjustment == true) { -if (pipe_ctx->plane_res.dpp->funcs->dpp_set_csc_adjustment !=NULL ) - pipe_ctx->plane_res.dpp->funcs->dpp_set_csc_adjustment (pipe_ctx->plane_res.dpp, matrix); +if (pipe_ctx->plane_res.dpp->funcs->dpp_set_csc_adjustment !=NULL ) + pipe_ctx->plane_res.dpp->funcs->dpp_set_csc_adjustment (pipe_ctx->plane_res.dpp, matrix); }else {if (pipe_ctx->plane_res.dpp->funcs->dpp_set_csc_default !=NULL ) pipe_ctx->plane_res.dpp->funcs->dpp_set_csc_default (pipe_ctx->plane_res.dpp, colorspace); } } -static void dcn10_program_output_csc (struct dc *dc, -struct pipe_ctx *pipe_ctx, -enum dc_color_space colorspace, -uint16_t *matrix, -int opp_id) -{ -if (pipe_ctx->plane_res.dpp->funcs->dpp_set_csc_adjustment !=NULL ) -program_csc_matrix (pipe_ctx, - colorspace, - matrix); -} -bool is_lower_pipe_tree_visible (struct pipe_ctx *pipe_ctx) {if (pipe_ctx->plane_state->visible)
@@ -2684,7 +2673,6 @@ static void dcn10_set_cursor_sdr_white_level(struct pipe_ctx *pipe_ctx)static const struct hw_sequencer_funcs dcn10_funcs = { .program_gamut_remap = program_gamut_remap, - .program_csc_matrix = program_csc_matrix, .init_hw = dcn10_init_hw, .apply_ctx_to_hw = dce110_apply_ctx_to_hw, .apply_ctx_for_surface = dcn10_apply_ctx_for_surface,
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h +0 -5
@@ -85,11 +85,6 @@ struct hw_sequencer_funcs {void (*program_gamut_remap)(struct pipe_ctx *pipe_ctx); -void (*program_csc_matrix)( -struct pipe_ctx *pipe_ctx, -enum dc_color_space colorspace, -uint16_t *matrix); - void (*program_output_csc)(struct dc *dc, struct pipe_ctx *pipe_ctx, enum dc_color_space colorspace,
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 15/21 drm/amd/display: Retiring set_display_requirements in dm_pp_smu.h - part4
In reply to a message not in the archiveFrom: Fatemeh Darbehani <[email protected]>
[Why]
In DCN we want direct DC to SMU calls, with minimal interference from pplib.
The reason for each pp_smu interface mapping to 1 SMU message is so we can have the sequencing of different SMU message in DC and shared across different OS's.
This will also simplify debugging as DAL owns this interaction and there's no confusion about division of ownership.
[How]
Part 4: Change clock units so they match the values PPLib sends to SMU.
--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c | 20 +++++++------- drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c | 32 +++++++++++----------- .../gpu/drm/amd/display/dc/dcn10/dcn10_clk_mgr.c | 6 ++-- drivers/gpu/drm/amd/display/dc/dm_pp_smu.h | 16 +++++------ 4 files changed, 37 insertions(+), 37 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c +10 -10
@@ -485,11 +485,11 @@ void pp_rv_set_display_requirement(struct pp_smu *pp,return ; clock.clock_type = amd_pp_dcf_clock; - clock.clock_freq_in_khz = req->hard_min_dcefclk_khz; + clock.clock_freq_in_khz = req->hard_min_dcefclk_mhz *1000 ; pp_funcs->display_clock_voltage_request (pp_handle, &clock); clock.clock_type = amd_pp_f_clock; - clock.clock_freq_in_khz = req->hard_min_fclk_khz; + clock.clock_freq_in_khz = req->hard_min_fclk_mhz *1000 ; pp_funcs->display_clock_voltage_request (pp_handle, &clock); }
@@ -518,13 +518,13 @@ void pp_rv_set_wm_ranges(struct pp_smu *pp, wm_dce_clocks[i].wm_set_id = ranges->reader_wm_sets[i].wm_inst; wm_dce_clocks[i].wm_max_dcfclk_clk_in_khz = - ranges->reader_wm_sets[i].max_drain_clk_khz; + ranges->reader_wm_sets[i].max_drain_clk_mhz *1000 ; wm_dce_clocks[i].wm_min_dcfclk_clk_in_khz = - ranges->reader_wm_sets[i].min_drain_clk_khz; + ranges->reader_wm_sets[i].min_drain_clk_mhz *1000 ; wm_dce_clocks[i].wm_max_mem_clk_in_khz = - ranges->reader_wm_sets[i].max_fill_clk_khz; + ranges->reader_wm_sets[i].max_fill_clk_mhz *1000 ; wm_dce_clocks[i].wm_min_mem_clk_in_khz = - ranges->reader_wm_sets[i].min_fill_clk_khz; + ranges->reader_wm_sets[i].min_fill_clk_mhz *1000 ; }for (i =0 ; i < wm_with_clock_ranges.num_wm_mcif_sets; i++) {
@@ -534,13 +534,13 @@ void pp_rv_set_wm_ranges(struct pp_smu *pp, wm_soc_clocks[i].wm_set_id = ranges->writer_wm_sets[i].wm_inst; wm_soc_clocks[i].wm_max_socclk_clk_in_khz = - ranges->writer_wm_sets[i].max_fill_clk_khz; + ranges->writer_wm_sets[i].max_fill_clk_mhz *1000 ; wm_soc_clocks[i].wm_min_socclk_clk_in_khz = - ranges->writer_wm_sets[i].min_fill_clk_khz; + ranges->writer_wm_sets[i].min_fill_clk_mhz *1000 ; wm_soc_clocks[i].wm_max_mem_clk_in_khz = - ranges->writer_wm_sets[i].max_drain_clk_khz; + ranges->writer_wm_sets[i].max_drain_clk_mhz *1000 ; wm_soc_clocks[i].wm_min_mem_clk_in_khz = - ranges->writer_wm_sets[i].min_drain_clk_khz; + ranges->writer_wm_sets[i].min_drain_clk_mhz *1000 ; } pp_funcs->set_watermarks_for_clocks_ranges (pp_handle, &wm_with_clock_ranges);
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c +16 -16
@@ -1423,27 +1423,27 @@ void dcn_bw_notify_pplib_of_wm_ranges(struct dc *dc) ranges.num_reader_wm_sets =WM_SET_COUNT ; ranges.num_writer_wm_sets =WM_SET_COUNT ; ranges.reader_wm_sets[0 ].wm_inst =WM_A ; - ranges.reader_wm_sets[0 ].min_drain_clk_khz = min_dcfclk_khz; - ranges.reader_wm_sets[0 ].max_drain_clk_khz = overdrive; - ranges.reader_wm_sets[0 ].min_fill_clk_khz = min_fclk_khz; - ranges.reader_wm_sets[0 ].max_fill_clk_khz = overdrive; + ranges.reader_wm_sets[0 ].min_drain_clk_mhz = min_dcfclk_khz /1000 ; + ranges.reader_wm_sets[0 ].max_drain_clk_mhz = overdrive /1000 ; + ranges.reader_wm_sets[0 ].min_fill_clk_mhz = min_fclk_khz /1000 ; + ranges.reader_wm_sets[0 ].max_fill_clk_mhz = overdrive /1000 ; ranges.writer_wm_sets[0 ].wm_inst =WM_A ; - ranges.writer_wm_sets[0 ].min_fill_clk_khz = socclk_khz; - ranges.writer_wm_sets[0 ].max_fill_clk_khz = overdrive; - ranges.writer_wm_sets[0 ].min_drain_clk_khz = min_fclk_khz; - ranges.writer_wm_sets[0 ].max_drain_clk_khz = overdrive; + ranges.writer_wm_sets[0 ].min_fill_clk_mhz = socclk_khz /1000 ; + ranges.writer_wm_sets[0 ].max_fill_clk_mhz = overdrive /1000 ; + ranges.writer_wm_sets[0 ].min_drain_clk_mhz = min_fclk_khz /1000 ; + ranges.writer_wm_sets[0 ].max_drain_clk_mhz = overdrive /1000 ;if (dc->debug.pplib_wm_report_mode ==WM_REPORT_OVERRIDE ) { ranges.reader_wm_sets[0 ].wm_inst =WM_A ; - ranges.reader_wm_sets[0 ].min_drain_clk_khz =300000 ; - ranges.reader_wm_sets[0 ].max_drain_clk_khz =5000000 ; - ranges.reader_wm_sets[0 ].min_fill_clk_khz =800000 ; - ranges.reader_wm_sets[0 ].max_fill_clk_khz =5000000 ; + ranges.reader_wm_sets[0 ].min_drain_clk_mhz =300 ; + ranges.reader_wm_sets[0 ].max_drain_clk_mhz =5000 ; + ranges.reader_wm_sets[0 ].min_fill_clk_mhz =800 ; + ranges.reader_wm_sets[0 ].max_fill_clk_mhz =5000 ; ranges.writer_wm_sets[0 ].wm_inst =WM_A ; - ranges.writer_wm_sets[0 ].min_fill_clk_khz =200000 ; - ranges.writer_wm_sets[0 ].max_fill_clk_khz =5000000 ; - ranges.writer_wm_sets[0 ].min_drain_clk_khz =800000 ; - ranges.writer_wm_sets[0 ].max_drain_clk_khz =5000000 ; + ranges.writer_wm_sets[0 ].min_fill_clk_mhz =200 ; + ranges.writer_wm_sets[0 ].max_fill_clk_mhz =5000 ; + ranges.writer_wm_sets[0 ].min_drain_clk_mhz =800 ; + ranges.writer_wm_sets[0 ].max_drain_clk_mhz =5000 ; } ranges.reader_wm_sets[1 ] = ranges.writer_wm_sets[0 ];
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_clk_mgr.c +3 -3
@@ -266,7 +266,7 @@ static void dcn1_update_clocks(struct clk_mgr *clk_mgr, clk_mgr->clks.fclk_khz = new_clocks->fclk_khz; clock_voltage_req.clk_type =DM_PP_CLOCK_TYPE_FCLK ; clock_voltage_req.clocks_in_khz = new_clocks->fclk_khz; - smu_req.hard_min_fclk_khz = new_clocks->fclk_khz; + smu_req.hard_min_fclk_mhz = new_clocks->fclk_khz /1000 ;notify_hard_min_fclk_to_smu (pp_smu, new_clocks->fclk_khz);
@@ -276,7 +276,7 @@ static void dcn1_update_clocks(struct clk_mgr *clk_mgr,//DCF Clock if (should_set_clock (safe_to_lower, new_clocks->dcfclk_khz, clk_mgr->clks.dcfclk_khz)) { clk_mgr->clks.dcfclk_khz = new_clocks->dcfclk_khz; - smu_req.hard_min_dcefclk_khz = new_clocks->dcfclk_khz; + smu_req.hard_min_dcefclk_mhz = new_clocks->dcfclk_khz /1000 ; send_request_to_lower = true; }
@@ -284,7 +284,7 @@ static void dcn1_update_clocks(struct clk_mgr *clk_mgr,if (should_set_clock (safe_to_lower, new_clocks->dcfclk_deep_sleep_khz, clk_mgr->clks.dcfclk_deep_sleep_khz)) { clk_mgr->clks.dcfclk_deep_sleep_khz = new_clocks->dcfclk_deep_sleep_khz; - smu_req.min_deep_sleep_dcefclk_mhz = new_clocks->dcfclk_deep_sleep_khz; + smu_req.min_deep_sleep_dcefclk_mhz = new_clocks->dcfclk_deep_sleep_khz /1000 ; send_request_to_lower = true; }
drivers/gpu/drm/amd/display/dc/dm_pp_smu.h +8 -8
@@ -55,10 +55,10 @@ struct pp_smu {struct pp_smu_wm_set_range {unsigned int wm_inst; -uint32_t min_fill_clk_khz; -uint32_t max_fill_clk_khz; -uint32_t min_drain_clk_khz; -uint32_t max_drain_clk_khz; +uint32_t min_fill_clk_mhz; +uint32_t max_fill_clk_mhz; +uint32_t min_drain_clk_mhz; +uint32_t max_drain_clk_mhz; };#define MAX_WATERMARK_SETS 4
@@ -77,15 +77,15 @@ struct pp_smu_display_requirement_rv {*/ unsigned int display_count; -/* PPSMC_MSG_SetHardMinFclkByFreq: khz +/* PPSMC_MSG_SetHardMinFclkByFreq: mhz * FCLK will vary with DPM, but never below requested hard min */ -unsigned int hard_min_fclk_khz; +unsigned int hard_min_fclk_mhz; -/* PPSMC_MSG_SetHardMinDcefclkByFreq: khz +/* PPSMC_MSG_SetHardMinDcefclkByFreq: mhz * fixed clock at requested freq, either from FCH bypass or DFS */ -unsigned int hard_min_dcefclk_khz; +unsigned int hard_min_dcefclk_mhz;/* PPSMC_MSG_SetMinDeepSleepDcefclk: mhz * when DF is in cstate, dcf clock is further divided down
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 16/21 drm/amd/display: fix mirror rotation scaling math
In reply to a message not in the archiveFrom: Dmytro Laktyushkin <[email protected]>
Curretly dc will incorrectly calculate viewport when there is rotation or mirror being applied
--- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 65 +++++++++-------------- 1 file changed, 24 insertions(+), 41 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +24 -41
@@ -499,8 +499,13 @@ static void calculate_viewport(struct pipe_ctx *pipe_ctx) pipe_ctx->top_pipe->plane_state == pipe_ctx->plane_state;bool flip_vert_scan_dir = false, flip_horz_scan_dir = false; +/* -* Need to calculate the scan direction for viewport to properly determine offset +* We need take horizontal mirror into account. On an unrotated surface this means +* that the viewport offset is actually the offset from the other side of source +* image so we have to subtract the right edge of the viewport from the right edge of +* the source window. Similar to mirror we need to take into account how offset is +* affected for 270/180 rotations */ if (pipe_ctx->plane_state->rotation ==ROTATION_ANGLE_180 ) { flip_vert_scan_dir = true;
@@ -510,6 +515,9 @@ static void calculate_viewport(struct pipe_ctx *pipe_ctx)else if (pipe_ctx->plane_state->rotation ==ROTATION_ANGLE_270 ) flip_horz_scan_dir = true; +if (pipe_ctx->plane_state->horizontal_mirror) + flip_horz_scan_dir = !flip_horz_scan_dir; +if (stream->view_format ==VIEW_3D_FORMAT_SIDE_BY_SIDE || stream->view_format ==VIEW_3D_FORMAT_TOP_AND_BOTTOM ) { pri_split = false;
@@ -540,45 +548,27 @@ static void calculate_viewport(struct pipe_ctx *pipe_ctx) plane_state->clip_rect.y + plane_state->clip_rect.height - clip.y ;/* offset = surf_src.ofs + (clip.ofs - surface->dst_rect.ofs) * scl_ratio +* note: surf_src.ofs should be added after rotation/mirror offset direction +* adjustment since it is already in viewport space * num_pixels = clip.num_pix * scl_ratio */ - data->viewport.x = surf_src.x + (clip.x - plane_state->dst_rect.x) * + data->viewport.x = (clip.x - plane_state->dst_rect.x) * surf_src.width / plane_state->dst_rect.width; data->viewport.width = clip.width * surf_src.width / plane_state->dst_rect.width; - data->viewport.y = surf_src.y + (clip.y - plane_state->dst_rect.y) * + data->viewport.y = (clip.y - plane_state->dst_rect.y) * surf_src.height / plane_state->dst_rect.height; data->viewport.height = clip.height * surf_src.height / plane_state->dst_rect.height; -/* To transfer the x, y to correct coordinate on mirror image (camera). -* deg 0 : transfer x, -* deg 90 : don't need to transfer, -* deg180 : transfer y, -* deg270 : transfer x and y. -* To transfer the x, y to correct coordinate on non-mirror image (video). -* deg 0 : don't need to transfer, -* deg 90 : transfer y, -* deg180 : transfer x and y, -* deg270 : transfer x. -*/ -if (pipe_ctx->plane_state->horizontal_mirror) { -if (flip_horz_scan_dir && !flip_vert_scan_dir) { - data->viewport.y = surf_src.height - data->viewport.y - data->viewport.height; - data->viewport.x = surf_src.width - data->viewport.x - data->viewport.width; - }else if (flip_horz_scan_dir && flip_vert_scan_dir) - data->viewport.y = surf_src.height - data->viewport.y - data->viewport.height; -else { -if (!flip_horz_scan_dir && !flip_vert_scan_dir) - data->viewport.x = surf_src.width - data->viewport.x - data->viewport.width; - } - }else { -if (flip_horz_scan_dir) - data->viewport.x = surf_src.width - data->viewport.x - data->viewport.width; -if (flip_vert_scan_dir) - data->viewport.y = surf_src.height - data->viewport.y - data->viewport.height; - } +if (flip_vert_scan_dir) + data->viewport.y = surf_src.height - data->viewport.y - data->viewport.height; +if (flip_horz_scan_dir) + data->viewport.x = surf_src.width - data->viewport.x - data->viewport.width; + + data->viewport.x += surf_src.x; + data->viewport.y += surf_src.y;/* Round down, compensate in init */ data->viewport_c.x = data->viewport.x / vpc_div;
@@ -773,22 +763,15 @@ static void calculate_inits_and_adj_vp(struct pipe_ctx *pipe_ctx, struct rect *relse if (pipe_ctx->plane_state->rotation ==ROTATION_ANGLE_270 ) flip_horz_scan_dir = true; +if (pipe_ctx->plane_state->horizontal_mirror) + flip_horz_scan_dir = !flip_horz_scan_dir; +if (pipe_ctx->plane_state->rotation ==ROTATION_ANGLE_90 || pipe_ctx->plane_state->rotation ==ROTATION_ANGLE_270 ) {rect_swap_helper (&src);rect_swap_helper (&data->viewport_c);rect_swap_helper (&data->viewport); - -if (pipe_ctx->plane_state->rotation ==ROTATION_ANGLE_270 && - pipe_ctx->plane_state->horizontal_mirror) { - flip_vert_scan_dir = true; - } -if (pipe_ctx->plane_state->rotation ==ROTATION_ANGLE_90 && - pipe_ctx->plane_state->horizontal_mirror) { - flip_vert_scan_dir = false; - } - }else if (pipe_ctx->plane_state->horizontal_mirror) - flip_horz_scan_dir = !flip_horz_scan_dir; + }/* * Init calculated according to formula:
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 17/21 drm/amd/display: Guard against null stream_state in set_crc_source
In reply to a message not in the archiveFrom: Nicholas Kazlauskas <[email protected]>
[Why]
The igt@kms_plane@pixel-format-pipe tests can create a sequence where stream_state is NULL during amdgpu_dm_crtc_set_crc_source which results in a null pointer dereference.
[How]
Guard against stream_state being NULL before accessing its fields. This doesn't fix the root cause of the issue so a DRM_ERROR is generated to still fail the tests.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c +5 -0
@@ -60,6 +60,11 @@ int amdgpu_dm_crtc_set_crc_source(struct drm_crtc *crtc, const char *src_name,return -EINVAL ; } +if (!stream_state) { +DRM_ERROR ("No stream state for CRTC%d\n" , crtc->index); +return -EINVAL ; + } +/* When enabling CRC, we should also disable dithering. */ if (source ==AMDGPU_DM_PIPE_CRC_SOURCE_AUTO ) { if (dc_stream_configure_crc(stream_state->ctx->dc,
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 18/21 drm/amd/display: Expose target backlight level
In reply to a message not in the archiveFrom: Anthony Koo <[email protected]>
[Why]
DM may want to understand any backlight optimizations applied, so DM needs a way to query from the HW both the real current backlight, which may be value during transition.
And also target backlight, which may be after some backlight optimizations applied.
[How]
Add interface to query current and target backlight levels Target level may indicate backlight level after backlight optimization and reductions are applied.
--- drivers/gpu/drm/amd/display/dc/dce/dce_abm.c | 12 ++++++++++++ drivers/gpu/drm/amd/display/dc/inc/hw/abm.h | 1 + 2 files changed, 13 insertions(+)
drivers/gpu/drm/amd/display/dc/dce/dce_abm.c +12 -0
@@ -276,6 +276,17 @@ static unsigned int dce_abm_get_current_backlight(struct abm *abm)return backlight; } +static unsigned int dce_abm_get_target_backlight (struct abm *abm) +{ +struct dce_abm *abm_dce =TO_DCE_ABM (abm); +unsigned int backlight =REG_READ (BL1_PWM_TARGET_ABM_LEVEL ); + +/* return backlight in hardware format which is unsigned 17 bits, with +* 1 bit integer and 16 bit fractional +*/ +return backlight; +} +static bool dce_abm_set_level (struct abm *abm,uint32_t level) {struct dce_abm *abm_dce =TO_DCE_ABM (abm);
@@ -410,6 +421,7 @@ static const struct abm_funcs dce_funcs = { .init_backlight = dce_abm_init_backlight, .set_backlight_level_pwm = dce_abm_set_backlight_level_pwm, .get_current_backlight = dce_abm_get_current_backlight, + .get_target_backlight = dce_abm_get_target_backlight, .set_abm_immediate_disable = dce_abm_immediate_disable };
drivers/gpu/drm/amd/display/dc/inc/hw/abm.h +1 -0
@@ -58,6 +58,7 @@ struct abm_funcs { bool use_smooth_brightness);unsigned int (*get_current_backlight)(struct abm *abm); + unsigned int (*get_target_backlight)(struct abm *abm); };#endif
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 19/21 drm/amd/display: remove CRTC_3D_STRUCTURE_V_UPDATE_MODE bit programming.
In reply to a message not in the archiveFrom: Charlene Liu <[email protected]>
[Description]
This is based on HW programming guide update.
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c +2 -4
@@ -87,9 +87,8 @@ static void optc1_disable_stereo(struct timing_generator *optc)REG_SET (OTG_STEREO_CONTROL ,0 ,OTG_STEREO_EN ,0 ); -REG_SET_3 (OTG_3D_STRUCTURE_CONTROL ,0 , +REG_SET_2 (OTG_3D_STRUCTURE_CONTROL ,0 ,OTG_3D_STRUCTURE_EN ,0 , -OTG_3D_STRUCTURE_V_UPDATE_MODE ,0 ,OTG_3D_STRUCTURE_STEREO_SEL_OVR ,0 ); }
@@ -1154,9 +1153,8 @@ static void optc1_enable_stereo(struct timing_generator *optc, OTG_DISABLE_STEREOSYNC_OUTPUT_FOR_DP, 1);if (flags->PROGRAM_STEREO) -REG_UPDATE_3 (OTG_3D_STRUCTURE_CONTROL , +REG_UPDATE_2 (OTG_3D_STRUCTURE_CONTROL ,OTG_3D_STRUCTURE_EN , flags->FRAME_PACKED, -OTG_3D_STRUCTURE_V_UPDATE_MODE , flags->FRAME_PACKED,OTG_3D_STRUCTURE_STEREO_SEL_OVR , flags->FRAME_PACKED); }
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 20/21 drm/amd/display: Remove the check to see if pp_display_cfg is changed
In reply to a message not in the archiveFrom: Fatemeh Darbehani <[email protected]>
[Why]
When going to full-screen mode commit_planes_for_stream tries to decrease dcf_deep_sleep value, but safe_to_lower is false, so we don't send the new value to SMU but dc context gets updated.
Later when dc_post_update_surfaces_to_stream tries to lower dcf_ds when safe_to_lower is true, this check prevents the message from being sent.
[How]
Remove the check that compares new value with what is stored in dc_context. This check is not necessary as dcn1_update_clocks already checks if the value is different from the current dcf_dp value.
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_clk_mgr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_clk_mgr.c +1 -2
@@ -57,8 +57,7 @@ void dcn1_pplib_apply_display_requirements( pp_display_cfg->disp_clk_khz = dc->res_pool->clk_mgr->clks.dispclk_khz;dce110_fill_display_configs (context, pp_display_cfg); -if (memcmp (&dc->current_state->pp_display_cfg, pp_display_cfg,sizeof (*pp_display_cfg)) !=0 ) -dm_pp_apply_display_requirements (dc->ctx, pp_display_cfg); +dm_pp_apply_display_requirements (dc->ctx, pp_display_cfg); }static int dcn1_determine_dppclk_threshold (struct clk_mgr *clk_mgr,struct dc_clocks *new_clocks)
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 21/21 drm/amd/display: Add condition to sync eDP SW status and HW status
In reply to a message not in the archiveFrom: Lewis Huang <[email protected]>
[Why]
Need to disable EDP backlight when enter S4 with EDP only and resume from S4 with secondary only.
[How]
Align the real hw and sw state via vBios scratch register in function enable_accelerated_mode when resume from S4.
--- drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c | 2 + .../drm/amd/display/dc/bios/bios_parser_helper.c | 93 ++++++++++++++++++++++ .../drm/amd/display/dc/bios/bios_parser_helper.h | 4 + drivers/gpu/drm/amd/display/dc/dc_bios_types.h | 5 ++ .../amd/display/dc/dce110/dce110_hw_sequencer.c | 15 ++++ .../gpu/drm/amd/display/dc/dcn10/dcn10_resource.c | 1 + 6 files changed, 120 insertions(+)
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +2 -0
@@ -1884,6 +1884,8 @@ static const struct dc_vbios_funcs vbios_funcs = { .is_accelerated_mode = bios_parser_is_accelerated_mode, + .is_active_display = bios_is_active_display, + .set_scratch_critical_state = bios_parser_set_scratch_critical_state,
drivers/gpu/drm/amd/display/dc/bios/bios_parser_helper.c +93 -0
96 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/bios/bios_parser_helper.h +4 -0
@@ -35,6 +35,10 @@ bool bios_is_accelerated_mode(struct dc_bios *bios);void bios_set_scratch_acc_mode_change (struct dc_bios *bios);void bios_set_scratch_critical_state (struct dc_bios *bios,bool state);uint32_t bios_get_vga_enabled_displays (struct dc_bios *bios); +bool bios_is_active_display ( +struct dc_bios *bios, +enum signal_type signal, +const struct connector_device_tag_info *device_tag);#define GET_IMAGE (type, offset) ((type *) bios_get_image(&bp->base, offset, sizeof(type)))
drivers/gpu/drm/amd/display/dc/dc_bios_types.h +5 -0
@@ -86,6 +86,10 @@ struct dc_vbios_funcs {bool (*is_accelerated_mode)(struct dc_bios *bios); +bool (*is_active_display)( +struct dc_bios *bios, +enum signal_type signal, +const struct connector_device_tag_info *device_tag);void (*set_scratch_critical_state)(struct dc_bios *bios,bool state);
@@ -141,6 +145,7 @@ struct dc_vbios_funcs { };struct bios_registers { +uint32_t BIOS_SCRATCH_0;uint32_t BIOS_SCRATCH_3;uint32_t BIOS_SCRATCH_6; };
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +15 -0
@@ -1546,6 +1546,7 @@ void dce110_enable_accelerated_mode(struct dc *dc, struct dc_state *context)int i;struct dc_link *edp_link_to_turnoff =NULL ;struct dc_link *edp_link =get_link_for_edp (dc); +struct dc_bios *bios = dc->ctx->dc_bios;bool can_edp_fast_boot_optimize = false;bool apply_edp_fast_boot_optimization = false;
@@ -1572,6 +1573,20 @@ void dce110_enable_accelerated_mode(struct dc *dc, struct dc_state *context)if (context->streams[i]->signal ==SIGNAL_TYPE_EDP ) { context->streams[i]->apply_edp_fast_boot_optimization = true; apply_edp_fast_boot_optimization = true; + +/* When after S4 and S5, vbios may post edp and previous dpms_off +* doesn't make sense. +* Update dpms_off state to align hw and sw state via check +* vBios scratch register. +*/ +if (bios->funcs->is_active_display) { +const struct connector_device_tag_info *device_tag = &(edp_link->device_tag); + +if (bios->funcs->is_active_display (bios, + context->streams[i]->signal, + device_tag)) + context->streams[i]->dpms_off = false; + } } } }
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c +1 -0
@@ -438,6 +438,7 @@ static const struct dcn_optc_mask tg_mask = {static const struct bios_registers bios_regs = { +NBIO_SR (BIOS_SCRATCH_0 ),NBIO_SR (BIOS_SCRATCH_3 ),NBIO_SR (BIOS_SCRATCH_6 ) };
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx