[weston,v5,13/14] compositor-drm: Calculate atomic-commit flags earlier

Submitted by Daniel Stone on July 20, 2018, 7:03 p.m.

Details

Message ID 20180720190335.23880-14-daniels@collabora.com
State Accepted
Commit 3158a2d42ec602c9dd138fcff1b9ad0c8e7db13d
Headers show
Series "weston-debug API and tool" ( rev: 2 1 ) in Wayland

Not browsing as part of any series.

Commit Message

Daniel Stone July 20, 2018, 7:03 p.m.
Shift up our calculation of the flags we use for atomic commits. We will
later use this to differentiate between test-only and full commits when
printing debug information inside drm_output_state_apply_atomic.

Signed-off-by: Daniel Stone <daniels@collabora.com>
---
 libweston/compositor-drm.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

Patch hide | download patch | download mbox

diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index e27671437..653d13e0c 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -2499,12 +2499,24 @@  drm_pending_state_apply_atomic(struct drm_pending_state *pending_state,
 	struct drm_output_state *output_state, *tmp;
 	struct drm_plane *plane;
 	drmModeAtomicReq *req = drmModeAtomicAlloc();
-	uint32_t flags = 0;
+	uint32_t flags;
 	int ret = 0;
 
 	if (!req)
 		return -1;
 
+	switch (mode) {
+	case DRM_STATE_APPLY_SYNC:
+		flags = 0;
+		break;
+	case DRM_STATE_APPLY_ASYNC:
+		flags = DRM_MODE_PAGE_FLIP_EVENT | DRM_MODE_ATOMIC_NONBLOCK;
+		break;
+	case DRM_STATE_TEST_ONLY:
+		flags = DRM_MODE_ATOMIC_TEST_ONLY;
+		break;
+	}
+
 	if (b->state_invalid) {
 		struct weston_head *head_base;
 		struct drm_head *head;
@@ -2597,17 +2609,6 @@  drm_pending_state_apply_atomic(struct drm_pending_state *pending_state,
 		goto out;
 	}
 
-	switch (mode) {
-	case DRM_STATE_APPLY_SYNC:
-		break;
-	case DRM_STATE_APPLY_ASYNC:
-		flags |= DRM_MODE_PAGE_FLIP_EVENT | DRM_MODE_ATOMIC_NONBLOCK;
-		break;
-	case DRM_STATE_TEST_ONLY:
-		flags |= DRM_MODE_ATOMIC_TEST_ONLY;
-		break;
-	}
-
 	ret = drmModeAtomicCommit(b->drm.fd, req, flags, b);
 
 	/* Test commits do not take ownership of the state; return

Comments

On Fri, 20 Jul 2018 20:03:34 +0100
Daniel Stone <daniels@collabora.com> wrote:

> Shift up our calculation of the flags we use for atomic commits. We will
> later use this to differentiate between test-only and full commits when
> printing debug information inside drm_output_state_apply_atomic.
> 
> Signed-off-by: Daniel Stone <daniels@collabora.com>
> ---
>  libweston/compositor-drm.c | 25 +++++++++++++------------
>  1 file changed, 13 insertions(+), 12 deletions(-)
> 
> diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
> index e27671437..653d13e0c 100644
> --- a/libweston/compositor-drm.c
> +++ b/libweston/compositor-drm.c
> @@ -2499,12 +2499,24 @@ drm_pending_state_apply_atomic(struct drm_pending_state *pending_state,
>  	struct drm_output_state *output_state, *tmp;
>  	struct drm_plane *plane;
>  	drmModeAtomicReq *req = drmModeAtomicAlloc();
> -	uint32_t flags = 0;
> +	uint32_t flags;
>  	int ret = 0;
>  
>  	if (!req)
>  		return -1;
>  
> +	switch (mode) {
> +	case DRM_STATE_APPLY_SYNC:
> +		flags = 0;
> +		break;
> +	case DRM_STATE_APPLY_ASYNC:
> +		flags = DRM_MODE_PAGE_FLIP_EVENT | DRM_MODE_ATOMIC_NONBLOCK;
> +		break;
> +	case DRM_STATE_TEST_ONLY:
> +		flags = DRM_MODE_ATOMIC_TEST_ONLY;
> +		break;
> +	}
> +
>  	if (b->state_invalid) {
>  		struct weston_head *head_base;
>  		struct drm_head *head;
> @@ -2597,17 +2609,6 @@ drm_pending_state_apply_atomic(struct drm_pending_state *pending_state,
>  		goto out;
>  	}
>  
> -	switch (mode) {
> -	case DRM_STATE_APPLY_SYNC:
> -		break;
> -	case DRM_STATE_APPLY_ASYNC:
> -		flags |= DRM_MODE_PAGE_FLIP_EVENT | DRM_MODE_ATOMIC_NONBLOCK;
> -		break;
> -	case DRM_STATE_TEST_ONLY:
> -		flags |= DRM_MODE_ATOMIC_TEST_ONLY;
> -		break;
> -	}
> -
>  	ret = drmModeAtomicCommit(b->drm.fd, req, flags, b);
>  
>  	/* Test commits do not take ownership of the state; return

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>


Thanks,
pq