[PATCH xf86-video-ati 01/21] Wait for pending scanout update before calling drmmode_crtc_scanout_free

Michel Dänzer michel at daenzer.net
Wed Jul 11 17:27:46 UTC 2018


From: Jim Qu <Jim.Qu at amd.com>

There is a case that when set screen from reverse to normal, the old
scanout damage is freed in modesetting before scanout update handler,
so it causes segment fault issue.

Signed-off-by: Jim Qu <Jim.Qu at amd.com>

[ Michel Dänzer: Only call drmmode_crtc_wait_pending_event before
  drmmode_crtc_scanout_free is actually called, slightly tweak commit
  message ]
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
(Ported from amdgpu commit 9f6a8905611b5b1d8fcd31bebbc9af7ca1355cc3)

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

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 2773ce672..b3e5cc991 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -985,9 +985,11 @@ done:
 
 		if (drmmode_crtc->scanout[scanout_id].pixmap &&
 		    fb != radeon_pixmap_get_fb(drmmode_crtc->
-					       scanout[scanout_id].pixmap))
+					       scanout[scanout_id].pixmap)) {
+			drmmode_crtc_wait_pending_event(drmmode_crtc, pRADEONEnt->fd,
+							drmmode_crtc->scanout_update_pending);
 			drmmode_crtc_scanout_free(drmmode_crtc);
-		else if (!drmmode_crtc->tear_free) {
+		} else if (!drmmode_crtc->tear_free) {
 			drmmode_crtc_scanout_destroy(drmmode,
 						     &drmmode_crtc->scanout[1]);
 		}
-- 
2.18.0



More information about the amd-gfx mailing list