OSDN Git Service

i965/drm: Use Mesa's macros.h instead of duplicating them.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 22 Mar 2017 05:42:43 +0000 (22:42 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 10 Apr 2017 21:31:24 +0000 (14:31 -0700)
Replace the duplicated macros imported from libdrm:

   ARRAY_SIZE, MAX2, ALIGN, STATIC_ASSERT

and remove unused ROUND_UP_TO and ROUND_UP_TO_MB.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
src/mesa/drivers/dri/i965/intel_bufmgr_gem.c
src/mesa/drivers/dri/i965/intel_bufmgr_priv.h
src/mesa/drivers/dri/i965/libdrm_macros.h

index d2bc3ed..b981658 100644 (file)
@@ -57,6 +57,8 @@
 #define ETIME ETIMEDOUT
 #endif
 #include "libdrm_macros.h"
+#include "main/macros.h"
+#include "util/macros.h"
 #include "util/list.h"
 #include "brw_bufmgr.h"
 #include "intel_bufmgr_priv.h"
@@ -81,9 +83,6 @@
                fprintf(stderr, __VA_ARGS__);           \
 } while (0)
 
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-#define MAX2(A, B) ((A) > (B) ? (A) : (B))
-
 static inline int
 atomic_add_unless(int *v, int add, int unless)
 {
index 58c2198..26ffd18 100644 (file)
@@ -285,8 +285,4 @@ struct _drm_bacon_context {
        struct _drm_bacon_bufmgr *bufmgr;
 };
 
-#define ALIGN(value, alignment)        ((value + alignment - 1) & ~(alignment - 1))
-#define ROUND_UP_TO(x, y)      (((x) + (y) - 1) / (y) * (y))
-#define ROUND_UP_TO_MB(x)      ROUND_UP_TO((x), 1024*1024)
-
 #endif /* INTEL_BUFMGR_PRIV_H */
index 7427fb1..8be103c 100644 (file)
 #ifndef LIBDRM_LIBDRM_H
 #define LIBDRM_LIBDRM_H
 
-/**
- * Static (compile-time) assertion.
- * Basically, use COND to dimension an array.  If COND is false/zero the
- * array size will be -1 and we'll get a compilation error.
- */
-#define STATIC_ASSERT(COND) \
-   do { \
-      (void) sizeof(char [1 - 2*!(COND)]); \
-   } while (0)
+#include "util/macros.h"
 
 
 #include <sys/mman.h>