summaryrefslogtreecommitdiff
path: root/tests/kms_rotation_crc.c
diff options
context:
space:
mode:
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>2015-04-27 12:29:11 +0100
committerThomas Wood <thomas.wood@intel.com>2015-05-01 16:24:28 +0100
commit637f0455da91c91eedae1245464b45f0c3f7310e (patch)
tree04c65cfa7fdbf6052e789d30d09615a4f0270d0f /tests/kms_rotation_crc.c
parent4650d3406cd2e1378b215793730b59c065c230d4 (diff)
kms_rotation_crc: Do not leak framebuffers during test duration
Test used to call prepare_crtc twice in the plane loop and leaked two framebuffers per [subtest]x[pipe]x[plane]. What the loops really wants to do, instead of second invocation of prepare_crtc, is to just turn on the display with the unrotated fb to verify that the plane property has been restored by the VT transition from previous to graphics mode. To enable that factor out code which does that from prepare_crtc into commit_crtc and call it instead. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Sonika Jindal <sonika.jindal@intel.com> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
Diffstat (limited to 'tests/kms_rotation_crc.c')
-rw-r--r--tests/kms_rotation_crc.c59
1 files changed, 33 insertions, 26 deletions
diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 0661b6bd..e16056de 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -87,19 +87,46 @@ paint_squares(data_t *data, drmModeModeInfo *mode, igt_rotation_t rotation,
cairo_destroy(cr);
}
+static void commit_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
+{
+ igt_display_t *display = &data->display;
+ enum igt_commit_style commit = COMMIT_LEGACY;
+ igt_plane_t *primary;
+
+ /*
+ * With igt_display_commit2 and COMMIT_UNIVERSAL, we call just the
+ * setplane without a modeset. So, to be able to call
+ * igt_display_commit and ultimately setcrtc to do the first modeset,
+ * we create an fb covering the crtc and call commit
+ */
+
+ primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+ igt_plane_set_fb(primary, &data->fb_modeset);
+ igt_display_commit(display);
+
+ igt_plane_set_fb(plane, &data->fb);
+
+ if (!plane->is_cursor)
+ igt_plane_set_position(plane, data->pos_x, data->pos_y);
+
+ if (plane->is_primary || plane->is_cursor) {
+ igt_require(data->display.has_universal_planes);
+ commit = COMMIT_UNIVERSAL;
+ }
+
+ igt_display_commit2(display, commit);
+}
+
static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
igt_plane_t *plane)
{
drmModeModeInfo *mode;
- igt_display_t *display = &data->display;
int fb_id, fb_modeset_id;
unsigned int w, h;
uint64_t tiling = data->override_tiling ?
data->override_tiling : LOCAL_DRM_FORMAT_MOD_NONE;
uint32_t pixel_format = data->override_fmt ?
data->override_fmt : DRM_FORMAT_XRGB8888;
- enum igt_commit_style commit = COMMIT_LEGACY;
- igt_plane_t *primary;
igt_output_set_pipe(output, pipe);
@@ -120,17 +147,6 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
igt_assert(fb_modeset_id);
/*
- * With igt_display_commit2 and COMMIT_UNIVERSAL, we call just the
- * setplane without a modeset. So, to be able to call
- * igt_display_commit and ultimately setcrtc to do the first modeset,
- * we create an fb covering the crtc and call commit
- */
-
- primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
- igt_plane_set_fb(primary, &data->fb_modeset);
- igt_display_commit(display);
-
- /*
* For 90/270, we will use create smaller fb so that the rotated
* frame can fit in
*/
@@ -156,18 +172,8 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
igt_assert(fb_id);
/* Step 1: create a reference CRC for a software-rotated fb */
-
paint_squares(data, mode, data->rotation, plane);
- igt_plane_set_fb(plane, &data->fb);
- if (!plane->is_cursor)
- igt_plane_set_position(plane, data->pos_x, data->pos_y);
-
- if (plane->is_primary || plane->is_cursor) {
- igt_require(data->display.has_universal_planes);
- commit = COMMIT_UNIVERSAL;
- }
-
- igt_display_commit2(display, commit);
+ commit_crtc(data, output, plane);
igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
/*
@@ -251,7 +257,8 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type)
*/
kmstest_restore_vt_mode();
kmstest_set_vt_graphics_mode();
- prepare_crtc(data, output, pipe, plane);
+
+ commit_crtc(data, output, plane);
igt_pipe_crc_collect_crc(data->pipe_crc, &crc_output);
igt_assert_crc_equal(&crc_unrotated, &crc_output);