[PATCH 1/2] compositor-drm: finish frame if initial page-flip fails

David Herrmann dh.herrmann at gmail.com
Tue Oct 22 17:11:25 CEST 2013


If the initial page-flip fails, immediately finish the frame to avoid
being stuck in the given frame. We already do this if we have no fbo
available. Now we do the same if the page-flip fails.
---
 src/compositor-drm.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index cbdbb3c..8a70674 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -674,7 +674,7 @@ drm_output_start_repaint_loop(struct weston_output *output_base)
 	struct drm_compositor *compositor = (struct drm_compositor *)
 		output_base->compositor;
 	uint32_t fb_id;
-
+	uint32_t msec;
 	struct timespec ts;
 
 	if (output->destroy_pending)
@@ -682,12 +682,7 @@ drm_output_start_repaint_loop(struct weston_output *output_base)
 
 	if (!output->current) {
 		/* We can't page flip if there's no mode set */
-		uint32_t msec;
-
-		clock_gettime(compositor->clock, &ts);
-		msec = ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
-		weston_output_finish_frame(output_base, msec);
-		return;
+		goto finish_frame;
 	}
 
 	fb_id = output->current->fb_id;
@@ -695,8 +690,16 @@ drm_output_start_repaint_loop(struct weston_output *output_base)
 	if (drmModePageFlip(compositor->drm.fd, output->crtc_id, fb_id,
 			    DRM_MODE_PAGE_FLIP_EVENT, output) < 0) {
 		weston_log("queueing pageflip failed: %m\n");
-		return;
+		goto finish_frame;
 	}
+
+	return;
+
+finish_frame:
+	/* if we cannot page-flip, immediately finish frame */
+	clock_gettime(compositor->clock, &ts);
+	msec = ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
+	weston_output_finish_frame(output_base, msec);
 }
 
 static void
-- 
1.8.4.1



More information about the wayland-devel mailing list