[Intel-gfx] [PATCH i-g-t] kms_rotation_crc: Excercise page flips with 90 degree rotation
Tvrtko Ursulin
tvrtko.ursulin at linux.intel.com
Tue Oct 6 06:23:32 PDT 2015
From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
Do some page flipping on the rotated plane just to excercise
that code path.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
Cc: Sonika Jindal <sonika.jindal at intel.com>
Cc: Arun R Murthy <arun.r.murthy at intel.com>
---
There are some, still unofficial, reports that page flipping with
90 degree rotation may be causing a vma->pin_count leak.
But more importantly it looks like it doesn't work at all at the
moment with frame buffers which do not cover the whole plane.
---
tests/kms_rotation_crc.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index cc9847ecc113..fde910250353 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -31,6 +31,7 @@ typedef struct {
igt_display_t display;
struct igt_fb fb;
struct igt_fb fb_modeset;
+ struct igt_fb fb_flip;
igt_crc_t ref_crc;
igt_pipe_crc_t *pipe_crc;
igt_rotation_t rotation;
@@ -39,6 +40,7 @@ typedef struct {
unsigned int w, h;
uint32_t override_fmt;
uint64_t override_tiling;
+ unsigned int flip_stress;
} data_t;
static void
@@ -165,6 +167,16 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
&data->fb);
igt_assert(fb_id);
+ if (data->flip_stress) {
+ fb_id = igt_create_fb(data->gfx_fd,
+ w, h,
+ pixel_format,
+ tiling,
+ &data->fb_flip);
+ igt_assert(fb_id);
+ paint_squares(data, mode, data->rotation, plane);
+ }
+
/* Step 1: create a reference CRC for a software-rotated fb */
paint_squares(data, mode, data->rotation, plane);
commit_crtc(data, output, plane);
@@ -187,6 +199,8 @@ static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
igt_remove_fb(data->gfx_fd, &data->fb);
igt_remove_fb(data->gfx_fd, &data->fb_modeset);
+ if (data->fb_flip.fb_id)
+ igt_remove_fb(data->gfx_fd, &data->fb_flip);
/* XXX: see the note in prepare_crtc() */
if (!plane->is_primary) {
@@ -202,6 +216,23 @@ static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
igt_display_commit(display);
}
+static void wait_for_pageflip(int fd)
+{
+ drmEventContext evctx = { .version = DRM_EVENT_CONTEXT_VERSION };
+ struct timeval timeout = { .tv_sec = 0, .tv_usec = 32000 };
+ fd_set fds;
+ int ret;
+
+ /* Wait for pageflip completion, then consume event on fd */
+ FD_ZERO(&fds);
+ FD_SET(fd, &fds);
+ do {
+ ret = select(fd + 1, &fds, NULL, NULL, &timeout);
+ } while (ret < 0 && errno == EINTR);
+ igt_assert_eq(ret, 1);
+ igt_assert(drmHandleEvent(fd, &evctx) == 0);
+}
+
static void test_plane_rotation(data_t *data, enum igt_plane plane_type)
{
igt_display_t *display = &data->display;
@@ -245,6 +276,23 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type)
&crc_output);
}
+ while (data->flip_stress--) {
+ ret = drmModePageFlip(data->gfx_fd,
+ output->config.crtc->crtc_id,
+ data->fb_flip.fb_id,
+ DRM_MODE_PAGE_FLIP_EVENT,
+ NULL);
+ igt_assert(ret == 0);
+ wait_for_pageflip(data->gfx_fd);
+ ret = drmModePageFlip(data->gfx_fd,
+ output->config.crtc->crtc_id,
+ data->fb.fb_id,
+ DRM_MODE_PAGE_FLIP_EVENT,
+ NULL);
+ igt_assert(ret == 0);
+ wait_for_pageflip(data->gfx_fd);
+ }
+
/*
* check the rotation state has been reset when the VT
* mode is restored
@@ -345,6 +393,14 @@ igt_main
test_plane_rotation(&data, IGT_PLANE_PRIMARY);
}
+ igt_subtest_f("primary-rotation-90-flip-stress") {
+ igt_require(gen >= 9);
+ data.override_tiling = 0;
+ data.flip_stress = 120;
+ data.rotation = IGT_ROTATION_90;
+ test_plane_rotation(&data, IGT_PLANE_PRIMARY);
+ }
+
igt_fixture {
igt_display_fini(&data.display);
}
--
1.9.1
More information about the Intel-gfx
mailing list