All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/10] amdgpu/dc: hide some unused aux/i2c payload apis.
@ 2017-09-29  7:13 Dave Airlie
       [not found] ` <20170929071331.18132-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Dave Airlie @ 2017-09-29  7:13 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Dave Airlie <airlied@redhat.com>

I've no idea if these are used on other platforms, but they
aren't used outside this file here, so make them static.

Drops 300 bytes.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c | 16 ++++++++--------
 drivers/gpu/drm/amd/display/dc/inc/dc_link_ddc.h  | 10 ----------
 2 files changed, 8 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
index 315160d..d5294798b 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
@@ -126,7 +126,7 @@ struct aux_payloads {
 	struct vector payloads;
 };
 
-struct i2c_payloads *dal_ddc_i2c_payloads_create(struct dc_context *ctx, uint32_t count)
+static struct i2c_payloads *dal_ddc_i2c_payloads_create(struct dc_context *ctx, uint32_t count)
 {
 	struct i2c_payloads *payloads;
 
@@ -144,17 +144,17 @@ struct i2c_payloads *dal_ddc_i2c_payloads_create(struct dc_context *ctx, uint32_
 
 }
 
-struct i2c_payload *dal_ddc_i2c_payloads_get(struct i2c_payloads *p)
+static struct i2c_payload *dal_ddc_i2c_payloads_get(struct i2c_payloads *p)
 {
 	return (struct i2c_payload *)p->payloads.container;
 }
 
-uint32_t  dal_ddc_i2c_payloads_get_count(struct i2c_payloads *p)
+static uint32_t dal_ddc_i2c_payloads_get_count(struct i2c_payloads *p)
 {
 	return p->payloads.count;
 }
 
-void dal_ddc_i2c_payloads_destroy(struct i2c_payloads **p)
+static void dal_ddc_i2c_payloads_destroy(struct i2c_payloads **p)
 {
 	if (!p || !*p)
 		return;
@@ -164,7 +164,7 @@ void dal_ddc_i2c_payloads_destroy(struct i2c_payloads **p)
 
 }
 
-struct aux_payloads *dal_ddc_aux_payloads_create(struct dc_context *ctx, uint32_t count)
+static struct aux_payloads *dal_ddc_aux_payloads_create(struct dc_context *ctx, uint32_t count)
 {
 	struct aux_payloads *payloads;
 
@@ -181,17 +181,17 @@ struct aux_payloads *dal_ddc_aux_payloads_create(struct dc_context *ctx, uint32_
 	return NULL;
 }
 
-struct aux_payload *dal_ddc_aux_payloads_get(struct aux_payloads *p)
+static struct aux_payload *dal_ddc_aux_payloads_get(struct aux_payloads *p)
 {
 	return (struct aux_payload *)p->payloads.container;
 }
 
-uint32_t  dal_ddc_aux_payloads_get_count(struct aux_payloads *p)
+static uint32_t  dal_ddc_aux_payloads_get_count(struct aux_payloads *p)
 {
 	return p->payloads.count;
 }
 
-void dal_ddc_aux_payloads_destroy(struct aux_payloads **p)
+static void dal_ddc_aux_payloads_destroy(struct aux_payloads **p)
 {
 	if (!p || !*p)
 		return;
diff --git a/drivers/gpu/drm/amd/display/dc/inc/dc_link_ddc.h b/drivers/gpu/drm/amd/display/dc/inc/dc_link_ddc.h
index af7ea5e..0bf73b7 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/dc_link_ddc.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/dc_link_ddc.h
@@ -57,16 +57,6 @@ struct dp_receiver_id_info;
 struct i2c_payloads;
 struct aux_payloads;
 
-struct i2c_payloads *dal_ddc_i2c_payloads_create(struct dc_context *ctx, uint32_t count);
-struct i2c_payload *dal_ddc_i2c_payloads_get(struct i2c_payloads *p);
-uint32_t  dal_ddc_i2c_payloads_get_count(struct i2c_payloads *p);
-void dal_ddc_i2c_payloads_destroy(struct i2c_payloads **p);
-
-struct aux_payloads *dal_ddc_aux_payloads_create(struct dc_context *ctx, uint32_t count);
-struct aux_payload *dal_ddc_aux_payloads_get(struct aux_payloads *p);
-uint32_t dal_ddc_aux_payloads_get_count(struct aux_payloads *p);
-void dal_ddc_aux_payloads_destroy(struct aux_payloads **p);
-
 void dal_ddc_i2c_payloads_add(
 		struct i2c_payloads *payloads,
 		uint32_t address,
-- 
2.9.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 02/10] amdgpu/dc: move some one line dp functions to inlines.
       [not found] ` <20170929071331.18132-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-09-29  7:13   ` Dave Airlie
  2017-09-29  7:13   ` [PATCH 03/10] amdgpu/dc: inline some of the bw_fixed code Dave Airlie
                     ` (7 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Dave Airlie @ 2017-09-29  7:13 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Dave Airlie <airlied@redhat.com>

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
index 38ccc01..305ca0d 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
@@ -1191,12 +1191,12 @@ struct dc_link_settings get_common_supported_link_settings (
 	return link_settings;
 }
 
-bool reached_minimum_lane_count(enum dc_lane_count lane_count)
+static inline bool reached_minimum_lane_count(enum dc_lane_count lane_count)
 {
 	return lane_count <= LANE_COUNT_ONE;
 }
 
-bool reached_minimum_link_rate(enum dc_link_rate link_rate)
+static inline bool reached_minimum_link_rate(enum dc_link_rate link_rate)
 {
 	return link_rate <= LINK_RATE_LOW;
 }
-- 
2.9.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 03/10] amdgpu/dc: inline some of the bw_fixed code.
       [not found] ` <20170929071331.18132-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2017-09-29  7:13   ` [PATCH 02/10] amdgpu/dc: move some one line dp functions to inlines Dave Airlie
@ 2017-09-29  7:13   ` Dave Airlie
  2017-09-29  7:13   ` [PATCH 04/10] amdgpu/dc: allow inlining constant int to fixed a lot better Dave Airlie
                     ` (6 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Dave Airlie @ 2017-09-29  7:13 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Dave Airlie <airlied@redhat.com>

This results in a ~4.5k code size reduction.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/amd/display/dc/calcs/bw_fixed.c |  93 --------------------
 drivers/gpu/drm/amd/display/dc/inc/bw_fixed.h   | 111 ++++++++++++++++++++----
 2 files changed, 96 insertions(+), 108 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/calcs/bw_fixed.c b/drivers/gpu/drm/amd/display/dc/calcs/bw_fixed.c
index fbf2adc..0de6fa1 100644
--- a/drivers/gpu/drm/amd/display/dc/calcs/bw_fixed.c
+++ b/drivers/gpu/drm/amd/display/dc/calcs/bw_fixed.c
@@ -56,16 +56,6 @@ static uint64_t abs_i64(int64_t arg)
 		return (uint64_t)(-arg);
 }
 
-struct bw_fixed bw_min3(struct bw_fixed v1, struct bw_fixed v2, struct bw_fixed v3)
-{
-	return bw_min2(bw_min2(v1, v2), v3);
-}
-
-struct bw_fixed bw_max3(struct bw_fixed v1, struct bw_fixed v2, struct bw_fixed v3)
-{
-	return bw_max2(bw_max2(v1, v2), v3);
-}
-
 struct bw_fixed bw_int_to_fixed(int64_t value)
 {
 	struct bw_fixed res;
@@ -133,16 +123,6 @@ struct bw_fixed bw_frc_to_fixed(int64_t numerator, int64_t denominator)
 	return res;
 }
 
-struct bw_fixed bw_min2(const struct bw_fixed arg1, const struct bw_fixed arg2)
-{
-	return (arg1.value <= arg2.value) ? arg1 : arg2;
-}
-
-struct bw_fixed bw_max2(const struct bw_fixed arg1, const struct bw_fixed arg2)
-{
-	return (arg2.value <= arg1.value) ? arg1 : arg2;
-}
-
 struct bw_fixed bw_floor2(
 	const struct bw_fixed arg,
 	const struct bw_fixed significance)
@@ -174,24 +154,6 @@ struct bw_fixed bw_ceil2(
 	return result;
 }
 
