drm/amd/display: WBSCL filter init calculation fixes
authorKen Chalmers <ken.chalmers@amd.com>
Wed, 17 Jan 2018 19:17:40 +0000 (14:17 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 19 Feb 2018 19:19:29 +0000 (14:19 -0500)
* Previous code did some calculations with a mix of normal integers and
  integers aligned as U2.24 fixed-point values.
* There were bugs in the conversion of the final result into the
  S4.19 values required for the registers.

Signed-off-by: Ken Chalmers <ken.chalmers@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/basics/fixpt31_32.c
drivers/gpu/drm/amd/display/include/fixed31_32.h

index 011a97f..8a9bba8 100644 (file)
@@ -593,3 +593,12 @@ uint32_t dal_fixed31_32_clamp_u0d10(
 {
        return clamp_ux_dy(arg.value, 0, 10, 1);
 }
+
+int32_t dal_fixed31_32_s4d19(
+       struct fixed31_32 arg)
+{
+       if (arg.value < 0)
+               return -(int32_t)ux_dy(dal_fixed31_32_abs(arg).value, 4, 19);
+       else
+               return ux_dy(arg.value, 4, 19);
+}
index 4badaed..0de2586 100644 (file)
@@ -470,4 +470,7 @@ uint32_t dal_fixed31_32_clamp_u0d14(
 uint32_t dal_fixed31_32_clamp_u0d10(
        struct fixed31_32 arg);
 
+int32_t dal_fixed31_32_s4d19(
+       struct fixed31_32 arg);
+
 #endif