From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Intel-gfx@lists.freedesktop.org
Cc: Vivek Kasireddy <vivek.kasireddy@intel.com>
Subject: [PATCH i-g-t 3/3] kms_rotation_crc: Test case for rotated VMA first with legacy tiling
Date: Fri, 16 Oct 2015 11:59:49 +0100 [thread overview]
Message-ID: <1444993189-18645-3-git-send-email-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <1444993189-18645-1-git-send-email-tvrtko.ursulin@linux.intel.com>
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Specifically targetting a WARN_ON in the kernel, i915_gem_fence.c:
if (WARN_ON(!obj->map_and_fenceable))
return -EINVAL;
Which happens for objects with legacy tiling set to Y at the point
object is pinned to display with no normal VMA in existance and
hence obj->map_and_fenceable false.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Vivek Kasireddy <vivek.kasireddy@intel.com>
---
tests/kms_rotation_crc.c | 121 +++++++++++++++++++++++++++++++++++++----------
1 file changed, 96 insertions(+), 25 deletions(-)
diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index cc9847ecc113..6b16ec73bb9a 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -81,7 +81,8 @@ 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)
+static void commit_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane,
+ bool render)
{
igt_display_t *display = &data->display;
enum igt_commit_style commit = COMMIT_LEGACY;
@@ -108,17 +109,18 @@ static void commit_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
commit = COMMIT_UNIVERSAL;
}
- igt_display_commit2(display, commit);
+ if (render)
+ igt_display_commit2(display, commit);
}
static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
- igt_plane_t *plane)
+ igt_plane_t *plane, bool render)
{
drmModeModeInfo *mode;
int fb_id, fb_modeset_id;
unsigned int w, h;
- uint64_t tiling = data->override_tiling ?
- data->override_tiling : LOCAL_DRM_FORMAT_MOD_NONE;
+ uint64_t tiling;
+ unsigned int obj_tiling = !render ? I915_TILING_Y : I915_TILING_NONE;
uint32_t pixel_format = data->override_fmt ?
data->override_fmt : DRM_FORMAT_XRGB8888;
@@ -133,6 +135,14 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
w = mode->hdisplay;
h = mode->vdisplay;
+ if (data->override_tiling)
+ tiling = data->override_tiling;
+ else if (data->rotation == IGT_ROTATION_90 ||
+ data->rotation == IGT_ROTATION_270)
+ tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
+ else
+ tiling = LOCAL_DRM_FORMAT_MOD_NONE;
+
fb_modeset_id = igt_create_fb(data->gfx_fd,
w, h,
pixel_format,
@@ -146,8 +156,6 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
*/
if (data->rotation == IGT_ROTATION_90 ||
data->rotation == IGT_ROTATION_270) {
- tiling = data->override_tiling ?
- data->override_tiling : LOCAL_I915_FORMAT_MOD_Y_TILED;
w = h = mode->vdisplay;
} else if (plane->is_cursor) {
pixel_format = data->override_fmt ?
@@ -158,24 +166,29 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
data->w = w;
data->h = h;
- fb_id = igt_create_fb(data->gfx_fd,
- w, h,
- pixel_format,
- tiling,
- &data->fb);
+ fb_id = igt_create_fb_with_bo_size(data->gfx_fd,
+ w, h,
+ pixel_format,
+ tiling, obj_tiling,
+ &data->fb, 0);
igt_assert(fb_id);
- /* Step 1: create a reference CRC for a software-rotated fb */
- paint_squares(data, mode, data->rotation, plane);
- commit_crtc(data, output, plane);
- igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
-
- /*
- * Step 2: prepare the plane with an non-rotated fb let the hw
- * rotate it.
- */
- paint_squares(data, mode, IGT_ROTATION_0, plane);
- igt_plane_set_fb(plane, &data->fb);
+ if (render) {
+ /* Step 1: create a reference CRC for a software-rotated fb */
+ paint_squares(data, mode, data->rotation, plane);
+ commit_crtc(data, output, plane, render);
+ igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
+
+ /*
+ * Step 2: prepare the plane with an non-rotated fb let the hw
+ * rotate it.
+ */
+ paint_squares(data, mode, IGT_ROTATION_0, plane);
+ igt_plane_set_fb(plane, &data->fb);
+ } else {
+ commit_crtc(data, output, plane, render);
+ igt_plane_set_fb(plane, &data->fb);
+ }
}
static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
@@ -226,7 +239,7 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type)
plane = igt_output_get_plane(output, plane_type);
igt_require(igt_plane_supports_rotation(plane));
- prepare_crtc(data, output, pipe, plane);
+ prepare_crtc(data, output, pipe, plane, true);
igt_display_commit2(display, commit);
@@ -252,7 +265,7 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type)
kmstest_restore_vt_mode();
kmstest_set_vt_graphics_mode();
- commit_crtc(data, output, plane);
+ commit_crtc(data, output, plane, true);
igt_pipe_crc_collect_crc(data->pipe_crc, &crc_output);
igt_assert_crc_equal(&crc_unrotated, &crc_output);
@@ -264,6 +277,52 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type)
igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
}
+static void
+test_plane_rotation_first(data_t *data, enum igt_plane plane_type)
+{
+ igt_display_t *display = &data->display;
+ igt_output_t *output;
+ enum pipe pipe;
+ int valid_tests = 0;
+ enum igt_commit_style commit = COMMIT_LEGACY;
+ int ret;
+
+ if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR) {
+ igt_require(data->display.has_universal_planes);
+ commit = COMMIT_UNIVERSAL;
+ }
+
+ for_each_connected_output(display, output) {
+ for_each_pipe(display, pipe) {
+ igt_plane_t *plane;
+
+ igt_output_set_pipe(output, pipe);
+
+ plane = igt_output_get_plane(output, plane_type);
+ igt_require(igt_plane_supports_rotation(plane));
+
+ prepare_crtc(data, output, pipe, plane, false);
+
+ igt_plane_set_rotation(plane, data->rotation);
+ ret = igt_display_try_commit2(display, commit);
+ igt_assert(ret == 0);
+
+ /*
+ * check the rotation state has been reset when the VT
+ * mode is restored
+ */
+ kmstest_restore_vt_mode();
+ kmstest_set_vt_graphics_mode();
+
+ commit_crtc(data, output, plane, false);
+
+ valid_tests++;
+ cleanup_crtc(data, output, plane);
+ }
+ }
+ igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
+}
+
igt_main
{
data_t data = {};
@@ -302,6 +361,18 @@ igt_main
test_plane_rotation(&data, IGT_PLANE_PRIMARY);
}
+ /*
+ * Test rotated VMA instantiated first for the frame buffer object,
+ * in other words with no normal VMA in existance first. Done by
+ * avoiding rendering anything to the frame buffer and setting
+ * rotation before commiting to display.
+ */
+ igt_subtest_f("primary-rotation-90-first") {
+ igt_require(gen >= 9);
+ data.rotation = IGT_ROTATION_90;
+ test_plane_rotation_first(&data, IGT_PLANE_PRIMARY);
+ }
+
igt_subtest_f("primary-rotation-270") {
igt_require(gen >= 9);
data.rotation = IGT_ROTATION_270;
--
1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-10-16 10:59 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-16 10:59 [PATCH i-g-t 1/3] lib/igt_fb: Allow specifiying object tiling when creating frame buffers Tvrtko Ursulin
2015-10-16 10:59 ` [PATCH i-g-t 2/3] lib/igt_kms: Set new rotation property before displaying Tvrtko Ursulin
2015-10-16 10:59 ` Tvrtko Ursulin [this message]
2015-10-16 12:03 ` [PATCH i-g-t 1/3] lib/igt_fb: Allow specifiying object tiling when creating frame buffers Ville Syrjälä
2015-10-16 12:19 ` Tvrtko Ursulin
2015-10-16 12:29 ` Ville Syrjälä
2015-10-16 12:54 ` Tvrtko Ursulin
2015-10-16 13:01 ` Ville Syrjälä
2015-10-16 13:06 ` Tvrtko Ursulin
2015-10-17 2:47 ` [PATCH] igt/kms_rotation_crc: Add a subtest to validate Y-tiled obj + Y fb modifier Vivek Kasireddy
2015-10-19 10:20 ` Tvrtko Ursulin
2015-10-20 1:14 ` Vivek Kasireddy
2015-10-20 9:10 ` Tvrtko Ursulin
2015-10-21 1:41 ` Vivek Kasireddy
2015-10-22 1:24 ` [PATCH] igt/kms_rotation_crc: Add a subtest to validate Y-tiled obj + Y fb modifier (v2) Vivek Kasireddy
2015-10-22 9:56 ` Tvrtko Ursulin
2015-10-23 1:34 ` [PATCH] igt/kms_rotation_crc: Add a subtest to validate Y-tiled obj + Y fb modifier (v3) Vivek Kasireddy
2015-10-23 8:51 ` Tvrtko Ursulin
2015-10-23 11:35 ` Daniel Vetter
2015-10-24 1:03 ` Vivek Kasireddy
2015-10-27 10:37 ` Tvrtko Ursulin
2015-10-29 1:48 ` [PATCH] igt/kms_rotation_crc: Add a subtest to validate Y-tiled obj + Y fb modifier (v4) Vivek Kasireddy
2015-10-29 10:33 ` Tvrtko Ursulin
2015-10-30 1:44 ` [PATCH] igt/kms_rotation_crc: Add a subtest to validate Y-tiled obj + Y fb modifier (v5) Vivek Kasireddy
2015-10-30 10:22 ` Tvrtko Ursulin
2015-10-31 1:45 ` Vivek Kasireddy
2015-11-02 9:41 ` Tvrtko Ursulin
2015-11-02 13:36 ` [PATCH] igt/kms_rotation_crc: Add a subtest to validate Y-tiled obj + Y fb modifier (v3) Thomas Wood
2015-11-03 1:25 ` [PATCH] igt/kms_rotation_crc: Add a new subtest to exhaustively test for fence leaks Vivek Kasireddy
2015-11-03 10:02 ` Tvrtko Ursulin
2015-11-04 2:25 ` [PATCH] igt/kms_rotation_crc: Add a new subtest to exhaustively test for fence leaks (v2) Vivek Kasireddy
2015-11-04 10:07 ` Tvrtko Ursulin
2015-11-05 0:10 ` [PATCH] igt/kms_rotation_crc: Add a new subtest to exhaustively test for fence leaks (v3) Vivek Kasireddy
2015-11-05 9:46 ` Tvrtko Ursulin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1444993189-18645-3-git-send-email-tvrtko.ursulin@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=Intel-gfx@lists.freedesktop.org \
--cc=vivek.kasireddy@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox