[PATCH xf86-video-ati 2/2] dri2: Call drm_queue_handle_deferred in dri2_deferred_event

Deucher, Alexander Alexander.Deucher at amd.com
Fri Mar 1 20:40:38 UTC 2019


Series is:
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
________________________________
From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> on behalf of Michel Dänzer <michel at daenzer.net>
Sent: Friday, March 1, 2019 12:35 PM
To: amd-gfx at lists.freedesktop.org
Subject: [PATCH xf86-video-ati 2/2] dri2: Call drm_queue_handle_deferred in dri2_deferred_event

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

drm_queue_handler just puts the event on the signalled list; without
calling drm_queue_handle_deferred, actual processing of the event may be
delayed indefinitely, e.g. until another event arrives from the kernel.

This could result in DRI2 clients hanging during DPMS off.

Fixes: ba83a866af5a "Add radeon_drm_handle_event wrapper for
                     drmHandleEvent"
(Ported from amdgpu commit 09be74a3d1dd9604336d9a27f98d132b262dcbaf)

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

diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index b5d6835c9..a9f14e8d8 100644
--- a/src/radeon_dri2.c
+++ b/src/radeon_dri2.c
@@ -979,12 +979,18 @@ CARD32 radeon_dri2_deferred_event(OsTimerPtr timer, CARD32 now, pointer data)
     if (ret) {
         xf86DrvMsg(scrn->scrnIndex, X_ERROR,
                    "%s cannot get current time\n", __func__);
-       if (event_info->drm_queue_seq)
+
+       if (event_info->drm_queue_seq) {
             drmmode_crtc->drmmode->event_context.
                 vblank_handler(pRADEONEnt->fd, 0, 0, 0,
                                (void*)event_info->drm_queue_seq);
-       else
+           drmmode_crtc->wait_flip_nesting_level++;
+           radeon_drm_queue_handle_deferred(crtc);
+
+       } else {
             radeon_dri2_frame_event_handler(crtc, 0, 0, data);
+       }
+
         return 0;
     }
     /*
@@ -995,13 +1001,18 @@ CARD32 radeon_dri2_deferred_event(OsTimerPtr timer, CARD32 now, pointer data)
     delta_seq = delta_t * drmmode_crtc->dpms_last_fps;
     delta_seq /= 1000000;
     frame = (CARD64)drmmode_crtc->dpms_last_seq + delta_seq;
-    if (event_info->drm_queue_seq)
+
+    if (event_info->drm_queue_seq) {
         drmmode_crtc->drmmode->event_context.
             vblank_handler(pRADEONEnt->fd, frame, drm_now / 1000000,
                            drm_now % 1000000,
                            (void*)event_info->drm_queue_seq);
-    else
+       drmmode_crtc->wait_flip_nesting_level++;
+       radeon_drm_queue_handle_deferred(crtc);
+    } else {
         radeon_dri2_frame_event_handler(crtc, frame, drm_now, data);
+    }
+
     return 0;
 }

--
2.20.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/20190301/07f22475/attachment.html>


More information about the amd-gfx mailing list