-struct bw_fixed bw_add(const struct bw_fixed arg1, const struct bw_fixed arg2)
-{
-	struct bw_fixed res;
-
-	res.value = arg1.value + arg2.value;
-
-	return res;
-}
-
-struct bw_fixed bw_sub(const struct bw_fixed arg1, const struct bw_fixed arg2)
-{
-	struct bw_fixed res;
-
-	res.value = arg1.value - arg2.value;
-
-	return res;
-}
-
 struct bw_fixed bw_mul(const struct bw_fixed arg1, const struct bw_fixed arg2)
 {
 	struct bw_fixed res;
@@ -242,58 +204,3 @@ struct bw_fixed bw_mul(const struct bw_fixed arg1, const struct bw_fixed arg2)
 	return res;
 }
 
-struct bw_fixed bw_div(const struct bw_fixed arg1, const struct bw_fixed arg2)
-{
-	struct bw_fixed res = bw_frc_to_fixed(arg1.value, arg2.value);
-	return res;
-}
-
-struct bw_fixed bw_mod(const struct bw_fixed arg1, const struct bw_fixed arg2)
-{
-	struct bw_fixed res;
-	div64_u64_rem(arg1.value, arg2.value, &res.value);
-	return res;
-}
-struct bw_fixed fixed31_32_to_bw_fixed(int64_t raw)
-{
-	struct bw_fixed result = { 0 };
-
-	if (raw < 0) {
-		raw = -raw;
-		result.value = -(raw >> (32 - BITS_PER_FRACTIONAL_PART));
-	} else {
-		result.value = raw >> (32 - BITS_PER_FRACTIONAL_PART);
-	}
-
-	return result;
-}
-
-bool bw_equ(const struct bw_fixed arg1, const struct bw_fixed arg2)
-{
-	return arg1.value == arg2.value;
-}
-
-bool bw_neq(const struct bw_fixed arg1, const struct bw_fixed arg2)
-{
-	return arg1.value != arg2.value;
-}
-
-bool bw_leq(const struct bw_fixed arg1, const struct bw_fixed arg2)
-{
-	return arg1.value <= arg2.value;
-}
-
-bool bw_meq(const struct bw_fixed arg1, const struct bw_fixed arg2)
-{
-	return arg1.value >= arg2.value;
-}
-
-bool bw_ltn(const struct bw_fixed arg1, const struct bw_fixed arg2)
-{
-	return arg1.value < arg2.value;
-}
-
-bool bw_mtn(const struct bw_fixed arg1, const struct bw_fixed arg2)
-{
-	return arg1.value > arg2.value;
-}
diff --git a/drivers/gpu/drm/amd/display/dc/inc/bw_fixed.h b/drivers/gpu/drm/amd/display/dc/inc/bw_fixed.h
index b31d07a..4477e62 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/bw_fixed.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/bw_fixed.h
@@ -30,9 +30,31 @@ struct bw_fixed {
 	int64_t value;
 };
 
-struct bw_fixed bw_min3(struct bw_fixed v1, struct bw_fixed v2, struct bw_fixed v3);
+static inline struct bw_fixed bw_min2(const struct bw_fixed arg1,
+				      const struct bw_fixed arg2)
+{
+	return (arg1.value <= arg2.value) ? arg1 : arg2;
+}
 
-struct bw_fixed bw_max3(struct bw_fixed v1, struct bw_fixed v2, struct bw_fixed v3);
+static inline struct bw_fixed bw_max2(const struct bw_fixed arg1,
+				      const struct bw_fixed arg2)
+{
+	return (arg2.value <= arg1.value) ? arg1 : arg2;
+}
+
+static inline struct bw_fixed bw_min3(struct bw_fixed v1,
+				      struct bw_fixed v2,
+				      struct bw_fixed v3)
+{
+	return bw_min2(bw_min2(v1, v2), v3);
+}
+
+static inline struct bw_fixed bw_max3(struct bw_fixed v1,
+				      struct bw_fixed v2,
+				      struct bw_fixed v3)
+{
+	return bw_max2(bw_max2(v1, v2), v3);
+}
 
 struct bw_fixed bw_int_to_fixed(int64_t value);
 
@@ -40,24 +62,83 @@ int32_t bw_fixed_to_int(struct bw_fixed value);
 
 struct bw_fixed bw_frc_to_fixed(int64_t num, int64_t denum);
 
-struct bw_fixed fixed31_32_to_bw_fixed(int64_t raw);
+static inline struct bw_fixed fixed31_32_to_bw_fixed(int64_t raw)
+{
+	struct bw_fixed result = { 0 };
+
+	if (raw < 0) {
+		raw = -raw;
+		result.value = -(raw >> (32 - BW_FIXED_BITS_PER_FRACTIONAL_PART));
+	} else {
+		result.value = raw >> (32 - BW_FIXED_BITS_PER_FRACTIONAL_PART);
+	}
+
+	return result;
+}
+
+static inline struct bw_fixed bw_add(const struct bw_fixed arg1,
+				     const struct bw_fixed arg2)
+{
+	struct bw_fixed res;
+
+	res.value = arg1.value + arg2.value;
+
+	return res;
+}
+
+static inline struct bw_fixed bw_sub(const struct bw_fixed arg1, const struct bw_fixed arg2)
+{
+	struct bw_fixed res;
+
+	res.value = arg1.value - arg2.value;
+
+	return res;
+}
 
-struct bw_fixed bw_add(const struct bw_fixed arg1, const struct bw_fixed arg2);
-struct bw_fixed bw_sub(const struct bw_fixed arg1, const struct bw_fixed arg2);
 struct bw_fixed bw_mul(const struct bw_fixed arg1, const struct bw_fixed arg2);
-struct bw_fixed bw_div(const struct bw_fixed arg1, const struct bw_fixed arg2);
-struct bw_fixed bw_mod(const struct bw_fixed arg1, const struct bw_fixed arg2);
+static inline struct bw_fixed bw_div(const struct bw_fixed arg1, const struct bw_fixed arg2)
+{
+	return bw_frc_to_fixed(arg1.value, arg2.value);
+}
+
+static inline struct bw_fixed bw_mod(const struct bw_fixed arg1, const struct bw_fixed arg2)
+{
+	struct bw_fixed res;
+	div64_u64_rem(arg1.value, arg2.value, &res.value);
+	return res;
+}
 
-struct bw_fixed bw_min2(const struct bw_fixed arg1, const struct bw_fixed arg2);
-struct bw_fixed bw_max2(const struct bw_fixed arg1, const struct bw_fixed arg2);
 struct bw_fixed bw_floor2(const struct bw_fixed arg, const struct bw_fixed significance);
 struct bw_fixed bw_ceil2(const struct bw_fixed arg, const struct bw_fixed significance);
 
-bool bw_equ(const struct bw_fixed arg1, const struct bw_fixed arg2);
-bool bw_neq(const struct bw_fixed arg1, const struct bw_fixed arg2);
-bool bw_leq(const struct bw_fixed arg1, const struct bw_fixed arg2);
-bool bw_meq(const struct bw_fixed arg1, const struct bw_fixed arg2);
-bool bw_ltn(const struct bw_fixed arg1, const struct bw_fixed arg2);
-bool bw_mtn(const struct bw_fixed arg1, const struct bw_fixed arg2);
+static inline bool bw_equ(const struct bw_fixed arg1, const struct bw_fixed arg2)
+{
+	return arg1.value == arg2.value;
+}
+
+static inline bool bw_neq(const struct bw_fixed arg1, const struct bw_fixed arg2)
+{
+	return arg1.value != arg2.value;
+}
+
+static inline bool bw_leq(const struct bw_fixed arg1, const struct bw_fixed arg2)
+{
+	return arg1.value <= arg2.value;
+}
+
+static inline bool bw_meq(const struct bw_fixed arg1, const struct bw_fixed arg2)
+{
+	return arg1.value >= arg2.value;
+}
+
+static inline bool bw_ltn(const struct bw_fixed arg1, const struct bw_fixed arg2)
+{
+	return arg1.value < arg2.value;
+}
+
+static inline bool bw_mtn(const struct bw_fixed arg1, const struct bw_fixed arg2)
+{
+	return arg1.value > arg2.value;
+}
 
 #endif //BW_FIXED_H_
