summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2017-09-28 10:45:25 +1000
committerAlex Deucher <alexander.deucher@amd.com>2017-09-28 16:51:08 -0400
commitd1209512e028a917e6e70b13297ff185234ba24d (patch)
tree366665676bfc5c9664111474b2e1f18969d4c0f1 /drivers
parentb3fbdcec5e6c16c93867289ae0960a64c423eb34 (diff)
amdgpu/dc: inline a bunch of float operations.
This reduces code size for the bw calcs code. Signed-off-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.c29
-rw-r--r--drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.h36
2 files changed, 30 insertions, 35 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 a18474437990..05cf5f77ec60 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,25 +25,6 @@
#include "dcn_calc_math.h"
-float dcn_bw_mod(const float arg1, const float arg2)
-{
- return arg1 - arg1 * ((int) (arg1 / arg2));
-}
-
-float dcn_bw_min2(const float arg1, const float arg2)
-{
- return arg1 < arg2 ? arg1 : arg2;
-}
-
-unsigned int dcn_bw_max(const unsigned int arg1, const unsigned int arg2)
-{
- return arg1 > arg2 ? arg1 : arg2;
-}
-float dcn_bw_max2(const float arg1, const float arg2)
-{
- return arg1 > arg2 ? arg1 : arg2;
-}
-
float dcn_bw_floor2(const float arg, const float significance)
{
if (significance == 0)
@@ -59,16 +40,6 @@ float dcn_bw_ceil2(const float arg, const float significance)
return flr + 0.00001 >= arg ? arg : flr + significance;
}
-float dcn_bw_max3(float v1, float v2, float v3)
-{
- return v3 > dcn_bw_max2(v1, v2) ? v3 : dcn_bw_max2(v1, v2);
-}
-
-float dcn_bw_max5(float v1, float v2, float v3, float v4, float v5)
-{
- return dcn_bw_max3(v1, v2, v3) > dcn_bw_max2(v4, v5) ? dcn_bw_max3(v1, v2, v3) : dcn_bw_max2(v4, v5);
-}
-
float dcn_bw_pow(float a, float exp)
{
float temp;
diff --git a/drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.h b/drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.h
index f46ab0e24ca1..6f66d9d164d1 100644
--- a/drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.h
+++ b/drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.h
@@ -26,14 +26,38 @@
#ifndef _DCN_CALC_MATH_H_
#define _DCN_CALC_MATH_H_
-float dcn_bw_mod(const float arg1, const float arg2);
-float dcn_bw_min2(const float arg1, const float arg2);
-unsigned int dcn_bw_max(const unsigned int arg1, const unsigned int arg2);
-float dcn_bw_max2(const float arg1, const float arg2);
+static inline float dcn_bw_mod(const float arg1, const float arg2)
+{
+ return arg1 - arg1 * ((int) (arg1 / arg2));
+}
+
+static inline float dcn_bw_min2(const float arg1, const float arg2)
+{
+ return arg1 < arg2 ? arg1 : arg2;
+}
+
+static inline unsigned int dcn_bw_max(const unsigned int arg1, const unsigned int arg2)
+{
+ return arg1 > arg2 ? arg1 : arg2;
+}
+
+static inline float dcn_bw_max2(const float arg1, const float arg2)
+{
+ return arg1 > arg2 ? arg1 : arg2;
+}
+
+static inline float dcn_bw_max3(float v1, float v2, float v3)
+{
+ return v3 > dcn_bw_max2(v1, v2) ? v3 : dcn_bw_max2(v1, v2);
+}
+
+static inline float dcn_bw_max5(float v1, float v2, float v3, float v4, float v5)
+{
+ return dcn_bw_max3(v1, v2, v3) > dcn_bw_max2(v4, v5) ? dcn_bw_max3(v1, v2, v3) : dcn_bw_max2(v4, v5);
+}
+
float dcn_bw_floor2(const float arg, const float significance);
float dcn_bw_ceil2(const float arg, const float significance);
-float dcn_bw_max3(float v1, float v2, float v3);
-float dcn_bw_max5(float v1, float v2, float v3, float v4, float v5);
float dcn_bw_pow(float a, float exp);
float dcn_bw_log(float a, float b);