summaryrefslogtreecommitdiff
path: root/lib/igt_draw.h
diff options
context:
space:
mode:
authorPaulo Zanoni <paulo.r.zanoni@intel.com>2015-02-19 15:41:15 -0200
committerPaulo Zanoni <paulo.r.zanoni@intel.com>2015-05-07 15:11:49 -0300
commitcf9f48e704030b606260919f2da4c4287e51c4af (patch)
treed3af82ad7794a6af59e507c5ac63e96ae9bb697b /lib/igt_draw.h
parent8d3023c15bcc9890ab7b89fa8ae4564a295078c2 (diff)
lib: add igt_draw
For all those IGT tests that need an easy way to draw rectangles on buffers using different methods. Current planned users: FBC and PSR CRC tests. There is also a tests/kms_draw_crc program to check if the library is sane. v2: - Move the test from lib/tests to tests/ (Daniel). - Add igt_require() to filter out the swizzling/tiling methods we don't support (Daniel). - Simplify reloc handling on the BLT case (Daniel). - Document enum igt_draw_method (Daniel). - Document igt_draw_get_method_name() (Paulo). v3: - Add IGT_DRAW_MMAP_WC (Chris). - Implement the other trivial swizzling methods (Chris). - Remove the gem_sync() calls (Chris). Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Diffstat (limited to 'lib/igt_draw.h')
-rw-r--r--lib/igt_draw.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/lib/igt_draw.h b/lib/igt_draw.h
new file mode 100644
index 00000000..61ffad5c
--- /dev/null
+++ b/lib/igt_draw.h
@@ -0,0 +1,65 @@
+/*
+ * 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_DRAW_H__
+#define __IGT_DRAW_H__
+
+#include <intel_bufmgr.h>
+#include "igt_fb.h"
+
+/**
+ *igt_draw_method:
+ * @IGT_DRAW_MMAP_CPU: draw using a CPU mmap.
+ * @IGT_DRAW_MMAP_GTT: draw using a GTT mmap.
+ * @IGT-DRAW_MMAP_WC: draw using the WC mmap.
+ * @IGT_DRAW_PWRITE: draw using the pwrite ioctl.
+ * @IGT_DRAW_BLT: draw using the BLT ring.
+ * @IGT_DRAW_RENDER: draw using the render ring.
+ * @IGT_DRAW_METHOD_COUNT: useful for iterating through everything.
+ */
+enum igt_draw_method {
+ IGT_DRAW_MMAP_CPU,
+ IGT_DRAW_MMAP_GTT,
+ IGT_DRAW_MMAP_WC,
+ IGT_DRAW_PWRITE,
+ IGT_DRAW_BLT,
+ IGT_DRAW_RENDER,
+ IGT_DRAW_METHOD_COUNT,
+};
+
+const char *igt_draw_get_method_name(enum igt_draw_method method);
+
+void igt_draw_rect(int fd, drm_intel_bufmgr *bufmgr, drm_intel_context *context,
+ uint32_t buf_handle, uint32_t buf_size, uint32_t buf_stride,
+ enum igt_draw_method method, int rect_x, int rect_y,
+ int rect_w, int rect_h, uint32_t color);
+
+void igt_draw_rect_fb(int fd, drm_intel_bufmgr *bufmgr,
+ drm_intel_context *context, struct igt_fb *fb,
+ enum igt_draw_method method, int rect_x, int rect_y,
+ int rect_w, int rect_h, uint32_t color);
+
+void igt_draw_fill_fb(int fd, struct igt_fb *fb, uint32_t color);
+
+#endif /* __IGT_DRAW_H__ */