summaryrefslogtreecommitdiff
path: root/common.h
diff options
context:
space:
mode:
authorRob Clark <robdclark@gmail.com>2019-01-06 11:34:24 -0500
committerRob Clark <robdclark@gmail.com>2019-05-04 16:35:43 +0000
commit1e82f507fe5469fdc03a2d56c63e2f422fabd5ba (patch)
tree94942af4a4f230bfd856a0f89e8d0a80e04da402 /common.h
parent572b93d7080f1c089b8c236ad0bc932859e2712d (diff)
downloadkmscube-1e82f507fe5469fdc03a2d56c63e2f422fabd5ba.tar.gz
Add texturator
A utility for testing layouts of various types of textures in various formats. Not really too much related to kms or kmscube, other than re-using kmscube's kms/gbm code and egl helper.
Diffstat (limited to 'common.h')
-rw-r--r--common.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/common.h b/common.h
index 17c4073..d461262 100644
--- a/common.h
+++ b/common.h
@@ -24,7 +24,9 @@
#ifndef _COMMON_H
#define _COMMON_H
+#ifndef GL_ES_VERSION_2_0
#include <GLES2/gl2.h>
+#endif
#include <GLES2/gl2ext.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
@@ -35,6 +37,18 @@
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+/* from mesa's util/macros.h: */
+#define MIN2( A, B ) ( (A)<(B) ? (A) : (B) )
+#define MAX2( A, B ) ( (A)>(B) ? (A) : (B) )
+#define MIN3( A, B, C ) ((A) < (B) ? MIN2(A, C) : MIN2(B, C))
+#define MAX3( A, B, C ) ((A) > (B) ? MAX2(A, C) : MAX2(B, C))
+
+static inline unsigned
+u_minify(unsigned value, unsigned levels)
+{
+ return MAX2(1, value >> levels);
+}
+
#ifndef DRM_FORMAT_MOD_LINEAR
#define DRM_FORMAT_MOD_LINEAR 0
#endif