-- 
2.9.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 04/10] amdgpu/dc: allow inlining constant int to fixed a lot better.
       [not found] ` <20170929071331.18132-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2017-09-29  7:13   ` [PATCH 02/10] amdgpu/dc: move some one line dp functions to inlines Dave Airlie
  2017-09-29  7:13   ` [PATCH 03/10] amdgpu/dc: inline some of the bw_fixed code Dave Airlie
@ 2017-09-29  7:13   ` Dave Airlie
       [not found]     ` <20170929071331.18132-4-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2017-09-29  7:13   ` [PATCH 05/10] amdgpu/dc: use the builtin constant p trick on the 31/32 fixed point Dave Airlie
                     ` (5 subsequent siblings)
  8 siblings, 1 reply; 12+ messages in thread
From: Dave Airlie @ 2017-09-29  7:13 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Dave Airlie <airlied@redhat.com>

This uses two things that might be Linux specific,
__builtin_constant_p (might be gcc)
and
BUILD_BUG_ON. (maybe other dm's can have something similiar).

This saves 4k in the bw calcs code.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/amd/display/dc/calcs/bw_fixed.c | 37 ++++++++-----------------
 drivers/gpu/drm/amd/display/dc/inc/bw_fixed.h   | 26 +++++++++++++++--
 2 files changed, 35 insertions(+), 28 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/calcs/bw_fixed.c b/drivers/gpu/drm/amd/display/dc/calcs/bw_fixed.c
index 0de6fa1..6ca288f 100644
--- a/drivers/gpu/drm/amd/display/dc/calcs/bw_fixed.c
+++ b/drivers/gpu/drm/amd/display/dc/calcs/bw_fixed.c
@@ -25,13 +25,6 @@
 #include "dm_services.h"
 #include "bw_fixed.h"
 
-#define BITS_PER_FRACTIONAL_PART 24
-
-#define MIN_I32 \
-	(int64_t)(-(1LL << (63 - BITS_PER_FRACTIONAL_PART)))
-
-#define MAX_I32 \
-	(int64_t)((1ULL << (63 - BITS_PER_FRACTIONAL_PART)) - 1)
 
 #define MIN_I64 \
 	(int64_t)(-(1LL << 63))
@@ -40,10 +33,7 @@
 	(int64_t)((1ULL << 63) - 1)
 
 #define FRACTIONAL_PART_MASK \
-	((1ULL << BITS_PER_FRACTIONAL_PART) - 1)
-
-#define GET_INTEGER_PART(x) \
-	((x) >> BITS_PER_FRACTIONAL_PART)
+	((1ULL << BW_FIXED_BITS_PER_FRACTIONAL_PART) - 1)
 
 #define GET_FRACTIONAL_PART(x) \
 	(FRACTIONAL_PART_MASK & (x))
@@ -56,19 +46,14 @@ static uint64_t abs_i64(int64_t arg)
 		return (uint64_t)(-arg);
 }
 
-struct bw_fixed bw_int_to_fixed(int64_t value)
+struct bw_fixed bw_int_to_fixed_nonconst(int64_t value)
 {
 	struct bw_fixed res;
-	ASSERT(value < MAX_I32 && value > MIN_I32);
-	res.value = value << BITS_PER_FRACTIONAL_PART;
+	ASSERT(value < BW_FIXED_MAX_I32 && value > BW_FIXED_MIN_I32);
+	res.value = value << BW_FIXED_BITS_PER_FRACTIONAL_PART;
 	return res;
 }
 
-int32_t bw_fixed_to_int(struct bw_fixed value)
-{
-	return GET_INTEGER_PART(value.value);
-}
-
 struct bw_fixed bw_frc_to_fixed(int64_t numerator, int64_t denominator)
 {
 	struct bw_fixed res;
@@ -87,11 +72,11 @@ struct bw_fixed bw_frc_to_fixed(int64_t numerator, int64_t denominator)
 	arg2_value = abs_i64(denominator);
 	res_value = div64_u64_rem(arg1_value, arg2_value, &remainder);
 
-	ASSERT(res_value <= MAX_I32);
+	ASSERT(res_value <= BW_FIXED_MAX_I32);
 
 	/* determine fractional part */
 	{
-		uint32_t i = BITS_PER_FRACTIONAL_PART;
+		uint32_t i = BW_FIXED_BITS_PER_FRACTIONAL_PART;
 
 		do
 		{
@@ -164,8 +149,8 @@ struct bw_fixed bw_mul(const struct bw_fixed arg1, const struct bw_fixed arg2)
 	uint64_t arg1_value = abs_i64(arg1.value);
 	uint64_t arg2_value = abs_i64(arg2.value);
 
-	uint64_t arg1_int = GET_INTEGER_PART(arg1_value);
-	uint64_t arg2_int = GET_INTEGER_PART(arg2_value);
+	uint64_t arg1_int = BW_FIXED_GET_INTEGER_PART(arg1_value);
+	uint64_t arg2_int = BW_FIXED_GET_INTEGER_PART(arg2_value);
 
 	uint64_t arg1_fra = GET_FRACTIONAL_PART(arg1_value);
 	uint64_t arg2_fra = GET_FRACTIONAL_PART(arg2_value);
@@ -174,9 +159,9 @@ struct bw_fixed bw_mul(const struct bw_fixed arg1, const struct bw_fixed arg2)
 
 	res.value = arg1_int * arg2_int;
 
-	ASSERT(res.value <= MAX_I32);
+	ASSERT(res.value <= BW_FIXED_MAX_I32);
 
-	res.value <<= BITS_PER_FRACTIONAL_PART;
+	res.value <<= BW_FIXED_BITS_PER_FRACTIONAL_PART;
 
 	tmp = arg1_int * arg2_fra;
 
@@ -192,7 +177,7 @@ struct bw_fixed bw_mul(const struct bw_fixed arg1, const struct bw_fixed arg2)
 
 	tmp = arg1_fra * arg2_fra;
 
-	tmp = (tmp >> BITS_PER_FRACTIONAL_PART) +
+	tmp = (tmp >> BW_FIXED_BITS_PER_FRACTIONAL_PART) +
 		(tmp >= (uint64_t)(bw_frc_to_fixed(1, 2).value));
 
 	ASSERT(tmp <= (uint64_t)(MAX_I64 - res.value));
diff --git a/drivers/gpu/drm/amd/display/dc/inc/bw_fixed.h b/drivers/gpu/drm/amd/display/dc/inc/bw_fixed.h
index 4477e62..39ee8eba3 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/bw_fixed.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/bw_fixed.h
@@ -26,10 +26,19 @@
 #ifndef BW_FIXED_H_
 #define BW_FIXED_H_
 
+#define BW_FIXED_BITS_PER_FRACTIONAL_PART 24
+
+#define BW_FIXED_GET_INTEGER_PART(x) ((x) >> BW_FIXED_BITS_PER_FRACTIONAL_PART)
 struct bw_fixed {
 	int64_t value;
 };
 
+#define BW_FIXED_MIN_I32 \
+	(int64_t)(-(1LL << (63 - BW_FIXED_BITS_PER_FRACTIONAL_PART)))
+
+#define BW_FIXED_MAX_I32 \
+	(int64_t)((1ULL << (63 - BW_FIXED_BITS_PER_FRACTIONAL_PART)) - 1)
+
 static inline struct bw_fixed bw_min2(const struct bw_fixed arg1,
 				      const struct bw_fixed arg2)
 {
@@ -56,9 +65,22 @@ static inline struct bw_fixed bw_max3(struct bw_fixed v1,
 	return bw_max2(bw_max2(v1, v2), v3);
 }
 
-struct bw_fixed bw_int_to_fixed(int64_t value);
+struct bw_fixed bw_int_to_fixed_nonconst(int64_t value);
+static inline struct bw_fixed bw_int_to_fixed(int64_t value)
+{
+	if (__builtin_constant_p(value)) {
+		struct bw_fixed res;
+		BUILD_BUG_ON(value > BW_FIXED_MAX_I32 || value < BW_FIXED_MIN_I32);
+		res.value = value << BW_FIXED_BITS_PER_FRACTIONAL_PART;
+		return res;
+	} else
+		return bw_int_to_fixed_nonconst(value);
+}
 
-int32_t bw_fixed_to_int(struct bw_fixed value);
+static inline int32_t bw_fixed_to_int(struct bw_fixed value)
+{
+	return BW_FIXED_GET_INTEGER_PART(value.value);
+}
 
 struct bw_fixed bw_frc_to_fixed(int64_t num, int64_t denum);
 
-- 
2.9.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 05/10] amdgpu/dc: use the builtin constant p trick on the 31/32 fixed point.
       [not found] ` <20170929071331.18132-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                     ` (2 preceding siblings ...)
  2017-09-29  7:13   ` [PATCH 04/10] amdgpu/dc: allow inlining constant int to fixed a lot better Dave Airlie
