[igt-dev] [PATCH i-g-t] lib: move upper_32_bits() and lower_32_bits() to library

Petri Latvala petri.latvala at intel.com
Tue Mar 3 11:14:42 UTC 2020


On Tue, Mar 03, 2020 at 11:34:12AM +0100, Daniel Mrzyglod wrote:
> Move inline upper_32_bits() and lower_32_bits() function from tests to
> library. Functiom will be usefull for elsewhere use.
> 
> Cc: Katarzyna Dec <katarzyna.dec at intel.com>
> Signed-off-by: Daniel Mrzyglod <daniel.t.mrzyglod at intel.com>
> ---
>  lib/ioctl_wrappers.h        | 20 ++++++++++++++++++++
>  tests/i915/gem_exec_fence.c | 10 ----------
>  2 files changed, 20 insertions(+), 10 deletions(-)
> 
> diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h
> index 7614e688c..17f54b2f9 100644
> --- a/lib/ioctl_wrappers.h
> +++ b/lib/ioctl_wrappers.h
> @@ -244,4 +244,24 @@ static inline void *from_user_pointer(uint64_t u64)
>  	return (void *)(uintptr_t)u64;
>  }
>  
> +/**
> + * lower_32_bits
> + *
> + * return bits 0-31 of a number
> + */
> +static inline uint32_t lower_32_bits(uint64_t x)
> +{
> +	return x & 0xffffffff;
> +}
> +
> +/**
> + * lower_32_bits
> + *
> + * return bits 32-63 of a number

upper_

Does the name need a colon : after it to be recognized? Can you build
docs and check that these appear?


-- 
Petri Latvala



> + */
> +static inline uint32_t upper_32_bits(uint64_t x)
> +{
> +	return x >> 32;
> +}
> +
>  #endif /* IOCTL_WRAPPERS_H */
> diff --git a/tests/i915/gem_exec_fence.c b/tests/i915/gem_exec_fence.c
> index 9b3735325..ebd0f931f 100644
> --- a/tests/i915/gem_exec_fence.c
> +++ b/tests/i915/gem_exec_fence.c
> @@ -590,16 +590,6 @@ static uint32_t batch_create(int fd)
>  	return handle;
>  }
>  
> -static inline uint32_t lower_32_bits(uint64_t x)
> -{
> -	return x & 0xffffffff;
> -}
> -
> -static inline uint32_t upper_32_bits(uint64_t x)
> -{
> -	return x >> 32;
> -}
> -
>  static void test_keep_in_fence(int fd, const struct intel_execution_engine2 *e)
>  {
>  	struct sigaction sa = { .sa_handler = alarm_handler };
> -- 
> 2.21.1
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev


More information about the igt-dev mailing list