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

Abramov, Slava Slava.Abramov at amd.com
Fri Aug 18 14:51:38 UTC 2017


One comment inline


________________________________
From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> on behalf of Michel Dänzer <michel at daenzer.net>
Sent: Friday, August 18, 2017 4:53 AM
To: amd-gfx at lists.freedesktop.org
Subject: [PATCH xf86-video-amdgpu 04/10] Create drmmode_crtc_wait_pending_event helper macro

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

Preparation for following change, no functional change intended yet.

(Ported from radeon commit f87acdbfb1b0b6d2769764772a52ea8b81675e20)

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 1a805b82d..bdd3866b8 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);
+
+

[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?

 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,
--
2.14.1

_______________________________________________
amd-gfx mailing list
amd-gfx at lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20170818/b3cd243f/attachment-0001.html>


More information about the amd-gfx mailing list