<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 style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Series is:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Reviewed-by: Alex Deucher <alexander.deucher@amd.com><br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><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, March 1, 2019 12:35 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Subject:</b> [PATCH xf86-video-ati 2/2] dri2: Call drm_queue_handle_deferred in dri2_deferred_event</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">From: Michel Dänzer <michel.daenzer@amd.com><br>
<br>
drm_queue_handler just puts the event on the signalled list; without<br>
calling drm_queue_handle_deferred, actual processing of the event may be<br>
delayed indefinitely, e.g. until another event arrives from the kernel.<br>
<br>
This could result in DRI2 clients hanging during DPMS off.<br>
<br>
Fixes: ba83a866af5a "Add radeon_drm_handle_event wrapper for<br>
                     drmHandleEvent"<br>
(Ported from amdgpu commit 09be74a3d1dd9604336d9a27f98d132b262dcbaf)<br>
<br>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com><br>
---<br>
 src/radeon_dri2.c | 19 +++++++++++++++----<br>
 1 file changed, 15 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c<br>
index b5d6835c9..a9f14e8d8 100644<br>
--- a/src/radeon_dri2.c<br>
+++ b/src/radeon_dri2.c<br>
@@ -979,12 +979,18 @@ CARD32 radeon_dri2_deferred_event(OsTimerPtr timer, CARD32 now, pointer data)<br>
     if (ret) {<br>
         xf86DrvMsg(scrn->scrnIndex, X_ERROR,<br>
                    "%s cannot get current time\n", __func__);<br>
-       if (event_info->drm_queue_seq)<br>
+<br>
+       if (event_info->drm_queue_seq) {<br>
             drmmode_crtc->drmmode->event_context.<br>
                 vblank_handler(pRADEONEnt->fd, 0, 0, 0,<br>
                                (void*)event_info->drm_queue_seq);<br>
-       else<br>
+           drmmode_crtc->wait_flip_nesting_level++;<br>
+           radeon_drm_queue_handle_deferred(crtc);<br>
+<br>
+       } else {<br>
             radeon_dri2_frame_event_handler(crtc, 0, 0, data);<br>
+       }<br>
+<br>
         return 0;<br>
     }<br>
     /*<br>
@@ -995,13 +1001,18 @@ CARD32 radeon_dri2_deferred_event(OsTimerPtr timer, CARD32 now, pointer data)<br>
     delta_seq = delta_t * drmmode_crtc->dpms_last_fps;<br>
     delta_seq /= 1000000;<br>
     frame = (CARD64)drmmode_crtc->dpms_last_seq + delta_seq;<br>
-    if (event_info->drm_queue_seq)<br>
+<br>
+    if (event_info->drm_queue_seq) {<br>
         drmmode_crtc->drmmode->event_context.<br>
             vblank_handler(pRADEONEnt->fd, frame, drm_now / 1000000,<br>
                            drm_now % 1000000,<br>
                            (void*)event_info->drm_queue_seq);<br>
-    else<br>
+       drmmode_crtc->wait_flip_nesting_level++;<br>
+       radeon_drm_queue_handle_deferred(crtc);<br>
+    } else {<br>
         radeon_dri2_frame_event_handler(crtc, frame, drm_now, data);<br>
+    }<br>
+<br>
     return 0;<br>
 }<br>
 <br>
-- <br>
2.20.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">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a></div>
</span></font></div>
</body>
</html>