From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Cc: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 1/3] i915/gem_eio: Race kms on/off vs reset
Date: Wed, 11 Sep 2019 11:14:59 +0100 [thread overview]
Message-ID: <20190911101501.7182-1-chris@chris-wilson.co.uk> (raw)
On older platforms, performing a GPU reset clobbers the display.
Exercise the interactions between reset/wedge and the display and
hopefully prevent any races creeping in.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
tests/i915/gem_eio.c | 79 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 79 insertions(+)
diff --git a/tests/i915/gem_eio.c b/tests/i915/gem_eio.c
index 9b086a039..e0213c76c 100644
--- a/tests/i915/gem_eio.c
+++ b/tests/i915/gem_eio.c
@@ -42,6 +42,8 @@
#include "igt.h"
#include "igt_device.h"
+#include "igt_fb.h"
+#include "igt_kms.h"
#include "igt_stats.h"
#include "igt_sysfs.h"
#include "sw_sync.h"
@@ -813,6 +815,67 @@ static void test_reset_stress(int fd, unsigned int flags)
gem_context_destroy(fd, ctx0);
}
+/*
+ * Modesetting vs wedged
+ */
+
+static void display_helper(igt_display_t *dpy, int *done)
+{
+ const int commit = dpy->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY;
+ struct igt_fb fb = {};
+
+ while (!READ_ONCE(*done)) {
+ drmModeModeInfoPtr mode;
+ igt_plane_t *primary;
+ igt_output_t *output;
+ int pipe;
+
+ pipe = rand() % dpy->n_pipes;
+ output = igt_get_single_output_for_pipe(dpy, pipe);
+ if (!output)
+ continue;
+
+ igt_output_set_pipe(output, pipe);
+ mode = igt_output_get_mode(output);
+
+ if (fb.width != mode->hdisplay || fb.height != mode->vdisplay) {
+ igt_remove_fb(dpy->drm_fd, &fb);
+ igt_create_pattern_fb(dpy->drm_fd,
+ mode->hdisplay, mode->vdisplay,
+ DRM_FORMAT_XRGB8888,
+ LOCAL_I915_FORMAT_MOD_X_TILED,
+ &fb);
+ }
+
+ primary = igt_output_get_plane_type(output,
+ DRM_PLANE_TYPE_PRIMARY);
+ igt_plane_set_fb(primary, &fb);
+
+ igt_display_commit2(dpy, commit);
+ igt_display_reset(dpy);
+ }
+
+ igt_remove_fb(dpy->drm_fd, &fb);
+}
+
+static void test_kms(int i915, igt_display_t *dpy)
+{
+ int *shared;
+
+ shared = mmap(NULL, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
+ igt_assert(shared != MAP_FAILED);
+
+ igt_fork(child, 1)
+ display_helper(dpy, shared);
+
+ test_reset_stress(i915, 0);
+ test_reset_stress(i915, TEST_WEDGE);
+
+ *shared = 1;
+ igt_waitchildren();
+ munmap(shared, 4096);
+}
+
static int fd = -1;
static void
@@ -906,4 +969,20 @@ igt_main
}
}
}
+
+ igt_subtest_group {
+ igt_display_t display = {
+ .drm_fd = -1, .n_pipes = IGT_MAX_PIPES
+ };
+
+ igt_fixture {
+ igt_device_set_master(fd);
+
+ igt_display_require(&display, fd);
+ igt_display_require_output(&display);
+ }
+
+ igt_subtest("kms")
+ test_kms(fd, &display);
+ }
}
--
2.23.0
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next reply other threads:[~2019-09-11 10:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-11 10:14 Chris Wilson [this message]
2019-09-11 10:15 ` [igt-dev] [PATCH i-g-t 2/3] Force spin-batch to cause a hang as required Chris Wilson
2019-09-19 14:09 ` Andi Shyti
2019-09-11 10:15 ` [igt-dev] [PATCH i-g-t 3/3] kms_busy: Replace fiddling with hangcheck modparam with explicit fence Chris Wilson
2019-09-19 14:09 ` Andi Shyti
2019-09-11 10:54 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] i915/gem_eio: Race kms on/off vs reset Patchwork
2019-09-11 17:12 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2019-09-19 14:08 ` [igt-dev] [PATCH i-g-t 1/3] " Andi Shyti
2019-09-19 14:20 ` Chris Wilson
2019-09-19 14:28 ` Ville Syrjälä
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=20190911101501.7182-1-chris@chris-wilson.co.uk \
--to=chris@chris-wilson.co.uk \
--cc=igt-dev@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
/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