summaryrefslogtreecommitdiff
path: root/tests/kms_cursor_crc.c
diff options
context:
space:
mode:
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2017-06-14 10:17:31 +0200
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2017-07-03 11:46:05 +0200
commit6fcc8e8b247661c7950b998e0b95141ffbd6b833 (patch)
tree6bcbc47842d8e0d861c46a894aac38e575f4059f /tests/kms_cursor_crc.c
parent44d9177502a614685f22965575438d1649959384 (diff)
tests/kms_cursor_crc: Fix the cursor tests to work on CHV
On CHV pipe C when the cursor is visible with a negative X coordinate a FIFO Underrun will occur. The kernel worked around this by disallowing cursor updates on pipe C at negative X coordinates when the cursor is visible. This was done in the following kernel commit: commit ef8dd37af85a8f37ca3a29074647511e52c56181 Author: Ville Syrjälä <ville.syrjala@linux.intel.com> Date: Fri Dec 18 19:24:39 2015 +0200 drm/i915: Workaround CHV pipe C cursor fail kms_chv_cursor_fail was created to test this issue, but it also happens in kms_cursor_crc, so workaround it there too. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97960
Diffstat (limited to 'tests/kms_cursor_crc.c')
-rw-r--r--tests/kms_cursor_crc.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
index 0940752b..4c5e00c0 100644
--- a/tests/kms_cursor_crc.c
+++ b/tests/kms_cursor_crc.c
@@ -106,6 +106,34 @@ static void cursor_disable(data_t *data)
igt_plane_set_fb(cursor, NULL);
}
+static bool chv_cursor_broken(data_t *data, int x)
+{
+ /*
+ * CHV gets a FIFO underrun on pipe C when cursor x coordinate
+ * is negative and the cursor visible.
+ *
+ * i915 is fixed to return -EINVAL on cursor updates with those
+ * negative coordinates, so require cursor update to fail with
+ * -EINVAL in that case.
+ *
+ * See also kms_chv_cursor_fail.c
+ */
+ if (x >= 0)
+ return false;
+
+ return IS_CHERRYVIEW(data->devid) && data->pipe == PIPE_C;
+}
+
+static bool cursor_visible(data_t *data, int x, int y)
+{
+ if (x + data->curw <= 0 || y + data->curh <= 0)
+ return false;
+
+ if (x >= data->screenw || y >= data->screenh)
+ return false;
+
+ return true;
+}
static void do_single_test(data_t *data, int x, int y)
{
@@ -114,6 +142,7 @@ static void do_single_test(data_t *data, int x, int y)
igt_crc_t crc, ref_crc;
igt_plane_t *cursor;
cairo_t *cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb);
+ int ret = 0;
igt_print_activity();
@@ -122,7 +151,17 @@ static void do_single_test(data_t *data, int x, int y)
cursor_enable(data);
cursor = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_CURSOR);
igt_plane_set_position(cursor, x, y);
+
+ if (chv_cursor_broken(data, x) && cursor_visible(data, x, y)) {
+ ret = igt_display_try_commit2(display, COMMIT_LEGACY);
+ igt_assert_eq(ret, -EINVAL);
+ igt_plane_set_position(cursor, 0, y);
+
+ return;
+ }
+
igt_display_commit(display);
+
igt_wait_for_vblank(data->drm_fd, data->pipe);
igt_pipe_crc_collect_crc(pipe_crc, &crc);