summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2004-09-12 20:31:39 +0000
committerEric Anholt <anholt@freebsd.org>2004-09-12 20:31:39 +0000
commit27b5a65f05c78a0b6de0d0ace4f4275d990cc3a4 (patch)
treec986bf9b434da28b33542e3e89bd9f5013bad4d9
parentfcd52d276f0276490ef08af2f0d6c52ed631f130 (diff)
Reset the CCE/CP on engine reset, and make the ATIDRIDMA functions take a
more useful argument.
-rw-r--r--hw/kdrive/ati/ati.h7
-rw-r--r--hw/kdrive/ati/ati_dma.c10
-rw-r--r--hw/kdrive/ati/ati_dri.c27
3 files changed, 32 insertions, 12 deletions
diff --git a/hw/kdrive/ati/ati.h b/hw/kdrive/ati/ati.h
index b3e297e96..db65b9434 100644
--- a/hw/kdrive/ati/ati.h
+++ b/hw/kdrive/ati/ati.h
@@ -371,10 +371,13 @@ void
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);
diff --git a/hw/kdrive/ati/ati_dma.c b/hw/kdrive/ati/ati_dma.c
index 66aa48fad..b4bc63d2c 100644
--- a/hw/kdrive/ati/ati_dma.c
+++ b/hw/kdrive/ati/ati_dma.c
@@ -222,6 +222,12 @@ ATIEngineReset(ATIScreenInfo *atis)
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 @@ ATIDMASetup(ScreenPtr pScreen)
#ifdef USE_DRI
if (atis->using_dri)
- ATIDRIDMAStart(pScreen);
+ ATIDRIDMAStart(atis);
#endif /* USE_DRI */
if (!atis->using_dri) {
@@ -981,7 +987,7 @@ ATIDMATeardown(ScreenPtr pScreen)
#ifdef USE_DRI
if (atis->using_dri)
- ATIDRIDMAStop(pScreen);
+ ATIDRIDMAStop(atis);
#endif /* USE_DRI */
if (atis->using_dma)
diff --git a/hw/kdrive/ati/ati_dri.c b/hw/kdrive/ati/ati_dri.c
index 772930c20..773f49467 100644
--- a/hw/kdrive/ati/ati_dri.c
+++ b/hw/kdrive/ati/ati_dri.c
@@ -1033,11 +1033,9 @@ ATIDRICloseScreen(ScreenPtr pScreen)
}
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 @@ ATIDRIDMAStart(ScreenPtr pScreen)
* 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 @@ ATIDRIDMAStop(ScreenPtr pScreen)
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)