From: Liu Ying <gnuiyl@gmail.com>
To: intel-gfx@lists.freedesktop.org
Cc: Micah Fedke <micah.fedke@collabora.com>,
Daniel Vetter <daniel.vetter@ffwll.ch>,
Daniel Stone <daniels@collabora.com>
Subject: [PATCH 2/2] kms_atomic: plane_primary: Allow modeset if atomic check returns -EINVAL
Date: Mon, 12 Sep 2016 15:11:54 +0800 [thread overview]
Message-ID: <1473664314-8398-2-git-send-email-gnuiyl@gmail.com> (raw)
In-Reply-To: <1473664314-8398-1-git-send-email-gnuiyl@gmail.com>
Allowing modeset may prevent the test case from failing in case the atomic
check phase finds the userspace doesn't allow modeset for the commit and
returns -EINVAL. A real case is to run the test case on imx-drm which
requires a full modeset when we change an active plane's configuration,
e.g., pixel format and stride.
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Marius Vlad <marius.c.vlad@intel.com>
Cc: Micah Fedke <micah.fedke@collabora.com>
Cc: Daniel Stone <daniels@collabora.com>
Signed-off-by: Liu Ying <gnuiyl@gmail.com>
---
tests/kms_atomic.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
index bc6e575..1441fdf 100644
--- a/tests/kms_atomic.c
+++ b/tests/kms_atomic.c
@@ -910,6 +910,8 @@ static void plane_primary(struct kms_atomic_crtc_state *crtc,
uint32_t format = plane_get_igt_format(&plane);
drmModeAtomicReq *req = drmModeAtomicAlloc();
struct igt_fb fb;
+ uint32_t flags = 0;
+ int ret;
igt_require(format != 0);
@@ -926,12 +928,21 @@ static void plane_primary(struct kms_atomic_crtc_state *crtc,
plane.crtc_w, plane.crtc_h,
format, I915_TILING_NONE, &fb);
+ drmModeAtomicSetCursor(req, 0);
+ crtc_populate_req(crtc, req);
+ plane_populate_req(&plane, req);
+ ret = drmModeAtomicCommit(crtc->state->desc->fd, req,
+ DRM_MODE_ATOMIC_TEST_ONLY, NULL);
+ /* Try harder in case the failure is caused by disallowing modeset. */
+ if (ret == -EINVAL)
+ flags |= DRM_MODE_ATOMIC_ALLOW_MODESET;
+
/* Flip the primary plane using the atomic API, and double-check
* state is what we think it should be. */
- crtc_commit_atomic(crtc, &plane, req, ATOMIC_RELAX_NONE, 0);
+ crtc_commit_atomic(crtc, &plane, req, ATOMIC_RELAX_NONE, flags);
/* Restore the primary plane and check the state matches the old. */
- crtc_commit_atomic(crtc, plane_old, req, ATOMIC_RELAX_NONE, 0);
+ crtc_commit_atomic(crtc, plane_old, req, ATOMIC_RELAX_NONE, flags);
/* Re-enable the plane through the legacy CRTC/primary-plane API, and
* verify through atomic. */
@@ -942,7 +953,7 @@ static void plane_primary(struct kms_atomic_crtc_state *crtc,
crtc_commit_legacy(crtc, plane_old, CRTC_RELAX_MODE);
/* Finally, restore to the original state. */
- crtc_commit_atomic(crtc, plane_old, req, ATOMIC_RELAX_NONE, 0);
+ crtc_commit_atomic(crtc, plane_old, req, ATOMIC_RELAX_NONE, flags);
drmModeAtomicFree(req);
}
--
2.7.4
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-09-12 8:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-12 7:11 [PATCH 1/2] kms_atomic: Expose atomic commit flags to crtc_commit_atomic() Liu Ying
2016-09-12 7:11 ` Liu Ying [this message]
2016-09-27 7:11 ` [PATCH 2/2] kms_atomic: plane_primary: Allow modeset if atomic check returns -EINVAL Tomeu Vizoso
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=1473664314-8398-2-git-send-email-gnuiyl@gmail.com \
--to=gnuiyl@gmail.com \
--cc=daniel.vetter@ffwll.ch \
--cc=daniels@collabora.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=micah.fedke@collabora.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;
as well as URLs for NNTP newsgroup(s).