From: Dave Airlie <airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [PATCH 1/2] amdgpu/dc: inline a bunch of float operations.
Date: Thu, 28 Sep 2017 10:45:25 +1000 [thread overview]
Message-ID: <20170928004526.6770-1-airlied@gmail.com> (raw)
From: Dave Airlie <airlied@redhat.com>
This reduces code size for the bw calcs code.
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
.../gpu/drm/amd/display/dc/calcs/dcn_calc_math.c | 29 -----------------
.../gpu/drm/amd/display/dc/calcs/dcn_calc_math.h | 36 ++++++++++++++++++----
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 a184744..05cf5f7 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 f46ab0e..6f66d9d 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);
--
2.9.4
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next reply other threads:[~2017-09-28 0:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-28 0:45 Dave Airlie [this message]
[not found] ` <20170928004526.6770-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-09-28 0:45 ` [PATCH 2/2] amdgpu/dc: inline a bunch of the dml wrappers Dave Airlie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170928004526.6770-1-airlied@gmail.com \
--to=airlied-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox