All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] kms_atomic: Expose atomic commit flags to crtc_commit_atomic()
@ 2016-09-12  7:11 Liu Ying
  2016-09-12  7:11 ` [PATCH 2/2] kms_atomic: plane_primary: Allow modeset if atomic check returns -EINVAL Liu Ying
  0 siblings, 1 reply; 3+ messages in thread
From: Liu Ying @ 2016-09-12  7:11 UTC (permalink / raw)
  To: intel-gfx; +Cc: Micah Fedke, Daniel Vetter, Daniel Stone

This patch exposes atomic commit flags to crtc_commit_atomic()
so that users of the macro may control the flags.

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 | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
index f27ee46..bc6e575 100644
--- a/tests/kms_atomic.c
+++ b/tests/kms_atomic.c
@@ -234,11 +234,11 @@ static uint32_t blob_duplicate(int fd, uint32_t id_orig)
 	igt_assert_eq(errno, err); \
 }
 
-#define crtc_commit_atomic(crtc, plane, req, relax) { \
+#define crtc_commit_atomic(crtc, plane, req, relax, flags) { \
 	drmModeAtomicSetCursor(req, 0); \
 	crtc_populate_req(crtc, req); \
 	plane_populate_req(plane, req); \
-	do_atomic_commit((crtc)->state->desc->fd, req, 0); \
+	do_atomic_commit((crtc)->state->desc->fd, req, flags); \
 	crtc_check_current_state(crtc, plane, relax); \
 	plane_check_current_state(plane, relax); \
 }
@@ -928,10 +928,10 @@ static void plane_primary(struct kms_atomic_crtc_state *crtc,
 
 	/* 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);
+	crtc_commit_atomic(crtc, &plane, req, ATOMIC_RELAX_NONE, 0);
 
 	/* Restore the primary plane and check the state matches the old. */
-	crtc_commit_atomic(crtc, plane_old, req, ATOMIC_RELAX_NONE);
+	crtc_commit_atomic(crtc, plane_old, req, ATOMIC_RELAX_NONE, 0);
 
 	/* Re-enable the plane through the legacy CRTC/primary-plane API, and
 	 * verify through atomic. */
@@ -942,7 +942,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);
+	crtc_commit_atomic(crtc, plane_old, req, ATOMIC_RELAX_NONE, 0);
 
 	drmModeAtomicFree(req);
 }
@@ -1117,7 +1117,7 @@ static void crtc_invalid_params(struct kms_atomic_crtc_state *crtc_old,
 	                       ATOMIC_RELAX_NONE, EINVAL);
 
 	crtc.mode.id = crtc_old->mode.id;
-	crtc_commit_atomic(&crtc, plane, req, ATOMIC_RELAX_NONE);
+	crtc_commit_atomic(&crtc, plane, req, ATOMIC_RELAX_NONE, 0);
 
 	/* Create a blob which is the wrong size to be a valid mode. */
 	do_or_die(drmModeCreatePropertyBlob(crtc.state->desc->fd,
@@ -1136,7 +1136,7 @@ static void crtc_invalid_params(struct kms_atomic_crtc_state *crtc_old,
 	                       ATOMIC_RELAX_NONE, EINVAL);
 
 	/* Restore the CRTC and check the state matches the old. */
-	crtc_commit_atomic(crtc_old, plane, req, ATOMIC_RELAX_NONE);
+	crtc_commit_atomic(crtc_old, plane, req, ATOMIC_RELAX_NONE, 0);
 
 	drmModeAtomicFree(req);
 }
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] kms_atomic: plane_primary: Allow modeset if atomic check returns -EINVAL
  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
  2016-09-27  7:11   ` Tomeu Vizoso
  0 siblings, 1 reply; 3+ messages in thread
From: Liu Ying @ 2016-09-12  7:11 UTC (permalink / raw)
  To: intel-gfx; +Cc: Micah Fedke, Daniel Vetter, Daniel Stone

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] kms_atomic: plane_primary: Allow modeset if atomic check returns -EINVAL
  2016-09-12  7:11 ` [PATCH 2/2] kms_atomic: plane_primary: Allow modeset if atomic check returns -EINVAL Liu Ying
@ 2016-09-27  7:11   ` Tomeu Vizoso
  0 siblings, 0 replies; 3+ messages in thread
From: Tomeu Vizoso @ 2016-09-27  7:11 UTC (permalink / raw)
  To: Liu Ying
  Cc: Micah Fedke, Daniel Vetter, Intel Graphics Development, Daniel Stone

On 12 September 2016 at 09:11, Liu Ying <gnuiyl@gmail.com> wrote:
> 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.

Pushed both changes, thanks!

Tomeu

> 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
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-27  7:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 2/2] kms_atomic: plane_primary: Allow modeset if atomic check returns -EINVAL Liu Ying
2016-09-27  7:11   ` Tomeu Vizoso

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.