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