@ 2017-09-29  7:13   ` Dave Airlie
  2017-09-29  7:13   ` [PATCH 06/10] amdgpu/dc: inline fixed31_32 div_int Dave Airlie
                     ` (4 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Dave Airlie @ 2017-09-29  7:13 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Dave Airlie <airlied@redhat.com>

This only gets us 100 bytes, but may as well be consistent.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/amd/display/dc/basics/fixpt31_32.c | 22 ++++++++++------------
 drivers/gpu/drm/amd/display/include/fixed31_32.h   | 15 +++++++++++++--
 2 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/basics/fixpt31_32.c b/drivers/gpu/drm/amd/display/dc/basics/fixpt31_32.c
index 578691c..1764a33 100644
--- a/drivers/gpu/drm/amd/display/dc/basics/fixpt31_32.c
+++ b/drivers/gpu/drm/amd/display/dc/basics/fixpt31_32.c
@@ -54,14 +54,12 @@ static inline uint64_t complete_integer_division_u64(
 	return result;
 }
 
-#define BITS_PER_FRACTIONAL_PART \
-	32
 
 #define FRACTIONAL_PART_MASK \
-	((1ULL << BITS_PER_FRACTIONAL_PART) - 1)
+	((1ULL << FIXED31_32_BITS_PER_FRACTIONAL_PART) - 1)
 
 #define GET_INTEGER_PART(x) \
-	((x) >> BITS_PER_FRACTIONAL_PART)
+	((x) >> FIXED31_32_BITS_PER_FRACTIONAL_PART)
 
 #define GET_FRACTIONAL_PART(x) \
 	(FRACTIONAL_PART_MASK & (x))
@@ -89,7 +87,7 @@ struct fixed31_32 dal_fixed31_32_from_fraction(
 
 	/* determine fractional part */
 	{
-		uint32_t i = BITS_PER_FRACTIONAL_PART;
+		uint32_t i = FIXED31_32_BITS_PER_FRACTIONAL_PART;
 
 		do {
 			remainder <<= 1;
@@ -120,14 +118,14 @@ struct fixed31_32 dal_fixed31_32_from_fraction(
 	return res;
 }
 
-struct fixed31_32 dal_fixed31_32_from_int(
+struct fixed31_32 dal_fixed31_32_from_int_nonconst(
 	int64_t arg)
 {
 	struct fixed31_32 res;
 
 	ASSERT((LONG_MIN <= arg) && (arg <= LONG_MAX));
 
-	res.value = arg << BITS_PER_FRACTIONAL_PART;
+	res.value = arg << FIXED31_32_BITS_PER_FRACTIONAL_PART;
 
 	return res;
 }
@@ -198,7 +196,7 @@ struct fixed31_32 dal_fixed31_32_mul(
 
 	ASSERT(res.value <= LONG_MAX);
 
-	res.value <<= BITS_PER_FRACTIONAL_PART;
+	res.value <<= FIXED31_32_BITS_PER_FRACTIONAL_PART;
 
 	tmp = arg1_int * arg2_fra;
 
@@ -214,7 +212,7 @@ struct fixed31_32 dal_fixed31_32_mul(
 
 	tmp = arg1_fra * arg2_fra;
 
-	tmp = (tmp >> BITS_PER_FRACTIONAL_PART) +
+	tmp = (tmp >> FIXED31_32_BITS_PER_FRACTIONAL_PART) +
 		(tmp >= (uint64_t)dal_fixed31_32_half.value);
 
 	ASSERT(tmp <= (uint64_t)(LLONG_MAX - res.value));
@@ -244,7 +242,7 @@ struct fixed31_32 dal_fixed31_32_sqr(
 
 	ASSERT(res.value <= LONG_MAX);
 
-	res.value <<= BITS_PER_FRACTIONAL_PART;
+	res.value <<= FIXED31_32_BITS_PER_FRACTIONAL_PART;
 
 	tmp = arg_int * arg_fra;
 
@@ -258,7 +256,7 @@ struct fixed31_32 dal_fixed31_32_sqr(
 
 	tmp = arg_fra * arg_fra;
 
-	tmp = (tmp >> BITS_PER_FRACTIONAL_PART) +
+	tmp = (tmp >> FIXED31_32_BITS_PER_FRACTIONAL_PART) +
 		(tmp >= (uint64_t)dal_fixed31_32_half.value);
 
 	ASSERT(tmp <= (uint64_t)(LLONG_MAX - res.value));
@@ -560,7 +558,7 @@ static inline uint32_t ux_dy(
 	/* 4. make space for fractional part to be filled in after integer */
 	result <<= fractional_bits;
 	/* 5. shrink fixed point fractional part to of fractional_bits width*/
-	fractional_part >>= BITS_PER_FRACTIONAL_PART - fractional_bits;
+	fractional_part >>= FIXED31_32_BITS_PER_FRACTIONAL_PART - fractional_bits;
 	/* 6. merge the result */
 	return result | fractional_part;
 }
diff --git a/drivers/gpu/drm/amd/display/include/fixed31_32.h b/drivers/gpu/drm/amd/display/include/fixed31_32.h
index f0bc3c4..2c9e223 100644
--- a/drivers/gpu/drm/amd/display/include/fixed31_32.h
+++ b/drivers/gpu/drm/amd/display/include/fixed31_32.h
@@ -28,6 +28,8 @@
 
 #include "os_types.h"
 
+#define FIXED31_32_BITS_PER_FRACTIONAL_PART 32
+
 /*
  * @brief
  * Arithmetic operations on real numbers
@@ -78,8 +80,17 @@ struct fixed31_32 dal_fixed31_32_from_fraction(
  * @brief
  * result = arg
  */
-struct fixed31_32 dal_fixed31_32_from_int(
-	int64_t arg);
+struct fixed31_32 dal_fixed31_32_from_int_nonconst(int64_t arg);
+static inline struct fixed31_32 dal_fixed31_32_from_int(int64_t arg)
+{
+	if (__builtin_constant_p(arg)) {
+		struct fixed31_32 res;
+		BUILD_BUG_ON((LONG_MIN > arg) || (arg > LONG_MAX));
+		res.value = arg << FIXED31_32_BITS_PER_FRACTIONAL_PART;
+		return res;
+	} else
+		return dal_fixed31_32_from_int_nonconst(arg);
+}
 
 /*
  * @brief
-- 
2.9.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 06/10] amdgpu/dc: inline fixed31_32 div_int
       [not found] ` <20170929071331.18132-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                     ` (3 preceding siblings ...)
  2017-09-29  7:13   ` [PATCH 05/10] amdgpu/dc: use the builtin constant p trick on the 31/32 fixed point Dave Airlie
