[igt-dev] [PATCH i-g-t] i915/gem_blits: Use common igt_fls()

Summers, Stuart stuart.summers at intel.com
Wed Nov 13 20:38:04 UTC 2019


On Sat, 2019-11-09 at 15:10 +0000, Chris Wilson wrote:
> igt_aux.h already provides the optimal igt_fls(), so use that in
> preference to open coding the brute force version.
> 
> Reported-by: Stuart Summers <stuart.summers at intel.com>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Stuart Summers <stuart.summers at intel.com>

Thanks for the look here Chris :)

-Stuart

> ---
>  tests/i915/gem_blits.c | 12 +-----------
>  1 file changed, 1 insertion(+), 11 deletions(-)
> 
> diff --git a/tests/i915/gem_blits.c b/tests/i915/gem_blits.c
> index e0346a7c7..f9cb12bb8 100644
> --- a/tests/i915/gem_blits.c
> +++ b/tests/i915/gem_blits.c
> @@ -57,16 +57,6 @@ enum mode {
>  	WC,
>  };
>  
> -static int fls(uint64_t x)
> -{
> -	int t;
> -
> -	for (t = 0; x >> t; t++)
> -		;
> -
> -	return t;
> -}
> -
>  static unsigned int
>  get_tiling_stride(const struct device *device,
>  		  unsigned int width, unsigned int tiling)
> @@ -81,7 +71,7 @@ get_tiling_stride(const struct device *device,
>  		else
>  			stride = ALIGN(stride, 128);
>  		if (device->gen < 4)
> -			stride = 1 << fls(stride - 1);
> +			stride = 1 << igt_fls(stride - 1);
>  	} else {
>  		if (device->gen >= 8)
>  			stride = ALIGN(stride, 64);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3270 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/igt-dev/attachments/20191113/45c8b0e8/attachment.bin>


More information about the igt-dev mailing list