Paulo Zanoni | cf9f48e | 2015-02-19 15:41:15 -0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright © 2015 Intel Corporation |
| 3 | * |
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 5 | * copy of this software and associated documentation files (the "Software"), |
| 6 | * to deal in the Software without restriction, including without limitation |
| 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 | * and/or sell copies of the Software, and to permit persons to whom the |
| 9 | * Software is furnished to do so, subject to the following conditions: |
| 10 | * |
| 11 | * The above copyright notice and this permission notice (including the next |
| 12 | * paragraph) shall be included in all copies or substantial portions of the |
| 13 | * Software. |
| 14 | * |
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
| 21 | * IN THE SOFTWARE. |
| 22 | * |
| 23 | */ |
| 24 | |
| 25 | #ifndef __IGT_DRAW_H__ |
| 26 | #define __IGT_DRAW_H__ |
| 27 | |
| 28 | #include <intel_bufmgr.h> |
| 29 | #include "igt_fb.h" |
| 30 | |
| 31 | /** |
Thomas Wood | 6141aa2 | 2015-05-14 16:00:25 +0100 | [diff] [blame] | 32 | * igt_draw_method: |
Paulo Zanoni | cf9f48e | 2015-02-19 15:41:15 -0200 | [diff] [blame] | 33 | * @IGT_DRAW_MMAP_CPU: draw using a CPU mmap. |
| 34 | * @IGT_DRAW_MMAP_GTT: draw using a GTT mmap. |
Thomas Wood | 6141aa2 | 2015-05-14 16:00:25 +0100 | [diff] [blame] | 35 | * @IGT_DRAW_MMAP_WC: draw using the WC mmap. |
Paulo Zanoni | cf9f48e | 2015-02-19 15:41:15 -0200 | [diff] [blame] | 36 | * @IGT_DRAW_PWRITE: draw using the pwrite ioctl. |
| 37 | * @IGT_DRAW_BLT: draw using the BLT ring. |
| 38 | * @IGT_DRAW_RENDER: draw using the render ring. |
| 39 | * @IGT_DRAW_METHOD_COUNT: useful for iterating through everything. |
| 40 | */ |
| 41 | enum igt_draw_method { |
| 42 | IGT_DRAW_MMAP_CPU, |
| 43 | IGT_DRAW_MMAP_GTT, |
| 44 | IGT_DRAW_MMAP_WC, |
| 45 | IGT_DRAW_PWRITE, |
| 46 | IGT_DRAW_BLT, |
| 47 | IGT_DRAW_RENDER, |
| 48 | IGT_DRAW_METHOD_COUNT, |
| 49 | }; |
| 50 | |
| 51 | const char *igt_draw_get_method_name(enum igt_draw_method method); |
| 52 | |
| 53 | void igt_draw_rect(int fd, drm_intel_bufmgr *bufmgr, drm_intel_context *context, |
| 54 | uint32_t buf_handle, uint32_t buf_size, uint32_t buf_stride, |
| 55 | enum igt_draw_method method, int rect_x, int rect_y, |
Paulo Zanoni | caaf3b8 | 2015-08-03 14:41:35 -0300 | [diff] [blame] | 56 | int rect_w, int rect_h, uint32_t color, int bpp); |
Paulo Zanoni | cf9f48e | 2015-02-19 15:41:15 -0200 | [diff] [blame] | 57 | |
| 58 | void igt_draw_rect_fb(int fd, drm_intel_bufmgr *bufmgr, |
| 59 | drm_intel_context *context, struct igt_fb *fb, |
| 60 | enum igt_draw_method method, int rect_x, int rect_y, |
| 61 | int rect_w, int rect_h, uint32_t color); |
| 62 | |
| 63 | void igt_draw_fill_fb(int fd, struct igt_fb *fb, uint32_t color); |
| 64 | |
| 65 | #endif /* __IGT_DRAW_H__ */ |