chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright © 2013,2014 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 | |
Thomas Wood | 804e11f | 2015-08-17 17:57:43 +0100 | [diff] [blame] | 25 | #include "igt.h" |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 26 | #include <math.h> |
| 27 | |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 28 | |
| 29 | IGT_TEST_DESCRIPTION("Test display plane scaling"); |
| 30 | |
| 31 | typedef struct { |
| 32 | uint32_t devid; |
| 33 | int drm_fd; |
| 34 | igt_display_t display; |
| 35 | igt_crc_t ref_crc; |
| 36 | igt_pipe_crc_t *pipe_crc; |
| 37 | |
| 38 | int image_w; |
| 39 | int image_h; |
| 40 | |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 41 | struct igt_fb fb[3]; |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 42 | igt_plane_t *plane1; |
| 43 | igt_plane_t *plane2; |
| 44 | igt_plane_t *plane3; |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 45 | } data_t; |
| 46 | |
Maarten Lankhorst | 1fb3faa | 2018-01-15 11:11:39 +0100 | [diff] [blame] | 47 | static int get_num_scalers(uint32_t devid, enum pipe pipe) |
| 48 | { |
| 49 | igt_require(intel_gen(devid) >= 9); |
| 50 | |
| 51 | if (intel_gen(devid) >= 10) |
| 52 | return 2; |
| 53 | else if (pipe != PIPE_C) |
| 54 | return 2; |
| 55 | else |
| 56 | return 1; |
| 57 | } |
| 58 | |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 59 | static void cleanup_crtc(data_t *data) |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 60 | { |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 61 | int i; |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 62 | |
| 63 | igt_pipe_crc_free(data->pipe_crc); |
| 64 | data->pipe_crc = NULL; |
| 65 | |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 66 | for (i = 0; i < ARRAY_SIZE(data->fb); i++) { |
| 67 | if (!data->fb[i].fb_id) |
| 68 | continue; |
| 69 | |
| 70 | igt_remove_fb(data->drm_fd, &data->fb[i]); |
| 71 | data->fb[i].fb_id = 0; |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 72 | } |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 73 | } |
| 74 | |
| 75 | static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe, |
| 76 | igt_plane_t *plane, drmModeModeInfo *mode) |
| 77 | { |
| 78 | igt_display_t *display = &data->display; |
| 79 | |
| 80 | cleanup_crtc(data); |
| 81 | |
| 82 | igt_display_reset(display); |
| 83 | igt_output_set_pipe(output, pipe); |
| 84 | |
| 85 | /* create the pipe_crc object for this pipe */ |
| 86 | data->pipe_crc = igt_pipe_crc_new(data->drm_fd, pipe, INTEL_PIPE_CRC_SOURCE_AUTO); |
| 87 | |
| 88 | /* allocate fb for plane 1 */ |
| 89 | igt_create_pattern_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, |
| 90 | DRM_FORMAT_XRGB8888, |
| 91 | LOCAL_I915_FORMAT_MOD_X_TILED, /* tiled */ |
| 92 | &data->fb[0]); |
| 93 | |
| 94 | igt_plane_set_fb(plane, &data->fb[0]); |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 95 | |
Robert Foss | ca20170 | 2017-01-10 20:14:07 -0500 | [diff] [blame] | 96 | if (plane->type != DRM_PLANE_TYPE_PRIMARY) { |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 97 | igt_plane_t *primary; |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 98 | int ret; |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 99 | |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 100 | /* Do we succeed without enabling the primary plane? */ |
| 101 | ret = igt_display_try_commit2(display, COMMIT_ATOMIC); |
| 102 | if (!ret) |
| 103 | return; |
| 104 | |
| 105 | /* |
| 106 | * Fallback: set the primary plane to actually enable the pipe. |
| 107 | * Some drivers always require the primary plane to be enabled. |
| 108 | */ |
Robert Foss | ca20170 | 2017-01-10 20:14:07 -0500 | [diff] [blame] | 109 | primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY); |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 110 | igt_plane_set_fb(primary, &data->fb[0]); |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 111 | } |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 112 | igt_display_commit2(display, COMMIT_ATOMIC); |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 113 | } |
| 114 | |
| 115 | /* does iterative scaling on plane2 */ |
| 116 | static void iterate_plane_scaling(data_t *d, drmModeModeInfo *mode) |
| 117 | { |
| 118 | igt_display_t *display = &d->display; |
| 119 | |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 120 | if (mode->hdisplay >= d->fb[1].width) { |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 121 | int w, h; |
| 122 | /* fixed fb */ |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 123 | igt_fb_set_position(&d->fb[1], d->plane2, 0, 0); |
| 124 | igt_fb_set_size(&d->fb[1], d->plane2, d->fb[1].width, d->fb[1].height); |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 125 | igt_plane_set_position(d->plane2, 0, 0); |
| 126 | |
| 127 | /* adjust plane size */ |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 128 | for (w = d->fb[1].width; w <= mode->hdisplay; w+=10) { |
| 129 | h = w * d->fb[1].height / d->fb[1].width; |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 130 | igt_plane_set_size(d->plane2, w, h); |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 131 | igt_display_commit2(display, COMMIT_ATOMIC); |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 132 | } |
| 133 | } else { |
| 134 | int w, h; |
| 135 | /* fixed plane */ |
| 136 | igt_plane_set_position(d->plane2, 0, 0); |
| 137 | igt_plane_set_size(d->plane2, mode->hdisplay, mode->vdisplay); |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 138 | igt_fb_set_position(&d->fb[1], d->plane2, 0, 0); |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 139 | |
| 140 | /* adjust fb size */ |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 141 | for (w = mode->hdisplay; w <= d->fb[1].width; w+=10) { |
Mahesh Kumar | 085d414 | 2017-12-13 15:20:47 +0530 | [diff] [blame] | 142 | /* Source coordinates must not be clipped. */ |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 143 | h = min(w * mode->hdisplay / mode->vdisplay, d->fb[1].height); |
| 144 | igt_fb_set_size(&d->fb[1], d->plane2, w, h); |
| 145 | igt_display_commit2(display, COMMIT_ATOMIC); |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 146 | } |
| 147 | } |
| 148 | } |
| 149 | |
Maarten Lankhorst | eeefac9 | 2018-01-09 12:58:48 +0100 | [diff] [blame] | 150 | static void |
| 151 | test_plane_scaling_on_pipe(data_t *d, enum pipe pipe, igt_output_t *output) |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 152 | { |
| 153 | igt_display_t *display = &d->display; |
Maarten Lankhorst | eeefac9 | 2018-01-09 12:58:48 +0100 | [diff] [blame] | 154 | drmModeModeInfo *mode; |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 155 | int primary_plane_scaling = 0; /* For now */ |
| 156 | |
Maarten Lankhorst | eeefac9 | 2018-01-09 12:58:48 +0100 | [diff] [blame] | 157 | mode = igt_output_get_mode(output); |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 158 | |
Maarten Lankhorst | eeefac9 | 2018-01-09 12:58:48 +0100 | [diff] [blame] | 159 | /* Set up display with plane 1 */ |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 160 | d->plane1 = &display->pipes[pipe].planes[0]; |
| 161 | prepare_crtc(d, output, pipe, d->plane1, mode); |
| 162 | |
| 163 | igt_create_color_pattern_fb(display->drm_fd, 600, 600, |
| 164 | DRM_FORMAT_XRGB8888, |
| 165 | LOCAL_I915_FORMAT_MOD_X_TILED, /* tiled */ |
| 166 | .5, .5, .5, &d->fb[1]); |
| 167 | |
| 168 | igt_create_pattern_fb(d->drm_fd, |
| 169 | mode->hdisplay, mode->vdisplay, |
| 170 | DRM_FORMAT_XRGB8888, |
| 171 | LOCAL_I915_FORMAT_MOD_X_TILED, /* tiled */ |
| 172 | &d->fb[2]); |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 173 | |
Maarten Lankhorst | eeefac9 | 2018-01-09 12:58:48 +0100 | [diff] [blame] | 174 | if (primary_plane_scaling) { |
| 175 | /* Primary plane upscaling */ |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 176 | igt_fb_set_position(&d->fb[0], d->plane1, 100, 100); |
| 177 | igt_fb_set_size(&d->fb[0], d->plane1, 500, 500); |
Maarten Lankhorst | eeefac9 | 2018-01-09 12:58:48 +0100 | [diff] [blame] | 178 | igt_plane_set_position(d->plane1, 0, 0); |
| 179 | igt_plane_set_size(d->plane1, mode->hdisplay, mode->vdisplay); |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 180 | igt_display_commit2(display, COMMIT_ATOMIC); |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 181 | |
Maarten Lankhorst | eeefac9 | 2018-01-09 12:58:48 +0100 | [diff] [blame] | 182 | /* Primary plane 1:1 no scaling */ |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 183 | igt_fb_set_position(&d->fb[0], d->plane1, 0, 0); |
| 184 | igt_fb_set_size(&d->fb[0], d->plane1, d->fb[0].width, d->fb[0].height); |
Maarten Lankhorst | eeefac9 | 2018-01-09 12:58:48 +0100 | [diff] [blame] | 185 | igt_plane_set_position(d->plane1, 0, 0); |
| 186 | igt_plane_set_size(d->plane1, mode->hdisplay, mode->vdisplay); |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 187 | igt_display_commit2(display, COMMIT_ATOMIC); |
Maarten Lankhorst | eeefac9 | 2018-01-09 12:58:48 +0100 | [diff] [blame] | 188 | } |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 189 | |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 190 | /* Set up fb[1]->plane2 mapping. */ |
Maarten Lankhorst | eeefac9 | 2018-01-09 12:58:48 +0100 | [diff] [blame] | 191 | d->plane2 = igt_output_get_plane(output, 1); |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 192 | igt_plane_set_fb(d->plane2, &d->fb[1]); |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 193 | |
Maarten Lankhorst | eeefac9 | 2018-01-09 12:58:48 +0100 | [diff] [blame] | 194 | /* 2nd plane windowed */ |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 195 | igt_fb_set_position(&d->fb[1], d->plane2, 100, 100); |
| 196 | igt_fb_set_size(&d->fb[1], d->plane2, d->fb[1].width-200, d->fb[1].height-200); |
Maarten Lankhorst | eeefac9 | 2018-01-09 12:58:48 +0100 | [diff] [blame] | 197 | igt_plane_set_position(d->plane2, 100, 100); |
| 198 | igt_plane_set_size(d->plane2, mode->hdisplay-200, mode->vdisplay-200); |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 199 | igt_display_commit2(display, COMMIT_ATOMIC); |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 200 | |
Maarten Lankhorst | eeefac9 | 2018-01-09 12:58:48 +0100 | [diff] [blame] | 201 | iterate_plane_scaling(d, mode); |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 202 | |
Maarten Lankhorst | eeefac9 | 2018-01-09 12:58:48 +0100 | [diff] [blame] | 203 | /* 2nd plane up scaling */ |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 204 | igt_fb_set_position(&d->fb[1], d->plane2, 100, 100); |
| 205 | igt_fb_set_size(&d->fb[1], d->plane2, 500, 500); |
Maarten Lankhorst | eeefac9 | 2018-01-09 12:58:48 +0100 | [diff] [blame] | 206 | igt_plane_set_position(d->plane2, 10, 10); |
| 207 | igt_plane_set_size(d->plane2, mode->hdisplay-20, mode->vdisplay-20); |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 208 | igt_display_commit2(display, COMMIT_ATOMIC); |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 209 | |
Maarten Lankhorst | eeefac9 | 2018-01-09 12:58:48 +0100 | [diff] [blame] | 210 | /* 2nd plane downscaling */ |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 211 | igt_fb_set_position(&d->fb[1], d->plane2, 0, 0); |
| 212 | igt_fb_set_size(&d->fb[1], d->plane2, d->fb[1].width, d->fb[1].height); |
Maarten Lankhorst | eeefac9 | 2018-01-09 12:58:48 +0100 | [diff] [blame] | 213 | igt_plane_set_position(d->plane2, 10, 10); |
Mahesh Kumar | 085d414 | 2017-12-13 15:20:47 +0530 | [diff] [blame] | 214 | |
| 215 | /* Downscale (10/9)x of original image */ |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 216 | igt_plane_set_size(d->plane2, (d->fb[1].width * 10)/9, (d->fb[1].height * 10)/9); |
| 217 | igt_display_commit2(display, COMMIT_ATOMIC); |
Maarten Lankhorst | eeefac9 | 2018-01-09 12:58:48 +0100 | [diff] [blame] | 218 | |
| 219 | if (primary_plane_scaling) { |
| 220 | /* Primary plane up scaling */ |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 221 | igt_fb_set_position(&d->fb[0], d->plane1, 100, 100); |
| 222 | igt_fb_set_size(&d->fb[0], d->plane1, 500, 500); |
Maarten Lankhorst | eeefac9 | 2018-01-09 12:58:48 +0100 | [diff] [blame] | 223 | igt_plane_set_position(d->plane1, 0, 0); |
| 224 | igt_plane_set_size(d->plane1, mode->hdisplay, mode->vdisplay); |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 225 | igt_display_commit2(display, COMMIT_ATOMIC); |
Maarten Lankhorst | eeefac9 | 2018-01-09 12:58:48 +0100 | [diff] [blame] | 226 | } |
| 227 | |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 228 | /* Set up fb[2]->plane3 mapping. */ |
Maarten Lankhorst | eeefac9 | 2018-01-09 12:58:48 +0100 | [diff] [blame] | 229 | d->plane3 = igt_output_get_plane(output, 2); |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 230 | igt_plane_set_fb(d->plane3, &d->fb[2]); |
Maarten Lankhorst | eeefac9 | 2018-01-09 12:58:48 +0100 | [diff] [blame] | 231 | |
Mahesh Kumar | 085d414 | 2017-12-13 15:20:47 +0530 | [diff] [blame] | 232 | if(d->plane3->type == DRM_PLANE_TYPE_CURSOR) { |
| 233 | igt_debug("Plane-3 doesnt exist on pipe %s\n", kmstest_pipe_name(pipe)); |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 234 | return; |
Mahesh Kumar | 085d414 | 2017-12-13 15:20:47 +0530 | [diff] [blame] | 235 | } |
| 236 | |
Maarten Lankhorst | eeefac9 | 2018-01-09 12:58:48 +0100 | [diff] [blame] | 237 | /* 3rd plane windowed - no scaling */ |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 238 | igt_fb_set_position(&d->fb[2], d->plane3, 100, 100); |
| 239 | igt_fb_set_size(&d->fb[2], d->plane3, d->fb[2].width-300, d->fb[2].height-300); |
Maarten Lankhorst | eeefac9 | 2018-01-09 12:58:48 +0100 | [diff] [blame] | 240 | igt_plane_set_position(d->plane3, 100, 100); |
| 241 | igt_plane_set_size(d->plane3, mode->hdisplay-300, mode->vdisplay-300); |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 242 | igt_display_commit2(display, COMMIT_ATOMIC); |
Maarten Lankhorst | eeefac9 | 2018-01-09 12:58:48 +0100 | [diff] [blame] | 243 | |
| 244 | /* Switch scaler from plane 2 to plane 3 */ |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 245 | igt_fb_set_position(&d->fb[1], d->plane2, 100, 100); |
| 246 | igt_fb_set_size(&d->fb[1], d->plane2, d->fb[1].width-200, d->fb[1].height-200); |
Maarten Lankhorst | eeefac9 | 2018-01-09 12:58:48 +0100 | [diff] [blame] | 247 | igt_plane_set_position(d->plane2, 100, 100); |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 248 | igt_plane_set_size(d->plane2, d->fb[1].width-200, d->fb[1].height-200); |
Maarten Lankhorst | eeefac9 | 2018-01-09 12:58:48 +0100 | [diff] [blame] | 249 | |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 250 | igt_fb_set_position(&d->fb[2], d->plane3, 100, 100); |
| 251 | igt_fb_set_size(&d->fb[2], d->plane3, d->fb[2].width-400, d->fb[2].height-400); |
Maarten Lankhorst | eeefac9 | 2018-01-09 12:58:48 +0100 | [diff] [blame] | 252 | igt_plane_set_position(d->plane3, 10, 10); |
| 253 | igt_plane_set_size(d->plane3, mode->hdisplay-300, mode->vdisplay-300); |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 254 | igt_display_commit2(display, COMMIT_ATOMIC); |
Maarten Lankhorst | eeefac9 | 2018-01-09 12:58:48 +0100 | [diff] [blame] | 255 | |
| 256 | if (primary_plane_scaling) { |
| 257 | /* Switch scaler from plane 1 to plane 2 */ |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 258 | igt_fb_set_position(&d->fb[0], d->plane1, 0, 0); |
| 259 | igt_fb_set_size(&d->fb[0], d->plane1, d->fb[0].width, d->fb[0].height); |
Maarten Lankhorst | eeefac9 | 2018-01-09 12:58:48 +0100 | [diff] [blame] | 260 | igt_plane_set_position(d->plane1, 0, 0); |
| 261 | igt_plane_set_size(d->plane1, mode->hdisplay, mode->vdisplay); |
| 262 | |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 263 | igt_fb_set_position(&d->fb[1], d->plane2, 100, 100); |
| 264 | igt_fb_set_size(&d->fb[1], d->plane2, d->fb[1].width-500,d->fb[1].height-500); |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 265 | igt_plane_set_position(d->plane2, 100, 100); |
| 266 | igt_plane_set_size(d->plane2, mode->hdisplay-200, mode->vdisplay-200); |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 267 | igt_display_commit2(display, COMMIT_ATOMIC); |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 268 | } |
Maarten Lankhorst | eeefac9 | 2018-01-09 12:58:48 +0100 | [diff] [blame] | 269 | } |
| 270 | |
Maarten Lankhorst | c54ed64 | 2018-01-11 12:33:39 +0100 | [diff] [blame] | 271 | igt_main |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 272 | { |
| 273 | data_t data = {}; |
Maarten Lankhorst | eeefac9 | 2018-01-09 12:58:48 +0100 | [diff] [blame] | 274 | enum pipe pipe; |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 275 | |
| 276 | igt_skip_on_simulation(); |
| 277 | |
Maarten Lankhorst | c54ed64 | 2018-01-11 12:33:39 +0100 | [diff] [blame] | 278 | igt_fixture { |
| 279 | data.drm_fd = drm_open_driver(DRIVER_INTEL); |
| 280 | igt_require_pipe_crc(data.drm_fd); |
| 281 | igt_display_init(&data.display, data.drm_fd); |
| 282 | data.devid = intel_get_drm_devid(data.drm_fd); |
Maarten Lankhorst | 1538eb6 | 2018-01-11 15:03:50 +0100 | [diff] [blame^] | 283 | igt_require(data.display.is_atomic); |
Maarten Lankhorst | c54ed64 | 2018-01-11 12:33:39 +0100 | [diff] [blame] | 284 | } |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 285 | |
Maarten Lankhorst | c54ed64 | 2018-01-11 12:33:39 +0100 | [diff] [blame] | 286 | for_each_pipe_static(pipe) igt_subtest_group { |
| 287 | igt_output_t *output; |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 288 | |
Maarten Lankhorst | 1fb3faa | 2018-01-15 11:11:39 +0100 | [diff] [blame] | 289 | igt_fixture { |
Maarten Lankhorst | c54ed64 | 2018-01-11 12:33:39 +0100 | [diff] [blame] | 290 | igt_display_require_output_on_pipe(&data.display, pipe); |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 291 | |
Maarten Lankhorst | 1fb3faa | 2018-01-15 11:11:39 +0100 | [diff] [blame] | 292 | igt_require(get_num_scalers(data.devid, pipe) > 0); |
| 293 | } |
| 294 | |
Maarten Lankhorst | c54ed64 | 2018-01-11 12:33:39 +0100 | [diff] [blame] | 295 | igt_subtest_f("pipe-%s-plane-scaling", kmstest_pipe_name(pipe)) |
| 296 | for_each_valid_output_on_pipe(&data.display, pipe, output) |
| 297 | test_plane_scaling_on_pipe(&data, pipe, output); |
| 298 | } |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 299 | |
Maarten Lankhorst | c54ed64 | 2018-01-11 12:33:39 +0100 | [diff] [blame] | 300 | igt_fixture |
| 301 | igt_display_fini(&data.display); |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 302 | } |