[PATCH xf86-video-ati 04/10] Create drmmode_crtc_wait_pending_event helper macro

Michel Dänzer michel at daenzer.net
Wed Aug 16 07:57:19 UTC 2017


From: Michel Dänzer <michel.daenzer at amd.com>

Preparation for following change, no functional change intended yet.

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/drmmode_display.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 96c108a85..6822bf586 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -99,6 +99,14 @@ RADEONZaphodStringMatches(ScrnInfoPtr pScrn, const char *s, char *output_name)
     return FALSE;
 }
 
+
+/* Wait for the boolean condition to be FALSE */
+#define drmmode_crtc_wait_pending_event(drmmode_crtc, fd, condition) \
+	do {} while ((condition) && \
+		     drmHandleEvent(fd, &drmmode_crtc->drmmode->event_context) \
+		     > 0);
+
+
 static PixmapPtr drmmode_create_bo_pixmap(ScrnInfoPtr pScrn,
 					  int width, int height,
 					  int depth, int bpp,
@@ -949,10 +957,8 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 			goto done;
 		}
 
-		/* Wait for any pending flip to finish */
-		do {} while (drmmode_crtc->flip_pending &&
-			     drmHandleEvent(pRADEONEnt->fd,
-					    &drmmode->event_context) > 0);
+		drmmode_crtc_wait_pending_event(drmmode_crtc, pRADEONEnt->fd,
+						drmmode_crtc->flip_pending);
 
 		if (drmModeSetCrtc(pRADEONEnt->fd,
 				   drmmode_crtc->mode_crtc->crtc_id,
-- 
2.14.1



More information about the amd-gfx mailing list