[PATCH xf86-video-ati 07/13] Perform scanout buffer update immediately if drmmode_wait_vblank fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Michel Dänzer <michel.daenzer@xxxxxxx>

Otherwise the damaged screen contents may never be displayed in that
case.

(Ported from amdgpu commit 500fadb16285146e91f62fce3a0ce1360ca684ba)

Signed-off-by: Michel Dänzer <michel.daenzer@xxxxxxx>
---
 src/radeon_kms.c | 29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index a7aade702..796dac5f1 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -752,6 +752,7 @@ radeon_prime_scanout_update(PixmapDirtyUpdatePtr dirty)
 {
     ScreenPtr screen = dirty->slave_dst->drawable.pScreen;
     ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+    RADEONEntPtr pRADEONEnt = RADEONEntPriv(scrn);
     xf86CrtcPtr xf86_crtc = radeon_prime_dirty_to_crtc(dirty);
     drmmode_crtc_private_ptr drmmode_crtc;
     uintptr_t drm_queue_seq;
@@ -774,19 +775,23 @@ radeon_prime_scanout_update(PixmapDirtyUpdatePtr dirty)
     if (drm_queue_seq == RADEON_DRM_QUEUE_ERROR) {
 	xf86DrvMsg(scrn->scrnIndex, X_WARNING,
 		   "radeon_drm_queue_alloc failed for PRIME update\n");
+	radeon_prime_scanout_update_handler(xf86_crtc, 0, 0, NULL);
 	return;
     }
 
+    drmmode_crtc->scanout_update_pending = drm_queue_seq;
+
     if (!drmmode_wait_vblank(xf86_crtc, DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT,
 			     1, drm_queue_seq, NULL, NULL)) {
 	xf86DrvMsg(scrn->scrnIndex, X_WARNING,
 		   "drmmode_wait_vblank failed for PRIME update: %s\n",
 		   strerror(errno));
-	radeon_drm_abort_entry(drm_queue_seq);
-	return;
+	drmmode_crtc->drmmode->event_context.vblank_handler(pRADEONEnt->fd,
+							    0, 0, 0,
+							    (void*)drm_queue_seq);
+	drmmode_crtc->wait_flip_nesting_level++;
+	radeon_drm_queue_handle_deferred(xf86_crtc);
     }
-
-    drmmode_crtc->scanout_update_pending = drm_queue_seq;
 }
 
 static void
@@ -1022,8 +1027,9 @@ static void
 radeon_scanout_update(xf86CrtcPtr xf86_crtc)
 {
     drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private;
+    ScrnInfoPtr scrn = xf86_crtc->scrn;
+    RADEONEntPtr pRADEONEnt = RADEONEntPriv(scrn);
     uintptr_t drm_queue_seq;
-    ScrnInfoPtr scrn;
     DamagePtr pDamage;
     RegionPtr pRegion;
     BoxRec extents;
@@ -1048,7 +1054,6 @@ radeon_scanout_update(xf86CrtcPtr xf86_crtc)
 	return;
     }
 
-    scrn = xf86_crtc->scrn;
     drm_queue_seq = radeon_drm_queue_alloc(xf86_crtc,
 					   RADEON_DRM_QUEUE_CLIENT_DEFAULT,
 					   RADEON_DRM_QUEUE_ID_DEFAULT,
@@ -1059,19 +1064,23 @@ radeon_scanout_update(xf86CrtcPtr xf86_crtc)
     if (drm_queue_seq == RADEON_DRM_QUEUE_ERROR) {
 	xf86DrvMsg(scrn->scrnIndex, X_WARNING,
 		   "radeon_drm_queue_alloc failed for scanout update\n");
+	radeon_scanout_update_handler(xf86_crtc, 0, 0, drmmode_crtc);
 	return;
     }
 
+    drmmode_crtc->scanout_update_pending = drm_queue_seq;
+
     if (!drmmode_wait_vblank(xf86_crtc, DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT,
 			     1, drm_queue_seq, NULL, NULL)) {
 	xf86DrvMsg(scrn->scrnIndex, X_WARNING,
 		   "drmmode_wait_vblank failed for scanout update: %s\n",
 		   strerror(errno));
-	radeon_drm_abort_entry(drm_queue_seq);
-	return;
+	drmmode_crtc->drmmode->event_context.vblank_handler(pRADEONEnt->fd,
+							    0, 0, 0,
+							    (void*)drm_queue_seq);
+	drmmode_crtc->wait_flip_nesting_level++;
+	radeon_drm_queue_handle_deferred(xf86_crtc);
     }
-
-    drmmode_crtc->scanout_update_pending = drm_queue_seq;
 }
 
 static void
-- 
2.20.1

_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux