On 2017-10-11 03:44 AM, Dave Airlie wrote: > On 11 October 2017 at 08:40, Harry Wentland <harry.wentland at amd.com> wrote: >> From: Dmytro Laktyushkin <Dmytro.Laktyushkin at amd.com> >> >> Signed-off-by: Dmytro Laktyushkin <Dmytro.Laktyushkin at amd.com> >> Reviewed-by: Tony Cheng <Tony.Cheng at amd.com> >> Acked-by: Harry Wentland <Harry.Wentland at amd.com> >> --- >> .../gpu/drm/amd/display/dc/calcs/dcn_calc_math.c | 16 + >> drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c | 103 +- >> drivers/gpu/drm/amd/display/dc/dc.h | 1 - >> .../gpu/drm/amd/display/dc/dcn10/dcn10_resource.c | 5 +- >> drivers/gpu/drm/amd/display/dc/dml/Makefile | 8 +- >> drivers/gpu/drm/amd/display/dc/dml/dc_features.h | 2 + >> .../drm/amd/display/dc/dml/display_mode_enums.h | 52 +- >> .../gpu/drm/amd/display/dc/dml/display_mode_lib.c | 7 +- >> .../gpu/drm/amd/display/dc/dml/display_mode_lib.h | 8 +- >> .../drm/amd/display/dc/dml/display_mode_structs.h | 898 +++--- >> .../drm/amd/display/dc/dml/display_mode_support.c | 2326 -------------- >> .../drm/amd/display/dc/dml/display_mode_support.h | 199 -- >> .../gpu/drm/amd/display/dc/dml/display_mode_vba.c | 3263 ++++++++++++++++++++ >> .../gpu/drm/amd/display/dc/dml/display_mode_vba.h | 410 +++ >> .../drm/amd/display/dc/dml/display_pipe_clocks.c | 377 +-- >> .../drm/amd/display/dc/dml/display_pipe_clocks.h | 8 +- >> .../drm/amd/display/dc/dml/display_rq_dlg_calc.c | 2457 ++++++--------- >> .../drm/amd/display/dc/dml/display_rq_dlg_calc.h | 151 +- >> .../amd/display/dc/dml/display_rq_dlg_helpers.c | 482 +-- >> .../amd/display/dc/dml/display_rq_dlg_helpers.h | 41 +- >> .../gpu/drm/amd/display/dc/dml/display_watermark.c | 1281 -------- >> .../gpu/drm/amd/display/dc/dml/display_watermark.h | 98 - >> .../amd/display/dc/dml/dml1_display_rq_dlg_calc.c | 1903 ++++++++++++ >> .../amd/display/dc/dml/dml1_display_rq_dlg_calc.h | 67 + >> .../gpu/drm/amd/display/dc/dml/dml_common_defs.c | 12 +- >> .../gpu/drm/amd/display/dc/dml/dml_common_defs.h | 8 +- >> .../gpu/drm/amd/display/dc/dml/soc_bounding_box.c | 48 +- >> .../gpu/drm/amd/display/dc/dml/soc_bounding_box.h | 9 +- >> 28 files changed, 7658 insertions(+), 6582 deletions(-) >> delete mode 100644 drivers/gpu/drm/amd/display/dc/dml/display_mode_support.c >> delete mode 100644 drivers/gpu/drm/amd/display/dc/dml/display_mode_support.h >> create mode 100644 drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.c >> create mode 100644 drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.h >> delete mode 100644 drivers/gpu/drm/amd/display/dc/dml/display_watermark.c >> delete mode 100644 drivers/gpu/drm/amd/display/dc/dml/display_watermark.h >> create mode 100644 drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.c >> create mode 100644 drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.h >> >> diff --git a/drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.c b/drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.c >> index a18474437990..b6abe0f3bb15 100644 >> --- a/drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.c >> +++ b/drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.c >> @@ -27,20 +27,36 @@ >> >> float dcn_bw_mod(const float arg1, const float arg2) >> { >> + if (arg1 != arg1) >> + return arg2; >> + if (arg2 != arg2) >> + return arg1; >> return arg1 - arg1 * ((int) (arg1 / arg2)); >> } >> >> float dcn_bw_min2(const float arg1, const float arg2) >> { >> + if (arg1 != arg1) >> + return arg2; >> + if (arg2 != arg2) >> + return arg1; >> return arg1 < arg2 ? arg1 : arg2; >> } >> >> unsigned int dcn_bw_max(const unsigned int arg1, const unsigned int arg2) >> { >> + if (arg1 != arg1) >> + return arg2; >> + if (arg2 != arg2) >> + return arg1; >> return arg1 > arg2 ? arg1 : arg2; >> } >> float dcn_bw_max2(const float arg1, const float arg2) >> { >> + if (arg1 != arg1) >> + return arg2; >> + if (arg2 != arg2) >> + return arg1; >> return arg1 > arg2 ? arg1 : arg2; >> } >> > > I got this far. Wow none of the added above code makes any sense, step > up the internal review please. > These are NaN checks for floating point math and is the recommended way to check for those. Is there a different recommended way in the kernel? Unfortunately this is HW magic and we'll need to find a way to deal with it. Harry > Dave. >