summaryrefslogtreecommitdiff
path: root/tests/kms_atomic.c
diff options
context:
space:
mode:
authorLiu Ying <gnuiyl@gmail.com>2016-09-12 15:11:54 +0800
committerTomeu Vizoso <tomeu.vizoso@collabora.com>2016-09-26 17:12:30 +0200
commita23769cae6310436338a468ce93175d1c02ead1b (patch)
treeb22ee6aa34a131a09e360c44f8f62867ca0d2f8b /tests/kms_atomic.c
parentb7096c690142474647d79071d0c3c978bed69a29 (diff)
kms_atomic: plane_primary: Allow modeset if atomic check returns -EINVAL
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>
Diffstat (limited to 'tests/kms_atomic.c')
-rw-r--r--tests/kms_atomic.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
index bc6e5757..1441fdfd 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);
}