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 | |
Vivek Kasireddy | 938b930 | 2015-11-04 16:10:15 -0800 | [diff] [blame] | 28 | #define MAX_FENCES 32 |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 29 | |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 30 | typedef struct { |
| 31 | int gfx_fd; |
| 32 | igt_display_t display; |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 33 | struct igt_fb fb; |
Tvrtko Ursulin | d901106 | 2015-04-22 16:46:43 +0100 | [diff] [blame] | 34 | struct igt_fb fb_modeset; |
Tvrtko Ursulin | 061a38f | 2015-10-07 12:18:52 +0100 | [diff] [blame] | 35 | struct igt_fb fb_flip; |
Damien Lespiau | 19743a1 | 2014-07-08 12:59:03 +0100 | [diff] [blame] | 36 | igt_crc_t ref_crc; |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 37 | igt_pipe_crc_t *pipe_crc; |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 38 | igt_rotation_t rotation; |
| 39 | int pos_x; |
| 40 | int pos_y; |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 41 | unsigned int w, h; |
Tvrtko Ursulin | dbf6468 | 2015-04-22 16:46:48 +0100 | [diff] [blame] | 42 | uint32_t override_fmt; |
| 43 | uint64_t override_tiling; |
Tvrtko Ursulin | 061a38f | 2015-10-07 12:18:52 +0100 | [diff] [blame] | 44 | unsigned int flip_stress; |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 45 | } data_t; |
| 46 | |
Damien Lespiau | 92b29b1 | 2014-07-08 12:49:03 +0100 | [diff] [blame] | 47 | static void |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 48 | paint_squares(data_t *data, drmModeModeInfo *mode, igt_rotation_t rotation, |
Tvrtko Ursulin | 061a38f | 2015-10-07 12:18:52 +0100 | [diff] [blame] | 49 | struct igt_fb *fb, float o) |
Damien Lespiau | 92b29b1 | 2014-07-08 12:49:03 +0100 | [diff] [blame] | 50 | { |
| 51 | cairo_t *cr; |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 52 | unsigned int w = data->w; |
| 53 | unsigned int h = data->h; |
Damien Lespiau | 92b29b1 | 2014-07-08 12:49:03 +0100 | [diff] [blame] | 54 | |
Tvrtko Ursulin | 061a38f | 2015-10-07 12:18:52 +0100 | [diff] [blame] | 55 | cr = igt_get_cairo_ctx(data->gfx_fd, fb); |
Damien Lespiau | 92b29b1 | 2014-07-08 12:49:03 +0100 | [diff] [blame] | 56 | |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 57 | if (rotation == IGT_ROTATION_180) { |
| 58 | cairo_translate(cr, w, h); |
| 59 | cairo_rotate(cr, M_PI); |
Damien Lespiau | 92b29b1 | 2014-07-08 12:49:03 +0100 | [diff] [blame] | 60 | } |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 61 | |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 62 | if (rotation == IGT_ROTATION_90) { |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 63 | /* Paint 4 squares with width == height in Green, White, |
| 64 | Blue, Red Clockwise order to look like 270 degree rotated*/ |
Tvrtko Ursulin | 061a38f | 2015-10-07 12:18:52 +0100 | [diff] [blame] | 65 | igt_paint_color(cr, 0, 0, w / 2, h / 2, 0.0, o, 0.0); |
| 66 | igt_paint_color(cr, w / 2, 0, w / 2, h / 2, o, o, o); |
| 67 | igt_paint_color(cr, 0, h / 2, w / 2, h / 2, o, 0.0, 0.0); |
| 68 | igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, 0.0, 0.0, o); |
Tvrtko Ursulin | f2a5896 | 2015-05-22 11:00:45 +0100 | [diff] [blame] | 69 | } else if (rotation == IGT_ROTATION_270) { |
| 70 | /* Paint 4 squares with width == height in Blue, Red, |
| 71 | Green, White Clockwise order to look like 90 degree rotated*/ |
Tvrtko Ursulin | 061a38f | 2015-10-07 12:18:52 +0100 | [diff] [blame] | 72 | igt_paint_color(cr, 0, 0, w / 2, h / 2, 0.0, 0.0, o); |
| 73 | igt_paint_color(cr, w / 2, 0, w / 2, h / 2, o, 0.0, 0.0); |
| 74 | igt_paint_color(cr, 0, h / 2, w / 2, h / 2, o, o, o); |
| 75 | igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, 0.0, o, 0.0); |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 76 | } else { |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 77 | /* Paint with 4 squares of Red, Green, White, Blue Clockwise */ |
Tvrtko Ursulin | 061a38f | 2015-10-07 12:18:52 +0100 | [diff] [blame] | 78 | igt_paint_color(cr, 0, 0, w / 2, h / 2, o, 0.0, 0.0); |
| 79 | igt_paint_color(cr, w / 2, 0, w / 2, h / 2, 0.0, o, 0.0); |
| 80 | igt_paint_color(cr, 0, h / 2, w / 2, h / 2, 0.0, 0.0, o); |
| 81 | igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, o, o, o); |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 82 | } |
| 83 | |
Damien Lespiau | 92b29b1 | 2014-07-08 12:49:03 +0100 | [diff] [blame] | 84 | cairo_destroy(cr); |
| 85 | } |
| 86 | |
Tvrtko Ursulin | 637f045 | 2015-04-27 12:29:11 +0100 | [diff] [blame] | 87 | static void commit_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane) |
| 88 | { |
| 89 | igt_display_t *display = &data->display; |
| 90 | enum igt_commit_style commit = COMMIT_LEGACY; |
| 91 | igt_plane_t *primary; |
| 92 | |
| 93 | /* |
| 94 | * With igt_display_commit2 and COMMIT_UNIVERSAL, we call just the |
| 95 | * setplane without a modeset. So, to be able to call |
| 96 | * igt_display_commit and ultimately setcrtc to do the first modeset, |
| 97 | * we create an fb covering the crtc and call commit |
| 98 | */ |
| 99 | |
| 100 | primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY); |
| 101 | igt_plane_set_fb(primary, &data->fb_modeset); |
Maarten Lankhorst | eeffa25 | 2017-01-05 14:13:34 +0100 | [diff] [blame^] | 102 | primary->rotation_changed = false; |
Tvrtko Ursulin | 637f045 | 2015-04-27 12:29:11 +0100 | [diff] [blame] | 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 | |
Lyude | 80baeb0 | 2016-12-07 19:02:04 -0500 | [diff] [blame] | 110 | if (plane->is_primary || plane->is_cursor) |
Tvrtko Ursulin | 637f045 | 2015-04-27 12:29:11 +0100 | [diff] [blame] | 111 | commit = COMMIT_UNIVERSAL; |
Tvrtko Ursulin | 637f045 | 2015-04-27 12:29:11 +0100 | [diff] [blame] | 112 | |
pvishwak | 8b8d7aa | 2016-04-11 11:24:56 +0530 | [diff] [blame] | 113 | if (data->display.is_atomic) |
| 114 | commit = COMMIT_ATOMIC; |
| 115 | |
Tvrtko Ursulin | 637f045 | 2015-04-27 12:29:11 +0100 | [diff] [blame] | 116 | igt_display_commit2(display, commit); |
| 117 | } |
| 118 | |
Daniel Vetter | 57259d7 | 2014-11-24 16:08:32 +0100 | [diff] [blame] | 119 | 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] | 120 | igt_plane_t *plane) |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 121 | { |
| 122 | drmModeModeInfo *mode; |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 123 | int fb_id, fb_modeset_id; |
| 124 | unsigned int w, h; |
Tvrtko Ursulin | dbf6468 | 2015-04-22 16:46:48 +0100 | [diff] [blame] | 125 | uint64_t tiling = data->override_tiling ? |
| 126 | data->override_tiling : LOCAL_DRM_FORMAT_MOD_NONE; |
| 127 | uint32_t pixel_format = data->override_fmt ? |
| 128 | data->override_fmt : DRM_FORMAT_XRGB8888; |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 129 | |
Damien Lespiau | 8facccf | 2014-07-08 18:28:53 +0100 | [diff] [blame] | 130 | igt_output_set_pipe(output, pipe); |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 131 | |
| 132 | /* create the pipe_crc object for this pipe */ |
Damien Lespiau | 2eaa50f | 2014-07-08 18:56:15 +0100 | [diff] [blame] | 133 | igt_pipe_crc_free(data->pipe_crc); |
Damien Lespiau | 8facccf | 2014-07-08 18:28:53 +0100 | [diff] [blame] | 134 | 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] | 135 | |
Damien Lespiau | 19743a1 | 2014-07-08 12:59:03 +0100 | [diff] [blame] | 136 | mode = igt_output_get_mode(output); |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 137 | |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 138 | w = mode->hdisplay; |
| 139 | h = mode->vdisplay; |
| 140 | |
Tvrtko Ursulin | d901106 | 2015-04-22 16:46:43 +0100 | [diff] [blame] | 141 | fb_modeset_id = igt_create_fb(data->gfx_fd, |
| 142 | w, h, |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 143 | pixel_format, |
Tvrtko Ursulin | d901106 | 2015-04-22 16:46:43 +0100 | [diff] [blame] | 144 | tiling, |
| 145 | &data->fb_modeset); |
| 146 | igt_assert(fb_modeset_id); |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 147 | |
| 148 | /* |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 149 | * For 90/270, we will use create smaller fb so that the rotated |
| 150 | * frame can fit in |
| 151 | */ |
| 152 | if (data->rotation == IGT_ROTATION_90 || |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 153 | data->rotation == IGT_ROTATION_270) { |
Tvrtko Ursulin | dbf6468 | 2015-04-22 16:46:48 +0100 | [diff] [blame] | 154 | tiling = data->override_tiling ? |
| 155 | data->override_tiling : LOCAL_I915_FORMAT_MOD_Y_TILED; |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 156 | w = h = mode->vdisplay; |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 157 | } else if (plane->is_cursor) { |
Tvrtko Ursulin | dbf6468 | 2015-04-22 16:46:48 +0100 | [diff] [blame] | 158 | pixel_format = data->override_fmt ? |
| 159 | data->override_fmt : DRM_FORMAT_ARGB8888; |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 160 | w = h = 128; |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 161 | } |
| 162 | |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 163 | data->w = w; |
| 164 | data->h = h; |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 165 | |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 166 | fb_id = igt_create_fb(data->gfx_fd, |
| 167 | w, h, |
| 168 | pixel_format, |
| 169 | tiling, |
| 170 | &data->fb); |
| 171 | igt_assert(fb_id); |
Damien Lespiau | 282f560 | 2014-07-10 17:44:28 +0100 | [diff] [blame] | 172 | |
Tvrtko Ursulin | 061a38f | 2015-10-07 12:18:52 +0100 | [diff] [blame] | 173 | if (data->flip_stress) { |
| 174 | fb_id = igt_create_fb(data->gfx_fd, |
| 175 | w, h, |
| 176 | pixel_format, |
| 177 | tiling, |
| 178 | &data->fb_flip); |
| 179 | igt_assert(fb_id); |
| 180 | paint_squares(data, mode, IGT_ROTATION_0, &data->fb_flip, 0.92); |
| 181 | } |
| 182 | |
Sonika Jindal | 4724698 | 2014-10-23 08:48:50 -0700 | [diff] [blame] | 183 | /* Step 1: create a reference CRC for a software-rotated fb */ |
Tvrtko Ursulin | 061a38f | 2015-10-07 12:18:52 +0100 | [diff] [blame] | 184 | paint_squares(data, mode, data->rotation, &data->fb, 1.0); |
Tvrtko Ursulin | 637f045 | 2015-04-27 12:29:11 +0100 | [diff] [blame] | 185 | commit_crtc(data, output, plane); |
Damien Lespiau | 19743a1 | 2014-07-08 12:59:03 +0100 | [diff] [blame] | 186 | igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc); |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 187 | |
Damien Lespiau | 282f560 | 2014-07-10 17:44:28 +0100 | [diff] [blame] | 188 | /* |
| 189 | * Step 2: prepare the plane with an non-rotated fb let the hw |
| 190 | * rotate it. |
| 191 | */ |
Tvrtko Ursulin | 061a38f | 2015-10-07 12:18:52 +0100 | [diff] [blame] | 192 | paint_squares(data, mode, IGT_ROTATION_0, &data->fb, 1.0); |
Tvrtko Ursulin | b769a7c | 2015-04-22 16:46:46 +0100 | [diff] [blame] | 193 | igt_plane_set_fb(plane, &data->fb); |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 194 | } |
| 195 | |
Damien Lespiau | 05f90b0 | 2014-07-08 18:51:25 +0100 | [diff] [blame] | 196 | 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] | 197 | { |
| 198 | igt_display_t *display = &data->display; |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 199 | |
| 200 | igt_pipe_crc_free(data->pipe_crc); |
| 201 | data->pipe_crc = NULL; |
| 202 | |
| 203 | igt_remove_fb(data->gfx_fd, &data->fb); |
Tvrtko Ursulin | d901106 | 2015-04-22 16:46:43 +0100 | [diff] [blame] | 204 | igt_remove_fb(data->gfx_fd, &data->fb_modeset); |
Tvrtko Ursulin | 061a38f | 2015-10-07 12:18:52 +0100 | [diff] [blame] | 205 | if (data->fb_flip.fb_id) |
| 206 | igt_remove_fb(data->gfx_fd, &data->fb_flip); |
Damien Lespiau | 1a75439 | 2014-07-09 14:00:59 +0100 | [diff] [blame] | 207 | |
| 208 | /* XXX: see the note in prepare_crtc() */ |
| 209 | if (!plane->is_primary) { |
| 210 | igt_plane_t *primary; |
| 211 | |
| 212 | primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY); |
| 213 | igt_plane_set_fb(primary, NULL); |
| 214 | } |
| 215 | |
Damien Lespiau | 05f90b0 | 2014-07-08 18:51:25 +0100 | [diff] [blame] | 216 | igt_plane_set_fb(plane, NULL); |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 217 | igt_output_set_pipe(output, PIPE_ANY); |
Damien Lespiau | eb81a92 | 2014-07-08 18:20:51 +0100 | [diff] [blame] | 218 | |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 219 | igt_display_commit(display); |
| 220 | } |
| 221 | |
Tvrtko Ursulin | 061a38f | 2015-10-07 12:18:52 +0100 | [diff] [blame] | 222 | static void wait_for_pageflip(int fd) |
| 223 | { |
| 224 | drmEventContext evctx = { .version = DRM_EVENT_CONTEXT_VERSION }; |
Maarten Lankhorst | 3c1362f | 2016-01-05 15:19:13 +0100 | [diff] [blame] | 225 | struct timeval timeout = { .tv_sec = 0, .tv_usec = 50000 }; |
Tvrtko Ursulin | 061a38f | 2015-10-07 12:18:52 +0100 | [diff] [blame] | 226 | fd_set fds; |
| 227 | int ret; |
| 228 | |
| 229 | /* Wait for pageflip completion, then consume event on fd */ |
| 230 | FD_ZERO(&fds); |
| 231 | FD_SET(fd, &fds); |
| 232 | do { |
| 233 | ret = select(fd + 1, &fds, NULL, NULL, &timeout); |
| 234 | } while (ret < 0 && errno == EINTR); |
| 235 | igt_assert_eq(ret, 1); |
| 236 | igt_assert(drmHandleEvent(fd, &evctx) == 0); |
| 237 | } |
| 238 | |
Damien Lespiau | 05f90b0 | 2014-07-08 18:51:25 +0100 | [diff] [blame] | 239 | 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] | 240 | { |
| 241 | igt_display_t *display = &data->display; |
| 242 | igt_output_t *output; |
Damien Lespiau | aef475b | 2014-07-08 18:43:44 +0100 | [diff] [blame] | 243 | enum pipe pipe; |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 244 | int valid_tests = 0; |
Thomas Wood | 1bec6cb | 2014-08-14 14:06:37 +0100 | [diff] [blame] | 245 | igt_crc_t crc_output, crc_unrotated; |
Damien Lespiau | c4564e0 | 2014-07-08 19:24:24 +0100 | [diff] [blame] | 246 | enum igt_commit_style commit = COMMIT_LEGACY; |
Tvrtko Ursulin | 061a38f | 2015-10-07 12:18:52 +0100 | [diff] [blame] | 247 | unsigned int flip_count; |
Tvrtko Ursulin | dbf6468 | 2015-04-22 16:46:48 +0100 | [diff] [blame] | 248 | int ret; |
Damien Lespiau | 13e979c | 2014-07-08 18:13:47 +0100 | [diff] [blame] | 249 | |
Lyude | 80baeb0 | 2016-12-07 19:02:04 -0500 | [diff] [blame] | 250 | if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR) |
Damien Lespiau | c4564e0 | 2014-07-08 19:24:24 +0100 | [diff] [blame] | 251 | commit = COMMIT_UNIVERSAL; |
Lyude | 80baeb0 | 2016-12-07 19:02:04 -0500 | [diff] [blame] | 252 | |
| 253 | if (plane_type == IGT_PLANE_CURSOR) |
| 254 | igt_require(display->has_cursor_plane); |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 255 | |
pvishwak | 8b8d7aa | 2016-04-11 11:24:56 +0530 | [diff] [blame] | 256 | if (data->display.is_atomic) |
| 257 | commit = COMMIT_ATOMIC; |
| 258 | |
Maarten Lankhorst | eeffa25 | 2017-01-05 14:13:34 +0100 | [diff] [blame^] | 259 | for_each_pipe_with_valid_output(display, pipe, output) { |
| 260 | igt_plane_t *plane; |
Damien Lespiau | 05f90b0 | 2014-07-08 18:51:25 +0100 | [diff] [blame] | 261 | |
Maarten Lankhorst | eeffa25 | 2017-01-05 14:13:34 +0100 | [diff] [blame^] | 262 | igt_output_set_pipe(output, pipe); |
Damien Lespiau | 05f90b0 | 2014-07-08 18:51:25 +0100 | [diff] [blame] | 263 | |
Maarten Lankhorst | eeffa25 | 2017-01-05 14:13:34 +0100 | [diff] [blame^] | 264 | plane = igt_output_get_plane(output, plane_type); |
| 265 | igt_require(igt_plane_supports_rotation(plane)); |
Damien Lespiau | 05f90b0 | 2014-07-08 18:51:25 +0100 | [diff] [blame] | 266 | |
Maarten Lankhorst | eeffa25 | 2017-01-05 14:13:34 +0100 | [diff] [blame^] | 267 | prepare_crtc(data, output, pipe, plane); |
Daniel Vetter | 57259d7 | 2014-11-24 16:08:32 +0100 | [diff] [blame] | 268 | |
Maarten Lankhorst | eeffa25 | 2017-01-05 14:13:34 +0100 | [diff] [blame^] | 269 | igt_display_commit2(display, commit); |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 270 | |
Maarten Lankhorst | eeffa25 | 2017-01-05 14:13:34 +0100 | [diff] [blame^] | 271 | /* collect unrotated CRC */ |
| 272 | igt_pipe_crc_collect_crc(data->pipe_crc, &crc_unrotated); |
Thomas Wood | 1bec6cb | 2014-08-14 14:06:37 +0100 | [diff] [blame] | 273 | |
Maarten Lankhorst | eeffa25 | 2017-01-05 14:13:34 +0100 | [diff] [blame^] | 274 | igt_plane_set_rotation(plane, data->rotation); |
| 275 | ret = igt_display_try_commit2(display, commit); |
| 276 | if (data->override_fmt || data->override_tiling) { |
| 277 | igt_assert_eq(ret, -EINVAL); |
| 278 | } else { |
| 279 | igt_assert_eq(ret, 0); |
| 280 | igt_pipe_crc_collect_crc(data->pipe_crc, |
| 281 | &crc_output); |
| 282 | igt_assert_crc_equal(&data->ref_crc, |
| 283 | &crc_output); |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 284 | } |
Maarten Lankhorst | eeffa25 | 2017-01-05 14:13:34 +0100 | [diff] [blame^] | 285 | |
| 286 | flip_count = data->flip_stress; |
| 287 | while (flip_count--) { |
| 288 | ret = drmModePageFlip(data->gfx_fd, |
| 289 | output->config.crtc->crtc_id, |
| 290 | data->fb_flip.fb_id, |
| 291 | DRM_MODE_PAGE_FLIP_EVENT, |
| 292 | NULL); |
| 293 | igt_assert_eq(ret, 0); |
| 294 | wait_for_pageflip(data->gfx_fd); |
| 295 | ret = drmModePageFlip(data->gfx_fd, |
| 296 | output->config.crtc->crtc_id, |
| 297 | data->fb.fb_id, |
| 298 | DRM_MODE_PAGE_FLIP_EVENT, |
| 299 | NULL); |
| 300 | igt_assert_eq(ret, 0); |
| 301 | wait_for_pageflip(data->gfx_fd); |
| 302 | } |
| 303 | |
| 304 | /* |
| 305 | * check the rotation state has been reset when the VT |
| 306 | * mode is restored |
| 307 | */ |
| 308 | kmstest_restore_vt_mode(); |
| 309 | kmstest_set_vt_graphics_mode(); |
| 310 | |
| 311 | commit_crtc(data, output, plane); |
| 312 | |
| 313 | igt_pipe_crc_collect_crc(data->pipe_crc, &crc_output); |
| 314 | igt_assert_crc_equal(&crc_unrotated, &crc_output); |
| 315 | |
| 316 | valid_tests++; |
| 317 | cleanup_crtc(data, output, plane); |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 318 | } |
| 319 | igt_require_f(valid_tests, "no valid crtc/connector combinations found\n"); |
| 320 | } |
| 321 | |
Maarten Lankhorst | eeffa25 | 2017-01-05 14:13:34 +0100 | [diff] [blame^] | 322 | static void test_plane_rotation_ytiled_obj(data_t *data, |
| 323 | igt_output_t *output, |
| 324 | enum igt_plane plane_type) |
Vivek Kasireddy | fe548fa | 2015-10-22 18:34:03 -0700 | [diff] [blame] | 325 | { |
| 326 | igt_display_t *display = &data->display; |
| 327 | uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED; |
| 328 | uint32_t format = DRM_FORMAT_XRGB8888; |
| 329 | int bpp = igt_drm_format_to_bpp(format); |
| 330 | enum igt_commit_style commit = COMMIT_LEGACY; |
| 331 | int fd = data->gfx_fd; |
Vivek Kasireddy | fe548fa | 2015-10-22 18:34:03 -0700 | [diff] [blame] | 332 | igt_plane_t *plane; |
| 333 | drmModeModeInfo *mode; |
| 334 | unsigned int stride, size, w, h; |
| 335 | uint32_t gem_handle; |
| 336 | int ret; |
| 337 | |
Vivek Kasireddy | fe548fa | 2015-10-22 18:34:03 -0700 | [diff] [blame] | 338 | plane = igt_output_get_plane(output, plane_type); |
| 339 | igt_require(igt_plane_supports_rotation(plane)); |
| 340 | |
Lyude | 80baeb0 | 2016-12-07 19:02:04 -0500 | [diff] [blame] | 341 | if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR) |
Vivek Kasireddy | fe548fa | 2015-10-22 18:34:03 -0700 | [diff] [blame] | 342 | commit = COMMIT_UNIVERSAL; |
Lyude | 80baeb0 | 2016-12-07 19:02:04 -0500 | [diff] [blame] | 343 | |
| 344 | if (plane_type == IGT_PLANE_CURSOR) |
| 345 | igt_require(display->has_cursor_plane); |
Vivek Kasireddy | fe548fa | 2015-10-22 18:34:03 -0700 | [diff] [blame] | 346 | |
pvishwak | 8b8d7aa | 2016-04-11 11:24:56 +0530 | [diff] [blame] | 347 | if (data->display.is_atomic) |
| 348 | commit = COMMIT_ATOMIC; |
| 349 | |
Vivek Kasireddy | fe548fa | 2015-10-22 18:34:03 -0700 | [diff] [blame] | 350 | mode = igt_output_get_mode(output); |
| 351 | w = mode->hdisplay; |
| 352 | h = mode->vdisplay; |
| 353 | |
| 354 | for (stride = 512; stride < (w * bpp / 8); stride *= 2) |
| 355 | ; |
| 356 | for (size = 1024*1024; size < stride * h; size *= 2) |
| 357 | ; |
| 358 | |
| 359 | gem_handle = gem_create(fd, size); |
| 360 | ret = __gem_set_tiling(fd, gem_handle, I915_TILING_Y, stride); |
Maarten Lankhorst | eeffa25 | 2017-01-05 14:13:34 +0100 | [diff] [blame^] | 361 | igt_assert_eq(ret, 0); |
Vivek Kasireddy | fe548fa | 2015-10-22 18:34:03 -0700 | [diff] [blame] | 362 | |
| 363 | do_or_die(__kms_addfb(fd, gem_handle, w, h, stride, |
| 364 | format, tiling, LOCAL_DRM_MODE_FB_MODIFIERS, |
| 365 | &data->fb.fb_id)); |
| 366 | data->fb.width = w; |
| 367 | data->fb.height = h; |
| 368 | data->fb.gem_handle = gem_handle; |
| 369 | |
| 370 | igt_plane_set_fb(plane, NULL); |
| 371 | igt_display_commit(display); |
| 372 | |
| 373 | igt_plane_set_rotation(plane, data->rotation); |
| 374 | igt_plane_set_fb(plane, &data->fb); |
| 375 | |
| 376 | drmModeObjectSetProperty(fd, plane->drm_plane->plane_id, |
| 377 | DRM_MODE_OBJECT_PLANE, |
| 378 | plane->rotation_property, |
| 379 | plane->rotation); |
| 380 | ret = igt_display_try_commit2(display, commit); |
| 381 | |
Maarten Lankhorst | eeffa25 | 2017-01-05 14:13:34 +0100 | [diff] [blame^] | 382 | igt_output_set_pipe(output, PIPE_NONE); |
| 383 | |
Vivek Kasireddy | fe548fa | 2015-10-22 18:34:03 -0700 | [diff] [blame] | 384 | kmstest_restore_vt_mode(); |
| 385 | igt_remove_fb(fd, &data->fb); |
Maarten Lankhorst | eeffa25 | 2017-01-05 14:13:34 +0100 | [diff] [blame^] | 386 | igt_assert_eq(ret, 0); |
Vivek Kasireddy | fe548fa | 2015-10-22 18:34:03 -0700 | [diff] [blame] | 387 | } |
| 388 | |
Maarten Lankhorst | eeffa25 | 2017-01-05 14:13:34 +0100 | [diff] [blame^] | 389 | static void test_plane_rotation_exhaust_fences(data_t *data, |
| 390 | igt_output_t *output, |
| 391 | enum igt_plane plane_type) |
Vivek Kasireddy | 938b930 | 2015-11-04 16:10:15 -0800 | [diff] [blame] | 392 | { |
| 393 | igt_display_t *display = &data->display; |
| 394 | uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED; |
| 395 | uint32_t format = DRM_FORMAT_XRGB8888; |
| 396 | int bpp = igt_drm_format_to_bpp(format); |
| 397 | enum igt_commit_style commit = COMMIT_LEGACY; |
| 398 | int fd = data->gfx_fd; |
Vivek Kasireddy | 938b930 | 2015-11-04 16:10:15 -0800 | [diff] [blame] | 399 | igt_plane_t *plane; |
| 400 | drmModeModeInfo *mode; |
| 401 | data_t data2[MAX_FENCES+1] = {}; |
| 402 | unsigned int stride, size, w, h; |
| 403 | uint32_t gem_handle; |
| 404 | uint64_t total_aperture_size, total_fbs_size; |
| 405 | int i, ret; |
| 406 | |
Vivek Kasireddy | 938b930 | 2015-11-04 16:10:15 -0800 | [diff] [blame] | 407 | plane = igt_output_get_plane(output, plane_type); |
| 408 | igt_require(igt_plane_supports_rotation(plane)); |
| 409 | |
Lyude | 80baeb0 | 2016-12-07 19:02:04 -0500 | [diff] [blame] | 410 | if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR) |
Vivek Kasireddy | 938b930 | 2015-11-04 16:10:15 -0800 | [diff] [blame] | 411 | commit = COMMIT_UNIVERSAL; |
Lyude | 80baeb0 | 2016-12-07 19:02:04 -0500 | [diff] [blame] | 412 | |
| 413 | if (plane_type == IGT_PLANE_CURSOR) |
| 414 | igt_require(display->has_cursor_plane); |
Vivek Kasireddy | 938b930 | 2015-11-04 16:10:15 -0800 | [diff] [blame] | 415 | |
pvishwak | 8b8d7aa | 2016-04-11 11:24:56 +0530 | [diff] [blame] | 416 | if (data->display.is_atomic) |
| 417 | commit = COMMIT_ATOMIC; |
| 418 | |
Vivek Kasireddy | 938b930 | 2015-11-04 16:10:15 -0800 | [diff] [blame] | 419 | mode = igt_output_get_mode(output); |
| 420 | w = mode->hdisplay; |
| 421 | h = mode->vdisplay; |
| 422 | |
| 423 | for (stride = 512; stride < (w * bpp / 8); stride *= 2) |
| 424 | ; |
| 425 | for (size = 1024*1024; size < stride * h; size *= 2) |
| 426 | ; |
| 427 | |
| 428 | /* |
| 429 | * Make sure there is atleast 90% of the available GTT space left |
| 430 | * for creating (MAX_FENCES+1) framebuffers. |
| 431 | */ |
| 432 | total_fbs_size = size * (MAX_FENCES + 1); |
Chris Wilson | 1603890 | 2016-02-18 10:35:10 +0000 | [diff] [blame] | 433 | total_aperture_size = gem_available_aperture_size(fd); |
Vivek Kasireddy | 938b930 | 2015-11-04 16:10:15 -0800 | [diff] [blame] | 434 | igt_require(total_fbs_size < total_aperture_size * 0.9); |
| 435 | |
| 436 | igt_plane_set_fb(plane, NULL); |
| 437 | igt_display_commit(display); |
| 438 | |
| 439 | for (i = 0; i < MAX_FENCES + 1; i++) { |
| 440 | gem_handle = gem_create(fd, size); |
| 441 | ret = __gem_set_tiling(fd, gem_handle, I915_TILING_Y, stride); |
| 442 | if (ret) { |
| 443 | igt_warn("failed to set tiling\n"); |
| 444 | goto err_alloc; |
| 445 | } |
| 446 | |
| 447 | ret = (__kms_addfb(fd, gem_handle, w, h, stride, |
| 448 | format, tiling, LOCAL_DRM_MODE_FB_MODIFIERS, |
| 449 | &data2[i].fb.fb_id)); |
| 450 | if (ret) { |
| 451 | igt_warn("failed to create framebuffer\n"); |
| 452 | goto err_alloc; |
| 453 | } |
| 454 | |
| 455 | data2[i].fb.width = w; |
| 456 | data2[i].fb.height = h; |
| 457 | data2[i].fb.gem_handle = gem_handle; |
| 458 | |
| 459 | igt_plane_set_fb(plane, &data2[i].fb); |
| 460 | igt_plane_set_rotation(plane, IGT_ROTATION_0); |
| 461 | |
| 462 | ret = igt_display_try_commit2(display, commit); |
| 463 | if (ret) { |
| 464 | igt_warn("failed to commit unrotated fb\n"); |
| 465 | goto err_commit; |
| 466 | } |
| 467 | |
| 468 | igt_plane_set_rotation(plane, IGT_ROTATION_90); |
| 469 | |
| 470 | drmModeObjectSetProperty(fd, plane->drm_plane->plane_id, |
| 471 | DRM_MODE_OBJECT_PLANE, |
| 472 | plane->rotation_property, |
| 473 | plane->rotation); |
Maarten Lankhorst | eeffa25 | 2017-01-05 14:13:34 +0100 | [diff] [blame^] | 474 | igt_display_commit2(display, commit); |
Vivek Kasireddy | 938b930 | 2015-11-04 16:10:15 -0800 | [diff] [blame] | 475 | if (ret) { |
Maarten Lankhorst | eeffa25 | 2017-01-05 14:13:34 +0100 | [diff] [blame^] | 476 | igt_warn("failed to commit hardware rotated fb: %i\n", ret); |
Vivek Kasireddy | 938b930 | 2015-11-04 16:10:15 -0800 | [diff] [blame] | 477 | goto err_commit; |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | err_alloc: |
| 482 | if (ret) |
| 483 | gem_close(fd, gem_handle); |
| 484 | |
| 485 | i--; |
| 486 | err_commit: |
Maarten Lankhorst | eeffa25 | 2017-01-05 14:13:34 +0100 | [diff] [blame^] | 487 | igt_plane_set_fb(plane, NULL); |
| 488 | igt_plane_set_rotation(plane, IGT_ROTATION_0); |
| 489 | |
| 490 | if (commit < COMMIT_ATOMIC) |
| 491 | igt_display_commit2(display, commit); |
| 492 | |
| 493 | igt_output_set_pipe(output, PIPE_NONE); |
| 494 | igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY); |
| 495 | |
Vivek Kasireddy | 938b930 | 2015-11-04 16:10:15 -0800 | [diff] [blame] | 496 | for (; i >= 0; i--) |
| 497 | igt_remove_fb(fd, &data2[i].fb); |
| 498 | |
| 499 | kmstest_restore_vt_mode(); |
Maarten Lankhorst | eeffa25 | 2017-01-05 14:13:34 +0100 | [diff] [blame^] | 500 | igt_assert_eq(ret, 0); |
Vivek Kasireddy | 938b930 | 2015-11-04 16:10:15 -0800 | [diff] [blame] | 501 | } |
| 502 | |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 503 | igt_main |
| 504 | { |
| 505 | data_t data = {}; |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 506 | int gen = 0; |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 507 | |
| 508 | igt_skip_on_simulation(); |
| 509 | |
| 510 | igt_fixture { |
Micah Fedke | c81d293 | 2015-07-22 21:54:02 +0000 | [diff] [blame] | 511 | data.gfx_fd = drm_open_driver_master(DRIVER_INTEL); |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 512 | gen = intel_gen(intel_get_drm_devid(data.gfx_fd)); |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 513 | |
Daniel Vetter | 33f0884 | 2014-08-12 11:23:09 +0200 | [diff] [blame] | 514 | kmstest_set_vt_graphics_mode(); |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 515 | |
| 516 | igt_require_pipe_crc(); |
| 517 | |
| 518 | igt_display_init(&data.display, data.gfx_fd); |
| 519 | } |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 520 | igt_subtest_f("primary-rotation-180") { |
| 521 | data.rotation = IGT_ROTATION_180; |
Damien Lespiau | 13e979c | 2014-07-08 18:13:47 +0100 | [diff] [blame] | 522 | test_plane_rotation(&data, IGT_PLANE_PRIMARY); |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 523 | } |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 524 | |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 525 | igt_subtest_f("sprite-rotation-180") { |
| 526 | data.rotation = IGT_ROTATION_180; |
Damien Lespiau | 13e979c | 2014-07-08 18:13:47 +0100 | [diff] [blame] | 527 | test_plane_rotation(&data, IGT_PLANE_2); |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 528 | } |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 529 | |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 530 | igt_subtest_f("cursor-rotation-180") { |
| 531 | data.rotation = IGT_ROTATION_180; |
Sonika Jindal | 4724698 | 2014-10-23 08:48:50 -0700 | [diff] [blame] | 532 | test_plane_rotation(&data, IGT_PLANE_CURSOR); |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 533 | } |
| 534 | |
| 535 | igt_subtest_f("primary-rotation-90") { |
| 536 | igt_require(gen >= 9); |
| 537 | data.rotation = IGT_ROTATION_90; |
| 538 | test_plane_rotation(&data, IGT_PLANE_PRIMARY); |
| 539 | } |
| 540 | |
| 541 | igt_subtest_f("primary-rotation-270") { |
| 542 | igt_require(gen >= 9); |
| 543 | data.rotation = IGT_ROTATION_270; |
| 544 | test_plane_rotation(&data, IGT_PLANE_PRIMARY); |
| 545 | } |
| 546 | |
| 547 | igt_subtest_f("sprite-rotation-90") { |
| 548 | igt_require(gen >= 9); |
| 549 | data.rotation = IGT_ROTATION_90; |
| 550 | test_plane_rotation(&data, IGT_PLANE_2); |
| 551 | } |
| 552 | |
| 553 | igt_subtest_f("sprite-rotation-270") { |
| 554 | igt_require(gen >= 9); |
| 555 | data.rotation = IGT_ROTATION_270; |
| 556 | test_plane_rotation(&data, IGT_PLANE_2); |
| 557 | } |
| 558 | |
| 559 | igt_subtest_f("sprite-rotation-90-pos-100-0") { |
| 560 | igt_require(gen >= 9); |
| 561 | data.rotation = IGT_ROTATION_90; |
| 562 | data.pos_x = 100, |
| 563 | data.pos_y = 0; |
| 564 | test_plane_rotation(&data, IGT_PLANE_2); |
| 565 | } |
| 566 | |
Tvrtko Ursulin | dbf6468 | 2015-04-22 16:46:48 +0100 | [diff] [blame] | 567 | igt_subtest_f("bad-pixel-format") { |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 568 | igt_require(gen >= 9); |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 569 | data.pos_x = 0, |
| 570 | data.pos_y = 0; |
Tvrtko Ursulin | dbf6468 | 2015-04-22 16:46:48 +0100 | [diff] [blame] | 571 | data.rotation = IGT_ROTATION_90; |
| 572 | data.override_fmt = DRM_FORMAT_RGB565; |
| 573 | test_plane_rotation(&data, IGT_PLANE_PRIMARY); |
| 574 | } |
| 575 | |
| 576 | igt_subtest_f("bad-tiling") { |
| 577 | igt_require(gen >= 9); |
| 578 | data.override_fmt = 0; |
| 579 | data.rotation = IGT_ROTATION_90; |
| 580 | data.override_tiling = LOCAL_DRM_FORMAT_MOD_NONE; |
| 581 | test_plane_rotation(&data, IGT_PLANE_PRIMARY); |
Sonika Jindal | e1ce5ea | 2015-04-22 16:44:05 +0530 | [diff] [blame] | 582 | } |
Sonika Jindal | 4724698 | 2014-10-23 08:48:50 -0700 | [diff] [blame] | 583 | |
Tvrtko Ursulin | 061a38f | 2015-10-07 12:18:52 +0100 | [diff] [blame] | 584 | igt_subtest_f("primary-rotation-90-flip-stress") { |
| 585 | igt_require(gen >= 9); |
| 586 | data.override_tiling = 0; |
| 587 | data.flip_stress = 60; |
| 588 | data.rotation = IGT_ROTATION_90; |
| 589 | test_plane_rotation(&data, IGT_PLANE_PRIMARY); |
| 590 | } |
| 591 | |
Vivek Kasireddy | fe548fa | 2015-10-22 18:34:03 -0700 | [diff] [blame] | 592 | igt_subtest_f("primary-rotation-90-Y-tiled") { |
Maarten Lankhorst | eeffa25 | 2017-01-05 14:13:34 +0100 | [diff] [blame^] | 593 | enum pipe pipe; |
| 594 | igt_output_t *output; |
| 595 | int valid_tests = 0; |
| 596 | |
Vivek Kasireddy | fe548fa | 2015-10-22 18:34:03 -0700 | [diff] [blame] | 597 | igt_require(gen >= 9); |
| 598 | data.rotation = IGT_ROTATION_90; |
Maarten Lankhorst | eeffa25 | 2017-01-05 14:13:34 +0100 | [diff] [blame^] | 599 | |
| 600 | for_each_pipe_with_valid_output(&data.display, pipe, output) { |
| 601 | igt_output_set_pipe(output, pipe); |
| 602 | |
| 603 | test_plane_rotation_ytiled_obj(&data, output, IGT_PLANE_PRIMARY); |
| 604 | |
| 605 | valid_tests++; |
| 606 | break; |
| 607 | } |
| 608 | |
| 609 | igt_require_f(valid_tests, "no valid crtc/connector combinations found\n"); |
Vivek Kasireddy | fe548fa | 2015-10-22 18:34:03 -0700 | [diff] [blame] | 610 | } |
| 611 | |
Vivek Kasireddy | 938b930 | 2015-11-04 16:10:15 -0800 | [diff] [blame] | 612 | igt_subtest_f("exhaust-fences") { |
Maarten Lankhorst | eeffa25 | 2017-01-05 14:13:34 +0100 | [diff] [blame^] | 613 | enum pipe pipe; |
| 614 | igt_output_t *output; |
| 615 | int valid_tests = 0; |
| 616 | |
Vivek Kasireddy | 938b930 | 2015-11-04 16:10:15 -0800 | [diff] [blame] | 617 | igt_require(gen >= 9); |
Maarten Lankhorst | eeffa25 | 2017-01-05 14:13:34 +0100 | [diff] [blame^] | 618 | |
| 619 | for_each_pipe_with_valid_output(&data.display, pipe, output) { |
| 620 | igt_output_set_pipe(output, pipe); |
| 621 | |
| 622 | test_plane_rotation_exhaust_fences(&data, output, IGT_PLANE_PRIMARY); |
| 623 | |
| 624 | valid_tests++; |
| 625 | break; |
| 626 | } |
| 627 | |
| 628 | igt_require_f(valid_tests, "no valid crtc/connector combinations found\n"); |
Vivek Kasireddy | 938b930 | 2015-11-04 16:10:15 -0800 | [diff] [blame] | 629 | } |
| 630 | |
Sonika Jindal | e361139 | 2014-06-18 14:27:27 +0530 | [diff] [blame] | 631 | igt_fixture { |
| 632 | igt_display_fini(&data.display); |
| 633 | } |
| 634 | } |