xf86-video-ati: Branch 'randr-1.2'

Dave Airlie airlied at kemper.freedesktop.org
Sat Jun 2 23:50:06 PDT 2007


 src/radeon.h        |    2 ++
 src/radeon_common.h |    7 ++++++-
 src/radeon_dri.c    |   29 +++++++++++++++++++++++++++++
 src/radeon_driver.c |    4 ++++
 4 files changed, 41 insertions(+), 1 deletion(-)

New commits:
diff-tree 63f0d4ed0a98830ecbe18c6e4174689111a59b68 (from d7775c1b38b5bdc439a27ec2c3c3a03a5b24cf57)
Author: Dave Airlie <airlied at linux.ie>
Date:   Sun Jun 3 16:49:14 2007 +1000

    randr-1.2: add support for vblank on both heads
    
    Also disable vbl when 3D isn't running

diff --git a/src/radeon.h b/src/radeon.h
index 62faee0..750d5c6 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -735,6 +735,7 @@ typedef struct {
 
     CARD32            tv_dac_adj;
 
+    Bool want_vblank_interrupts;
     RADEONBIOSConnector BiosConnector[RADEON_MAX_BIOS_CONNECTOR];
 
     Rotation rotation;
@@ -899,6 +900,7 @@ extern drmBufPtr   RADEONCPGetBuffer(Scr
 extern void        RADEONCPFlushIndirect(ScrnInfoPtr pScrn, int discard);
 extern void        RADEONCPReleaseIndirect(ScrnInfoPtr pScrn);
 extern int         RADEONCPStop(ScrnInfoPtr pScrn,  RADEONInfoPtr info);
+extern Bool RADEONDRISetVBlankInterrupt(ScrnInfoPtr pScrn, Bool on);
 
 extern void        RADEONHostDataParams(ScrnInfoPtr pScrn, CARD8 *dst,
 					CARD32 pitch, int cpp,
diff --git a/src/radeon_common.h b/src/radeon_common.h
index 3f2c6ab..467addf 100644
--- a/src/radeon_common.h
+++ b/src/radeon_common.h
@@ -420,6 +420,8 @@ typedef union {
 #define RADEON_PARAM_SAREA_HANDLE          9
 #define RADEON_PARAM_GART_TEX_HANDLE       10
 #define RADEON_PARAM_SCRATCH_OFFSET        11
+#define RADEON_PARAM_CARD_TYPE             12
+#define RADEON_PARAM_VBLANK_CRTC           13   /* VBLANK CRTC */
 
 typedef struct drm_radeon_getparam {
 	int param;
@@ -473,7 +475,7 @@ typedef struct drm_radeon_set_param {
 #define RADEON_SETPARAM_PCIGART_LOCATION 3
 #define RADEON_SETPARAM_NEW_MEMMAP 4
 #define RADEON_SETPARAM_PCIGART_TABLE_SIZE 5
-
+#define RADEON_SETPARAM_VBLANK_CRTC 6           /* VBLANK CRTC */
 /* 1.14: Clients can allocate/free a surface
  */
 typedef struct drm_radeon_surface_alloc {
@@ -486,4 +488,7 @@ typedef struct drm_radeon_surface_free {
 	unsigned int address;
 } drmRadeonSurfaceFree;
 
+#define	DRM_RADEON_VBLANK_CRTC1 	1
+#define	DRM_RADEON_VBLANK_CRTC2 	2
+
 #endif
diff --git a/src/radeon_dri.c b/src/radeon_dri.c
index 39393f5..97ed357 100644
--- a/src/radeon_dri.c
+++ b/src/radeon_dri.c
@@ -1352,6 +1352,29 @@ Bool RADEONDRIGetVersion(ScrnInfoPtr pSc
     return TRUE;
 }
 
+Bool RADEONDRISetVBlankInterrupt(ScrnInfoPtr pScrn, Bool on)
+{
+    RADEONInfoPtr  info    = RADEONPTR(pScrn);
+    xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+    int value = 0;
+
+    if (info->directRenderingEnabled && info->pKernelDRMVersion->version_minor >= 28) {
+        if (on) {
+  	    if (xf86_config->num_crtc > 1 && xf86_config->crtc[1]->enabled)
+	        value = DRM_RADEON_VBLANK_CRTC1 | DRM_RADEON_VBLANK_CRTC2;
+	    else
+	        value = DRM_RADEON_VBLANK_CRTC1;
+	}
+
+	if (RADEONDRISetParam(pScrn, RADEON_SETPARAM_VBLANK_CRTC, value)) {
+	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "RADEON Vblank Crtc Setup Failed %d\n", value);
+	    return FALSE;
+	}
+    }
+    return TRUE;
+}
+
+
 /* Initialize the screen-specific data structures for the DRI and the
  * Radeon.  This is the main entry point to the device-specific
  * initialization code.  It calls device-independent DRI functions to
@@ -2029,6 +2052,9 @@ static void RADEONDRITransitionTo3d(Scre
 
     RADEONChangeSurfaces(pScrn);
     RADEONEnablePageFlip(pScreen);
+    
+    info->want_vblank_interrupts = TRUE;
+    RADEONDRISetVBlankInterrupt(pScrn, TRUE);
 
     if (info->cursor)
 	xf86ForceHWCursor (pScreen, TRUE);
@@ -2068,6 +2094,9 @@ static void RADEONDRITransitionTo2d(Scre
 
     RADEONChangeSurfaces(pScrn);
 
+    info->want_vblank_interrupts = FALSE;
+    RADEONDRISetVBlankInterrupt(pScrn, FALSE);
+
     if (info->cursor)
 	xf86ForceHWCursor (pScreen, FALSE);
 }
diff --git a/src/radeon_driver.c b/src/radeon_driver.c
index 1c433e2..7d48650 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -5436,6 +5436,8 @@ Bool RADEONEnterVT(int scrnIndex, int fl
 	/* get the DRI back into shape after resume */
 	RADEONDRIResume(pScrn->pScreen);
 	RADEONAdjustMemMapRegisters(pScrn, &info->ModeReg);
+
+	RADEONDRISetVBlankInterrupt (pScrn, TRUE);
     }
 #endif
     /* this will get XVideo going again, but only if XVideo was initialised
@@ -5471,6 +5473,8 @@ void RADEONLeaveVT(int scrnIndex, int fl
 		   "RADEONLeaveVT\n");
 #ifdef XF86DRI
     if (RADEONPTR(pScrn)->directRenderingInited) {
+
+	RADEONDRISetVBlankInterrupt (pScrn, FALSE);
 	DRILock(pScrn->pScreen, 0);
 	RADEONCP_STOP(pScrn, info);
 


More information about the xorg-commit mailing list