summaryrefslogtreecommitdiff
path: root/src/drmmode_display.c
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2017-08-18 16:11:41 +0900
committerMichel Dänzer <michel@daenzer.net>2017-08-22 18:32:57 +0900
commite8d0bfab276d47338c337955b9d2fcbff3af225f (patch)
treeb420fc6884e7466768c011fc2680c1765c54d9bc /src/drmmode_display.c
parentfd5b78b7edff2021111bca37642b8b508f0c3328 (diff)
Create drmmode_crtc_wait_pending_event helper macro
Preparation for following change, no functional change intended yet. (Ported from radeon commit f87acdbfb1b0b6d2769764772a52ea8b81675e20) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'src/drmmode_display.c')
-rw-r--r--src/drmmode_display.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 1a805b8..bdd3866 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -96,6 +96,14 @@ AMDGPUZaphodStringMatches(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,
@@ -891,10 +899,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(pAMDGPUEnt->fd,
- &drmmode->event_context) > 0);
+ drmmode_crtc_wait_pending_event(drmmode_crtc, pAMDGPUEnt->fd,
+ drmmode_crtc->flip_pending);
if (drmModeSetCrtc(pAMDGPUEnt->fd,
drmmode_crtc->mode_crtc->crtc_id,