From 48a5f43372c4b6aafe3b3bff8a4c26ff06275c1c Mon Sep 17 00:00:00 2001
From: Peter Clifton <pcjc2@cam.ac.uk>
Date: Fri, 2 Nov 2007 00:00:00 +0000
Subject: [PATCH] Workaround crash on 855 series chips when programming PIPE[AB]CONF

---
 src/i830_driver.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/i830_driver.c b/src/i830_driver.c
index 488232d..bbf4909 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -2052,7 +2052,9 @@ RestoreHWState(ScrnInfoPtr pScrn)
       OUTREG(DSPASURF, pI830->saveDSPASURF);
       OUTREG(DSPATILEOFF, pI830->saveDSPATILEOFF);
    }
-   OUTREG(PIPEACONF, pI830->savePIPEACONF);
+   if ((pI830->saveDPLL_A & DPLL_VCO_ENABLE) &&
+       (pI830->saveDPLL_A & DPLL_VGA_MODE_DIS))
+      OUTREG(PIPEACONF, pI830->savePIPEACONF);
    i830WaitForVblank(pScrn);
    OUTREG(DSPACNTR, pI830->saveDSPACNTR);
    OUTREG(DSPABASE, INREG(DSPABASE));
@@ -2092,7 +2094,9 @@ RestoreHWState(ScrnInfoPtr pScrn)
 	 OUTREG(DSPBSURF, pI830->saveDSPBSURF);
 	 OUTREG(DSPBTILEOFF, pI830->saveDSPBTILEOFF);
       }
-      OUTREG(PIPEBCONF, pI830->savePIPEBCONF);
+      if ((pI830->saveDPLL_B & DPLL_VCO_ENABLE) &&
+          (pI830->saveDPLL_B & DPLL_VGA_MODE_DIS))
+         OUTREG(PIPEBCONF, pI830->savePIPEBCONF);
       i830WaitForVblank(pScrn);
       OUTREG(DSPBCNTR, pI830->saveDSPBCNTR);
       OUTREG(DSPBBASE, INREG(DSPBBASE));
-- 
1.5.2.5