amdgpu/dc: hide some unused aux/i2c payload apis.
PATCH 1/10 amdgpu/dc: hide some unused aux/i2c payload apis.
From: Dave Airlie <[email protected]>
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.
--- 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(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c +8 -8
@@ -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 ;
drivers/gpu/drm/amd/display/dc/inc/dc_link_ddc.h +0 -10
@@ -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,
Signature · 6 lines
2.9.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20170929071331.18132-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
PATCH 2/10 amdgpu/dc: move some one line dp functions to inlines.
From: Dave Airlie <[email protected]>
--- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +2 -2
@@ -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 ; }
Signature · 6 lines
2.9.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/10 amdgpu/dc: inline some of the bw_fixed code.
In reply to a message not in the archiveFrom: Dave Airlie <[email protected]>
This results in a ~4.5k code size reduction.
--- 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(-)
drivers/gpu/drm/amd/display/dc/calcs/bw_fixed.c +0 -93
@@ -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; -}
drivers/gpu/drm/amd/display/dc/inc/bw_fixed.h +96 -15
129 lines not on this page · raw message
Signature · 6 lines
2.9.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/10 amdgpu/dc: allow inlining constant int to fixed a lot better.
In reply to a message not in the archiveFrom: Dave Airlie <[email protected]>
This uses two things that might be Linux specific, __builtin_constant_p (might be gcc)
andBUILD_BUG_ON. (maybe other dm's can have something similiar).
This saves 4k in the bw calcs code.
--- 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(-)
drivers/gpu/drm/amd/display/dc/calcs/bw_fixed.c +11 -26
@@ -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));
drivers/gpu/drm/amd/display/dc/inc/bw_fixed.h +24 -2
@@ -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);
Signature · 6 lines
2.9.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20170929071331.18132-4-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH 04/10] amdgpu/dc: allow inlining constant int to fixed a lot better.
Quoted 7 lines · Dave Airlie
From: Dave Airlie <[email protected]>
This uses two things that might be Linux specific,
__builtin_constant_p(might be gcc)
andBUILD_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
Quoted 147 lines
This saves 4k in the bw calcs code.
Signed-off-by Dave Airlie <[email protected]>--- 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(-)drivers/gpu/drm/amd/display/dc/calcs/bw_fixed.c +11
-26@@ -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));drivers/gpu/drm/amd/display/dc/inc/bw_fixed.h +19
-1@@ -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);
drivers/gpu/drm/amd/display/dc/inc/bw_fixed.h static inline struct bw_fixed bw_max3(struct bw_fixed v1, · line 86
Quoted 10 lines
drivers/gpu/drm/amd/display/dc/inc/bw_fixed.h +5
-1+} -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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/10 amdgpu/dc: use the builtin constant p trick on the 31/32 fixed point.
In reply to a message not in the archiveFrom: Dave Airlie <[email protected]>
This only gets us 100 bytes, but may as well be consistent.
--- 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(-)
drivers/gpu/drm/amd/display/dc/basics/fixpt31_32.c +10 -12
@@ -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; }
drivers/gpu/drm/amd/display/include/fixed31_32.h +13 -2
@@ -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
Signature · 6 lines
2.9.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 6/10 amdgpu/dc: inline fixed31_32 div_int
In reply to a message not in the archiveFrom: Dave Airlie <[email protected]>
--- 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(-)
drivers/gpu/drm/amd/display/dc/basics/fixpt31_32.c +0 -9
@@ -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) {
drivers/gpu/drm/amd/display/include/fixed31_32.h +6 -3
@@ -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
Signature · 6 lines
2.9.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 7/10 amdgpu/dc: inline all the signal_types code.
In reply to a message not in the archiveFrom: Dave Airlie <[email protected]>
This is worth 300 bytes, and one less source file.
--- 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
drivers/gpu/drm/amd/display/dc/basics/Makefile +1 -1
@@ -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))
drivers/gpu/drm/amd/display/dc/basics/signal_types.c deleted +0 -80
80 lines not on this page · raw message
drivers/gpu/drm/amd/display/include/signal_types.h +51 -8
64 lines not on this page · raw message
Signature · 6 lines
2.9.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 8/10 amdgpu/dc: set some of the link dp code to static.
In reply to a message not in the archiveFrom: Dave Airlie <[email protected]>
These aren't currently used outside this file.
--- 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(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +13 -5
@@ -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)
drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h +0 -8
@@ -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);
Signature · 6 lines
2.9.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 9/10 amdgpu/dc: rename bios get_image symbol to something more searchable.
In reply to a message not in the archiveFrom: Dave Airlie <[email protected]>
This just makes it easier to find.
--- 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(-)
drivers/gpu/drm/amd/display/dc/bios/bios_parser.c +3 -3
@@ -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 ;
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +1 -1
@@ -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 ));
drivers/gpu/drm/amd/display/dc/bios/bios_parser_helper.c +1 -1
@@ -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) {
drivers/gpu/drm/amd/display/dc/bios/bios_parser_helper.h +2 -2
@@ -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
Signature · 6 lines
2.9.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 10/10 amdgpu/dc: inline dml_round_to_multiple
In reply to a message not in the archiveFrom: Dave Airlie <[email protected]>
turns out to be a win to inline this.
--- 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(-)
drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.c +0 -19
@@ -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); -}
drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.h +0 -2
@@ -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__ */
drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h +19 -0
@@ -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
Signature · 6 lines
2.9.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20170929071331.18132-10-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Harry Wentland
Reviewed-byRe: [PATCH 10/10] amdgpu/dc: inline dml_round_to_multiple
Quoted 5 lines · Dave Airlie
From: Dave Airlie <[email protected]>
turns out to be a win to inline this.
Signed-off-by Dave Airlie <[email protected]>
Series is
Harry
Quoted 65 lines
--- 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(-)drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.c +0
-19@@ -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); -}drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.h +0
-2@@ -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__ */ drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h +10
-0@@ -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;
drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h static inline double dml_log(double x, double base) · line 80
Quoted 10 lines
drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h +9
-0+ +if (remainder ==0 ) +return num; + +if (up) +return (num + multiple - remainder); +else + return (num - remainder); +}#endif
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx