From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH i-g-t v2 4/6] kms_vblank: Add tests implemented in kms_flip
Date: Thu, 4 Jan 2018 15:12:41 +0100 [thread overview]
Message-ID: <20180104141243.15098-5-maarten.lankhorst@linux.intel.com> (raw)
In-Reply-To: <20180104141243.15098-1-maarten.lankhorst@linux.intel.com>
In kms_flip there are some tests for testing whether the
vblank counter is monotonically increasing. Add these subtests
to kms_vblank, where they belong.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
tests/kms_vblank.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 80 insertions(+), 4 deletions(-)
diff --git a/tests/kms_vblank.c b/tests/kms_vblank.c
index 959ba46ca30f..362221c03677 100644
--- a/tests/kms_vblank.c
+++ b/tests/kms_vblank.c
@@ -51,10 +51,14 @@ typedef struct {
igt_output_t *output;
enum pipe pipe;
unsigned int flags;
-#define IDLE 1
-#define BUSY 2
-#define FORKED 4
-#define NOHANG 8
+#define IDLE 0x1
+#define BUSY 0x2
+#define FORKED 0x4
+#define NOHANG 0x8
+#define MODESET 0x10
+#define DPMS 0x20
+#define SUSPEND 0x40
+#define RPM 0x80
} data_t;
static double elapsed(const struct timespec *start,
@@ -124,6 +128,9 @@ static void run_test(data_t *data, int fd, void (*testfunc)(data_t *, int, int))
prepare_crtc(data, fd, output);
+ if (data->flags & RPM)
+ igt_require(igt_setup_runtime_pm());
+
igt_info("Beginning %s on pipe %s, connector %s (%d threads)\n",
igt_subtest_name(), kmstest_pipe_name(data->pipe),
igt_output_name(output), nchildren);
@@ -315,6 +322,69 @@ static void vblank_wait(data_t *data, int fd, int nchildren)
elapsed(&start, &end, count));
}
+static int get_vblank(int fd, enum pipe pipe, unsigned flags)
+{
+ union drm_wait_vblank vbl;
+
+ memset(&vbl, 0, sizeof(vbl));
+ vbl.request.type = DRM_VBLANK_RELATIVE | kmstest_get_vbl_flag(pipe) | flags;
+ do_or_die(igt_ioctl(fd, DRM_IOCTL_WAIT_VBLANK, &vbl));
+
+ return vbl.reply.sequence;
+}
+
+static void vblank_ts_cont(data_t *data, int fd, int nchildren)
+{
+ igt_display_t *display = &data->display;
+ igt_output_t *output = data->output;
+ int seq1, seq2;
+ union drm_wait_vblank vbl;
+
+ seq1 = get_vblank(fd, data->pipe, 0);
+
+ if (data->flags & DPMS) {
+ igt_output_set_prop_value(output, IGT_CONNECTOR_DPMS, DRM_MODE_DPMS_OFF);
+ igt_display_commit(display);
+ }
+
+ if (data->flags & MODESET) {
+ igt_output_set_pipe(output, PIPE_NONE);
+ igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
+ }
+
+ if (data->flags & RPM)
+ igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED));
+
+ if (data->flags & SUSPEND)
+ igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
+ SUSPEND_TEST_NONE);
+
+ if (data->flags & (MODESET | DPMS)) {
+ /* Attempting to do a vblank while disabled should return -EINVAL */
+ memset(&vbl, 0, sizeof(vbl));
+ vbl.request.type = DRM_VBLANK_RELATIVE;
+ vbl.request.type |= kmstest_get_vbl_flag(data->pipe);
+ igt_assert_eq(wait_vblank(fd, &vbl), -EINVAL);
+ }
+
+ if (data->flags & DPMS) {
+ igt_output_set_prop_value(output, IGT_CONNECTOR_DPMS, DRM_MODE_DPMS_ON);
+ igt_display_commit(display);
+ }
+
+ if (data->flags & MODESET) {
+ igt_output_set_pipe(output, data->pipe);
+ igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
+ }
+
+ seq2 = get_vblank(fd, data->pipe, 0);
+
+ igt_debug("testing ts continuity: Current frame %u, old frame %u\n", seq2, seq1);
+
+ igt_assert_f(seq2 - seq1 >= 0, "unexpected vblank seq %u, should be >= %u\n", seq2, seq1);
+ igt_assert_f(seq2 - seq1 <= 150, "unexpected vblank seq %u, should be < %u\n", seq2, seq1 + 150);
+}
+
igt_main
{
int fd;
@@ -327,6 +397,7 @@ igt_main
{ "accuracy", accuracy, IDLE },
{ "query", vblank_query, IDLE | FORKED | BUSY },
{ "wait", vblank_wait, IDLE | FORKED | BUSY },
+ { "ts-continuation", vblank_ts_cont, IDLE | SUSPEND | MODESET | DPMS | RPM },
{ }
}, *f;
enum pipe p;
@@ -339,6 +410,11 @@ igt_main
{ "forked", IDLE | FORKED },
{ "busy", BUSY },
{ "forked-busy", BUSY | FORKED },
+ { "dpms-rpm", DPMS | RPM | NOHANG },
+ { "dpms-suspend", DPMS | SUSPEND | NOHANG},
+ { "suspend", SUSPEND | NOHANG },
+ { "modeset", MODESET },
+ { "modeset-rpm", MODESET | RPM | NOHANG},
{ }
}, *m;
--
2.15.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2018-01-04 14:12 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-04 14:12 [PATCH i-g-t v2 0/6] kms_vblank: Move tests over from kms_flip Maarten Lankhorst
2018-01-04 14:12 ` [PATCH i-g-t v2 1/6] tests/kms_flip: Remove blt/rcs flip tests Maarten Lankhorst
2018-01-10 8:50 ` Daniel Vetter
2018-01-04 14:12 ` [PATCH i-g-t v2 2/6] kms_vblank: Reorganize subtests by pipe Maarten Lankhorst
2018-01-10 8:57 ` Daniel Vetter
2018-01-10 9:04 ` Daniel Vetter
2018-01-10 10:59 ` Maarten Lankhorst
2018-01-10 12:57 ` Daniel Vetter
2018-01-04 14:12 ` [PATCH i-g-t v2 3/6] tests/kms_flip: Move kms_flip.vblank-vs-hang to kms_vblank, v2 Maarten Lankhorst
2018-01-08 10:23 ` [PATCH v3 i-g-t] tests/kms_flip: Move kms_flip.vblank-vs-hang to kms_vblank, v3 Maarten Lankhorst
2018-01-10 9:30 ` Daniel Vetter
2018-01-04 14:12 ` Maarten Lankhorst [this message]
2018-01-04 14:12 ` [PATCH i-g-t v2 5/6] kms_flip: Remove redundant vblank tests Maarten Lankhorst
2018-01-04 14:12 ` [PATCH i-g-t v2 6/6] kms_vblank: Remove teardown code from cleanup_crtc Maarten Lankhorst
2018-01-10 9:32 ` Daniel Vetter
2018-01-04 14:49 ` ✓ Fi.CI.BAT: success for kms_vblank: Move tests over from kms_flip. (rev2) Patchwork
2018-01-04 16:52 ` ✓ Fi.CI.IGT: " Patchwork
2018-01-08 13:50 ` ✗ Fi.CI.BAT: failure for kms_vblank: Move tests over from kms_flip. (rev3) Patchwork
2018-01-08 15:08 ` ✓ Fi.CI.BAT: success " Patchwork
2018-01-08 20:00 ` ✗ Fi.CI.IGT: warning " Patchwork
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=20180104141243.15098-5-maarten.lankhorst@linux.intel.com \
--to=maarten.lankhorst@linux.intel.com \
--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