From: Paulo Zanoni <przanoni@gmail.com>
To: intel-gfx@lists.freedesktop.org
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: [PATCH 1/2] tests/pm_rpm: add cursor subtests
Date: Mon, 28 Jul 2014 15:37:13 -0300 [thread overview]
Message-ID: <1406572636-1809-3-git-send-email-przanoni@gmail.com> (raw)
In-Reply-To: <1406572636-1809-1-git-send-email-przanoni@gmail.com>
From: Paulo Zanoni <paulo.r.zanoni@intel.com>
These tests currently trigger WARNs on our Kernel. Let's make sure we
fix the bugs and they never come back.
v2: Reorganize the code a little bit, and improve the tests.
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
tests/pm_rpm.c | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 113 insertions(+), 10 deletions(-)
diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c
index 869e6f3..f720f86 100644
--- a/tests/pm_rpm.c
+++ b/tests/pm_rpm.c
@@ -277,13 +277,15 @@ static uint32_t get_fb(struct mode_set_data *data, int width, int height)
igt_assert(false);
}
-static bool enable_one_screen_with_type(struct mode_set_data *data,
- enum screen_type type)
+static bool find_connector_for_modeset(struct mode_set_data *data,
+ enum screen_type type,
+ uint32_t *connector_id,
+ drmModeModeInfoPtr *mode)
{
- uint32_t crtc_id = 0, buffer_id = 0, connector_id = 0;
- drmModeModeInfoPtr mode = NULL;
- int i, rc;
+ int i;
+ *connector_id = 0;
+ *mode = NULL;
for (i = 0; i < data->res->count_connectors; i++) {
drmModeConnectorPtr c = data->connectors[i];
@@ -296,13 +298,23 @@ static bool enable_one_screen_with_type(struct mode_set_data *data,
continue;
if (c->connection == DRM_MODE_CONNECTED && c->count_modes) {
- connector_id = c->connector_id;
- mode = &c->modes[0];
+ *connector_id = c->connector_id;
+ *mode = &c->modes[0];
break;
}
}
- if (connector_id == 0)
+ return (*connector_id != 0);
+}
+
+static bool enable_one_screen_with_type(struct mode_set_data *data,
+ enum screen_type type)
+{
+ uint32_t crtc_id = 0, buffer_id = 0, connector_id;
+ drmModeModeInfoPtr mode;
+ int rc;
+
+ if (!find_connector_for_modeset(data, type, &connector_id, &mode))
return false;
crtc_id = data->res->crtcs[0];
@@ -310,8 +322,6 @@ static bool enable_one_screen_with_type(struct mode_set_data *data,
igt_assert(crtc_id);
igt_assert(buffer_id);
- igt_assert(connector_id);
- igt_assert(mode);
rc = drmModeSetCrtc(drm_fd, crtc_id, buffer_id, 0, 0, &connector_id,
1, mode);
@@ -1407,6 +1417,93 @@ static void dpms_mode_unset_subtest(enum screen_type type)
igt_assert(wait_for_suspended());
}
+static void fill_igt_fb(struct igt_fb *fb, uint32_t color)
+{
+ int i;
+ uint32_t *ptr;
+
+ ptr = gem_mmap__cpu(drm_fd, fb->gem_handle, fb->size, 0);
+ for (i = 0; i < fb->size/sizeof(uint32_t); i++)
+ ptr[i] = color;
+ igt_assert(munmap(ptr, fb->size) == 0);
+}
+
+/* At some point, this test triggered WARNs in the Kernel. */
+static void cursor_subtest(bool dpms)
+{
+ uint32_t crtc_id = 0, connector_id;
+ drmModeModeInfoPtr mode;
+ int rc;
+ struct igt_fb scanout_fb, cursor_fb1, cursor_fb2;
+
+ disable_all_screens(&ms_data);
+ igt_assert(wait_for_suspended());
+
+ igt_require(find_connector_for_modeset(&ms_data, SCREEN_TYPE_ANY,
+ &connector_id, &mode));
+
+ crtc_id = ms_data.res->crtcs[0];
+ igt_assert(crtc_id);
+
+ igt_create_fb(drm_fd, mode->hdisplay, mode->vdisplay,
+ DRM_FORMAT_XRGB8888, false, &scanout_fb);
+ igt_create_fb(drm_fd, 64, 64, DRM_FORMAT_ARGB8888, false, &cursor_fb1);
+ igt_create_fb(drm_fd, 64, 64, DRM_FORMAT_ARGB8888, false, &cursor_fb2);
+
+ fill_igt_fb(&scanout_fb, 0xFF);
+ fill_igt_fb(&cursor_fb1, 0xFF00FFFF);
+ fill_igt_fb(&cursor_fb2, 0xFF00FF00);
+
+ rc = drmModeSetCrtc(drm_fd, crtc_id, scanout_fb.fb_id, 0, 0,
+ &connector_id, 1, mode);
+ igt_assert(rc == 0);
+ igt_assert(wait_for_active());
+
+ rc = drmModeSetCursor(drm_fd, crtc_id, cursor_fb1.gem_handle,
+ cursor_fb1.width, cursor_fb1.height);
+ igt_assert(rc == 0);
+ rc = drmModeMoveCursor(drm_fd, crtc_id, 0, 0);
+ igt_assert(rc == 0);
+ igt_assert(wait_for_active());
+
+ if (dpms)
+ disable_all_screens_dpms(&ms_data);
+ else
+ disable_all_screens(&ms_data);
+ igt_assert(wait_for_suspended());
+
+ /* First, just move the cursor. */
+ rc = drmModeMoveCursor(drm_fd, crtc_id, 1, 1);
+ igt_assert(rc == 0);
+ igt_assert(wait_for_suspended());
+
+ /* Then unset it, and set a new one. */
+ rc = drmModeSetCursor(drm_fd, crtc_id, 0, 0, 0);
+ igt_assert(rc == 0);
+ igt_assert(wait_for_suspended());
+
+ rc = drmModeSetCursor(drm_fd, crtc_id, cursor_fb2.gem_handle,
+ cursor_fb1.width, cursor_fb2.height);
+ igt_assert(rc == 0);
+ igt_assert(wait_for_suspended());
+
+ /* Move the new cursor. */
+ rc = drmModeMoveCursor(drm_fd, crtc_id, 2, 2);
+ igt_assert(rc == 0);
+ igt_assert(wait_for_suspended());
+
+ /* Now set a new one without unsetting the previous one. */
+ rc = drmModeSetCursor(drm_fd, crtc_id, cursor_fb1.gem_handle,
+ cursor_fb1.width, cursor_fb1.height);
+ igt_assert(rc == 0);
+ igt_assert(wait_for_suspended());
+
+ /* Make sure nothing remains for the other tests. */
+ rc = drmModeSetCursor(drm_fd, crtc_id, 0, 0, 0);
+ igt_assert(rc == 0);
+ igt_assert(wait_for_suspended());
+}
+
int rounds = 50;
bool stay = false;
@@ -1480,6 +1577,12 @@ int main(int argc, char *argv[])
igt_subtest("gem-idle")
gem_idle_subtest();
+ /* Cursors */
+ igt_subtest("cursor")
+ cursor_subtest(false);
+ igt_subtest("cursor-dpms")
+ cursor_subtest(true);
+
/* Misc */
igt_subtest("reg-read-ioctl")
reg_read_ioctl_subtest();
--
2.0.1
next prev parent reply other threads:[~2014-07-28 18:37 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-28 18:37 [PATCH 0/3] Fixes for runtime PM on planes APIs Paulo Zanoni
2014-07-28 18:37 ` [PATCH 1/3] drm/i915: fix cursor handling when runtime suspended Paulo Zanoni
2014-07-29 10:22 ` Ville Syrjälä
2014-07-29 14:25 ` Paulo Zanoni
2014-07-28 18:37 ` Paulo Zanoni [this message]
2014-07-28 18:37 ` [PATCH 2/3] drm/i915: get runtime PM when pinning sprite objects Paulo Zanoni
2014-07-28 18:37 ` [PATCH 2/2] tests/pm_rpm: add planes subtests Paulo Zanoni
2014-07-28 23:47 ` Matt Roper
2014-08-05 21:34 ` Paulo Zanoni
2014-08-05 21:51 ` Matt Roper
2014-08-06 14:11 ` Paulo Zanoni
2014-08-06 14:23 ` Daniel Vetter
2014-07-28 18:37 ` [PATCH 3/3] drm/i915: get runtime PM when pinning primary plane objects Paulo Zanoni
2014-07-28 23:25 ` [PATCH 0/3] Fixes for runtime PM on planes APIs Matt Roper
2014-07-29 8:01 ` Daniel Vetter
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=1406572636-1809-3-git-send-email-przanoni@gmail.com \
--to=przanoni@gmail.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=paulo.r.zanoni@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.