drm/i915: extract fixed point math to i915_fixed.h
Subsystems (2)
PATCH v2 1/5 drm/i915: extract fixed point math to i915_fixed.h
Reduce bloat in one of the bigger header files. Fix some indentation while at it. No functional changes.
v2: Add include guards (Joonas)
--- drivers/gpu/drm/i915/i915_drv.h | 139 +---------------------------------- drivers/gpu/drm/i915/i915_fixed.h | 147 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 148 insertions(+), 138 deletions(-) create mode 100644 drivers/gpu/drm/i915/i915_fixed.h
drivers/gpu/drm/i915/i915_drv.h +1 -138
@@ -54,6 +54,7 @@#include <drm/drm_cache.h> #include <drm/drm_util.h> +#include "i915_fixed.h" #include "i915_params.h" #include "i915_reg.h" #include "i915_utils.h"
@@ -127,144 +128,6 @@ bool i915_error_injected(void);__i915_printk (i915,i915_error_injected () ?KERN_DEBUG :KERN_ERR , \ fmt, ##__VA_ARGS__) -typedef struct { -uint32_t val; -}uint_fixed_16_16_t ; - -#define FP_16_16_MAX ({ \ - uint_fixed_16_16_t fp; \ - fp.val = UINT_MAX; \ - fp; \ -}) - -static inline bool is_fixed16_zero (uint_fixed_16_16_t val) -{ -if (val.val ==0 ) -return true; -return false; -} - -static inline uint_fixed_16_16_t u32_to_fixed16 (uint32_t val) -{ -uint_fixed_16_16_t fp; - -WARN_ON (val >U16_MAX ); - - fp.val = val <<16 ; -return fp; -} - -static inline uint32_t fixed16_to_u32_round_up (uint_fixed_16_16_t fp) -{ -return DIV_ROUND_UP (fp.val,1 <<16 ); -} - -static inline uint32_t fixed16_to_u32 (uint_fixed_16_16_t fp) -{ -return fp.val >>16 ; -} - -static inline uint_fixed_16_16_t min_fixed16 (uint_fixed_16_16_t min1, -uint_fixed_16_16_t min2) -{ -uint_fixed_16_16_t min; - - min.val =min (min1.val, min2.val); -return min; -} - -static inline uint_fixed_16_16_t max_fixed16 (uint_fixed_16_16_t max1, -uint_fixed_16_16_t max2) -{ -uint_fixed_16_16_t max; - - max.val =max (max1.val, max2.val); -return max; -} - -static inline uint_fixed_16_16_t clamp_u64_to_fixed16 (uint64_t val) -{ -uint_fixed_16_16_t fp; -WARN_ON (val >U32_MAX ); - fp.val = (uint32_t ) val; -return fp; -} - -static inline uint32_t div_round_up_fixed16 (uint_fixed_16_16_t val, -uint_fixed_16_16_t d) -{ -return DIV_ROUND_UP (val.val, d.val); -} - -static inline uint32_t mul_round_up_u32_fixed16 (uint32_t val, -uint_fixed_16_16_t mul) -{ -uint64_t intermediate_val; - - intermediate_val = (uint64_t ) val * mul.val; - intermediate_val =DIV_ROUND_UP_ULL (intermediate_val,1 <<16 ); -WARN_ON (intermediate_val >U32_MAX ); -return (uint32_t ) intermediate_val; -} - -static inline uint_fixed_16_16_t mul_fixed16 (uint_fixed_16_16_t val, -uint_fixed_16_16_t mul) -{ -uint64_t intermediate_val; - - intermediate_val = (uint64_t ) val.val * mul.val; - intermediate_val = intermediate_val >>16 ; -return clamp_u64_to_fixed16 (intermediate_val); -} - -static inline uint_fixed_16_16_t div_fixed16 (uint32_t val,uint32_t d) -{ -uint64_t interm_val; - - interm_val = (uint64_t )val <<16 ; - interm_val =DIV_ROUND_UP_ULL (interm_val, d); -return clamp_u64_to_fixed16 (interm_val); -} - -static inline uint32_t div_round_up_u32_fixed16 (uint32_t val, -uint_fixed_16_16_t d) -{ -uint64_t interm_val; - - interm_val = (uint64_t )val <<16 ; - interm_val =DIV_ROUND_UP_ULL (interm_val, d.val); -WARN_ON (interm_val >U32_MAX ); -return (uint32_t ) interm_val; -} - -static inline uint_fixed_16_16_t mul_u32_fixed16 (uint32_t val, -uint_fixed_16_16_t mul) -{ -uint64_t intermediate_val; - - intermediate_val = (uint64_t ) val * mul.val; -return clamp_u64_to_fixed16 (intermediate_val); -} - -static inline uint_fixed_16_16_t add_fixed16 (uint_fixed_16_16_t add1, -uint_fixed_16_16_t add2) -{ -uint64_t interm_sum; - - interm_sum = (uint64_t ) add1.val + add2.val; -return clamp_u64_to_fixed16 (interm_sum); -} - -static inline uint_fixed_16_16_t add_fixed16_u32 (uint_fixed_16_16_t add1, -uint32_t add2) -{ -uint64_t interm_sum; -uint_fixed_16_16_t interm_add2 =u32_to_fixed16 (add2); - - interm_sum = (uint64_t ) add1.val + interm_add2.val; -return clamp_u64_to_fixed16 (interm_sum); -} -enum hpd_pin {HPD_NONE =0 ,HPD_TV =HPD_NONE ,/* TV is known to be unreliable */
drivers/gpu/drm/i915/i915_fixed.h new file +147 -0
147 lines not on this page · raw message
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 2/5 drm/i915/fixed: prefer kernel types over stdint types
While at it, conform to kernel spacing (i.e. no space) after cast. No functional changes.
--- drivers/gpu/drm/i915/i915_fixed.h | 61 +++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 32 deletions(-)
drivers/gpu/drm/i915/i915_fixed.h +29 -32
@@ -7,7 +7,7 @@#define _I915_FIXED_H_typedef struct { -uint32_t val; +u32 val; }uint_fixed_16_16_t ;#define FP_16_16_MAX ({ \
@@ -23,7 +23,7 @@ static inline bool is_fixed16_zero(uint_fixed_16_16_t val)return false; } -static inline uint_fixed_16_16_t u32_to_fixed16 (uint32_t val) +static inline uint_fixed_16_16_t u32_to_fixed16 (u32 val) {uint_fixed_16_16_t fp;
@@ -33,12 +33,12 @@ static inline uint_fixed_16_16_t u32_to_fixed16(uint32_t val)return fp; } -static inline uint32_t fixed16_to_u32_round_up (uint_fixed_16_16_t fp) +static inline u32 fixed16_to_u32_round_up (uint_fixed_16_16_t fp) {return DIV_ROUND_UP (fp.val,1 <<16 ); } -static inline uint32_t fixed16_to_u32 (uint_fixed_16_16_t fp) +static inline u32 fixed16_to_u32 (uint_fixed_16_16_t fp) {return fp.val >>16 ; }
@@ -61,86 +61,83 @@ static inline uint_fixed_16_16_t max_fixed16(uint_fixed_16_16_t max1,return max; } -static inline uint_fixed_16_16_t clamp_u64_to_fixed16 (uint64_t val) +static inline uint_fixed_16_16_t clamp_u64_to_fixed16 (u64 val) {uint_fixed_16_16_t fp;WARN_ON (val >U32_MAX ); - fp.val = (uint32_t ) val; + fp.val = (u32 )val;return fp; } -static inline uint32_t div_round_up_fixed16 (uint_fixed_16_16_t val, -uint_fixed_16_16_t d) +static inline u32 div_round_up_fixed16 (uint_fixed_16_16_t val, +uint_fixed_16_16_t d) {return DIV_ROUND_UP (val.val, d.val); } -static inline uint32_t mul_round_up_u32_fixed16 (uint32_t val, -uint_fixed_16_16_t mul) +static inline u32 mul_round_up_u32_fixed16 (u32 val,uint_fixed_16_16_t mul) { -uint64_t intermediate_val; +u64 intermediate_val; - intermediate_val = (uint64_t ) val * mul.val; + intermediate_val = (u64 )val * mul.val; intermediate_val =DIV_ROUND_UP_ULL (intermediate_val,1 <<16 );WARN_ON (intermediate_val >U32_MAX ); -return (uint32_t ) intermediate_val; +return (u32 )intermediate_val; }static inline uint_fixed_16_16_t mul_fixed16 (uint_fixed_16_16_t val,uint_fixed_16_16_t mul) { -uint64_t intermediate_val; +u64 intermediate_val; - intermediate_val = (uint64_t ) val.val * mul.val; + intermediate_val = (u64 )val.val * mul.val; intermediate_val = intermediate_val >>16 ;return clamp_u64_to_fixed16 (intermediate_val); } -static inline uint_fixed_16_16_t div_fixed16 (uint32_t val,uint32_t d) +static inline uint_fixed_16_16_t div_fixed16 (u32 val,u32 d) { -uint64_t interm_val; +u64 interm_val; - interm_val = (uint64_t )val <<16 ; + interm_val = (u64 )val <<16 ; interm_val =DIV_ROUND_UP_ULL (interm_val, d);return clamp_u64_to_fixed16 (interm_val); } -static inline uint32_t div_round_up_u32_fixed16 (uint32_t val, -uint_fixed_16_16_t d) +static inline u32 div_round_up_u32_fixed16 (u32 val,uint_fixed_16_16_t d) { -uint64_t interm_val; +u64 interm_val; - interm_val = (uint64_t )val <<16 ; + interm_val = (u64 )val <<16 ; interm_val =DIV_ROUND_UP_ULL (interm_val, d.val);WARN_ON (interm_val >U32_MAX ); -return (uint32_t ) interm_val; +return (u32 )interm_val; } -static inline uint_fixed_16_16_t mul_u32_fixed16 (uint32_t val, -uint_fixed_16_16_t mul) +static inline uint_fixed_16_16_t mul_u32_fixed16 (u32 val,uint_fixed_16_16_t mul) { -uint64_t intermediate_val; +u64 intermediate_val; - intermediate_val = (uint64_t ) val * mul.val; + intermediate_val = (u64 )val * mul.val;return clamp_u64_to_fixed16 (intermediate_val); }static inline uint_fixed_16_16_t add_fixed16 (uint_fixed_16_16_t add1,uint_fixed_16_16_t add2) { -uint64_t interm_sum; +u64 interm_sum; - interm_sum = (uint64_t ) add1.val + add2.val; + interm_sum = (u64 )add1.val + add2.val;return clamp_u64_to_fixed16 (interm_sum); }static inline uint_fixed_16_16_t add_fixed16_u32 (uint_fixed_16_16_t add1, -uint32_t add2) +u32 add2) { -uint64_t interm_sum; +u64 interm_sum;uint_fixed_16_16_t interm_add2 =u32_to_fixed16 (add2); - interm_sum = (uint64_t ) add1.val + interm_add2.val; + interm_sum = (u64 )add1.val + interm_add2.val;return clamp_u64_to_fixed16 (interm_sum); }
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Rodrigo Vivi
maintainerRe: [PATCH v2 2/5] drm/i915/fixed: prefer kernel types over stdint types
Quoted 2 lines · Jani Nikula
While at it, conform to kernel spacing (i.e. no space) after cast. No functional changes.
could we do a sed or cocinelle patch for a massive update on this?
Quoted 163 lines
Reviewed-by Joonas Lahtinen <[email protected]>Signed-off-by Jani Nikula <[email protected]>--- drivers/gpu/drm/i915/i915_fixed.h | 61 +++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 32 deletions(-)drivers/gpu/drm/i915/i915_fixed.h +29
-32@@ -7,7 +7,7 @@#define _I915_FIXED_H_typedef struct { -uint32_t val; +u32 val; }uint_fixed_16_16_t ;#define FP_16_16_MAX ({ \@@ -23,7 +23,7 @@ static inline bool is_fixed16_zero(uint_fixed_16_16_t val)return false; } -static inline uint_fixed_16_16_t u32_to_fixed16 (uint32_t val) +static inline uint_fixed_16_16_t u32_to_fixed16 (u32 val) {uint_fixed_16_16_t fp;@@ -33,12 +33,12 @@ static inline uint_fixed_16_16_t u32_to_fixed16(uint32_t val)return fp; } -static inline uint32_t fixed16_to_u32_round_up (uint_fixed_16_16_t fp) +static inline u32 fixed16_to_u32_round_up (uint_fixed_16_16_t fp) {return DIV_ROUND_UP (fp.val,1 <<16 ); } -static inline uint32_t fixed16_to_u32 (uint_fixed_16_16_t fp) +static inline u32 fixed16_to_u32 (uint_fixed_16_16_t fp) {return fp.val >>16 ; }@@ -61,86 +61,83 @@ static inline uint_fixed_16_16_t max_fixed16(uint_fixed_16_16_t max1,return max; } -static inline uint_fixed_16_16_t clamp_u64_to_fixed16 (uint64_t val) +static inline uint_fixed_16_16_t clamp_u64_to_fixed16 (u64 val) {uint_fixed_16_16_t fp;WARN_ON (val >U32_MAX ); - fp.val = (uint32_t ) val; + fp.val = (u32 )val;return fp; } -static inline uint32_t div_round_up_fixed16 (uint_fixed_16_16_t val, -uint_fixed_16_16_t d) +static inline u32 div_round_up_fixed16 (uint_fixed_16_16_t val, +uint_fixed_16_16_t d) {return DIV_ROUND_UP (val.val, d.val); } -static inline uint32_t mul_round_up_u32_fixed16 (uint32_t val, -uint_fixed_16_16_t mul) +static inline u32 mul_round_up_u32_fixed16 (u32 val,uint_fixed_16_16_t mul) { -uint64_t intermediate_val; +u64 intermediate_val; - intermediate_val = (uint64_t ) val * mul.val; + intermediate_val = (u64 )val * mul.val; intermediate_val =DIV_ROUND_UP_ULL (intermediate_val,1 <<16 );WARN_ON (intermediate_val >U32_MAX ); -return (uint32_t ) intermediate_val; +return (u32 )intermediate_val; }static inline uint_fixed_16_16_t mul_fixed16 (uint_fixed_16_16_t val,uint_fixed_16_16_t mul) { -uint64_t intermediate_val; +u64 intermediate_val; - intermediate_val = (uint64_t ) val.val * mul.val; + intermediate_val = (u64 )val.val * mul.val; intermediate_val = intermediate_val >>16 ;return clamp_u64_to_fixed16 (intermediate_val); } -static inline uint_fixed_16_16_t div_fixed16 (uint32_t val,uint32_t d) +static inline uint_fixed_16_16_t div_fixed16 (u32 val,u32 d) { -uint64_t interm_val; +u64 interm_val; - interm_val = (uint64_t )val <<16 ; + interm_val = (u64 )val <<16 ; interm_val =DIV_ROUND_UP_ULL (interm_val, d);return clamp_u64_to_fixed16 (interm_val); } -static inline uint32_t div_round_up_u32_fixed16 (uint32_t val, -uint_fixed_16_16_t d) +static inline u32 div_round_up_u32_fixed16 (u32 val,uint_fixed_16_16_t d) { -uint64_t interm_val; +u64 interm_val; - interm_val = (uint64_t )val <<16 ; + interm_val = (u64 )val <<16 ; interm_val =DIV_ROUND_UP_ULL (interm_val, d.val);WARN_ON (interm_val >U32_MAX ); -return (uint32_t ) interm_val; +return (u32 )interm_val; } -static inline uint_fixed_16_16_t mul_u32_fixed16 (uint32_t val, -uint_fixed_16_16_t mul) +static inline uint_fixed_16_16_t mul_u32_fixed16 (u32 val,uint_fixed_16_16_t mul) { -uint64_t intermediate_val; +u64 intermediate_val; - intermediate_val = (uint64_t ) val * mul.val; + intermediate_val = (u64 )val * mul.val;return clamp_u64_to_fixed16 (intermediate_val); }static inline uint_fixed_16_16_t add_fixed16 (uint_fixed_16_16_t add1,uint_fixed_16_16_t add2) { -uint64_t interm_sum; +u64 interm_sum; - interm_sum = (uint64_t ) add1.val + add2.val; + interm_sum = (u64 )add1.val + add2.val;return clamp_u64_to_fixed16 (interm_sum); }static inline uint_fixed_16_16_t add_fixed16_u32 (uint_fixed_16_16_t add1, -uint32_t add2) +u32 add2) { -uint64_t interm_sum; +u64 interm_sum;uint_fixed_16_16_t interm_add2 =u32_to_fixed16 (add2); - interm_sum = (uint64_t ) add1.val + interm_add2.val; + interm_sum = (u64 )add1.val + interm_add2.val;return clamp_u64_to_fixed16 (interm_sum); }Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 3/5 drm/i915/fixed: simplify FP_16_16_MAX definition
In reply to Jani NikulaNo need to use a compound statement enclosed in parenthesis where a C99 compound literal will do. No functional changes.
--- drivers/gpu/drm/i915/i915_fixed.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_fixed.h +1 -5
@@ -10,11 +10,7 @@ typedef struct {u32 val; } uint_fixed_16_16_t; -#define FP_16_16_MAX ({ \ - uint_fixed_16_16_t fp; \ - fp.val = UINT_MAX; \ - fp; \ -}) +#define FP_16_16_MAX ((uint_fixed_16_16_t){ .val = UINT_MAX })static inline bool is_fixed16_zero (uint_fixed_16_16_t val) {
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 4/5 drm/i915/fixed: simplify is_fixed16_zero()
In reply to Jani NikulaSimply return the condition. No functional changes.
--- drivers/gpu/drm/i915/i915_fixed.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_fixed.h +1 -3
@@ -14,9 +14,7 @@ typedef struct {static inline bool is_fixed16_zero (uint_fixed_16_16_t val) { -if (val.val ==0 ) -return true; -return false; +return val.val ==0 ; }static inline uint_fixed_16_16_t u32_to_fixed16 (u32 val)
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 5/5 drm/i915/fixed: cosmetic cleanup
In reply to Jani NikulaClean up fixed point temp variable initialization, use the more conventional tmp name for temp variables, add empty lines before return. No functional changes.
--- drivers/gpu/drm/i915/i915_fixed.h | 77 +++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 36 deletions(-)
drivers/gpu/drm/i915/i915_fixed.h +41 -36
@@ -19,11 +19,10 @@ static inline bool is_fixed16_zero(uint_fixed_16_16_t val)static inline uint_fixed_16_16_t u32_to_fixed16 (u32 val) { -uint_fixed_16_16_t fp; +uint_fixed_16_16_t fp = { .val = val <<16 };WARN_ON (val >U16_MAX ); - fp.val = val <<16 ;return fp; }
@@ -40,26 +39,25 @@ static inline u32 fixed16_to_u32(uint_fixed_16_16_t fp)static inline uint_fixed_16_16_t min_fixed16 (uint_fixed_16_16_t min1,uint_fixed_16_16_t min2) { -uint_fixed_16_16_t min; +uint_fixed_16_16_t min = { .val =min (min1.val, min2.val) }; - min.val =min (min1.val, min2.val);return min; }static inline uint_fixed_16_16_t max_fixed16 (uint_fixed_16_16_t max1,uint_fixed_16_16_t max2) { -uint_fixed_16_16_t max; +uint_fixed_16_16_t max = { .val =max (max1.val, max2.val) }; - max.val =max (max1.val, max2.val);return max; }static inline uint_fixed_16_16_t clamp_u64_to_fixed16 (u64 val) { -uint_fixed_16_16_t fp; +uint_fixed_16_16_t fp = { .val = (u32 )val }; +WARN_ON (val >U32_MAX ); - fp.val = (u32 )val; +return fp; }
@@ -71,68 +69,75 @@ static inline u32 div_round_up_fixed16(uint_fixed_16_16_t val,static inline u32 mul_round_up_u32_fixed16 (u32 val,uint_fixed_16_16_t mul) { -u64 intermediate_val; +u64 tmp; + + tmp = (u64 )val * mul.val; + tmp =DIV_ROUND_UP_ULL (tmp,1 <<16 ); +WARN_ON (tmp >U32_MAX ); - intermediate_val = (u64 )val * mul.val; - intermediate_val =DIV_ROUND_UP_ULL (intermediate_val,1 <<16 ); -WARN_ON (intermediate_val >U32_MAX ); -return (u32 )intermediate_val; +return (u32 )tmp; }static inline uint_fixed_16_16_t mul_fixed16 (uint_fixed_16_16_t val,uint_fixed_16_16_t mul) { -u64 intermediate_val; +u64 tmp; - intermediate_val = (u64 )val.val * mul.val; - intermediate_val = intermediate_val >>16 ; -return clamp_u64_to_fixed16 (intermediate_val); + tmp = (u64 )val.val * mul.val; + tmp = tmp >>16 ; + +return clamp_u64_to_fixed16 (tmp); }static inline uint_fixed_16_16_t div_fixed16 (u32 val,u32 d) { -u64 interm_val; +u64 tmp; + + tmp = (u64 )val <<16 ; + tmp =DIV_ROUND_UP_ULL (tmp, d); - interm_val = (u64 )val <<16 ; - interm_val =DIV_ROUND_UP_ULL (interm_val, d); -return clamp_u64_to_fixed16 (interm_val); +return clamp_u64_to_fixed16 (tmp); }static inline u32 div_round_up_u32_fixed16 (u32 val,uint_fixed_16_16_t d) { -u64 interm_val; +u64 tmp; - interm_val = (u64 )val <<16 ; - interm_val =DIV_ROUND_UP_ULL (interm_val, d.val); -WARN_ON (interm_val >U32_MAX ); -return (u32 )interm_val; + tmp = (u64 )val <<16 ; + tmp =DIV_ROUND_UP_ULL (tmp, d.val); +WARN_ON (tmp >U32_MAX ); + +return (u32 )tmp; }static inline uint_fixed_16_16_t mul_u32_fixed16 (u32 val,uint_fixed_16_16_t mul) { -u64 intermediate_val; +u64 tmp; + + tmp = (u64 )val * mul.val; - intermediate_val = (u64 )val * mul.val; -return clamp_u64_to_fixed16 (intermediate_val); +return clamp_u64_to_fixed16 (tmp); }static inline uint_fixed_16_16_t add_fixed16 (uint_fixed_16_16_t add1,uint_fixed_16_16_t add2) { -u64 interm_sum; +u64 tmp; - interm_sum = (u64 )add1.val + add2.val; -return clamp_u64_to_fixed16 (interm_sum); + tmp = (u64 )add1.val + add2.val; + +return clamp_u64_to_fixed16 (tmp); }static inline uint_fixed_16_16_t add_fixed16_u32 (uint_fixed_16_16_t add1,u32 add2) { -u64 interm_sum; -uint_fixed_16_16_t interm_add2 =u32_to_fixed16 (add2); +uint_fixed_16_16_t tmp_add2 =u32_to_fixed16 (add2); +u64 tmp; + + tmp = (u64 )add1.val + tmp_add2.val; - interm_sum = (u64 )add1.val + interm_add2.val; -return clamp_u64_to_fixed16 (interm_sum); +return clamp_u64_to_fixed16 (tmp); }#endif /* _I915_FIXED_H_ */
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.CHECKPATCH: warning for series starting with [v2,1/5] drm/i915: extract fixed point math to i915_fixed.h
In reply to Jani Nikula== Series Details ==
== Series Details ==
Series: series starting with [v2,1/5] drm/i915: extract fixed point math to i915_fixed.h
URL : https://patchwork.freedesktop.org/series/52608/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip 8b6b415c312d drm/i915: extract fixed point math to i915_fixed.h -:172: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #172: new file mode 100644
-:185: WARNING:NEW_TYPEDEFS: do not add new typedefs #185: FILE: drivers/gpu/drm/i915/i915_fixed.h:9:
+typedef struct {
-:243: WARNING:LINE_SPACING: Missing a blank line after declarations #243: FILE: drivers/gpu/drm/i915/i915_fixed.h:67:
+ uint_fixed_16_16_t fp;
+ WARN_ON(val > U32_MAX);
-:244: CHECK:SPACING: No space is necessary after a cast #244: FILE: drivers/gpu/drm/i915/i915_fixed.h:68:
+ fp.val = (uint32_t) val;
-:259: CHECK:SPACING: No space is necessary after a cast #259: FILE: drivers/gpu/drm/i915/i915_fixed.h:83:
+ intermediate_val = (uint64_t) val * mul.val;
-:262: CHECK:SPACING: No space is necessary after a cast #262: FILE: drivers/gpu/drm/i915/i915_fixed.h:86:
+ return (uint32_t) intermediate_val;
-:270: CHECK:SPACING: No space is necessary after a cast #270: FILE: drivers/gpu/drm/i915/i915_fixed.h:94:
+ intermediate_val = (uint64_t) val.val * mul.val;
-:292: CHECK:SPACING: No space is necessary after a cast #292: FILE: drivers/gpu/drm/i915/i915_fixed.h:116:
+ return (uint32_t) interm_val;
-:300: CHECK:SPACING: No space is necessary after a cast #300: FILE: drivers/gpu/drm/i915/i915_fixed.h:124:
+ intermediate_val = (uint64_t) val * mul.val;
-:309: CHECK:SPACING: No space is necessary after a cast #309: FILE: drivers/gpu/drm/i915/i915_fixed.h:133:
+ interm_sum = (uint64_t) add1.val + add2.val;
-:319: CHECK:SPACING: No space is necessary after a cast #319: FILE: drivers/gpu/drm/i915/i915_fixed.h:143:
+ interm_sum = (uint64_t) add1.val + interm_add2.val;
total: 0 errors, 3 warnings, 8 checks, 298 lines checked 6f246d68ba40 drm/i915/fixed: prefer kernel types over stdint types a16ca22d5f12 drm/i915/fixed: simplify FP_16_16_MAX definition 6224a283b3bb drm/i915/fixed: simplify is_fixed16_zero() 50d2d523f15e drm/i915/fixed: cosmetic cleanup
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.SPARSE: warning for series starting with [v2,1/5] drm/i915: extract fixed point math to i915_fixed.h
In reply to Jani Nikula== Series Details ==
== Series Details ==
Series: series starting with [v2,1/5] drm/i915: extract fixed point math to i915_fixed.h
URL : https://patchwork.freedesktop.org/series/52608/
State : warning
== Summary ==
$ dim sparse origin/drm-tip Sparse version: v0.5.2 Commit: drm/i915: extract fixed point math to i915_fixed.h -O:drivers/gpu/drm/i915/i915_drv.h:172:19: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/i915_drv.h:172:19: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/i915_drv.h:172:19: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/i915_drv.h:172:19: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/i915_drv.h:181:19: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/i915_drv.h:181:19: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/i915_drv.h:181:19: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/i915_drv.h:181:19: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/i915_drv.h:181:19: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/i915_drv.h:181:19: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/i915_drv.h:181:19: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/i915_drv.h:181:19: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/i915_drv.h:181:19: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/i915_drv.h:181:19: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/i915_drv.h:181:19: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/i915_drv.h:181:19: warning: expression using sizeof(void) +drivers/gpu/drm/i915/i915_fixed.h:51:19: warning: expression using sizeof(void) +drivers/gpu/drm/i915/i915_fixed.h:51:19: warning: expression using sizeof(void) +drivers/gpu/drm/i915/i915_fixed.h:51:19: warning: expression using sizeof(void) +drivers/gpu/drm/i915/i915_fixed.h:51:19: warning: expression using sizeof(void) +drivers/gpu/drm/i915/i915_fixed.h:60:19: warning: expression using sizeof(void) +drivers/gpu/drm/i915/i915_fixed.h:60:19: warning: expression using sizeof(void) +drivers/gpu/drm/i915/i915_fixed.h:60:19: warning: expression using sizeof(void) +drivers/gpu/drm/i915/i915_fixed.h:60:19: warning: expression using sizeof(void) +drivers/gpu/drm/i915/i915_fixed.h:60:19: warning: expression using sizeof(void) +drivers/gpu/drm/i915/i915_fixed.h:60:19: warning: expression using sizeof(void) +drivers/gpu/drm/i915/i915_fixed.h:60:19: warning: expression using sizeof(void) +drivers/gpu/drm/i915/i915_fixed.h:60:19: warning: expression using sizeof(void) +drivers/gpu/drm/i915/i915_fixed.h:60:19: warning: expression using sizeof(void) +drivers/gpu/drm/i915/i915_fixed.h:60:19: warning: expression using sizeof(void) +drivers/gpu/drm/i915/i915_fixed.h:60:19: warning: expression using sizeof(void) +drivers/gpu/drm/i915/i915_fixed.h:60:19: warning: expression using sizeof(void) -drivers/gpu/drm/i915/selftests/../i915_drv.h:3705:16: warning: expression using sizeof(void) +drivers/gpu/drm/i915/selftests/../i915_drv.h:3568:16: warning: expression using sizeof(void)
Commit: drm/i915/fixed: prefer kernel types over stdint types Okay!
Commit: drm/i915/fixed: simplify FP_16_16_MAX definition Okay!
Commit: drm/i915/fixed: simplify is_fixed16_zero() Okay!
Commit: drm/i915/fixed: cosmetic cleanup -O:drivers/gpu/drm/i915/i915_fixed.h:45:19: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/i915_fixed.h:45:19: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/i915_fixed.h:45:19: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/i915_fixed.h:45:19: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/i915_fixed.h:54:19: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/i915_fixed.h:54:19: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/i915_fixed.h:54:19: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/i915_fixed.h:54:19: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/i915_fixed.h:54:19: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/i915_fixed.h:54:19: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/i915_fixed.h:54:19: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/i915_fixed.h:54:19: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/i915_fixed.h:54:19: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/i915_fixed.h:54:19: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/i915_fixed.h:54:19: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/i915_fixed.h:54:19: warning: expression using sizeof(void) +drivers/gpu/drm/i915/i915_fixed.h:42:43: warning: expression using sizeof(void) +drivers/gpu/drm/i915/i915_fixed.h:42:43: warning: expression using sizeof(void) +drivers/gpu/drm/i915/i915_fixed.h:42:43: warning: expression using sizeof(void) +drivers/gpu/drm/i915/i915_fixed.h:42:43: warning: expression using sizeof(void) +drivers/gpu/drm/i915/i915_fixed.h:50:43: warning: expression using sizeof(void) +drivers/gpu/drm/i915/i915_fixed.h:50:43: warning: expression using sizeof(void) +drivers/gpu/drm/i915/i915_fixed.h:50:43: warning: expression using sizeof(void) +drivers/gpu/drm/i915/i915_fixed.h:50:43: warning: expression using sizeof(void) +drivers/gpu/drm/i915/i915_fixed.h:50:43: warning: expression using sizeof(void) +drivers/gpu/drm/i915/i915_fixed.h:50:43: warning: expression using sizeof(void) +drivers/gpu/drm/i915/i915_fixed.h:50:43: warning: expression using sizeof(void) +drivers/gpu/drm/i915/i915_fixed.h:50:43: warning: expression using sizeof(void) +drivers/gpu/drm/i915/i915_fixed.h:50:43: warning: expression using sizeof(void) +drivers/gpu/drm/i915/i915_fixed.h:50:43: warning: expression using sizeof(void) +drivers/gpu/drm/i915/i915_fixed.h:50:43: warning: expression using sizeof(void) +drivers/gpu/drm/i915/i915_fixed.h:50:43: warning: expression using sizeof(void)
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for series starting with [v2,1/5] drm/i915: extract fixed point math to i915_fixed.h
In reply to Jani Nikula== Series Details ==
== Series Details ==
Series: series starting with [v2,1/5] drm/i915: extract fixed point math to i915_fixed.h
URL : https://patchwork.freedesktop.org/series/52608/
State : success
== Summary ==
= CI Bug Log - changes from CI_DRM_5150 -> Patchwork_10838 =
== Summary - SUCCESS ==
No regressions found.
External URL: https://patchwork.freedesktop.org/api/1.0/series/52608/revisions/1/mbox/
== Possible new issues ==
Here are the unknown changes that may have been introduced in Patchwork_10838:
=== IGT changes ===
==== Possible regressions ====
igt@kms_chamelium@hdmi-hpd-fast:
{fi-kbl-7500u}: SKIP -> FAIL +2
==== Warnings ====
igt@kms_chamelium@common-hpd-after-suspend:
{fi-kbl-7500u}: DMESG-WARN (fdo#105602, fdo#105079, fdo#102505) -> FAIL== Known issues ==
Here are the changes found in Patchwork_10838 that come from known issues:
=== IGT changes ===
==== Issues hit ====
igt@gem_ctx_create@basic-files:
fi-bsw-n3050: PASS -> FAIL (fdo#108656)
fi-icl-u2: PASS -> DMESG-WARN (fdo#107724)
igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a:
fi-byt-clapper: PASS -> FAIL (fdo#107362)
==== Possible fixes ====
igt@drv_selftest@live_coherency:
fi-gdg-551: DMESG-FAIL (fdo#107164) -> PASS
igt@kms_pipe_crc_basic@hang-read-crc-pipe-a:
fi-snb-2520m: DMESG-FAIL (fdo#103713) -> PASS
==== Warnings ====
igt@drv_selftest@live_contexts:
fi-icl-u: DMESG-FAIL (fdo#108569) -> INCOMPLETE (fdo#108315) {name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
fdo#102505 https://bugs.freedesktop.org/show_bug.cgi?id=102505
fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fdo#105079 https://bugs.freedesktop.org/show_bug.cgi?id=105079
fdo#105602 https://bugs.freedesktop.org/show_bug.cgi?id=105602
fdo#107164 https://bugs.freedesktop.org/show_bug.cgi?id=107164
fdo#107362 https://bugs.freedesktop.org/show_bug.cgi?id=107362
fdo#107724 https://bugs.freedesktop.org/show_bug.cgi?id=107724
fdo#108315 https://bugs.freedesktop.org/show_bug.cgi?id=108315
fdo#108569 https://bugs.freedesktop.org/show_bug.cgi?id=108569
fdo#108656 https://bugs.freedesktop.org/show_bug.cgi?id=108656
== Participating hosts (50 -> 46) ==
Missing (4): fi-ilk-m540 fi-byt-squawks fi-hsw-4200u fi-pnv-d510
== Build changes ==
* Linux: CI_DRM_5150 -> Patchwork_10838
CI_DRM_5150: ab97324c7fb98fc8cadbe5ae4e50f36fb0137308 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4716: 111593c49d812a4f4ff9ab0ef053a3ab88a6f73f @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_10838: 50d2d523f15e654ef6f95c65b1637cf78518d31a @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
50d2d523f15e drm/i915/fixed: cosmetic cleanup 6224a283b3bb drm/i915/fixed: simplify is_fixed16_zero() a16ca22d5f12 drm/i915/fixed: simplify FP_16_16_MAX definition 6f246d68ba40 drm/i915/fixed: prefer kernel types over stdint types 8b6b415c312d drm/i915: extract fixed point math to i915_fixed.h
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_10838/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.IGT: success for series starting with [v2,1/5] drm/i915: extract fixed point math to i915_fixed.h
In reply to Jani Nikula== Series Details ==
== Series Details ==
Series: series starting with [v2,1/5] drm/i915: extract fixed point math to i915_fixed.h
URL : https://patchwork.freedesktop.org/series/52608/
State : success
== Summary ==
= CI Bug Log - changes from CI_DRM_5150_full -> Patchwork_10838_full =
== Summary - SUCCESS ==
No regressions found.
== Known issues ==
Here are the changes found in Patchwork_10838_full that come from known issues:
=== IGT changes ===
==== Issues hit ====
igt@drm_import_export@import-close-race-flink:
shard-skl: PASS -> TIMEOUT (fdo#108667)
igt@gem_exec_schedule@pi-ringfull-bsd:
shard-skl: NOTRUN -> FAIL (fdo#103158) +1
igt@gem_exec_schedule@pi-ringfull-render:
shard-kbl: NOTRUN -> FAIL (fdo#103158)
igt@gem_ppgtt@blt-vs-render-ctx0:
shard-skl: NOTRUN -> TIMEOUT (fdo#108039)
igt@gem_ppgtt@blt-vs-render-ctxn:
shard-kbl: PASS -> INCOMPLETE (fdo#106887, fdo#103665, fdo#106023)
igt@gem_workarounds@suspend-resume-fd:
shard-skl: PASS -> INCOMPLETE (fdo#104108, fdo#107773)
igt@kms_busy@extended-modeset-hang-newfb-with-reset-render-c:
shard-skl: NOTRUN -> DMESG-WARN (fdo#107956) +2
igt@kms_busy@extended-pageflip-modeset-hang-oldfb-render-b:
shard-snb: NOTRUN -> DMESG-WARN (fdo#107956)
igt@kms_cursor_crc@cursor-256x256-dpms:
shard-apl: PASS -> FAIL (fdo#103232) +1
igt@kms_cursor_crc@cursor-256x256-suspend:
shard-skl: NOTRUN -> INCOMPLETE (fdo#104108)
igt@kms_cursor_legacy@cursora-vs-flipa-toggle:
shard-glk: PASS -> DMESG-WARN (fdo#105763, fdo#106538)
igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-pwrite:
shard-apl: PASS -> FAIL (fdo#103167)
igt@kms_frontbuffer_tracking@fbc-1p-rte:
shard-apl: PASS -> DMESG-WARN (fdo#108131, fdo#103558)
igt@kms_frontbuffer_tracking@fbcpsr-stridechange:
shard-skl: NOTRUN -> FAIL (fdo#105683)
igt@kms_frontbuffer_tracking@fbcpsr-suspend:
shard-skl: NOTRUN -> INCOMPLETE (fdo#106978, fdo#104108)
igt@kms_frontbuffer_tracking@psr-1p-primscrn-spr-indfb-draw-mmap-wc:
shard-skl: NOTRUN -> FAIL (fdo#103167) +1
igt@kms_plane@plane-panning-bottom-right-suspend-pipe-c-planes:
shard-skl: PASS -> FAIL (fdo#103166)
igt@kms_plane@plane-position-covered-pipe-a-planes:
shard-apl: PASS -> FAIL (fdo#103166) +1
igt@kms_plane_alpha_blend@pipe-b-constant-alpha-max:
shard-kbl: NOTRUN -> FAIL (fdo#108145)
igt@kms_plane_alpha_blend@pipe-c-alpha-7efc:
shard-skl: NOTRUN -> FAIL (fdo#108145, fdo#107815) +3
igt@kms_plane_alpha_blend@pipe-c-alpha-opaque-fb:
shard-skl: NOTRUN -> FAIL (fdo#108145) +3
igt@kms_plane_alpha_blend@pipe-c-coverage-7efc:
shard-skl: PASS -> FAIL (fdo#107815)
igt@kms_plane_multiple@atomic-pipe-a-tiling-x:
shard-skl: NOTRUN -> FAIL (fdo#103166, fdo#107815)
igt@kms_rotation_crc@primary-rotation-90:
shard-skl: PASS -> FAIL (fdo#103925, fdo#107815)
igt@kms_setmode@basic:
shard-apl: PASS -> FAIL (fdo#99912)
igt@kms_sysfs_edid_timing:
shard-skl: NOTRUN -> FAIL (fdo#100047)
igt@perf@blocking:
shard-hsw: PASS -> FAIL (fdo#102252)
igt@pm_backlight@fade_with_suspend:
shard-skl: NOTRUN -> FAIL (fdo#107847)
igt@pm_rpm@dpms-mode-unset-lpsp:
shard-skl: NOTRUN -> INCOMPLETE (fdo#107807)
igt@pm_rpm@gem-mmap-cpu:
shard-apl: PASS -> DMESG-WARN (fdo#103558, fdo#105602) +5
==== Possible fixes ====
igt@kms_cursor_crc@cursor-256x85-onscreen:
shard-apl: FAIL (fdo#103232) -> PASS +2
igt@kms_plane_alpha_blend@pipe-a-coverage-7efc:
shard-skl: FAIL (fdo#108145, fdo#107815) -> PASS
igt@kms_plane_alpha_blend@pipe-b-coverage-7efc:
shard-skl: FAIL (fdo#107815) -> PASS
igt@kms_plane_multiple@atomic-pipe-c-tiling-y:
shard-glk: FAIL (fdo#103166) -> PASS
igt@kms_plane_multiple@atomic-pipe-c-tiling-yf:
shard-apl: FAIL (fdo#103166) -> PASS +1
igt@kms_setmode@basic:
shard-kbl: FAIL (fdo#99912) -> PASS
igt@perf@oa-exponents:
shard-kbl: INCOMPLETE (fdo#103665) -> PASS fdo#100047 https://bugs.freedesktop.org/show_bug.cgi?id=100047
fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
fdo#103158 https://bugs.freedesktop.org/show_bug.cgi?id=103158
fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#103232 https://bugs.freedesktop.org/show_bug.cgi?id=103232
fdo#103558 https://bugs.freedesktop.org/show_bug.cgi?id=103558
fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
fdo#103925 https://bugs.freedesktop.org/show_bug.cgi?id=103925
fdo#104108 https://bugs.freedesktop.org/show_bug.cgi?id=104108
fdo#105602 https://bugs.freedesktop.org/show_bug.cgi?id=105602
fdo#105683 https://bugs.freedesktop.org/show_bug.cgi?id=105683
fdo#105763 https://bugs.freedesktop.org/show_bug.cgi?id=105763
fdo#106023 https://bugs.freedesktop.org/show_bug.cgi?id=106023
fdo#106538 https://bugs.freedesktop.org/show_bug.cgi?id=106538
fdo#106887 https://bugs.freedesktop.org/show_bug.cgi?id=106887
fdo#106978 https://bugs.freedesktop.org/show_bug.cgi?id=106978
fdo#107773 https://bugs.freedesktop.org/show_bug.cgi?id=107773
fdo#107807 https://bugs.freedesktop.org/show_bug.cgi?id=107807
fdo#107815 https://bugs.freedesktop.org/show_bug.cgi?id=107815
fdo#107847 https://bugs.freedesktop.org/show_bug.cgi?id=107847
fdo#107956 https://bugs.freedesktop.org/show_bug.cgi?id=107956
fdo#108039 https://bugs.freedesktop.org/show_bug.cgi?id=108039
fdo#108131 https://bugs.freedesktop.org/show_bug.cgi?id=108131
fdo#108145 https://bugs.freedesktop.org/show_bug.cgi?id=108145
fdo#108667 https://bugs.freedesktop.org/show_bug.cgi?id=108667
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
== Participating hosts (7 -> 6) ==
Missing (1): shard-iclb
== Build changes ==
* Linux: CI_DRM_5150 -> Patchwork_10838
CI_DRM_5150: ab97324c7fb98fc8cadbe5ae4e50f36fb0137308 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4716: 111593c49d812a4f4ff9ab0ef053a3ab88a6f73f @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_10838: 50d2d523f15e654ef6f95c65b1637cf78518d31a @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_10838/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 7 lines · Jani Nikula
Reduce bloat in one of the bigger header files. Fix some indentation while at it. No functional changes.
v2: Add include guards (Joonas)
Reviewed-by Joonas Lahtinen <[email protected]>Signed-off-by Jani Nikula <[email protected]>
Pushed the series, thanks for the review.
BR,
Jani.
Quoted 316 lines
--- drivers/gpu/drm/i915/i915_drv.h | 139 +---------------------------------- drivers/gpu/drm/i915/i915_fixed.h | 147 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 148 insertions(+), 138 deletions(-) create mode 100644 drivers/gpu/drm/i915/i915_fixed.hdrivers/gpu/drm/i915/i915_drv.h +1
-138@@ -54,6 +54,7 @@#include <drm/drm_cache.h> #include <drm/drm_util.h> +#include "i915_fixed.h" #include "i915_params.h" #include "i915_reg.h" #include "i915_utils.h" @@ -127,144 +128,6 @@ bool i915_error_injected(void);__i915_printk (i915,i915_error_injected () ?KERN_DEBUG :KERN_ERR , \ fmt, ##__VA_ARGS__) -typedef struct { -uint32_t val; -}uint_fixed_16_16_t ; - -#define FP_16_16_MAX ({ \ - uint_fixed_16_16_t fp; \ - fp.val = UINT_MAX; \ - fp; \ -}) - -static inline bool is_fixed16_zero (uint_fixed_16_16_t val) -{ -if (val.val ==0 ) -return true; -return false; -} - -static inline uint_fixed_16_16_t u32_to_fixed16 (uint32_t val) -{ -uint_fixed_16_16_t fp; - -WARN_ON (val >U16_MAX ); - - fp.val = val <<16 ; -return fp; -} - -static inline uint32_t fixed16_to_u32_round_up (uint_fixed_16_16_t fp) -{ -return DIV_ROUND_UP (fp.val,1 <<16 ); -} - -static inline uint32_t fixed16_to_u32 (uint_fixed_16_16_t fp) -{ -return fp.val >>16 ; -} - -static inline uint_fixed_16_16_t min_fixed16 (uint_fixed_16_16_t min1, -uint_fixed_16_16_t min2) -{ -uint_fixed_16_16_t min; - - min.val =min (min1.val, min2.val); -return min; -} - -static inline uint_fixed_16_16_t max_fixed16 (uint_fixed_16_16_t max1, -uint_fixed_16_16_t max2) -{ -uint_fixed_16_16_t max; - - max.val =max (max1.val, max2.val); -return max; -} - -static inline uint_fixed_16_16_t clamp_u64_to_fixed16 (uint64_t val) -{ -uint_fixed_16_16_t fp; -WARN_ON (val >U32_MAX ); - fp.val = (uint32_t ) val; -return fp; -} - -static inline uint32_t div_round_up_fixed16 (uint_fixed_16_16_t val, -uint_fixed_16_16_t d) -{ -return DIV_ROUND_UP (val.val, d.val); -} - -static inline uint32_t mul_round_up_u32_fixed16 (uint32_t val, -uint_fixed_16_16_t mul) -{ -uint64_t intermediate_val; - - intermediate_val = (uint64_t ) val * mul.val; - intermediate_val =DIV_ROUND_UP_ULL (intermediate_val,1 <<16 ); -WARN_ON (intermediate_val >U32_MAX ); -return (uint32_t ) intermediate_val; -} - -static inline uint_fixed_16_16_t mul_fixed16 (uint_fixed_16_16_t val, -uint_fixed_16_16_t mul) -{ -uint64_t intermediate_val; - - intermediate_val = (uint64_t ) val.val * mul.val; - intermediate_val = intermediate_val >>16 ; -return clamp_u64_to_fixed16 (intermediate_val); -} - -static inline uint_fixed_16_16_t div_fixed16 (uint32_t val,uint32_t d) -{ -uint64_t interm_val; - - interm_val = (uint64_t )val <<16 ; - interm_val =DIV_ROUND_UP_ULL (interm_val, d); -return clamp_u64_to_fixed16 (interm_val); -} - -static inline uint32_t div_round_up_u32_fixed16 (uint32_t val, -uint_fixed_16_16_t d) -{ -uint64_t interm_val; - - interm_val = (uint64_t )val <<16 ; - interm_val =DIV_ROUND_UP_ULL (interm_val, d.val); -WARN_ON (interm_val >U32_MAX ); -return (uint32_t ) interm_val; -} - -static inline uint_fixed_16_16_t mul_u32_fixed16 (uint32_t val, -uint_fixed_16_16_t mul) -{ -uint64_t intermediate_val; - - intermediate_val = (uint64_t ) val * mul.val; -return clamp_u64_to_fixed16 (intermediate_val); -} - -static inline uint_fixed_16_16_t add_fixed16 (uint_fixed_16_16_t add1, -uint_fixed_16_16_t add2) -{ -uint64_t interm_sum; - - interm_sum = (uint64_t ) add1.val + add2.val; -return clamp_u64_to_fixed16 (interm_sum); -} - -static inline uint_fixed_16_16_t add_fixed16_u32 (uint_fixed_16_16_t add1, -uint32_t add2) -{ -uint64_t interm_sum; -uint_fixed_16_16_t interm_add2 =u32_to_fixed16 (add2); - - interm_sum = (uint64_t ) add1.val + interm_add2.val; -return clamp_u64_to_fixed16 (interm_sum); -} -enum hpd_pin {HPD_NONE =0 ,HPD_TV =HPD_NONE ,/* TV is known to be unreliable */ drivers/gpu/drm/i915/i915_fixed.h new file +147
-0@@ -0,0 +1,147 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright © 2018 Intel Corporation +*/ + +#ifndef _I915_FIXED_H_ +#define _I915_FIXED_H_ + +typedef struct { +uint32_t val; +}uint_fixed_16_16_t ; + +#define FP_16_16_MAX ({ \ + uint_fixed_16_16_t fp; \ + fp.val = UINT_MAX; \ + fp; \ +}) + +static inline bool is_fixed16_zero (uint_fixed_16_16_t val) +{ +if (val.val ==0 ) +return true; +return false; +} + +static inline uint_fixed_16_16_t u32_to_fixed16 (uint32_t val) +{ +uint_fixed_16_16_t fp; + +WARN_ON (val >U16_MAX ); + + fp.val = val <<16 ; +return fp; +} + +static inline uint32_t fixed16_to_u32_round_up (uint_fixed_16_16_t fp) +{ +return DIV_ROUND_UP (fp.val,1 <<16 ); +} + +static inline uint32_t fixed16_to_u32 (uint_fixed_16_16_t fp) +{ +return fp.val >>16 ; +} + +static inline uint_fixed_16_16_t min_fixed16 (uint_fixed_16_16_t min1, +uint_fixed_16_16_t min2) +{ +uint_fixed_16_16_t min; + + min.val =min (min1.val, min2.val); +return min; +} + +static inline uint_fixed_16_16_t max_fixed16 (uint_fixed_16_16_t max1, +uint_fixed_16_16_t max2) +{ +uint_fixed_16_16_t max; + + max.val =max (max1.val, max2.val); +return max; +} + +static inline uint_fixed_16_16_t clamp_u64_to_fixed16 (uint64_t val) +{ +uint_fixed_16_16_t fp; +WARN_ON (val >U32_MAX ); + fp.val = (uint32_t ) val; +return fp; +} + +static inline uint32_t div_round_up_fixed16 (uint_fixed_16_16_t val, +uint_fixed_16_16_t d) +{ +return DIV_ROUND_UP (val.val, d.val); +} + +static inline uint32_t mul_round_up_u32_fixed16 (uint32_t val, +uint_fixed_16_16_t mul) +{ +uint64_t intermediate_val; + + intermediate_val = (uint64_t ) val * mul.val; + intermediate_val =DIV_ROUND_UP_ULL (intermediate_val,1 <<16 ); +WARN_ON (intermediate_val >U32_MAX ); +return (uint32_t ) intermediate_val; +} + +static inline uint_fixed_16_16_t mul_fixed16 (uint_fixed_16_16_t val, +uint_fixed_16_16_t mul) +{ +uint64_t intermediate_val; + + intermediate_val = (uint64_t ) val.val * mul.val; + intermediate_val = intermediate_val >>16 ; +return clamp_u64_to_fixed16 (intermediate_val); +} + +static inline uint_fixed_16_16_t div_fixed16 (uint32_t val,uint32_t d) +{ +uint64_t interm_val; + + interm_val = (uint64_t )val <<16 ; + interm_val =DIV_ROUND_UP_ULL (interm_val, d); +return clamp_u64_to_fixed16 (interm_val); +} + +static inline uint32_t div_round_up_u32_fixed16 (uint32_t val, +uint_fixed_16_16_t d) +{ +uint64_t interm_val; + + interm_val = (uint64_t )val <<16 ; + interm_val =DIV_ROUND_UP_ULL (interm_val, d.val); +WARN_ON (interm_val >U32_MAX ); +return (uint32_t ) interm_val; +} + +static inline uint_fixed_16_16_t mul_u32_fixed16 (uint32_t val, +uint_fixed_16_16_t mul) +{ +uint64_t intermediate_val; + + intermediate_val = (uint64_t ) val * mul.val; +return clamp_u64_to_fixed16 (intermediate_val); +} + +static inline uint_fixed_16_16_t add_fixed16 (uint_fixed_16_16_t add1, +uint_fixed_16_16_t add2) +{ +uint64_t interm_sum; + + interm_sum = (uint64_t ) add1.val + add2.val; +return clamp_u64_to_fixed16 (interm_sum); +} + +static inline uint_fixed_16_16_t add_fixed16_u32 (uint_fixed_16_16_t add1, +uint32_t add2) +{ +uint64_t interm_sum; +uint_fixed_16_16_t interm_add2 =u32_to_fixed16 (add2); + + interm_sum = (uint64_t ) add1.val + interm_add2.val; +return clamp_u64_to_fixed16 (interm_sum); +} + +#endif /* _I915_FIXED_H_ */
Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx