blob: 85ff24385c1b81a059bc649ec98dcf30cb0584d2 [file] [log] [blame]
Ville Syrjälä08c27e32013-10-18 17:44:42 +03001/*
2 * Copyright © 2013 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 *
23 */
24
25#include <errno.h>
Ville Syrjäläfee27cf2014-01-13 17:05:19 +020026#include <limits.h>
Ville Syrjälä08c27e32013-10-18 17:44:42 +030027#include <stdbool.h>
28#include <stdio.h>
29#include <string.h>
30
Ville Syrjälä08c27e32013-10-18 17:44:42 +030031#include "drmtest.h"
32#include "igt_debugfs.h"
Oscar Mateo37f26d12013-11-12 11:50:38 +000033#include "igt_kms.h"
Ville Syrjälä08c27e32013-10-18 17:44:42 +030034
Sagar Kambleba3a1a82014-03-18 15:59:43 +053035#ifndef DRM_CAP_CURSOR_WIDTH
36#define DRM_CAP_CURSOR_WIDTH 0x8
37#endif
38#ifndef DRM_CAP_CURSOR_HEIGHT
39#define DRM_CAP_CURSOR_HEIGHT 0x9
40#endif
41
Ville Syrjälä08c27e32013-10-18 17:44:42 +030042typedef struct {
Ville Syrjälä08c27e32013-10-18 17:44:42 +030043 int drm_fd;
Damien Lespiaud4358292014-02-05 17:14:12 +000044 igt_display_t display;
Daniel Vetter9aea7ae2014-03-26 09:18:11 +010045 struct igt_fb primary_fb;
Antti Koskipaaa593d612014-04-10 15:08:05 +030046 struct igt_fb fb;
Ville Syrjälä08c27e32013-10-18 17:44:42 +030047 igt_pipe_crc_t **pipe_crc;
48} data_t;
49
50typedef struct {
51 data_t *data;
Damien Lespiaud4358292014-02-05 17:14:12 +000052 igt_output_t *output;
53 enum pipe pipe;
Ville Syrjälä08c27e32013-10-18 17:44:42 +030054 igt_crc_t ref_crc;
Ville Syrjälä08c27e32013-10-18 17:44:42 +030055 int left, right, top, bottom;
Antti Koskipaa795eddc2014-04-10 15:08:09 +030056 int screenw, screenh;
Antti Koskipaafe8041b2014-04-10 15:08:07 +030057 int curw, curh; /* cursor size */
Ville Syrjälä08c27e32013-10-18 17:44:42 +030058} test_data_t;
59
Antti Koskipaaa593d612014-04-10 15:08:05 +030060static void draw_cursor(cairo_t *cr, int x, int y, int w)
61{
62 w /= 2;
Antti Koskipaa795eddc2014-04-10 15:08:09 +030063 /* Cairo doesn't like to be fed numbers that are too wild */
64 if ((x < SHRT_MIN) || (x > SHRT_MAX) || (y < SHRT_MIN) || (y > SHRT_MAX))
65 return;
Antti Koskipaaa593d612014-04-10 15:08:05 +030066 cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
67 /* 4 color rectangles in the corners, RGBY */
68 igt_paint_color_alpha(cr, x, y, w, w, 1.0, 0.0, 0.0, 1.0);
69 igt_paint_color_alpha(cr, x + w, y, w, w, 0.0, 1.0, 0.0, 1.0);
70 igt_paint_color_alpha(cr, x, y + w, w, w, 0.0, 0.0, 1.0, 1.0);
71 igt_paint_color_alpha(cr, x + w, y + w, w, w, 0.5, 0.5, 0.5, 1.0);
72}
Ville Syrjälä08c27e32013-10-18 17:44:42 +030073
Antti Koskipaaa593d612014-04-10 15:08:05 +030074static void cursor_enable(test_data_t *test_data)
Damien Lespiaud4358292014-02-05 17:14:12 +000075{
76 data_t *data = test_data->data;
77 igt_display_t *display = &data->display;
78 igt_output_t *output = test_data->output;
79 igt_plane_t *cursor;
80
Damien Lespiau2043e6b2014-02-11 17:45:48 +000081 cursor = igt_output_get_plane(output, IGT_PLANE_CURSOR);
Antti Koskipaaa593d612014-04-10 15:08:05 +030082 igt_plane_set_fb(cursor, &data->fb);
Damien Lespiaud4358292014-02-05 17:14:12 +000083 igt_display_commit(display);
84}
85
86static void cursor_disable(test_data_t *test_data)
87{
88 data_t *data = test_data->data;
89 igt_display_t *display = &data->display;
90 igt_output_t *output = test_data->output;
91 igt_plane_t *cursor;
92
Damien Lespiau2043e6b2014-02-11 17:45:48 +000093 cursor = igt_output_get_plane(output, IGT_PLANE_CURSOR);
Damien Lespiaud4358292014-02-05 17:14:12 +000094 igt_plane_set_fb(cursor, NULL);
95 igt_display_commit(display);
96}
97
Antti Koskipaa7ec631c2014-04-10 15:08:06 +030098static igt_pipe_crc_t *create_crc(data_t *data, enum pipe pipe)
99{
100 igt_pipe_crc_t *crc;
101
102 crc = igt_pipe_crc_new(pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
103 return crc;
104}
105
106static void do_single_test(test_data_t *test_data, int x, int y)
107{
108 data_t *data = test_data->data;
109 igt_display_t *display = &data->display;
110 igt_pipe_crc_t *pipe_crc = data->pipe_crc[test_data->pipe];
Antti Koskipaa795eddc2014-04-10 15:08:09 +0300111 igt_crc_t crc, ref_crc;
Antti Koskipaa7ec631c2014-04-10 15:08:06 +0300112 igt_plane_t *cursor;
Antti Koskipaa795eddc2014-04-10 15:08:09 +0300113 cairo_t *cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb);
Antti Koskipaa7ec631c2014-04-10 15:08:06 +0300114
115 printf("."); fflush(stdout);
116
Antti Koskipaa795eddc2014-04-10 15:08:09 +0300117 /* Hardware test */
Antti Koskipaa7ec631c2014-04-10 15:08:06 +0300118 cursor_enable(test_data);
119 cursor = igt_output_get_plane(test_data->output, IGT_PLANE_CURSOR);
120 igt_plane_set_position(cursor, x, y);
121 igt_display_commit(display);
122 igt_wait_for_vblank(data->drm_fd, test_data->pipe);
123 igt_pipe_crc_collect_crc(pipe_crc, &crc);
124 cursor_disable(test_data);
125
Antti Koskipaa795eddc2014-04-10 15:08:09 +0300126 /* Now render the same in software and collect crc */
127 draw_cursor(cr, x, y, test_data->curw);
128 igt_display_commit(display);
129 igt_wait_for_vblank(data->drm_fd, test_data->pipe);
130 igt_pipe_crc_collect_crc(pipe_crc, &ref_crc);
131 /* Clear screen afterwards */
132 igt_paint_color(cr, 0, 0, test_data->screenw, test_data->screenh,
133 0.0, 0.0, 0.0);
134
135 igt_assert(igt_crc_equal(&crc, &ref_crc));
Antti Koskipaa7ec631c2014-04-10 15:08:06 +0300136}
137
138static void do_test(test_data_t *test_data,
139 int left, int right, int top, int bottom)
140{
141 do_single_test(test_data, left, top);
142 do_single_test(test_data, right, top);
143 do_single_test(test_data, right, bottom);
144 do_single_test(test_data, left, bottom);
145}
146
Antti Koskipaaead01732014-04-10 15:08:08 +0300147static void test_crc_onscreen(test_data_t *test_data)
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300148{
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300149 int left = test_data->left;
150 int right = test_data->right;
151 int top = test_data->top;
152 int bottom = test_data->bottom;
Antti Koskipaafe8041b2014-04-10 15:08:07 +0300153 int cursor_w = test_data->curw;
154 int cursor_h = test_data->curh;
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300155
Antti Koskipaaead01732014-04-10 15:08:08 +0300156 /* fully inside */
157 do_test(test_data, left, right, top, bottom);
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300158
Antti Koskipaaead01732014-04-10 15:08:08 +0300159 /* 2 pixels inside */
160 do_test(test_data, left - (cursor_w-2), right + (cursor_w-2), top , bottom );
161 do_test(test_data, left , right , top - (cursor_h-2), bottom + (cursor_h-2));
162 do_test(test_data, left - (cursor_w-2), right + (cursor_w-2), top - (cursor_h-2), bottom + (cursor_h-2));
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300163
Antti Koskipaaead01732014-04-10 15:08:08 +0300164 /* 1 pixel inside */
165 do_test(test_data, left - (cursor_w-1), right + (cursor_w-1), top , bottom );
166 do_test(test_data, left , right , top - (cursor_h-1), bottom + (cursor_h-1));
167 do_test(test_data, left - (cursor_w-1), right + (cursor_w-1), top - (cursor_h-1), bottom + (cursor_h-1));
168}
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300169
Antti Koskipaaead01732014-04-10 15:08:08 +0300170static void test_crc_offscreen(test_data_t *test_data)
171{
172 int left = test_data->left;
173 int right = test_data->right;
174 int top = test_data->top;
175 int bottom = test_data->bottom;
176 int cursor_w = test_data->curw;
177 int cursor_h = test_data->curh;
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300178
Antti Koskipaaead01732014-04-10 15:08:08 +0300179 /* fully outside */
180 do_test(test_data, left - (cursor_w), right + (cursor_w), top , bottom );
181 do_test(test_data, left , right , top - (cursor_h), bottom + (cursor_h));
182 do_test(test_data, left - (cursor_w), right + (cursor_w), top - (cursor_h), bottom + (cursor_h));
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300183
Antti Koskipaaead01732014-04-10 15:08:08 +0300184 /* fully outside by 1 extra pixels */
185 do_test(test_data, left - (cursor_w+1), right + (cursor_w+1), top , bottom );
186 do_test(test_data, left , right , top - (cursor_h+1), bottom + (cursor_h+1));
187 do_test(test_data, left - (cursor_w+1), right + (cursor_w+1), top - (cursor_h+1), bottom + (cursor_h+1));
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300188
Antti Koskipaaead01732014-04-10 15:08:08 +0300189 /* fully outside by 2 extra pixels */
190 do_test(test_data, left - (cursor_w+2), right + (cursor_w+2), top , bottom );
191 do_test(test_data, left , right , top - (cursor_h+2), bottom + (cursor_h+2));
192 do_test(test_data, left - (cursor_w+2), right + (cursor_w+2), top - (cursor_h+2), bottom + (cursor_h+2));
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300193
Antti Koskipaaead01732014-04-10 15:08:08 +0300194 /* fully outside by a lot of extra pixels */
195 do_test(test_data, left - (cursor_w+512), right + (cursor_w+512), top , bottom );
196 do_test(test_data, left , right , top - (cursor_h+512), bottom + (cursor_h+512));
197 do_test(test_data, left - (cursor_w+512), right + (cursor_w+512), top - (cursor_h+512), bottom + (cursor_h+512));
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300198
Antti Koskipaaead01732014-04-10 15:08:08 +0300199 /* go nuts */
200 do_test(test_data, INT_MIN, INT_MAX, INT_MIN, INT_MAX);
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300201}
202
Sagar Kambleba3a1a82014-03-18 15:59:43 +0530203static bool prepare_crtc(test_data_t *test_data, igt_output_t *output,
204 int cursor_w, int cursor_h)
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300205{
Damien Lespiaud4358292014-02-05 17:14:12 +0000206 drmModeModeInfo *mode;
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300207 data_t *data = test_data->data;
Damien Lespiaud4358292014-02-05 17:14:12 +0000208 igt_display_t *display = &data->display;
Daniel Vetter43def942013-10-31 16:06:40 +0100209 igt_pipe_crc_t *pipe_crc;
Damien Lespiaud4358292014-02-05 17:14:12 +0000210 igt_plane_t *primary;
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300211
Damien Lespiaud4358292014-02-05 17:14:12 +0000212 /* select the pipe we want to use */
213 igt_output_set_pipe(output, test_data->pipe);
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300214
Damien Lespiaud4358292014-02-05 17:14:12 +0000215 /* create and set the primary plane fb */
216 mode = igt_output_get_mode(output);
Daniel Vetter9aea7ae2014-03-26 09:18:11 +0100217 igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
Damien Lespiau06319402014-02-06 19:04:58 +0000218 DRM_FORMAT_XRGB8888,
219 false, /* tiled */
220 0.0, 0.0, 0.0,
221 &data->primary_fb);
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300222
Damien Lespiau2043e6b2014-02-11 17:45:48 +0000223 primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
Damien Lespiaud4358292014-02-05 17:14:12 +0000224 igt_plane_set_fb(primary, &data->primary_fb);
Ville Syrjälä3d371a72013-11-22 23:46:32 +0200225
Damien Lespiaud4358292014-02-05 17:14:12 +0000226 igt_display_commit(display);
227
228 /* create the pipe_crc object for this pipe */
229 igt_pipe_crc_free(data->pipe_crc[test_data->pipe]);
230 data->pipe_crc[test_data->pipe] = NULL;
231
232 pipe_crc = create_crc(data, test_data->pipe);
Daniel Vetter43def942013-10-31 16:06:40 +0100233 if (!pipe_crc) {
Damien Lespiaud4358292014-02-05 17:14:12 +0000234 printf("auto crc not supported on this connector with pipe %i\n",
235 test_data->pipe);
Daniel Vetter43def942013-10-31 16:06:40 +0100236 return false;
237 }
238
Damien Lespiaud4358292014-02-05 17:14:12 +0000239 data->pipe_crc[test_data->pipe] = pipe_crc;
Daniel Vetter43def942013-10-31 16:06:40 +0100240
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300241 /* x/y position where the cursor is still fully visible */
242 test_data->left = 0;
Sagar Kambleba3a1a82014-03-18 15:59:43 +0530243 test_data->right = mode->hdisplay - cursor_w;
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300244 test_data->top = 0;
Sagar Kambleba3a1a82014-03-18 15:59:43 +0530245 test_data->bottom = mode->vdisplay - cursor_h;
Antti Koskipaa795eddc2014-04-10 15:08:09 +0300246 test_data->screenw = mode->hdisplay;
247 test_data->screenh = mode->vdisplay;
Antti Koskipaafe8041b2014-04-10 15:08:07 +0300248 test_data->curw = cursor_w;
249 test_data->curh = cursor_h;
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300250
251 /* make sure cursor is disabled */
Damien Lespiaud4358292014-02-05 17:14:12 +0000252 cursor_disable(test_data);
253 igt_wait_for_vblank(data->drm_fd, test_data->pipe);
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300254
255 /* get reference crc w/o cursor */
Damien Lespiau1c608a22014-02-06 16:26:31 +0000256 igt_pipe_crc_collect_crc(pipe_crc, &test_data->ref_crc);
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300257
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300258 return true;
259}
260
Damien Lespiaud4358292014-02-05 17:14:12 +0000261static void cleanup_crtc(test_data_t *test_data, igt_output_t *output)
262{
263 data_t *data = test_data->data;
264 igt_plane_t *primary;
265
266 igt_pipe_crc_free(data->pipe_crc[test_data->pipe]);
267 data->pipe_crc[test_data->pipe] = NULL;
268
Daniel Vetter9aea7ae2014-03-26 09:18:11 +0100269 igt_remove_fb(data->drm_fd, &data->primary_fb);
Damien Lespiaud4358292014-02-05 17:14:12 +0000270
Damien Lespiau2043e6b2014-02-11 17:45:48 +0000271 primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
Damien Lespiaud4358292014-02-05 17:14:12 +0000272 igt_plane_set_fb(primary, NULL);
273
274 igt_output_set_pipe(output, PIPE_ANY);
275}
276
Antti Koskipaaead01732014-04-10 15:08:08 +0300277static void run_test(data_t *data, void (*testfunc)(test_data_t *), int cursor_w, int cursor_h)
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300278{
Damien Lespiaud4358292014-02-05 17:14:12 +0000279 igt_display_t *display = &data->display;
280 igt_output_t *output;
281 enum pipe p;
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300282 test_data_t test_data = {
283 .data = data,
284 };
Daniel Vetter43def942013-10-31 16:06:40 +0100285 int valid_tests = 0;
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300286
Damien Lespiaud4358292014-02-05 17:14:12 +0000287 for_each_connected_output(display, output) {
288 test_data.output = output;
289 for (p = 0; p < igt_display_get_n_pipes(display); p++) {
290 test_data.pipe = p;
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300291
Sagar Kambleba3a1a82014-03-18 15:59:43 +0530292 if (!prepare_crtc(&test_data, output, cursor_w, cursor_h))
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300293 continue;
294
Daniel Vetter43def942013-10-31 16:06:40 +0100295 valid_tests++;
296
Damien Lespiaud4358292014-02-05 17:14:12 +0000297 fprintf(stdout, "Beginning %s on pipe %c, connector %s\n",
298 igt_subtest_name(), pipe_name(test_data.pipe),
299 igt_output_name(output));
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300300
Antti Koskipaaead01732014-04-10 15:08:08 +0300301 testfunc(&test_data);
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300302
Damien Lespiaud4358292014-02-05 17:14:12 +0000303 fprintf(stdout, "\n%s on pipe %c, connector %s: PASSED\n\n",
304 igt_subtest_name(), pipe_name(test_data.pipe),
305 igt_output_name(output));
Daniel Vetter43def942013-10-31 16:06:40 +0100306
Damien Lespiaud4358292014-02-05 17:14:12 +0000307 /* cleanup what prepare_crtc() has done */
308 cleanup_crtc(&test_data, output);
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300309 }
310 }
Daniel Vetter43def942013-10-31 16:06:40 +0100311
312 igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300313}
314
Antti Koskipaaa593d612014-04-10 15:08:05 +0300315static void create_cursor_fb(data_t *data, int cur_w, int cur_h)
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300316{
317 cairo_t *cr;
Antti Koskipaaa593d612014-04-10 15:08:05 +0300318 uint32_t fb_id;
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300319
Antti Koskipaaa593d612014-04-10 15:08:05 +0300320 fb_id = igt_create_fb(data->drm_fd, cur_w, cur_h,
321 DRM_FORMAT_ARGB8888, false,
322 &data->fb);
323 igt_assert(fb_id);
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300324
Antti Koskipaaa593d612014-04-10 15:08:05 +0300325 cr = igt_get_cairo_ctx(data->drm_fd, &data->fb);
326 draw_cursor(cr, 0, 0, cur_w);
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300327 igt_assert(cairo_status(cr) == 0);
328}
329
Sagar Kambleba3a1a82014-03-18 15:59:43 +0530330static void run_test_generic(data_t *data, int cursor_max_size)
331{
332 int cursor_size;
333 char c_size[5];
334 for (cursor_size = 64; cursor_size <= cursor_max_size; cursor_size *= 2)
335 {
336 igt_require(cursor_max_size >= cursor_size);
337 sprintf(c_size, "%d", cursor_size);
338
Antti Koskipaaa593d612014-04-10 15:08:05 +0300339 create_cursor_fb(data, cursor_size, cursor_size);
Sagar Kambleba3a1a82014-03-18 15:59:43 +0530340
341 /* Using created cursor FBs to test cursor support */
Antti Koskipaaa593d612014-04-10 15:08:05 +0300342 igt_subtest_f("cursor-%s-onscreen", c_size)
Antti Koskipaaead01732014-04-10 15:08:08 +0300343 run_test(data, test_crc_onscreen, cursor_size, cursor_size);
Antti Koskipaaa593d612014-04-10 15:08:05 +0300344 igt_subtest_f("cursor-%s-offscreen", c_size)
Antti Koskipaaead01732014-04-10 15:08:08 +0300345 run_test(data, test_crc_offscreen, cursor_size, cursor_size);
Sagar Kambleba3a1a82014-03-18 15:59:43 +0530346 }
347
348}
349
Daniel Vetter52edf3a2014-03-22 14:45:54 +0100350uint64_t cursor_width, cursor_height;
351
Daniel Vetter071e9ca2013-10-31 16:23:26 +0100352igt_main
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300353{
354 data_t data = {};
Daniel Vetter52edf3a2014-03-22 14:45:54 +0100355 int ret;
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300356
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300357 igt_skip_on_simulation();
358
359 igt_fixture {
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300360 data.drm_fd = drm_open_any();
Daniel Vetter1f0cf2d2013-10-31 17:02:41 +0100361
Sagar Kambleba3a1a82014-03-18 15:59:43 +0530362 ret = drmGetCap(data.drm_fd, DRM_CAP_CURSOR_WIDTH, &cursor_width);
363 igt_assert(ret == 0);
364 /* Not making use of cursor_height since it is same as width, still reading */
365 ret = drmGetCap(data.drm_fd, DRM_CAP_CURSOR_HEIGHT, &cursor_height);
366 igt_assert(ret == 0);
367
Sagar Kambleba3a1a82014-03-18 15:59:43 +0530368 /* We assume width and height are same so max is assigned width */
Daniel Vetter701a7552014-03-20 17:31:16 +0100369 igt_assert_cmpint(cursor_width, ==, cursor_height);
Sagar Kambleba3a1a82014-03-18 15:59:43 +0530370
Daniel Vetter1f0cf2d2013-10-31 17:02:41 +0100371 igt_set_vt_graphics_mode();
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300372
Daniel Vetterf2e5dc02014-03-16 15:09:22 +0100373 igt_require_pipe_crc();
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300374
Damien Lespiaud4358292014-02-05 17:14:12 +0000375 igt_display_init(&data.display, data.drm_fd);
376 data.pipe_crc = calloc(igt_display_get_n_pipes(&data.display),
377 sizeof(data.pipe_crc[0]));
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300378
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300379 }
380
Daniel Vetter52edf3a2014-03-22 14:45:54 +0100381 run_test_generic(&data, cursor_width);
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300382
Damien Lespiaud4358292014-02-05 17:14:12 +0000383 igt_fixture {
384 free(data.pipe_crc);
385 igt_display_fini(&data.display);
386 }
Ville Syrjälä08c27e32013-10-18 17:44:42 +0300387}