[Bug 42035] no way to turn off vsync

Michel Dänzer michel at daenzer.net
Thu Nov 3 10:51:28 PDT 2011


On Mit, 2011-11-02 at 18:55 +0100, Michal Suchanek wrote: 
> 2011/11/2 Michel Dänzer <michel at daenzer.net>:
> > On Die, 2011-11-01 at 08:50 +0100, Michal Suchanek wrote:
> >> 
> >> I could configure my X server to disable the vline sync but since it
> >> is not really helpful in its current state and per-application
> >> configurable replacement exists I guess this would be nice to have in
> >> the driver.
> >
> > Actually, I'm not sure anymore it's a good idea, as it results e.g. in
> > horrible tearing with fullscreen video playback in compiz with multiple
> > monitors enabled.
> 
> Then perhaps compiz or the video player ignore the vblank sync?
> 
> Applications can control it themselves so can set the option poorly, too.

That's with sync to vblank enabled in the compiz configuration; it's not
that simple because there's only a single Composite Overlay Window
covering the whole X screen, so without vline waits, compiz's rendering
can only really avoid tearing on one monitor.


> > Also, I still can't see how having this option enabled can result in 3D
> > clients (only, as opposed to the whole X display) hanging. You'd need to
> > gather more information about that.
> 
> Only the 3D clients are waiting for the vblank that is not signalled.

That didn't really make sense, but you finally offered a little more
information on IRC:

        <hramrach> well, maybe whole X stalls. I can't tell because with
        vline waits I only saw this with screens off

That sounds like maybe the vline waits stall indefinitely because the
CRTC is disabled, in which case the patch below (only compile tested)
might help. (Though in that case I'd expect the GPU lockup detection to
kick in and reset the GPU?)


diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index f49aa3d..b1457ec 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -140,11 +140,12 @@ drmmode_ConvertToKMode(ScrnInfoPtr	scrn,
 static void
 drmmode_crtc_dpms(xf86CrtcPtr crtc, int mode)
 {
-#if 0
-	xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
-//	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
 //	drmmode_ptr drmmode = drmmode_crtc->drmmode;
 
+	drmmode_crtc->dpms_mode = mode;
+
+#if 0
 	/* bonghits in the randr 1.2 - uses dpms to disable crtc - bad buzz */
 	if (mode == DPMSModeOff) {
 //		drmModeSetCrtc(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,
diff --git a/src/drmmode_display.h b/src/drmmode_display.h
index eb271f5..272c1df 100644
--- a/src/drmmode_display.h
+++ b/src/drmmode_display.h
@@ -73,6 +73,7 @@ typedef struct {
     struct radeon_bo *cursor_bo;
     struct radeon_bo *rotate_bo;
     unsigned rotate_fb_id;
+    int dpms_mode;
     uint16_t lut_r[256], lut_g[256], lut_b[256];
 } drmmode_crtc_private_rec, *drmmode_crtc_private_ptr;
 
diff --git a/src/radeon_video.c b/src/radeon_video.c
index 834f924..7fb97fe 100644
--- a/src/radeon_video.c
+++ b/src/radeon_video.c
@@ -19,6 +19,14 @@
 #include "atipciids.h"
 #include "xf86fbman.h"
 
+/* DPMS */
+#ifdef HAVE_XEXTPROTO_71
+#include <X11/extensions/dpmsconst.h>
+#else
+#define DPMS_SERVER
+#include <X11/extensions/dpms.h>
+#endif
+
 #include <X11/extensions/Xv.h>
 #include "fourcc.h"
 
@@ -158,6 +166,11 @@ radeon_pick_best_crtc(ScrnInfoPtr pScrn,
 
     for (c = 0; c < xf86_config->num_crtc; c++) {
 	xf86CrtcPtr crtc = xf86_config->crtc[c];
+	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+
+	if (drmmode_crtc->dpms_mode == DPMSModeOff)
+	    continue;
+
 	radeon_crtc_box(crtc, &crtc_box);
 	radeon_box_intersect(&cover_box, &crtc_box, &box);
 	coverage = radeon_box_area(&cover_box);


-- 
Earthling Michel Dänzer           |                   http://www.amd.com
Libre software enthusiast         |          Debian, X and DRI developer


More information about the xorg-driver-ati mailing list