@ 2017-09-29  7:13   ` Dave Airlie
  2017-09-29  7:13   ` [PATCH 07/10] amdgpu/dc: inline all the signal_types code Dave Airlie
                     ` (3 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Dave Airlie @ 2017-09-29  7:13 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Dave Airlie <airlied@redhat.com>

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/amd/display/dc/basics/fixpt31_32.c | 9 ---------
 drivers/gpu/drm/amd/display/include/fixed31_32.h   | 9 ++++++---
 2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/basics/fixpt31_32.c b/drivers/gpu/drm/amd/display/dc/basics/fixpt31_32.c
index 1764a33..2693689 100644
--- a/drivers/gpu/drm/amd/display/dc/basics/fixpt31_32.c
+++ b/drivers/gpu/drm/amd/display/dc/basics/fixpt31_32.c
@@ -266,15 +266,6 @@ struct fixed31_32 dal_fixed31_32_sqr(
 	return res;
 }
 
-struct fixed31_32 dal_fixed31_32_div_int(
-	struct fixed31_32 arg1,
-	int64_t arg2)
-{
-	return dal_fixed31_32_from_fraction(
-		arg1.value,
-		dal_fixed31_32_from_int(arg2).value);
-}
-
 struct fixed31_32 dal_fixed31_32_recip(
 	struct fixed31_32 arg)
 {
diff --git a/drivers/gpu/drm/amd/display/include/fixed31_32.h b/drivers/gpu/drm/amd/display/include/fixed31_32.h
index 2c9e223..3248f69 100644
--- a/drivers/gpu/drm/amd/display/include/fixed31_32.h
+++ b/drivers/gpu/drm/amd/display/include/fixed31_32.h
@@ -308,9 +308,12 @@ struct fixed31_32 dal_fixed31_32_sqr(
  * @brief
  * result = arg1 / arg2
  */
-struct fixed31_32 dal_fixed31_32_div_int(
-	struct fixed31_32 arg1,
-	int64_t arg2);
+static inline struct fixed31_32 dal_fixed31_32_div_int(struct fixed31_32 arg1,
+						       int64_t arg2)
+{
+	return dal_fixed31_32_from_fraction(arg1.value,
+					    dal_fixed31_32_from_int(arg2).value);
+}
 
 /*
  * @brief
-- 
2.9.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 07/10] amdgpu/dc: inline all the signal_types code.
       [not found] ` <20170929071331.18132-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                     ` (4 preceding siblings ...)
  2017-09-29  7:13   ` [PATCH 06/10] amdgpu/dc: inline fixed31_32 div_int Dave Airlie
@ 2017-09-29  7:13   ` Dave Airlie
  2017-09-29  7:13   ` [PATCH 08/10] amdgpu/dc: set some of the link dp code to static Dave Airlie
                     ` (2 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Dave Airlie @ 2017-09-29  7:13 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Dave Airlie <airlied@redhat.com>

This is worth 300 bytes, and one less source file.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/amd/display/dc/basics/Makefile     |  2 +-
 .../gpu/drm/amd/display/dc/basics/signal_types.c   | 80 ----------------------
 drivers/gpu/drm/amd/display/include/signal_types.h | 59 +++++++++++++---
 3 files changed, 52 insertions(+), 89 deletions(-)
 delete mode 100644 drivers/gpu/drm/amd/display/dc/basics/signal_types.c

diff --git a/drivers/gpu/drm/amd/display/dc/basics/Makefile b/drivers/gpu/drm/amd/display/dc/basics/Makefile
index 0658162..43c5ccd 100644
--- a/drivers/gpu/drm/amd/display/dc/basics/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/basics/Makefile
@@ -4,7 +4,7 @@
 # subcomponents.
 
 BASICS = conversion.o fixpt31_32.o fixpt32_32.o grph_object_id.o \
-	logger.o log_helpers.o signal_types.o vector.o
+	logger.o log_helpers.o vector.o
 
 AMD_DAL_BASICS = $(addprefix $(AMDDALPATH)/dc/basics/,$(BASICS))
 
diff --git a/drivers/gpu/drm/amd/display/dc/basics/signal_types.c b/drivers/gpu/drm/amd/display/dc/basics/signal_types.c
deleted file mode 100644
index 534c803..0000000
--- a/drivers/gpu/drm/amd/display/dc/basics/signal_types.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright 2012-15 Advanced Micro Devices, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors: AMD
- *
- */
-
-#include "dm_services.h"
-#include "include/signal_types.h"
-
-bool dc_is_hdmi_signal(enum signal_type signal)
-{
-	return (signal == SIGNAL_TYPE_HDMI_TYPE_A);
-}
-
-bool dc_is_dp_sst_signal(enum signal_type signal)
-{
-	return (signal == SIGNAL_TYPE_DISPLAY_PORT ||
-		signal == SIGNAL_TYPE_EDP);
-}
-
-bool dc_is_dp_signal(enum signal_type signal)
-{
-	return (signal == SIGNAL_TYPE_DISPLAY_PORT ||
-		signal == SIGNAL_TYPE_EDP ||
-		signal == SIGNAL_TYPE_DISPLAY_PORT_MST);
-}
-
-bool dc_is_embedded_signal(enum signal_type signal)
-{
-	return (signal == SIGNAL_TYPE_EDP || signal == SIGNAL_TYPE_LVDS);
-}
-
-bool dc_is_dvi_signal(enum signal_type signal)
-{
-	switch (signal) {
-	case SIGNAL_TYPE_DVI_SINGLE_LINK:
-	case SIGNAL_TYPE_DVI_DUAL_LINK:
-		return true;
-	break;
-	default:
-		return false;
-	}
-}
-
-bool dc_is_dvi_single_link_signal(enum signal_type signal)
-{
-	return (signal == SIGNAL_TYPE_DVI_SINGLE_LINK);
-}
-
-bool dc_is_dual_link_signal(enum signal_type signal)
-{
-	return (signal == SIGNAL_TYPE_DVI_DUAL_LINK);
-}
-
-bool dc_is_audio_capable_signal(enum signal_type signal)
-{
-	return (signal == SIGNAL_TYPE_DISPLAY_PORT ||
-		signal == SIGNAL_TYPE_DISPLAY_PORT_MST ||
-		dc_is_hdmi_signal(signal));
-}
-
diff --git a/drivers/gpu/drm/amd/display/include/signal_types.h b/drivers/gpu/drm/amd/display/include/signal_types.h
index 1a2ca53..b5ebde6 100644
--- a/drivers/gpu/drm/amd/display/include/signal_types.h
+++ b/drivers/gpu/drm/amd/display/include/signal_types.h
@@ -40,13 +40,56 @@ enum signal_type {
 };
 
 /* help functions for signal types manipulation */
-bool dc_is_hdmi_signal(enum signal_type signal);
-bool dc_is_dp_sst_signal(enum signal_type signal);
-bool dc_is_dp_signal(enum signal_type signal);
-bool dc_is_embedded_signal(enum signal_type signal);
-bool dc_is_dvi_signal(enum signal_type signal);
-bool dc_is_dvi_single_link_signal(enum signal_type signal);
-bool dc_is_dual_link_signal(enum signal_type signal);
-bool dc_is_audio_capable_signal(enum signal_type signal);
+static inline bool dc_is_hdmi_signal(enum signal_type signal)
+{
+	return (signal == SIGNAL_TYPE_HDMI_TYPE_A);
+}
+
+static inline bool dc_is_dp_sst_signal(enum signal_type signal)
+{
+	return (signal == SIGNAL_TYPE_DISPLAY_PORT ||
+		signal == SIGNAL_TYPE_EDP);
+}
+
+static inline bool dc_is_dp_signal(enum signal_type signal)
+{
+	return (signal == SIGNAL_TYPE_DISPLAY_PORT ||
+		signal == SIGNAL_TYPE_EDP ||
+		signal == SIGNAL_TYPE_DISPLAY_PORT_MST);
+}
+
+static inline bool dc_is_embedded_signal(enum signal_type signal)
+{
+	return (signal == SIGNAL_TYPE_EDP || signal == SIGNAL_TYPE_LVDS);
+}
+
+static inline bool dc_is_dvi_signal(enum signal_type signal)
+{
+	switch (signal) {
+	case SIGNAL_TYPE_DVI_SINGLE_LINK:
+	case SIGNAL_TYPE_DVI_DUAL_LINK:
+		return true;
+	break;
+	default:
+		return false;
+	}
+}
+
+static inline bool dc_is_dvi_single_link_signal(enum signal_type signal)
+{
+	return (signal == SIGNAL_TYPE_DVI_SINGLE_LINK);
+}
+
+static inline bool dc_is_dual_link_signal(enum signal_type signal)
+{
+	return (signal == SIGNAL_TYPE_DVI_DUAL_LINK);
+}
+
+static inline bool dc_is_audio_capable_signal(enum signal_type signal)
+{
+	return (signal == SIGNAL_TYPE_DISPLAY_PORT ||
+		signal == SIGNAL_TYPE_DISPLAY_PORT_MST ||
+		dc_is_hdmi_signal(signal));
+}
 
 #endif
-- 
2.9.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 08/10] amdgpu/dc: set some of the link dp code to static.
       [not found] ` <20170929071331.18132-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                     ` (5 preceding siblings ...)
  2017-09-29  7:13   ` [PATCH 07/10] amdgpu/dc: inline all the signal_types code Dave Airlie
