xserver/hw/kdrive/ati ati.h, 1.12, 1.13 ati_dma.c, 1.4, 1.5 ati_dri.c, 1.9, 1.10

Eric Anholt <xserver-commit-u7BhqnqprCWvj1b/[email protected]>
Newsgroups gmane.comp.freedesktop.xserver.cvs
Message-ID <[email protected]>
Committed by: anholt

Update of /cvs/xserver/xserver/hw/kdrive/ati
In directory gabe:/tmp/cvs-serv22124/hw/kdrive/ati

Modified Files:
	ati.h ati_dma.c ati_dri.c 
Log Message:
Reset the CCE/CP on engine reset, and make the ATIDRIDMA functions take
a more useful argument.


Index: ati.h
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/ati/ati.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- ati.h	11 Sep 2004 09:28:19 -0000	1.12
+++ ati.h	12 Sep 2004 20:31:39 -0000	1.13
@@ -371,10 +371,13 @@
 ATIDRICloseScreen(ScreenPtr pScreen);
 
 void
-ATIDRIDMAStart(ScreenPtr pScreen);
+ATIDRIDMAStart(ATIScreenInfo *atis);
 
 void
-ATIDRIDMAStop(ScreenPtr pScreen);
+ATIDRIDMAStop(ATIScreenInfo *atis);
+
+void
+ATIDRIDMAReset(ATIScreenInfo *atis);
 
 void
 ATIDRIDispatchIndirect(ATIScreenInfo *atis, Bool discard);

Index: ati_dma.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/ati/ati_dma.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- ati_dma.c	12 Sep 2004 19:52:51 -0000	1.4
+++ ati_dma.c	12 Sep 2004 20:31:39 -0000	1.5
@@ -222,6 +222,12 @@
 		OUTPLL(mmio, R128_REG_MCLK_CNTL, mclkcntl);
 		MMIO_OUT32(mmio, ATI_REG_CLOCK_CNTL_INDEX, clockcntlindex);
 	}
+#ifdef USE_DRI
+	if (atis->using_dri) {
+		ATIDRIDMAReset(atis);
+		ATIDRIDMAStart(atis);
+	}
+#endif
 }
 
 static void
@@ -937,7 +943,7 @@
 
 #ifdef USE_DRI
 	if (atis->using_dri)
-		ATIDRIDMAStart(pScreen);
+		ATIDRIDMAStart(atis);
 #endif /* USE_DRI */
 
 	if (!atis->using_dri) {
@@ -981,7 +987,7 @@
 
 #ifdef USE_DRI
 	if (atis->using_dri)
-		ATIDRIDMAStop(pScreen);
+		ATIDRIDMAStop(atis);
 #endif /* USE_DRI */
 
 	if (atis->using_dma)

Index: ati_dri.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/ati/ati_dri.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- ati_dri.c	12 Sep 2004 20:02:10 -0000	1.9
+++ ati_dri.c	12 Sep 2004 20:31:39 -0000	1.10
@@ -1033,11 +1033,9 @@
 }
 
 void
-ATIDRIDMAStart(ScreenPtr pScreen)
+ATIDRIDMAStart(ATIScreenInfo *atis)
 {
-	KdScreenPriv(pScreen);
-	ATICardInfo(pScreenPriv);
-	ATIScreenInfo(pScreenPriv);
+	ATICardInfo *atic = atis->atic;
 	int ret;
 
 	if (atic->is_radeon)
@@ -1055,11 +1053,9 @@
  * same for both R128 and Radeon, so we can just use the name of one of them.
  */
 void
-ATIDRIDMAStop(ScreenPtr pScreen)
+ATIDRIDMAStop(ATIScreenInfo *atis)
 {
-	KdScreenPriv(pScreen);
-	ATICardInfo(pScreenPriv);
-	ATIScreenInfo(pScreenPriv);
+	ATICardInfo *atic = atis->atic;
 	drmRadeonCPStop stop;
 	int ret;
 
@@ -1078,6 +1074,21 @@
 	atis->dma_started = FALSE;
 }
 
+void
+ATIDRIDMAReset(ATIScreenInfo *atis)
+{
+	ATICardInfo *atic = atis->atic;
+	int ret;
+
+	ret = drmCommandNone(atic->drmFd, atic->is_radeon ?
+	    DRM_RADEON_CP_RESET : DRM_R128_CCE_RESET);
+
+	if (ret != 0)
+		FatalError("Failed to reset CCE/CP\n");
+
+	atis->dma_started = FALSE;
+}
+
 /* The R128 and Radeon Indirect ioctls differ only in the ioctl number */
 void
 ATIDRIDispatchIndirect(ATIScreenInfo *atis, Bool discard)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.