Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 1 | /* |
Damien Lespiau | 9cf7e8d | 2014-07-08 12:08:20 +0100 | [diff] [blame] | 2 | * Copyright © 2013,2014 Intel Corporation |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 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 | |
Thomas Wood | 804e11f | 2015-08-17 17:57:43 +0100 | [diff] [blame^] | 25 | #include "igt.h" |
Damien Lespiau | 92b29b1 | 2014-07-08 12:49:03 +0100 | [diff] [blame] | 26 | #include <math.h> |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 27 | |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 28 | |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 29 | typedef struct { |
| 30 | int gfx_fd; |
| 31 | igt_display_t display; |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 32 | struct igt_fb fb; |
Tvrtko Ursulin | d901106 | 2015-04-22 16:46:43 +0100 | [diff] [blame] | 33 | struct igt_fb fb_modeset; |
Damien Lespiau | 19743a1 | 2014-07-08 12:59:03 +0100 | [diff] [blame] | 34 | igt_crc_t ref_crc; |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 35 | igt_pipe_crc_t *pipe_crc; |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 36 | igt_rotation_t rotation; |
| 37 | int pos_x; |
| 38 | int pos_y; |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 39 | unsigned int w, h; |
Tvrtko Ursulin | dbf6468 | 2015-04-22 16:46:48 +0100 | [diff] [blame] | 40 | uint32_t override_fmt; |
| 41 | uint64_t override_tiling; |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 42 | } data_t; |
| 43 | |
Damien Lespiau | 92b29b1 | 2014-07-08 12:49:03 +0100 | [diff] [blame] | 44 | static void |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 45 | paint_squares(data_t *data, drmModeModeInfo *mode, igt_rotation_t rotation, |
| 46 | igt_plane_t *plane) |
Damien Lespiau | 92b29b1 | 2014-07-08 12:49:03 +0100 | [diff] [blame] | 47 | { |
| 48 | cairo_t *cr; |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 49 | unsigned int w = data->w; |
| 50 | unsigned int h = data->h; |
Damien Lespiau | 92b29b1 | 2014-07-08 12:49:03 +0100 | [diff] [blame] | 51 | |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 52 | cr = igt_get_cairo_ctx(data->gfx_fd, &data->fb); |
Damien Lespiau | 92b29b1 | 2014-07-08 12:49:03 +0100 | [diff] [blame] | 53 | |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 54 | if (rotation == IGT_ROTATION_180) { |
| 55 | cairo_translate(cr, w, h); |
| 56 | cairo_rotate(cr, M_PI); |
Damien Lespiau | 92b29b1 | 2014-07-08 12:49:03 +0100 | [diff] [blame] | 57 | } |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 58 | |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 59 | if (rotation == IGT_ROTATION_90) { |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 60 | /* Paint 4 squares with width == height in Green, White, |
| 61 | Blue, Red Clockwise order to look like 270 degree rotated*/ |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 62 | igt_paint_color(cr, 0, 0, w / 2, h / 2, 0.0, 1.0, 0.0); |
| 63 | igt_paint_color(cr, w / 2, 0, w / 2, h / 2, 1.0, 1.0, 1.0); |
| 64 | igt_paint_color(cr, 0, h / 2, w / 2, h / 2, 1.0, 0.0, 0.0); |
| 65 | igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, 0.0, 0.0, 1.0); |
Tvrtko Ursulin | f2a5896 | 2015-05-22 11:00:45 +0100 | [diff] [blame] | 66 | } else if (rotation == IGT_ROTATION_270) { |
| 67 | /* Paint 4 squares with width == height in Blue, Red, |
| 68 | Green, White Clockwise order to look like 90 degree rotated*/ |
| 69 | igt_paint_color(cr, 0, 0, w / 2, h / 2, 0.0, 0.0, 1.0); |
| 70 | igt_paint_color(cr, w / 2, 0, w / 2, h / 2, 1.0, 0.0, 0.0); |
| 71 | igt_paint_color(cr, 0, h / 2, w / 2, h / 2, 1.0, 1.0, 1.0); |
| 72 | igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, 0.0, 1.0, 0.0); |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 73 | } else { |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 74 | /* Paint with 4 squares of Red, Green, White, Blue Clockwise */ |
| 75 | igt_paint_color(cr, 0, 0, w / 2, h / 2, 1.0, 0.0, 0.0); |
| 76 | igt_paint_color(cr, w / 2, 0, w / 2, h / 2, 0.0, 1.0, 0.0); |
| 77 | igt_paint_color(cr, 0, h / 2, w / 2, h / 2, 0.0, 0.0, 1.0); |
| 78 | igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, 1.0, 1.0, 1.0); |
| 79 | } |
| 80 | |
Damien Lespiau | 92b29b1 | 2014-07-08 12:49:03 +0100 | [diff] [blame] | 81 | cairo_destroy(cr); |
| 82 | } |
| 83 | |
Tvrtko Ursulin | 637f045 | 2015-04-27 12:29:11 +0100 | [diff] [blame] | 84 | static void commit_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane) |
| 85 | { |
| 86 | igt_display_t *display = &data->display; |
| 87 | enum igt_commit_style commit = COMMIT_LEGACY; |
| 88 | igt_plane_t *primary; |
| 89 | |
| 90 | /* |
| 91 | * With igt_display_commit2 and COMMIT_UNIVERSAL, we call just the |
| 92 | * setplane without a modeset. So, to be able to call |
| 93 | * igt_display_commit and ultimately setcrtc to do the first modeset, |
| 94 | * we create an fb covering the crtc and call commit |
| 95 | */ |
| 96 | |
| 97 | primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY); |
| 98 | igt_plane_set_fb(primary, &data->fb_modeset); |
| 99 | igt_display_commit(display); |
| 100 | |
| 101 | igt_plane_set_fb(plane, &data->fb); |
| 102 | |
| 103 | if (!plane->is_cursor) |
| 104 | igt_plane_set_position(plane, data->pos_x, data->pos_y); |
| 105 | |
| 106 | if (plane->is_primary || plane->is_cursor) { |
| 107 | igt_require(data->display.has_universal_planes); |
| 108 | commit = COMMIT_UNIVERSAL; |
| 109 | } |
| 110 | |
| 111 | igt_display_commit2(display, commit); |
| 112 | } |
| 113 | |
Daniel Vetter | 57259d7 | 2014-11-24 16:08:32 +0100 | [diff] [blame] | 114 | static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe, |
Damien Lespiau | 05f90b0 | 2014-07-08 18:51:25 +0100 | [diff] [blame] | 115 | igt_plane_t *plane) |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 116 | { |
| 117 | drmModeModeInfo *mode; |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 118 | int fb_id, fb_modeset_id; |
| 119 | unsigned int w, h; |
Tvrtko Ursulin | dbf6468 | 2015-04-22 16:46:48 +0100 | [diff] [blame] | 120 | uint64_t tiling = data->override_tiling ? |
| 121 | data->override_tiling : LOCAL_DRM_FORMAT_MOD_NONE; |
| 122 | uint32_t pixel_format = data->override_fmt ? |
| 123 | data->override_fmt : DRM_FORMAT_XRGB8888; |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 124 | |
Damien Lespiau | 8facccf | 2014-07-08 18:28:53 +0100 | [diff] [blame] | 125 | igt_output_set_pipe(output, pipe); |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 126 | |
| 127 | /* create the pipe_crc object for this pipe */ |
Damien Lespiau | 2eaa50f | 2014-07-08 18:56:15 +0100 | [diff] [blame] | 128 | igt_pipe_crc_free(data->pipe_crc); |
Damien Lespiau | 8facccf | 2014-07-08 18:28:53 +0100 | [diff] [blame] | 129 | data->pipe_crc = igt_pipe_crc_new(pipe, INTEL_PIPE_CRC_SOURCE_AUTO); |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 130 | |
Damien Lespiau | 19743a1 | 2014-07-08 12:59:03 +0100 | [diff] [blame] | 131 | mode = igt_output_get_mode(output); |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 132 | |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 133 | w = mode->hdisplay; |
| 134 | h = mode->vdisplay; |
| 135 | |
Tvrtko Ursulin | d901106 | 2015-04-22 16:46:43 +0100 | [diff] [blame] | 136 | fb_modeset_id = igt_create_fb(data->gfx_fd, |
| 137 | w, h, |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 138 | pixel_format, |
Tvrtko Ursulin | d901106 | 2015-04-22 16:46:43 +0100 | [diff] [blame] | 139 | tiling, |
| 140 | &data->fb_modeset); |
| 141 | igt_assert(fb_modeset_id); |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 142 | |
| 143 | /* |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 144 | * For 90/270, we will use create smaller fb so that the rotated |
| 145 | * frame can fit in |
| 146 | */ |
| 147 | if (data->rotation == IGT_ROTATION_90 || |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 148 | data->rotation == IGT_ROTATION_270) { |
Tvrtko Ursulin | dbf6468 | 2015-04-22 16:46:48 +0100 | [diff] [blame] | 149 | tiling = data->override_tiling ? |
| 150 | data->override_tiling : LOCAL_I915_FORMAT_MOD_Y_TILED; |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 151 | w = h = mode->vdisplay; |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 152 | } else if (plane->is_cursor) { |
Tvrtko Ursulin | dbf6468 | 2015-04-22 16:46:48 +0100 | [diff] [blame] | 153 | pixel_format = data->override_fmt ? |
| 154 | data->override_fmt : DRM_FORMAT_ARGB8888; |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 155 | w = h = 128; |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 156 | } |
| 157 | |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 158 | data->w = w; |
| 159 | data->h = h; |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 160 | |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 161 | fb_id = igt_create_fb(data->gfx_fd, |
| 162 | w, h, |
| 163 | pixel_format, |
| 164 | tiling, |
| 165 | &data->fb); |
| 166 | igt_assert(fb_id); |
Damien Lespiau | 282f560 | 2014-07-10 17:44:28 +0100 | [diff] [blame] | 167 | |
Sonika Jindal | 4724698 | 2014-10-23 08:48:50 -0700 | [diff] [blame] | 168 | /* Step 1: create a reference CRC for a software-rotated fb */ |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 169 | paint_squares(data, mode, data->rotation, plane); |
Tvrtko Ursulin | 637f045 | 2015-04-27 12:29:11 +0100 | [diff] [blame] | 170 | commit_crtc(data, output, plane); |
Damien Lespiau | 19743a1 | 2014-07-08 12:59:03 +0100 | [diff] [blame] | 171 | igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc); |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 172 | |
Damien Lespiau | 282f560 | 2014-07-10 17:44:28 +0100 | [diff] [blame] | 173 | /* |
| 174 | * Step 2: prepare the plane with an non-rotated fb let the hw |
| 175 | * rotate it. |
| 176 | */ |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 177 | paint_squares(data, mode, IGT_ROTATION_0, plane); |
| 178 | igt_plane_set_fb(plane, &data->fb); |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 179 | } |
| 180 | |
Damien Lespiau | 05f90b0 | 2014-07-08 18:51:25 +0100 | [diff] [blame] | 181 | static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane) |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 182 | { |
| 183 | igt_display_t *display = &data->display; |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 184 | |
| 185 | igt_pipe_crc_free(data->pipe_crc); |
| 186 | data->pipe_crc = NULL; |
| 187 | |
| 188 | igt_remove_fb(data->gfx_fd, &data->fb); |
Tvrtko Ursulin | d901106 | 2015-04-22 16:46:43 +0100 | [diff] [blame] | 189 | igt_remove_fb(data->gfx_fd, &data->fb_modeset); |
Damien Lespiau | 1a75439 | 2014-07-09 14:00:59 +0100 | [diff] [blame] | 190 | |
| 191 | /* XXX: see the note in prepare_crtc() */ |
| 192 | if (!plane->is_primary) { |
| 193 | igt_plane_t *primary; |
| 194 | |
| 195 | primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY); |
| 196 | igt_plane_set_fb(primary, NULL); |
| 197 | } |
| 198 | |
Damien Lespiau | 05f90b0 | 2014-07-08 18:51:25 +0100 | [diff] [blame] | 199 | igt_plane_set_fb(plane, NULL); |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 200 | igt_output_set_pipe(output, PIPE_ANY); |
Damien Lespiau | eb81a92 | 2014-07-08 18:20:51 +0100 | [diff] [blame] | 201 | |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 202 | igt_display_commit(display); |
| 203 | } |
| 204 | |
Damien Lespiau | 05f90b0 | 2014-07-08 18:51:25 +0100 | [diff] [blame] | 205 | static void test_plane_rotation(data_t *data, enum igt_plane plane_type) |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 206 | { |
| 207 | igt_display_t *display = &data->display; |
| 208 | igt_output_t *output; |
Damien Lespiau | aef475b | 2014-07-08 18:43:44 +0100 | [diff] [blame] | 209 | enum pipe pipe; |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 210 | int valid_tests = 0; |
Thomas Wood | 1bec6cb | 2014-08-14 14:06:37 +0100 | [diff] [blame] | 211 | igt_crc_t crc_output, crc_unrotated; |
Damien Lespiau | c4564e0 | 2014-07-08 19:24:24 +0100 | [diff] [blame] | 212 | enum igt_commit_style commit = COMMIT_LEGACY; |
Tvrtko Ursulin | dbf6468 | 2015-04-22 16:46:48 +0100 | [diff] [blame] | 213 | int ret; |
Damien Lespiau | 13e979c | 2014-07-08 18:13:47 +0100 | [diff] [blame] | 214 | |
Sonika Jindal | 4724698 | 2014-10-23 08:48:50 -0700 | [diff] [blame] | 215 | if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR) { |
Damien Lespiau | 13e979c | 2014-07-08 18:13:47 +0100 | [diff] [blame] | 216 | igt_require(data->display.has_universal_planes); |
Damien Lespiau | c4564e0 | 2014-07-08 19:24:24 +0100 | [diff] [blame] | 217 | commit = COMMIT_UNIVERSAL; |
| 218 | } |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 219 | |
| 220 | for_each_connected_output(display, output) { |
Damien Lespiau | aef475b | 2014-07-08 18:43:44 +0100 | [diff] [blame] | 221 | for_each_pipe(display, pipe) { |
Damien Lespiau | 05f90b0 | 2014-07-08 18:51:25 +0100 | [diff] [blame] | 222 | igt_plane_t *plane; |
| 223 | |
| 224 | igt_output_set_pipe(output, pipe); |
| 225 | |
| 226 | plane = igt_output_get_plane(output, plane_type); |
| 227 | igt_require(igt_plane_supports_rotation(plane)); |
| 228 | |
Daniel Vetter | 57259d7 | 2014-11-24 16:08:32 +0100 | [diff] [blame] | 229 | prepare_crtc(data, output, pipe, plane); |
| 230 | |
Sonika Jindal | 4428151 | 2014-08-19 12:01:25 +0530 | [diff] [blame] | 231 | igt_display_commit2(display, commit); |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 232 | |
Thomas Wood | 1bec6cb | 2014-08-14 14:06:37 +0100 | [diff] [blame] | 233 | /* collect unrotated CRC */ |
Thomas Wood | 1bec6cb | 2014-08-14 14:06:37 +0100 | [diff] [blame] | 234 | igt_pipe_crc_collect_crc(data->pipe_crc, &crc_unrotated); |
| 235 | |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 236 | igt_plane_set_rotation(plane, data->rotation); |
Tvrtko Ursulin | dbf6468 | 2015-04-22 16:46:48 +0100 | [diff] [blame] | 237 | ret = igt_display_try_commit2(display, commit); |
| 238 | if (data->override_fmt || data->override_tiling) { |
| 239 | igt_assert(ret == -EINVAL); |
| 240 | } else { |
| 241 | igt_assert(ret == 0); |
| 242 | igt_pipe_crc_collect_crc(data->pipe_crc, |
| 243 | &crc_output); |
| 244 | igt_assert_crc_equal(&data->ref_crc, |
| 245 | &crc_output); |
| 246 | } |
Damien Lespiau | 39abe77 | 2014-07-08 18:36:32 +0100 | [diff] [blame] | 247 | |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 248 | /* |
| 249 | * check the rotation state has been reset when the VT |
| 250 | * mode is restored |
| 251 | */ |
Thomas Wood | 1bec6cb | 2014-08-14 14:06:37 +0100 | [diff] [blame] | 252 | kmstest_restore_vt_mode(); |
| 253 | kmstest_set_vt_graphics_mode(); |
Tvrtko Ursulin | 637f045 | 2015-04-27 12:29:11 +0100 | [diff] [blame] | 254 | |
| 255 | commit_crtc(data, output, plane); |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 256 | |
Thomas Wood | 1bec6cb | 2014-08-14 14:06:37 +0100 | [diff] [blame] | 257 | igt_pipe_crc_collect_crc(data->pipe_crc, &crc_output); |
Daniel Vetter | e588f6d | 2015-02-27 20:37:29 +0100 | [diff] [blame] | 258 | igt_assert_crc_equal(&crc_unrotated, &crc_output); |
Thomas Wood | 1bec6cb | 2014-08-14 14:06:37 +0100 | [diff] [blame] | 259 | |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 260 | valid_tests++; |
Damien Lespiau | 05f90b0 | 2014-07-08 18:51:25 +0100 | [diff] [blame] | 261 | cleanup_crtc(data, output, plane); |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 262 | } |
| 263 | } |
| 264 | igt_require_f(valid_tests, "no valid crtc/connector combinations found\n"); |
| 265 | } |
| 266 | |
| 267 | igt_main |
| 268 | { |
| 269 | data_t data = {}; |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 270 | int gen = 0; |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 271 | |
| 272 | igt_skip_on_simulation(); |
| 273 | |
| 274 | igt_fixture { |
Imre Deak | c256af5 | 2014-09-18 18:31:29 +0300 | [diff] [blame] | 275 | data.gfx_fd = drm_open_any_master(); |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 276 | gen = intel_gen(intel_get_drm_devid(data.gfx_fd)); |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 277 | |
Daniel Vetter | 33f0884 | 2014-08-12 11:23:09 +0200 | [diff] [blame] | 278 | kmstest_set_vt_graphics_mode(); |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 279 | |
| 280 | igt_require_pipe_crc(); |
| 281 | |
| 282 | igt_display_init(&data.display, data.gfx_fd); |
| 283 | } |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 284 | igt_subtest_f("primary-rotation-180") { |
| 285 | data.rotation = IGT_ROTATION_180; |
Damien Lespiau | 13e979c | 2014-07-08 18:13:47 +0100 | [diff] [blame] | 286 | test_plane_rotation(&data, IGT_PLANE_PRIMARY); |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 287 | } |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 288 | |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 289 | igt_subtest_f("sprite-rotation-180") { |
| 290 | data.rotation = IGT_ROTATION_180; |
Damien Lespiau | 13e979c | 2014-07-08 18:13:47 +0100 | [diff] [blame] | 291 | test_plane_rotation(&data, IGT_PLANE_2); |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 292 | } |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 293 | |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 294 | igt_subtest_f("cursor-rotation-180") { |
| 295 | data.rotation = IGT_ROTATION_180; |
Sonika Jindal | 4724698 | 2014-10-23 08:48:50 -0700 | [diff] [blame] | 296 | test_plane_rotation(&data, IGT_PLANE_CURSOR); |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 297 | } |
| 298 | |
| 299 | igt_subtest_f("primary-rotation-90") { |
| 300 | igt_require(gen >= 9); |
| 301 | data.rotation = IGT_ROTATION_90; |
| 302 | test_plane_rotation(&data, IGT_PLANE_PRIMARY); |
| 303 | } |
| 304 | |
| 305 | igt_subtest_f("primary-rotation-270") { |
| 306 | igt_require(gen >= 9); |
| 307 | data.rotation = IGT_ROTATION_270; |
| 308 | test_plane_rotation(&data, IGT_PLANE_PRIMARY); |
| 309 | } |
| 310 | |
| 311 | igt_subtest_f("sprite-rotation-90") { |
| 312 | igt_require(gen >= 9); |
| 313 | data.rotation = IGT_ROTATION_90; |
| 314 | test_plane_rotation(&data, IGT_PLANE_2); |
| 315 | } |
| 316 | |
| 317 | igt_subtest_f("sprite-rotation-270") { |
| 318 | igt_require(gen >= 9); |
| 319 | data.rotation = IGT_ROTATION_270; |
| 320 | test_plane_rotation(&data, IGT_PLANE_2); |
| 321 | } |
| 322 | |
| 323 | igt_subtest_f("sprite-rotation-90-pos-100-0") { |
| 324 | igt_require(gen >= 9); |
| 325 | data.rotation = IGT_ROTATION_90; |
| 326 | data.pos_x = 100, |
| 327 | data.pos_y = 0; |
| 328 | test_plane_rotation(&data, IGT_PLANE_2); |
| 329 | } |
| 330 | |
Tvrtko Ursulin | dbf6468 | 2015-04-22 16:46:48 +0100 | [diff] [blame] | 331 | igt_subtest_f("bad-pixel-format") { |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 332 | igt_require(gen >= 9); |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 333 | data.pos_x = 0, |
| 334 | data.pos_y = 0; |
Tvrtko Ursulin | dbf6468 | 2015-04-22 16:46:48 +0100 | [diff] [blame] | 335 | data.rotation = IGT_ROTATION_90; |
| 336 | data.override_fmt = DRM_FORMAT_RGB565; |
| 337 | test_plane_rotation(&data, IGT_PLANE_PRIMARY); |
| 338 | } |
| 339 | |
| 340 | igt_subtest_f("bad-tiling") { |
| 341 | igt_require(gen >= 9); |
| 342 | data.override_fmt = 0; |
| 343 | data.rotation = IGT_ROTATION_90; |
| 344 | data.override_tiling = LOCAL_DRM_FORMAT_MOD_NONE; |
| 345 | test_plane_rotation(&data, IGT_PLANE_PRIMARY); |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 346 | } |
Sonika Jindal | 4724698 | 2014-10-23 08:48:50 -0700 | [diff] [blame] | 347 | |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 348 | igt_fixture { |
| 349 | igt_display_fini(&data.display); |
| 350 | } |
| 351 | } |