diff options
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2912-drm-amd-display-Use-macro-for-isnan-check.patch')
-rw-r--r-- | meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2912-drm-amd-display-Use-macro-for-isnan-check.patch | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2912-drm-amd-display-Use-macro-for-isnan-check.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2912-drm-amd-display-Use-macro-for-isnan-check.patch new file mode 100644 index 00000000..13cc9041 --- /dev/null +++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2912-drm-amd-display-Use-macro-for-isnan-check.patch @@ -0,0 +1,72 @@ +From 595cb55c7f03860e304e6c2782f72da042ccdc09 Mon Sep 17 00:00:00 2001 +From: Harry Wentland <harry.wentland@amd.com> +Date: Wed, 29 Nov 2017 10:16:51 -0500 +Subject: [PATCH 2912/4131] drm/amd/display: Use macro for isnan check + +In code provided by HW teams we do a NaN check on floats +by comparing the number against itself. This confuses most +people including myself. Macro it out to make it self-explanatory. + +Don't do a NaN check for int. + +v2: parantheses around 'number' expression + +Signed-off-by: Harry Wentland <harry.wentland@amd.com> +Reviewed-by: Alex Deucher <alexander.deucher@amd.com> +--- + drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.c | 18 ++++++++---------- + 1 file changed, 8 insertions(+), 10 deletions(-) + +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 b6abe0f..ae38cdb 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 +@@ -25,37 +25,35 @@ + + #include "dcn_calc_math.h" + ++#define isNaN(number) ((number) != (number)) ++ + float dcn_bw_mod(const float arg1, const float arg2) + { +- if (arg1 != arg1) ++ if (isNaN(arg1)) + return arg2; +- if (arg2 != arg2) ++ if (isNaN(arg2)) + return arg1; + return arg1 - arg1 * ((int) (arg1 / arg2)); + } + + float dcn_bw_min2(const float arg1, const float arg2) + { +- if (arg1 != arg1) ++ if (isNaN(arg1)) + return arg2; +- if (arg2 != arg2) ++ if (isNaN(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) ++ if (isNaN(arg1)) + return arg2; +- if (arg2 != arg2) ++ if (isNaN(arg2)) + return arg1; + return arg1 > arg2 ? arg1 : arg2; + } +-- +2.7.4 + |