summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>2014-04-23 16:07:55 +0100
committerThomas Wood <thomas.wood@intel.com>2014-04-24 13:49:19 +0100
commitdc14bf455d66a0a31253ac4fa3e024eb1e036968 (patch)
treefb1eacc61003444b2b96a49e0b578f0da790a8ed /lib
parente32664c8ee47d8eb01955240672a198aab7e2969 (diff)
tests: Extract ALIGN macro into a common header
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 <tvrtko.ursulin@intel.com> Reviewed-by: Brad Volkin <bradley.d.volkin@intel.com> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/drmtest.h9
-rw-r--r--lib/media_fill_gen7.c2
-rw-r--r--lib/media_fill_gen8.c2
-rw-r--r--lib/rendercopy_gen6.c1
-rw-r--r--lib/rendercopy_gen7.c1
-rw-r--r--lib/rendercopy_gen8.c1
6 files changed, 11 insertions, 5 deletions
diff --git a/lib/drmtest.h b/lib/drmtest.h
index f3afbaa8..84f80dc6 100644
--- a/lib/drmtest.h
+++ b/lib/drmtest.h
@@ -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);
diff --git a/lib/media_fill_gen7.c b/lib/media_fill_gen7.c
index cdf4b603..82c34692 100644
--- a/lib/media_fill_gen7.c
+++ b/lib/media_fill_gen7.c
@@ -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 },
diff --git a/lib/media_fill_gen8.c b/lib/media_fill_gen8.c
index 996d4d02..54309d59 100644
--- a/lib/media_fill_gen8.c
+++ b/lib/media_fill_gen8.c
@@ -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 },
diff --git a/lib/rendercopy_gen6.c b/lib/rendercopy_gen6.c
index d806ceff..7b3104c5 100644
--- a/lib/rendercopy_gen6.c
+++ b/lib/rendercopy_gen6.c
@@ -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] = {
diff --git a/lib/rendercopy_gen7.c b/lib/rendercopy_gen7.c
index cdbc70c1..5131d8f8 100644
--- a/lib/rendercopy_gen7.c
+++ b/lib/rendercopy_gen7.c
@@ -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 },
diff --git a/lib/rendercopy_gen8.c b/lib/rendercopy_gen8.c
index e8463766..6f5a6980 100644
--- a/lib/rendercopy_gen8.c
+++ b/lib/rendercopy_gen8.c
@@ -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