@ 2017-09-29  7:13   ` Dave Airlie
  2017-09-29  7:13   ` [PATCH 09/10] amdgpu/dc: rename bios get_image symbol to something more searchable Dave Airlie
  2017-09-29  7:13   ` [PATCH 10/10] amdgpu/dc: inline dml_round_to_multiple Dave Airlie
  8 siblings, 0 replies; 12+ messages in thread
From: Dave Airlie @ 2017-09-29  7:13 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Dave Airlie <airlied@redhat.com>

These aren't currently used outside this file.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 18 +++++++++++++-----
 drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h  |  8 --------
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
index 305ca0d..888d268 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
@@ -32,6 +32,14 @@ enum {
 	LINK_TRAINING_MAX_CR_RETRY = 100
 };
 
+static bool decide_fallback_link_setting(
+		struct dc_link_settings initial_link_settings,
+		struct dc_link_settings *current_link_setting,
+		enum link_training_result training_result);
+static struct dc_link_settings get_common_supported_link_settings (
+		struct dc_link_settings link_setting_a,
+		struct dc_link_settings link_setting_b);
+
 static void wait_for_training_aux_rd_interval(
 	struct dc_link *link,
 	uint32_t default_wait_in_micro_secs)
@@ -1150,7 +1158,7 @@ bool dp_hbr_verify_link_cap(
 	return success;
 }
 
-struct dc_link_settings get_common_supported_link_settings (
+static struct dc_link_settings get_common_supported_link_settings (
 		struct dc_link_settings link_setting_a,
 		struct dc_link_settings link_setting_b)
 {
@@ -1215,7 +1223,7 @@ enum dc_lane_count reduce_lane_count(enum dc_lane_count lane_count)
 	}
 }
 
-enum dc_link_rate reduce_link_rate(enum dc_link_rate link_rate)
+static enum dc_link_rate reduce_link_rate(enum dc_link_rate link_rate)
 {
 	switch (link_rate) {
 	case LINK_RATE_HIGH3:
@@ -1231,7 +1239,7 @@ enum dc_link_rate reduce_link_rate(enum dc_link_rate link_rate)
 	}
 }
 
-enum dc_lane_count increase_lane_count(enum dc_lane_count lane_count)
+static enum dc_lane_count increase_lane_count(enum dc_lane_count lane_count)
 {
 	switch (lane_count) {
 	case LANE_COUNT_ONE:
@@ -1243,7 +1251,7 @@ enum dc_lane_count increase_lane_count(enum dc_lane_count lane_count)
 	}
 }
 
-enum dc_link_rate increase_link_rate(enum dc_link_rate link_rate)
+static enum dc_link_rate increase_link_rate(enum dc_link_rate link_rate)
 {
 	switch (link_rate) {
 	case LINK_RATE_LOW:
@@ -1265,7 +1273,7 @@ enum dc_link_rate increase_link_rate(enum dc_link_rate link_rate)
  *			false - has reached minimum setting
  *					and no further fallback could be done
  */
-bool decide_fallback_link_setting(
+static bool decide_fallback_link_setting(
 		struct dc_link_settings initial_link_settings,
 		struct dc_link_settings *current_link_setting,
 		enum link_training_result training_result)
diff --git a/drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h b/drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h
index 7168dcc..616c73e 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h
@@ -37,14 +37,6 @@ bool dp_hbr_verify_link_cap(
 	struct dc_link *link,
 	struct dc_link_settings *known_limit_link_setting);
 
-bool decide_fallback_link_setting(struct dc_link_settings link_setting_init,
-		struct dc_link_settings *link_setting_current,
-		enum link_training_result training_result);
-
-struct dc_link_settings get_common_supported_link_settings (
-		struct dc_link_settings link_setting_a,
-		struct dc_link_settings link_setting_b);
-
 bool dp_validate_mode_timing(
 	struct dc_link *link,
 	const struct dc_crtc_timing *timing);
-- 
2.9.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 09/10] amdgpu/dc: rename bios get_image symbol to something more searchable.
       [not found] ` <20170929071331.18132-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                     ` (6 preceding siblings ...)
  2017-09-29  7:13   ` [PATCH 08/10] amdgpu/dc: set some of the link dp code to static Dave Airlie
@ 2017-09-29  7:13   ` Dave Airlie
  2017-09-29  7:13   ` [PATCH 10/10] amdgpu/dc: inline dml_round_to_multiple Dave Airlie
  8 siblings, 0 replies; 12+ messages in thread
From: Dave Airlie @ 2017-09-29  7:13 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Dave Airlie <airlied@redhat.com>

This just makes it easier to find.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/amd/display/dc/bios/bios_parser.c        | 6 +++---
 drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c       | 2 +-
 drivers/gpu/drm/amd/display/dc/bios/bios_parser_helper.c | 2 +-
 drivers/gpu/drm/amd/display/dc/bios/bios_parser_helper.h | 4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
index f6828f4..2e003b5 100644
--- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
+++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
@@ -412,7 +412,7 @@ static enum bp_result bios_parser_get_voltage_ddc_info(struct dc_bios *dcb,
 	if (!DATA_TABLES(VoltageObjectInfo))
 		return result;
 
-	voltage_info_address = get_image(&bp->base, DATA_TABLES(VoltageObjectInfo), sizeof(ATOM_COMMON_TABLE_HEADER));
+	voltage_info_address = bios_get_image(&bp->base, DATA_TABLES(VoltageObjectInfo), sizeof(ATOM_COMMON_TABLE_HEADER));
 
 	header = (ATOM_COMMON_TABLE_HEADER *) voltage_info_address;
 
@@ -2328,7 +2328,7 @@ static uint32_t get_dest_obj_list(struct bios_parser *bp,
 		return 0;
 
 	offset += sizeof(uint8_t);
-	*id_list = (uint16_t *)get_image(&bp->base, offset, *number * sizeof(uint16_t));
+	*id_list = (uint16_t *)bios_get_image(&bp->base, offset, *number * sizeof(uint16_t));
 
 	if (!*id_list)
 		return 0;
@@ -2355,7 +2355,7 @@ static uint32_t get_src_obj_list(struct bios_parser *bp, ATOM_OBJECT *object,
 		return 0;
 
 	offset += sizeof(uint8_t);
-	*id_list = (uint16_t *)get_image(&bp->base, offset, *number * sizeof(uint16_t));
+	*id_list = (uint16_t *)bios_get_image(&bp->base, offset, *number * sizeof(uint16_t));
 
 	if (!*id_list)
 		return 0;
diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
index 852bb0d..0c623b3 100644
--- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
+++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
@@ -535,7 +535,7 @@ static enum bp_result bios_parser_get_voltage_ddc_info(struct dc_bios *dcb,
 	if (!DATA_TABLES(voltageobject_info))
 		return result;
 
-	voltage_info_address = get_image(&bp->base,
+	voltage_info_address = bios_get_image(&bp->base,
 			DATA_TABLES(voltageobject_info),
 			sizeof(struct atom_common_table_header));
 
diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser_helper.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser_helper.c
index 8e56d2f..5c9e510 100644
--- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser_helper.c
+++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser_helper.c
@@ -33,7 +33,7 @@
 #include "command_table.h"
 #include "bios_parser_types_internal.h"
 
-uint8_t *get_image(struct dc_bios *bp,
+uint8_t *bios_get_image(struct dc_bios *bp,
 	uint32_t offset,
 	uint32_t size)
 {
diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser_helper.h b/drivers/gpu/drm/amd/display/dc/bios/bios_parser_helper.h
index a8fbb82..c0047ef 100644
--- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser_helper.h
+++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser_helper.h
@@ -28,13 +28,13 @@
 
 struct bios_parser;
 
-uint8_t *get_image(struct dc_bios *bp, uint32_t offset,
+uint8_t *bios_get_image(struct dc_bios *bp, uint32_t offset,
 	uint32_t size);
 
 bool bios_is_accelerated_mode(struct dc_bios *bios);
 void bios_set_scratch_acc_mode_change(struct dc_bios *bios);
 void bios_set_scratch_critical_state(struct dc_bios *bios, bool state);
 
-#define GET_IMAGE(type, offset) ((type *) get_image(&bp->base, offset, sizeof(type)))
+#define GET_IMAGE(type, offset) ((type *) bios_get_image(&bp->base, offset, sizeof(type)))
 
 #endif
-- 
2.9.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 10/10] amdgpu/dc: inline dml_round_to_multiple
       [not found] ` <20170929071331.18132-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                     ` (7 preceding siblings ...)
  2017-09-29  7:13   ` [PATCH 09/10] amdgpu/dc: rename bios get_image symbol to something more searchable Dave Airlie
@ 2017-09-29  7:13   ` Dave Airlie
       [not found]     ` <20170929071331.18132-10-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  8 siblings, 1 reply; 12+ messages in thread
From: Dave Airlie @ 2017-09-29  7:13 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Dave Airlie <airlied@redhat.com>

turns out to be a win to inline this.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.c | 19 -------------------
 drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.h |  2 --
 drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h | 19 +++++++++++++++++++
 3 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.c b/drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.c
index 7c0eb52..df2d509 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.c
@@ -39,23 +39,4 @@ double dml_round(double a)
 		return floor;
 }
 
-unsigned int dml_round_to_multiple(
-	unsigned int num,
-	unsigned int multiple,
-	bool up)
-{
-	unsigned int remainder;
-
-	if (multiple == 0)
-		return num;
-
-	remainder = num % multiple;
 
-	if (remainder == 0)
-		return num;
-
-	if (up)
-		return (num + multiple - remainder);
-	else
-		return (num - remainder);
-}
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.h b/drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.h
index a2da3da..81c53d8 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.h
+++ b/drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.h
@@ -33,7 +33,5 @@
 #define DTRACE(str, ...) dm_logger_write(mode_lib->logger, LOG_DML, str, ##__VA_ARGS__);
 
 double dml_round(double a);
-unsigned int dml_round_to_multiple(
-			unsigned int num, unsigned int multiple, bool up);
 
 #endif /* __DC_COMMON_DEFS_H__ */
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h b/drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h
index 1c6c631..a91b4a6 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h
+++ b/drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h
@@ -58,4 +58,23 @@ static inline double dml_log(double x, double base)
 	return (double) dcn_bw_log(x, base);
 }
 
+static inline unsigned int dml_round_to_multiple(unsigned int num,
+						 unsigned int multiple,
+						 bool up)
+{
+	unsigned int remainder;
+
+	if (multiple == 0)
+		return num;
+
+	remainder = num % multiple;
+
+	if (remainder == 0)
+		return num;
+
+	if (up)
+		return (num + multiple - remainder);
+	else
+		return (num - remainder);
+}
 #endif
-- 
2.9.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 04/10] amdgpu/dc: allow inlining constant int to fixed a lot better.
       [not found]     ` <20170929071331.18132-4-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-09-29 15:13       ` Harry Wentland
  0 siblings, 0 replies; 12+ messages in thread
From: Harry Wentland @ 2017-09-29 15:13 UTC (permalink / raw)
  To: Dave Airlie, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On 2017-09-29 03:13 AM, Dave Airlie wrote:
> From: Dave Airlie <airlied@redhat.com>
> 
> This uses two things that might be Linux specific,
> __builtin_constant_p (might be gcc)
> and
> BUILD_BUG_ON. (maybe other dm's can have something similiar).
> 

We can always use ifdef in our internal tree to keep Linux specific bits
without affecting other users of our code. As long as it's not all over
the place and the payoff is worthwhile, which it is in this case.

Harry

> This saves 4k in the bw calcs code.
> 
> Signed-off-by: Dave Airlie <airlied@redhat.com>
> ---
>  drivers/gpu/drm/amd/display/dc/calcs/bw_fixed.c | 37 ++++++++-----------------
>  drivers/gpu/drm/amd/display/dc/inc/bw_fixed.h   | 26 +++++++++++++++--
>  2 files changed, 35 insertions(+), 28 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/calcs/bw_fixed.c b/drivers/gpu/drm/amd/display/dc/calcs/bw_fixed.c
> index 0de6fa1..6ca288f 100644
> --- a/drivers/gpu/drm/amd/display/dc/calcs/bw_fixed.c
> +++ b/drivers/gpu/drm/amd/display/dc/calcs/bw_fixed.c
> @@ -25,13 +25,6 @@
>  #include "dm_services.h"
>  #include "bw_fixed.h"
>  
> -#define BITS_PER_FRACTIONAL_PART 24
> -
> -#define MIN_I32 \
> -	(int64_t)(-(1LL << (63 - BITS_PER_FRACTIONAL_PART)))
> -
> -#define MAX_I32 \
> -	(int64_t)((1ULL << (63 - BITS_PER_FRACTIONAL_PART)) - 1)
>  
>  #define MIN_I64 \
>  	(int64_t)(-(1LL << 63))
> @@ -40,10 +33,7 @@
>  	(int64_t)((1ULL << 63) - 1)
>  
>  #define FRACTIONAL_PART_MASK \
> -	((1ULL << BITS_PER_FRACTIONAL_PART) - 1)
> -
> -#define GET_INTEGER_PART(x) \
> -	((x) >> BITS_PER_FRACTIONAL_PART)
> +	((1ULL << BW_FIXED_BITS_PER_FRACTIONAL_PART) - 1)
>  
>  #define GET_FRACTIONAL_PART(x) \
>  	(FRACTIONAL_PART_MASK & (x))
> @@ -56,19 +46,14 @@ static uint64_t abs_i64(int64_t arg)
>  		return (uint64_t)(-arg);
>  }
>  
> -struct bw_fixed bw_int_to_fixed(int64_t value)
> +struct bw_fixed bw_int_to_fixed_nonconst(int64_t value)
>  {
>  	struct bw_fixed res;
> -	ASSERT(value < MAX_I32 && value > MIN_I32);
> -	res.value = value << BITS_PER_FRACTIONAL_PART;
> +	ASSERT(value < BW_FIXED_MAX_I32 && value > BW_FIXED_MIN_I32);
> +	res.value = value << BW_FIXED_BITS_PER_FRACTIONAL_PART;
>  	return res;
>  }
>  
> -int32_t bw_fixed_to_int(struct bw_fixed value)
> -{
> -	return GET_INTEGER_PART(value.value);
> -}
> -
>  struct bw_fixed bw_frc_to_fixed(int64_t numerator, int64_t denominator)
>  {
>  	struct bw_fixed res;
> @@ -87,11 +72,11 @@ struct bw_fixed bw_frc_to_fixed(int64_t numerator, int64_t denominator)
>  	arg2_value = abs_i64(denominator);
>  	res_value = div64_u64_rem(arg1_value, arg2_value, &remainder);
>  
> -	ASSERT(res_value <= MAX_I32);
> +	ASSERT(res_value <= BW_FIXED_MAX_I32);
>  
>  	/* determine fractional part */
>  	{
> -		uint32_t i = BITS_PER_FRACTIONAL_PART;
> +		uint32_t i = BW_FIXED_BITS_PER_FRACTIONAL_PART;
>  
>  		do
>  		{
> @@ -164,8 +149,8 @@ struct bw_fixed bw_mul(const struct bw_fixed arg1, const struct bw_fixed arg2)
>  	uint64_t arg1_value = abs_i64(arg1.value);
>  	uint64_t arg2_value = abs_i64(arg2.value);
>  
> -	uint64_t arg1_int = GET_INTEGER_PART(arg1_value);
> -	uint64_t arg2_int = GET_INTEGER_PART(arg2_value);
> +	uint64_t arg1_int = BW_FIXED_GET_INTEGER_PART(arg1_value);
> +	uint64_t arg2_int = BW_FIXED_GET_INTEGER_PART(arg2_value);
>  
>  	uint64_t arg1_fra = GET_FRACTIONAL_PART(arg1_value);
>  	uint64_t arg2_fra = GET_FRACTIONAL_PART(arg2_value);
> @@ -174,9 +159,9 @@ struct bw_fixed bw_mul(const struct bw_fixed arg1, const struct bw_fixed arg2)
>  
>  	res.value = arg1_int * arg2_int;
>  
> -	ASSERT(res.value <= MAX_I32);
> +	ASSERT(res.value <= BW_FIXED_MAX_I32);
>  
> -	res.value <<= BITS_PER_FRACTIONAL_PART;
> +	res.value <<= BW_FIXED_BITS_PER_FRACTIONAL_PART;
>  
>  	tmp = arg1_int * arg2_fra;
>  
> @@ -192,7 +177,7 @@ struct bw_fixed bw_mul(const struct bw_fixed arg1, const struct bw_fixed arg2)
>  
>  	tmp = arg1_fra * arg2_fra;
>  
> -	tmp = (tmp >> BITS_PER_FRACTIONAL_PART) +
> +	tmp = (tmp >> BW_FIXED_BITS_PER_FRACTIONAL_PART) +
>  		(tmp >= (uint64_t)(bw_frc_to_fixed(1, 2).value));
>  
>  	ASSERT(tmp <= (uint64_t)(MAX_I64 - res.value));
> diff --git a/drivers/gpu/drm/amd/display/dc/inc/bw_fixed.h b/drivers/gpu/drm/amd/display/dc/inc/bw_fixed.h
> index 4477e62..39ee8eba3 100644
> --- a/drivers/gpu/drm/amd/display/dc/inc/bw_fixed.h
> +++ b/drivers/gpu/drm/amd/display/dc/inc/bw_fixed.h
> @@ -26,10 +26,19 @@
>  #ifndef BW_FIXED_H_
>  #define BW_FIXED_H_
>  
> +#define BW_FIXED_BITS_PER_FRACTIONAL_PART 24
> +
> +#define BW_FIXED_GET_INTEGER_PART(x) ((x) >> BW_FIXED_BITS_PER_FRACTIONAL_PART)
>  struct bw_fixed {
>  	int64_t value;
>  };
>  
> +#define BW_FIXED_MIN_I32 \
> +	(int64_t)(-(1LL << (63 - BW_FIXED_BITS_PER_FRACTIONAL_PART)))
> +
> +#define BW_FIXED_MAX_I32 \
> +	(int64_t)((1ULL << (63 - BW_FIXED_BITS_PER_FRACTIONAL_PART)) - 1)
> +
>  static inline struct bw_fixed bw_min2(const struct bw_fixed arg1,
>  				      const struct bw_fixed arg2)
>  {
> @@ -56,9 +65,22 @@ static inline struct bw_fixed bw_max3(struct bw_fixed v1,
>  	return bw_max2(bw_max2(v1, v2), v3);
>  }
>  
> -struct bw_fixed bw_int_to_fixed(int64_t value);
> +struct bw_fixed bw_int_to_fixed_nonconst(int64_t value);
> +static inline struct bw_fixed bw_int_to_fixed(int64_t value)
> +{
> +	if (__builtin_constant_p(value)) {
> +		struct bw_fixed res;
> +		BUILD_BUG_ON(value > BW_FIXED_MAX_I32 || value < BW_FIXED_MIN_I32);
> +		res.value = value << BW_FIXED_BITS_PER_FRACTIONAL_PART;
> +		return res;
> +	} else
> +		return bw_int_to_fixed_nonconst(value);
> +}
>  
> -int32_t bw_fixed_to_int(struct bw_fixed value);
> +static inline int32_t bw_fixed_to_int(struct bw_fixed value)
> +{
> +	return BW_FIXED_GET_INTEGER_PART(value.value);
> +}
>  
>  struct bw_fixed bw_frc_to_fixed(int64_t num, int64_t denum);
>  
> 
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 10/10] amdgpu/dc: inline dml_round_to_multiple
       [not found]     ` <20170929071331.18132-10-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-09-29 15:13       ` Harry Wentland
  0 siblings, 0 replies; 12+ messages in thread
From: Harry Wentland @ 2017-09-29 15:13 UTC (permalink / raw)
  To: Dave Airlie, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On 2017-09-29 03:13 AM, Dave Airlie wrote:
> From: Dave Airlie <airlied@redhat.com>
> 
> turns out to be a win to inline this.
> 
> Signed-off-by: Dave Airlie <airlied@redhat.com>

Series is
Reviewed-by: Harry Wentland <harry.wentland@amd.com>

Harry

> ---
>  drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.c | 19 -------------------
>  drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.h |  2 --
>  drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h | 19 +++++++++++++++++++
>  3 files changed, 19 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.c b/drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.c
> index 7c0eb52..df2d509 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.c
> +++ b/drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.c
> @@ -39,23 +39,4 @@ double dml_round(double a)
>  		return floor;
>  }
>  
> -unsigned int dml_round_to_multiple(
> -	unsigned int num,
> -	unsigned int multiple,
> -	bool up)
> -{
> -	unsigned int remainder;
> -
> -	if (multiple == 0)
> -		return num;
> -
> -	remainder = num % multiple;
>  
> -	if (remainder == 0)
> -		return num;
> -
> -	if (up)
> -		return (num + multiple - remainder);
> -	else
> -		return (num - remainder);
> -}
> diff --git a/drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.h b/drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.h
> index a2da3da..81c53d8 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.h
> +++ b/drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.h
> @@ -33,7 +33,5 @@
>  #define DTRACE(str, ...) dm_logger_write(mode_lib->logger, LOG_DML, str, ##__VA_ARGS__);
>  
>  double dml_round(double a);
> -unsigned int dml_round_to_multiple(
> -			unsigned int num, unsigned int multiple, bool up);
>  
>  #endif /* __DC_COMMON_DEFS_H__ */
> diff --git a/drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h b/drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h
> index 1c6c631..a91b4a6 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h
> +++ b/drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h
> @@ -58,4 +58,23 @@ static inline double dml_log(double x, double base)
>  	return (double) dcn_bw_log(x, base);
>  }
>  
> +static inline unsigned int dml_round_to_multiple(unsigned int num,
> +						 unsigned int multiple,
> +						 bool up)
> +{
> +	unsigned int remainder;
> +
> +	if (multiple == 0)
> +		return num;
> +
> +	remainder = num % multiple;
> +
> +	if (remainder == 0)
> +		return num;
> +
> +	if (up)
> +		return (num + multiple - remainder);
> +	else
> +		return (num - remainder);
> +}
>  #endif
> 
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-09-29 15:13 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-29  7:13 [PATCH 01/10] amdgpu/dc: hide some unused aux/i2c payload apis Dave Airlie
     [not found] ` <20170929071331.18132-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-09-29  7:13   ` [PATCH 02/10] amdgpu/dc: move some one line dp functions to inlines Dave Airlie
2017-09-29  7:13   ` [PATCH 03/10] amdgpu/dc: inline some of the bw_fixed code Dave Airlie
2017-09-29  7:13   ` [PATCH 04/10] amdgpu/dc: allow inlining constant int to fixed a lot better Dave Airlie
     [not found]     ` <20170929071331.18132-4-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-09-29 15:13       ` Harry Wentland
2017-09-29  7:13   ` [PATCH 05/10] amdgpu/dc: use the builtin constant p trick on the 31/32 fixed point Dave Airlie
2017-09-29  7:13   ` [PATCH 06/10] amdgpu/dc: inline fixed31_32 div_int Dave Airlie
2017-09-29  7:13   ` [PATCH 07/10] amdgpu/dc: inline all the signal_types code Dave Airlie
2017-09-29  7:13   ` [PATCH 08/10] amdgpu/dc: set some of the link dp code to static Dave Airlie
2017-09-29  7:13   ` [PATCH 09/10] amdgpu/dc: rename bios get_image symbol to something more searchable Dave Airlie
2017-09-29  7:13   ` [PATCH 10/10] amdgpu/dc: inline dml_round_to_multiple Dave Airlie
     [not found]     ` <20170929071331.18132-10-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-09-29 15:13       ` Harry Wentland

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.