Skip to contentSkip to conversation

Always delete entry from list in drm_queue_handler

PATCH New Michel Dänzer 1 participant 2 messages Sep 5, 2018 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Always delete entry from list in drm_queue_handler

From: Michel Dänzer <[email protected]>

We left entries without a handler hook in the list, so the list could keep taking longer to process and use up more memory.

(Ported from amdgpu commit 7eea3e2cd74eed22e982319144e18ae5b1087b78)

---
 src/radeon_drm_queue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/radeon_drm_queue.c +1 -1
index 857278fdd..61a2f5cef 100644
@@ -82,7 +82,7 @@ radeon_drm_queue_handler(struct xorg_list *signalled, unsigned int frame,
     xorg_list_for_each_entry_safe(e, tmp, &radeon_drm_queue, list) {
 	if (e->seq == seq) {
 	    if (!e->handler) {
-		e->abort(e->crtc, e->data);
+		radeon_drm_queue_handle_one(e);
 		break;
 	    }
 
Signature · 6 lines
2.19.0.rc1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20180905094121.9965-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org

#2 lore raw

PATCH 2/2 Don't use xorg_list_for_each_entry_safe for signalled flips

From: Michel Dänzer <[email protected]>

drm_wait_pending_flip can get called from drm_handle_event, in which case xorg_list_for_each_entry_safe can end up processing the same entry in both. To avoid this, just process the first list entry until the list is empty.

(Ported from amdgpu commit 26770be44b89b83bf39c28f2fe284c8cb92ed0c0)

---
 src/radeon_drm_queue.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
src/radeon_drm_queue.c +9 -3
index 61a2f5cef..bf1650ea9 100644
@@ -257,8 +257,11 @@ radeon_drm_handle_event(int fd, drmEventContext *event_context)
 
     r = drmHandleEvent(fd, event_context);
 
-    xorg_list_for_each_entry_safe(e, tmp, &radeon_drm_flip_signalled, list)
+    while (!xorg_list_is_empty(&radeon_drm_flip_signalled)) {
+	e = xorg_list_first_entry(&radeon_drm_flip_signalled,
+				  struct radeon_drm_queue_entry, list);
 	radeon_drm_queue_handle_one(e);
+    }
 
     xorg_list_for_each_entry_safe(e, tmp, &radeon_drm_vblank_signalled, list) {
 	drmmode_crtc_private_ptr drmmode_crtc = e->crtc->driver_private;
@@ -277,12 +280,15 @@ void radeon_drm_wait_pending_flip(xf86CrtcPtr crtc)
 {
     drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
     RADEONEntPtr pRADEONEnt = RADEONEntPriv(crtc->scrn);
-    struct radeon_drm_queue_entry *e, *tmp;
+    struct radeon_drm_queue_entry *e;
 
     drmmode_crtc->wait_flip_nesting_level++;
 
-    xorg_list_for_each_entry_safe(e, tmp, &radeon_drm_flip_signalled, list)
+    while (!xorg_list_is_empty(&radeon_drm_flip_signalled)) {
+	e = xorg_list_first_entry(&radeon_drm_flip_signalled,
+				  struct radeon_drm_queue_entry, list);
 	radeon_drm_queue_handle_one(e);
+    }
 
     while (drmmode_crtc->flip_pending
 	   && radeon_drm_handle_event(pRADEONEnt->fd,
Signature · 6 lines
2.19.0.rc1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx