Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

amdgpu/dc: inline some of the fixed 32_32 fns

This drops ~400 bytes here.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Dave Airlie and committed by
Alex Deucher
c4fee879 6be663b5

+61 -75
-60
drivers/gpu/drm/amd/display/dc/basics/fixpt32_32.c
··· 57 57 return fx; 58 58 } 59 59 60 - struct fixed32_32 dal_fixed32_32_from_int(uint32_t value) 61 - { 62 - struct fixed32_32 fx; 63 - 64 - fx.value = (uint64_t)value<<32; 65 - return fx; 66 - } 67 - 68 60 struct fixed32_32 dal_fixed32_32_add( 69 61 struct fixed32_32 lhs, 70 62 struct fixed32_32 rhs) ··· 147 155 return fx; 148 156 } 149 157 150 - struct fixed32_32 dal_fixed32_32_min( 151 - struct fixed32_32 lhs, 152 - struct fixed32_32 rhs) 153 - { 154 - return (lhs.value < rhs.value) ? lhs : rhs; 155 - } 156 - 157 - struct fixed32_32 dal_fixed32_32_max( 158 - struct fixed32_32 lhs, 159 - struct fixed32_32 rhs) 160 - { 161 - return (lhs.value > rhs.value) ? lhs : rhs; 162 - } 163 - 164 - bool dal_fixed32_32_gt(struct fixed32_32 lhs, struct fixed32_32 rhs) 165 - { 166 - return lhs.value > rhs.value; 167 - } 168 - bool dal_fixed32_32_gt_int(struct fixed32_32 lhs, uint32_t rhs) 169 - { 170 - return lhs.value > ((uint64_t)rhs<<32); 171 - } 172 - 173 - bool dal_fixed32_32_lt(struct fixed32_32 lhs, struct fixed32_32 rhs) 174 - { 175 - return lhs.value < rhs.value; 176 - } 177 - 178 - bool dal_fixed32_32_le(struct fixed32_32 lhs, struct fixed32_32 rhs) 179 - { 180 - return lhs.value <= rhs.value; 181 - } 182 - 183 - bool dal_fixed32_32_lt_int(struct fixed32_32 lhs, uint32_t rhs) 184 - { 185 - return lhs.value < ((uint64_t)rhs<<32); 186 - } 187 - 188 - bool dal_fixed32_32_le_int(struct fixed32_32 lhs, uint32_t rhs) 189 - { 190 - return lhs.value <= ((uint64_t)rhs<<32); 191 - } 192 - 193 158 uint32_t dal_fixed32_32_ceil(struct fixed32_32 v) 194 159 { 195 160 ASSERT((uint32_t)v.value ? (v.value >> 32) + 1 >= 1 : true); 196 161 return (v.value>>32) + ((uint32_t)v.value ? 1 : 0); 197 - } 198 - 199 - uint32_t dal_fixed32_32_floor(struct fixed32_32 v) 200 - { 201 - return v.value>>32; 202 162 } 203 163 204 164 uint32_t dal_fixed32_32_round(struct fixed32_32 v) ··· 159 215 return (v.value + (1ULL<<31))>>32; 160 216 } 161 217 162 - bool dal_fixed32_32_eq(struct fixed32_32 lhs, struct fixed32_32 rhs) 163 - { 164 - return lhs.value == rhs.value; 165 - }
+61 -15
drivers/gpu/drm/amd/display/include/fixed32_32.h
··· 38 38 static const struct fixed32_32 dal_fixed32_32_half = { 0x80000000LL }; 39 39 40 40 struct fixed32_32 dal_fixed32_32_from_fraction(uint32_t n, uint32_t d); 41 - struct fixed32_32 dal_fixed32_32_from_int(uint32_t value); 41 + static inline struct fixed32_32 dal_fixed32_32_from_int(uint32_t value) 42 + { 43 + struct fixed32_32 fx; 44 + 45 + fx.value = (uint64_t)value<<32; 46 + return fx; 47 + } 48 + 42 49 struct fixed32_32 dal_fixed32_32_add( 43 50 struct fixed32_32 lhs, 44 51 struct fixed32_32 rhs); ··· 70 63 struct fixed32_32 dal_fixed32_32_div_int( 71 64 struct fixed32_32 lhs, 72 65 uint32_t rhs); 73 - struct fixed32_32 dal_fixed32_32_min( 74 - struct fixed32_32 lhs, 75 - struct fixed32_32 rhs); 76 - struct fixed32_32 dal_fixed32_32_max( 77 - struct fixed32_32 lhs, 78 - struct fixed32_32 rhs); 79 - bool dal_fixed32_32_gt(struct fixed32_32 lhs, struct fixed32_32 rhs); 80 - bool dal_fixed32_32_gt_int(struct fixed32_32 lhs, uint32_t rhs); 81 - bool dal_fixed32_32_lt(struct fixed32_32 lhs, struct fixed32_32 rhs); 82 - bool dal_fixed32_32_lt_int(struct fixed32_32 lhs, uint32_t rhs); 83 - bool dal_fixed32_32_le(struct fixed32_32 lhs, struct fixed32_32 rhs); 84 - bool dal_fixed32_32_le_int(struct fixed32_32 lhs, uint32_t rhs); 85 - bool dal_fixed32_32_eq(struct fixed32_32 lhs, struct fixed32_32 rhs); 66 + 67 + static inline struct fixed32_32 dal_fixed32_32_min(struct fixed32_32 lhs, 68 + struct fixed32_32 rhs) 69 + { 70 + return (lhs.value < rhs.value) ? lhs : rhs; 71 + } 72 + 73 + static inline struct fixed32_32 dal_fixed32_32_max(struct fixed32_32 lhs, 74 + struct fixed32_32 rhs) 75 + { 76 + return (lhs.value > rhs.value) ? lhs : rhs; 77 + } 78 + 79 + static inline bool dal_fixed32_32_gt(struct fixed32_32 lhs, struct fixed32_32 rhs) 80 + { 81 + return lhs.value > rhs.value; 82 + } 83 + 84 + static inline bool dal_fixed32_32_gt_int(struct fixed32_32 lhs, uint32_t rhs) 85 + { 86 + return lhs.value > ((uint64_t)rhs<<32); 87 + } 88 + 89 + static inline bool dal_fixed32_32_lt(struct fixed32_32 lhs, struct fixed32_32 rhs) 90 + { 91 + return lhs.value < rhs.value; 92 + } 93 + 94 + static inline bool dal_fixed32_32_lt_int(struct fixed32_32 lhs, uint32_t rhs) 95 + { 96 + return lhs.value < ((uint64_t)rhs<<32); 97 + } 98 + 99 + static inline bool dal_fixed32_32_le(struct fixed32_32 lhs, struct fixed32_32 rhs) 100 + { 101 + return lhs.value <= rhs.value; 102 + } 103 + 104 + static inline bool dal_fixed32_32_le_int(struct fixed32_32 lhs, uint32_t rhs) 105 + { 106 + return lhs.value <= ((uint64_t)rhs<<32); 107 + } 108 + 109 + static inline bool dal_fixed32_32_eq(struct fixed32_32 lhs, struct fixed32_32 rhs) 110 + { 111 + return lhs.value == rhs.value; 112 + } 113 + 86 114 uint32_t dal_fixed32_32_ceil(struct fixed32_32 value); 87 - uint32_t dal_fixed32_32_floor(struct fixed32_32 value); 115 + static inline uint32_t dal_fixed32_32_floor(struct fixed32_32 value) 116 + { 117 + return value.value>>32; 118 + } 119 + 88 120 uint32_t dal_fixed32_32_round(struct fixed32_32 value); 89 121 90 122 #endif