On Mon, Jun 02, 2014 at 01:43:18PM +0300, Antti Koskipaa wrote: > Now that we support cursor changes other than 64x64, a bug was found > where the size change was only applied at cursor enable time, rather > than at every update. Add a testcase for that. > > Signed-off-by: Antti Koskipaa <antti.koskipaa@xxxxxxxxxxxxxxx> Merged, thanks. -Daniel > --- > tests/kms_cursor_crc.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 55 insertions(+) > > diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c > index 06625ee..1b8da26 100644 > --- a/tests/kms_cursor_crc.c > +++ b/tests/kms_cursor_crc.c > @@ -54,6 +54,7 @@ typedef struct { > int left, right, top, bottom; > int screenw, screenh; > int curw, curh; /* cursor size */ > + int cursor_max_size; > igt_pipe_crc_t *pipe_crc; > } test_data_t; > > @@ -272,6 +273,7 @@ static bool prepare_crtc(test_data_t *test_data, igt_output_t *output, > test_data->screenh = mode->vdisplay; > test_data->curw = cursor_w; > test_data->curh = cursor_h; > + test_data->cursor_max_size = cursor_w; > > /* make sure cursor is disabled */ > cursor_disable(test_data); > @@ -354,6 +356,56 @@ static void create_cursor_fb(data_t *data, int cur_w, int cur_h) > igt_assert(cairo_status(cr) == 0); > } > > +static void test_cursor_size(test_data_t *test_data) > +{ > + data_t *data = test_data->data; > + igt_display_t *display = &data->display; > + igt_pipe_crc_t *pipe_crc = test_data->pipe_crc; > + igt_crc_t crc[10], ref_crc; > + igt_plane_t *cursor; > + cairo_t *cr; > + uint32_t fb_id; > + int i, size, cursor_max_size = test_data->cursor_max_size; > + > + /* Create a maximum size cursor, then change the size in flight to > + * smaller ones to see that the size is applied correctly > + */ > + fb_id = igt_create_fb(data->drm_fd, cursor_max_size, cursor_max_size, > + DRM_FORMAT_ARGB8888, false, &data->fb); > + igt_assert(fb_id); > + > + /* Use a solid white rectangle as the cursor */ > + cr = igt_get_cairo_ctx(data->drm_fd, &data->fb); > + igt_paint_color_alpha(cr, 0, 0, cursor_max_size, cursor_max_size, 1.0, 1.0, 1.0, 1.0); > + > + /* Hardware test loop */ > + cursor_enable(test_data); > + cursor = igt_output_get_plane(test_data->output, IGT_PLANE_CURSOR); > + igt_plane_set_position(cursor, 0, 0); > + for (i = 0, size = cursor_max_size; size >= 64; size /= 2, i++) { > + /* Change size in flight: */ > + int ret = drmModeSetCursor(data->drm_fd, test_data->output->config.crtc->crtc_id, > + data->fb.gem_handle, size, size); > + igt_assert(ret == 0); > + igt_wait_for_vblank(data->drm_fd, test_data->pipe); > + igt_pipe_crc_collect_crc(pipe_crc, &crc[i]); > + } > + cursor_disable(test_data); > + /* Software test loop */ > + cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb); > + for (i = 0, size = cursor_max_size; size >= 64; size /= 2, i++) { > + /* Now render the same in software and collect crc */ > + igt_paint_color_alpha(cr, 0, 0, size, size, 1.0, 1.0, 1.0, 1.0); > + igt_display_commit(display); > + igt_wait_for_vblank(data->drm_fd, test_data->pipe); > + igt_pipe_crc_collect_crc(pipe_crc, &ref_crc); > + /* Clear screen afterwards */ > + igt_paint_color(cr, 0, 0, test_data->screenw, test_data->screenh, > + 0.0, 0.0, 0.0); > + igt_assert(igt_crc_equal(&crc[i], &ref_crc)); > + } > +} > + > static void run_test_generic(data_t *data, int cursor_max_size) > { > int cursor_size; > @@ -407,6 +459,9 @@ igt_main > igt_display_init(&data.display, data.drm_fd); > } > > + igt_subtest_f("cursor-size-change") > + run_test(&data, test_cursor_size, cursor_width, cursor_height); > + > run_test_generic(&data, cursor_width); > > igt_fixture { > -- > 1.8.3.2 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@xxxxxxxxxxxxxxxxxxxxx > http://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx