<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;" dir="ltr">
<p>One comment inline</p>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Michel Dänzer <michel@daenzer.net><br>
<b>Sent:</b> Friday, August 18, 2017 4:53 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Subject:</b> [PATCH xf86-video-amdgpu 04/10] Create drmmode_crtc_wait_pending_event helper macro</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">From: Michel Dänzer <michel.daenzer@amd.com><br>
<br>
Preparation for following change, no functional change intended yet.<br>
<br>
(Ported from radeon commit f87acdbfb1b0b6d2769764772a52ea8b81675e20)<br>
<br>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com><br>
---<br>
 src/drmmode_display.c | 14 ++++++++++----<br>
 1 file changed, 10 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/src/drmmode_display.c b/src/drmmode_display.c<br>
index 1a805b82d..bdd3866b8 100644<br>
--- a/src/drmmode_display.c<br>
+++ b/src/drmmode_display.c<br>
@@ -96,6 +96,14 @@ AMDGPUZaphodStringMatches(ScrnInfoPtr pScrn, const char *s, char *output_name)<br>
         return FALSE;<br>
 }<br>
 <br>
+<br>
+/* Wait for the boolean condition to be FALSE */<br>
+#define drmmode_crtc_wait_pending_event(drmmode_crtc, fd, condition) \<br>
+       do {} while ((condition) && \<br>
+                    drmHandleEvent(fd, &drmmode_crtc->drmmode->event_context) \<br>
+                    > 0);<br>
+<br>
+</div>
<div class="PlainText"><br>
</div>
<div class="PlainText">[slava] The comment seems a little misleading to me.  The loop condition has actually two parts, and it's unclear what we're actually waiting for.  A side question: is it expected that the variable 'condition' will change while we're
 waiting?</div>
<div class="PlainText"><br>
 static PixmapPtr drmmode_create_bo_pixmap(ScrnInfoPtr pScrn,<br>
                                           int width, int height,<br>
                                           int depth, int bpp,<br>
@@ -891,10 +899,8 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,<br>
                         goto done;<br>
                 }<br>
 <br>
-               /* Wait for any pending flip to finish */<br>
-               do {} while (drmmode_crtc->flip_pending &&<br>
-                            drmHandleEvent(pAMDGPUEnt->fd,<br>
-                                           &drmmode->event_context) > 0);<br>
+               drmmode_crtc_wait_pending_event(drmmode_crtc, pAMDGPUEnt->fd,<br>
+                                               drmmode_crtc->flip_pending);<br>
 <br>
                 if (drmModeSetCrtc(pAMDGPUEnt->fd,<br>
                                    drmmode_crtc->mode_crtc->crtc_id,<br>
-- <br>
2.14.1<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx" id="LPlnk443971" previewremoved="true">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</div>
</span></font></div>
</div>
</body>
</html>