tests: Extract ALIGN macro into a common header
PATCH 1/1 tests: Extract ALIGN macro into a common header
From: Tvrtko Ursulin <[email protected]>
Makes for a little bit less code duplication, especially since it will be used from more callers in the future.
Signed-off-by Tvrtko Ursulin <[email protected]>
--- lib/drmtest.h | 9 +++++++++ lib/media_fill_gen7.c | 2 +- lib/media_fill_gen8.c | 2 +- lib/rendercopy_gen6.c | 1 - lib/rendercopy_gen7.c | 1 - lib/rendercopy_gen8.c | 1 - 6 files changed, 11 insertions(+), 5 deletions(-)
lib/drmtest.h +9 -0
@@ -60,6 +60,15 @@ static inline void *igt_mmap64(void *addr, size_t length, int prot, int flags,*/ #define ARRAY_SIZE (arr) (sizeof(arr)/sizeof(arr[0])) +/** +* ALIGN: +* @v: value to be aligned +* @a: alignment unit in bytes +* +* Macro to align a value @v to a specified unit @a. +*/ +#define ALIGN (v, a) (((v) + (a)-1) & ~((a)-1)) +int drm_get_card (void );int drm_open_any (void );int drm_open_any_render (void );
lib/media_fill_gen7.c +1 -1
@@ -4,10 +4,10 @@#include "media_fill.h" #include "gen7_media.h" #include "intel_reg.h" +#include "drmtest.h" #include <assert.h> -#define ALIGN (x, y) (((x) + (y)-1) & ~((y)-1))static const uint32_t media_kernel[][4 ] = { {0x00400001 ,0x20200231 ,0x00000020 ,0x00000000 },
lib/media_fill_gen8.c +1 -1
@@ -4,10 +4,10 @@#include "media_fill.h" #include "gen8_media.h" #include "intel_reg.h" +#include "drmtest.h" #include <assert.h> -#define ALIGN (x, y) (((x) + (y)-1) & ~((y)-1))static const uint32_t media_kernel[][4 ] = { {0x00400001 ,0x20202288 ,0x00000020 ,0x00000000 },
lib/rendercopy_gen6.c +0 -1
@@ -20,7 +20,6 @@#include "gen6_render.h" #include "intel_reg.h" -#define ALIGN (x, y) (((x) + (y)-1) & ~((y)-1))#define VERTEX_SIZE (3*4)static const uint32_t ps_kernel_nomask_affine[][4 ] = {
lib/rendercopy_gen7.c +0 -1
@@ -21,7 +21,6 @@#include "gen7_render.h" #include "intel_reg.h" -#define ALIGN (x, y) (((x) + (y)-1) & ~((y)-1))static const uint32_t ps_kernel[][4 ] = { {0x0080005a ,0x2e2077bd ,0x000000c0 ,0x008d0040 },
lib/rendercopy_gen8.c +0 -1
@@ -25,7 +25,6 @@#include <intel_aub.h> -#define ALIGN (x, y) (((x) + (y)-1) & ~((y)-1))#define VERTEX_SIZE (3*4)#if DEBUG_RENDERCPY
Signature · 1 line
1.9.1
Reviewed-by Brad Volkin <[email protected]>
Quoted 110 lines · Tvrtko Ursulin
From: Tvrtko Ursulin <[email protected]>
Makes for a little bit less code duplication, especially since it will be used from more callers in the future.
Signed-off-by Tvrtko Ursulin <[email protected]>--- lib/drmtest.h | 9 +++++++++ lib/media_fill_gen7.c | 2 +- lib/media_fill_gen8.c | 2 +- lib/rendercopy_gen6.c | 1 - lib/rendercopy_gen7.c | 1 - lib/rendercopy_gen8.c | 1 - 6 files changed, 11 insertions(+), 5 deletions(-)lib/drmtest.h +9
-0@@ -60,6 +60,15 @@ static inline void *igt_mmap64(void *addr, size_t length, int prot, int flags,*/ #define ARRAY_SIZE (arr) (sizeof(arr)/sizeof(arr[0])) +/** +* ALIGN: +* @v: value to be aligned +* @a: alignment unit in bytes +* +* Macro to align a value @v to a specified unit @a. +*/ +#define ALIGN (v, a) (((v) + (a)-1) & ~((a)-1)) +int drm_get_card (void );int drm_open_any (void );int drm_open_any_render (void );lib/media_fill_gen7.c +1
-1@@ -4,10 +4,10 @@#include "media_fill.h" #include "gen7_media.h" #include "intel_reg.h" +#include "drmtest.h" #include <assert.h> -#define ALIGN (x, y) (((x) + (y)-1) & ~((y)-1))static const uint32_t media_kernel[][4 ] = { {0x00400001 ,0x20200231 ,0x00000020 ,0x00000000 },lib/media_fill_gen8.c +1
-1@@ -4,10 +4,10 @@#include "media_fill.h" #include "gen8_media.h" #include "intel_reg.h" +#include "drmtest.h" #include <assert.h> -#define ALIGN (x, y) (((x) + (y)-1) & ~((y)-1))static const uint32_t media_kernel[][4 ] = { {0x00400001 ,0x20202288 ,0x00000020 ,0x00000000 },lib/rendercopy_gen6.c +0
-1@@ -20,7 +20,6 @@#include "gen6_render.h" #include "intel_reg.h" -#define ALIGN (x, y) (((x) + (y)-1) & ~((y)-1))#define VERTEX_SIZE (3*4)static const uint32_t ps_kernel_nomask_affine[][4 ] = {lib/rendercopy_gen7.c +0
-1@@ -21,7 +21,6 @@#include "gen7_render.h" #include "intel_reg.h" -#define ALIGN (x, y) (((x) + (y)-1) & ~((y)-1))static const uint32_t ps_kernel[][4 ] = { {0x0080005a ,0x2e2077bd ,0x000000c0 ,0x008d0040 },lib/rendercopy_gen8.c +0
-1@@ -25,7 +25,6 @@#include <intel_aub.h> -#define ALIGN (x, y) (((x) + (y)-1) & ~((y)-1))#define VERTEX_SIZE (3*4)#if DEBUG_RENDERCPY Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx