[Intel-gfx] [PATCH i-g-t 04/16] lib: Add some basic types
Damien Lespiau
damien.lespiau at intel.com
Mon Jul 6 05:35:32 PDT 2015
Might as well start to define some igt wide types. I'll need them for
igt_plot, but other things belong here, like a color type.
Signed-off-by: Damien Lespiau <damien.lespiau at intel.com>
---
.../intel-gpu-tools/intel-gpu-tools-docs.xml | 1 +
lib/Makefile.sources | 1 +
lib/igt_types.h | 99 ++++++++++++++++++++++
3 files changed, 101 insertions(+)
create mode 100644 lib/igt_types.h
diff --git a/docs/reference/intel-gpu-tools/intel-gpu-tools-docs.xml b/docs/reference/intel-gpu-tools/intel-gpu-tools-docs.xml
index 618dc5f..0992308 100644
--- a/docs/reference/intel-gpu-tools/intel-gpu-tools-docs.xml
+++ b/docs/reference/intel-gpu-tools/intel-gpu-tools-docs.xml
@@ -17,6 +17,7 @@
<title>API Reference</title>
<xi:include href="xml/drmtest.xml"/>
<xi:include href="xml/igt_core.xml"/>
+ <xi:include href="xml/igt_types.xml"/>
<xi:include href="xml/igt_stats.xml"/>
<xi:include href="xml/igt_debugfs.xml"/>
<xi:include href="xml/igt_draw.xml"/>
diff --git a/lib/Makefile.sources b/lib/Makefile.sources
index 7f88b65..205a9aa 100644
--- a/lib/Makefile.sources
+++ b/lib/Makefile.sources
@@ -14,6 +14,7 @@ libintel_tools_la_SOURCES = \
igt_gt.h \
igt_stats.c \
igt_stats.h \
+ igt_types.h \
instdone.c \
instdone.h \
intel_batchbuffer.c \
diff --git a/lib/igt_types.h b/lib/igt_types.h
new file mode 100644
index 0000000..3d7f1d6
--- /dev/null
+++ b/lib/igt_types.h
@@ -0,0 +1,99 @@
+/*
+ * Copyright © 2015 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifndef __IGT_TYPES_H__
+#define __IGT_TYPES_H__
+
+/**
+ * SECTION:igt_types
+ * @short_description: Some handy types
+ * @title: Basic Types
+ * @include: igt_types.h
+ */
+
+/**
+ * igt_orientation_t:
+ * @IGT_ORIENTATION_HORIZONTAL: Horizontal
+ * @IGT_ORIENTATION_VERTICAL: Vertical
+ */
+typedef enum {
+ IGT_ORIENTATION_HORIZONTAL,
+ IGT_ORIENTATION_VERTICAL,
+} igt_orientation_t;
+
+/**
+ * igt_point_t:
+ * @x: X coordinate
+ * @y: Y coordinate
+ *
+ * A point on a plane.
+ */
+typedef struct {
+ double x, y;
+} igt_point_t;
+
+/**
+ * igt_box_t:
+ * @x1: X-coordinate of the top left corner
+ * @y1: Y-coordinate of the top left corner
+ * @x2: X-coordinate of the bottom right corner
+ * @y2: Y-coordinate of the bottom right corner
+ *
+ * A rectangle defined by two points.
+ */
+typedef struct {
+ double x1, y1, x2, y2;
+} igt_box_t;
+
+/**
+ * igt_trbl_t:
+ * @top: Top value
+ * @right: Right value
+ * @bottom: Bottom value
+ * @left: Left value
+ *
+ * Useful to store margin, padding, ... with a CSS-like feeling.
+ */
+typedef struct {
+ double top, right, bottom, left;
+} igt_trbl_t;
+
+/**
+ * igt_align_t:
+ * @IGT_ALIGN_LEFT: Align left
+ * @IGT_ALIGN_RIGHT: Align right
+ * @IGT_ALIGN_TOP: Align top
+ * @IGT_ALIGN_BOTTOM: Align bottom
+ * @IGT_ALIGN_CENTER: Align center
+ *
+ * An alignment type, to give to text drawing functions for instance.
+ */
+typedef enum {
+ IGT_ALIGN_LEFT,
+ IGT_ALIGN_RIGHT,
+ IGT_ALIGN_TOP,
+ IGT_ALIGN_BOTTOM,
+ IGT_ALIGN_CENTER,
+} igt_align_t;
+
+#endif /* __IGT_TYPES_H__ */
--
2.1.0
More information about the Intel-gfx
mailing list