Skip to contentSkip to conversation

present: Check that flip and screen pixmap pitches match

PATCH In review Michel Dänzer 2 participants 3 messages Mar 1, 2019 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 present: Check that flip and screen pixmap pitches match

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

If they don't, flipping will result in corrupted display.

Test case:

* Run Xorg at 1920x1080 with no window manager
* glxgears -geometry 2048x1080

The Present extension code in xserver 1.21 will check for this.

(Ported from amdgpu commit a636f42b496b0604ca00a144690ece61d1a88a27)

---
 src/radeon_present.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
src/radeon_present.c +6 -2
index 0b55117eb..38a9a6b79 100644
@@ -256,7 +256,7 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,
     ScrnInfoPtr scrn = xf86_crtc->scrn;
     xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
     RADEONInfoPtr info = RADEONPTR(scrn);
-    PixmapPtr screen_pixmap;
+    PixmapPtr screen_pixmap = screen->GetScreenPixmap(screen);
     int num_crtcs_on;
     int i;
 
@@ -272,10 +272,14 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,
     if (info->drmmode.dri2_flipping)
 	return FALSE;
 
+#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(1, 20, 99, 1, 0)
+    if (pixmap->devKind != screen_pixmap->devKind)
+	return FALSE;
+#endif
+
     /* The kernel driver doesn't handle flipping between BOs with different
      * tiling parameters correctly yet
      */
-    screen_pixmap = screen->GetScreenPixmap(screen);
     if (radeon_present_get_pixmap_tiling_flags(info, pixmap) !=
 	radeon_present_get_pixmap_tiling_flags(info, screen_pixmap))
 	return FALSE;
Signature · 6 lines
2.20.1

_______________________________________________
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): 20190301173550.21762-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org

#2 lore raw

PATCH 2/2 dri2: Call drm_queue_handle_deferred in dri2_deferred_event

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

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)

---
 src/radeon_dri2.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
src/radeon_dri2.c +15 -4
index b5d6835c9..a9f14e8d8 100644
@@ -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;
 }
 
Signature · 6 lines
2.20.1

_______________________________________________
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): 20190301173550.21762-2-michel-otUistvHUpPR7s880joybQ@public.gmane.org

Reviewed-by
#4 lore raw

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

Series is:

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Michel Dänzer <[email protected]>
Sent: Friday, March 1, 2019 12:35 PM
To: [email protected]
Subject: [PATCH xf86-video-ati 2/2] dri2: Call drm_queue_handle_deferred in dri2_deferred_event

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

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)

---
 src/radeon_dri2.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
src/radeon_dri2.c +15 -4
index b5d6835c9..a9f14e8d8 100644
@@ -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 [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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