diff options
author | Eric Anholt <eric@anholt.net> | 2006-12-12 13:45:41 -0800 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2006-12-12 14:55:10 -0800 |
commit | 838af10b85ee8c085c6d2c4fbe18fd90b2be9d3f (patch) | |
tree | 5d20a313d6b0beb61e8f7b28f29c3f1bf881a335 /src | |
parent | 668ae6ce3c3c4b93a58749fd44ef32451adb6f9c (diff) |
Move PrintErrorState and CheckInheritedErrors code to i830_debug.c.
Diffstat (limited to 'src')
-rw-r--r-- | src/common.h | 2 | ||||
-rw-r--r-- | src/i830.h | 2 | ||||
-rw-r--r-- | src/i830_accel.c | 3 | ||||
-rw-r--r-- | src/i830_debug.c | 161 | ||||
-rw-r--r-- | src/i830_debug.h | 4 | ||||
-rw-r--r-- | src/i830_driver.c | 154 | ||||
-rw-r--r-- | src/i830_video.c | 2 |
7 files changed, 170 insertions, 158 deletions
diff --git a/src/common.h b/src/common.h index dd3fed62..540983b5 100644 --- a/src/common.h +++ b/src/common.h @@ -96,7 +96,7 @@ extern void I830DPRINTF_stub(const char *filename, int line, const char *function, const char *fmt, ...); #ifdef _I830_H_ -#define PrintErrorState I830PrintErrorState +#define PrintErrorState i830_dump_error_state #define WaitRingFunc I830WaitLpRing #define RecPtr pI830 #else @@ -499,8 +499,6 @@ typedef struct _I830Rec { extern int I830WaitLpRing(ScrnInfoPtr pScrn, int n, int timeout_millis); extern void I830SetPIOAccess(I830Ptr pI830); extern void I830SetMMIOAccess(I830Ptr pI830); -extern void I830PrintErrorState(ScrnInfoPtr pScrn); -extern void I965PrintErrorState(ScrnInfoPtr pScrn); extern void I830Sync(ScrnInfoPtr pScrn); extern void I830InitHWCursor(ScrnInfoPtr pScrn); extern void I830SetPipeCursor (xf86CrtcPtr crtc, Bool force); diff --git a/src/i830_accel.c b/src/i830_accel.c index 6ad62d1f..2260b71b 100644 --- a/src/i830_accel.c +++ b/src/i830_accel.c @@ -58,6 +58,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "xaarop.h" #include "i830.h" #include "i810_reg.h" +#include "i830_debug.h" int I830WaitLpRing(ScrnInfoPtr pScrn, int n, int timeout_millis) @@ -99,7 +100,7 @@ I830WaitLpRing(ScrnInfoPtr pScrn, int n, int timeout_millis) } else if (now - start > timeout_millis) { ErrorF("Error in I830WaitLpRing(), now is %d, start is %d\n", now, start); - I830PrintErrorState(pScrn); + i830_dump_error_state(pScrn); ErrorF("space: %d wanted %d\n", ring->space, n); #ifdef XF86DRI if (pI830->directRenderingEnabled) { diff --git a/src/i830_debug.c b/src/i830_debug.c index c2096a50..7446a22b 100644 --- a/src/i830_debug.c +++ b/src/i830_debug.c @@ -522,3 +522,164 @@ void i830DumpRegs (ScrnInfoPtr pScrn) } xf86DrvMsg (pScrn->scrnIndex, X_INFO, "DumpRegsEnd\n"); } + +/* Famous last words + */ +void +i830_dump_error_state(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + + ErrorF("pgetbl_ctl: 0x%lx pgetbl_err: 0x%lx\n", + (unsigned long)INREG(PGETBL_CTL), (unsigned long)INREG(PGE_ERR)); + + ErrorF("ipeir: %lx iphdr: %lx\n", (unsigned long)INREG(IPEIR), + (unsigned long)INREG(IPEHR)); + + ErrorF("LP ring tail: %lx head: %lx len: %lx start %lx\n", + (unsigned long)INREG(LP_RING + RING_TAIL), + (unsigned long)INREG(LP_RING + RING_HEAD) & HEAD_ADDR, + (unsigned long)INREG(LP_RING + RING_LEN), + (unsigned long)INREG(LP_RING + RING_START)); + + ErrorF("eir: %x esr: %x emr: %x\n", + INREG16(EIR), INREG16(ESR), INREG16(EMR)); + + ErrorF("instdone: %x instpm: %x\n", INREG16(INST_DONE), INREG8(INST_PM)); + + ErrorF("memmode: %lx instps: %lx\n", (unsigned long)INREG(MEMMODE), + (unsigned long)INREG(INST_PS)); + + ErrorF("hwstam: %x ier: %x imr: %x iir: %x\n", + INREG16(HWSTAM), INREG16(IER), INREG16(IMR), INREG16(IIR)); +} + +void +i965_dump_error_state(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + + ErrorF("pgetbl_ctl: 0x%lx pgetbl_err: 0x%lx\n", + INREG(PGETBL_CTL), INREG(PGE_ERR)); + + ErrorF("ipeir: %lx iphdr: %lx\n", INREG(IPEIR_I965), INREG(IPEHR_I965)); + + ErrorF("LP ring tail: %lx head: %lx len: %lx start %lx\n", + INREG(LP_RING + RING_TAIL), + INREG(LP_RING + RING_HEAD) & HEAD_ADDR, + INREG(LP_RING + RING_LEN), INREG(LP_RING + RING_START)); + + ErrorF("Err ID (eir): %x Err Status (esr): %x Err Mask (emr): %x\n", + (int)INREG(EIR), (int)INREG(ESR), (int)INREG(EMR)); + + ErrorF("instdone: %x instdone_1: %x\n", (int)INREG(INST_DONE_I965), + (int)INREG(INST_DONE_1)); + ErrorF("instpm: %x\n", (int)INREG(INST_PM)); + + ErrorF("memmode: %lx instps: %lx\n", INREG(MEMMODE), INREG(INST_PS_I965)); + + ErrorF("HW Status mask (hwstam): %x\nIRQ enable (ier): %x " + "imr: %x iir: %x\n", + (int)INREG(HWSTAM), (int)INREG(IER), (int)INREG(IMR), + (int)INREG(IIR)); + + ErrorF("acthd: %lx dma_fadd_p: %lx\n", INREG(ACTHD), INREG(DMA_FADD_P)); + ErrorF("ecoskpd: %lx excc: %lx\n", INREG(ECOSKPD), INREG(EXCC)); + + ErrorF("cache_mode: %x/%x\n", (int)INREG(CACHE_MODE_0), + (int)INREG(CACHE_MODE_1)); + ErrorF("mi_arb_state: %x\n", (int)INREG(MI_ARB_STATE)); + + ErrorF("IA_VERTICES_COUNT_QW %x/%x\n", + (int)INREG(IA_VERTICES_COUNT_QW), + (int)INREG(IA_VERTICES_COUNT_QW+4)); + ErrorF("IA_PRIMITIVES_COUNT_QW %x/%x\n", + (int)INREG(IA_PRIMITIVES_COUNT_QW), + (int)INREG(IA_PRIMITIVES_COUNT_QW+4)); + + ErrorF("VS_INVOCATION_COUNT_QW %x/%x\n", + (int)INREG(VS_INVOCATION_COUNT_QW), + (int)INREG(VS_INVOCATION_COUNT_QW+4)); + + ErrorF("GS_INVOCATION_COUNT_QW %x/%x\n", + (int)INREG(GS_INVOCATION_COUNT_QW), + (int)INREG(GS_INVOCATION_COUNT_QW+4)); + ErrorF("GS_PRIMITIVES_COUNT_QW %x/%x\n", + (int)INREG(GS_PRIMITIVES_COUNT_QW), + (int)INREG(GS_PRIMITIVES_COUNT_QW+4)); + + ErrorF("CL_INVOCATION_COUNT_QW %x/%x\n", + (int)INREG(CL_INVOCATION_COUNT_QW), + (int)INREG(CL_INVOCATION_COUNT_QW+4)); + ErrorF("CL_PRIMITIVES_COUNT_QW %x/%x\n", + (int)INREG(CL_PRIMITIVES_COUNT_QW), + (int)INREG(CL_PRIMITIVES_COUNT_QW+4)); + + ErrorF("PS_INVOCATION_COUNT_QW %x/%x\n", + (int)INREG(PS_INVOCATION_COUNT_QW), + (int)INREG(PS_INVOCATION_COUNT_QW+4)); + ErrorF("PS_DEPTH_COUNT_QW %x/%x\n", + (int)INREG(PS_DEPTH_COUNT_QW), + (int)INREG(PS_DEPTH_COUNT_QW+4)); + + ErrorF("WIZ_CTL %x\n", (int)INREG(WIZ_CTL)); + ErrorF("TS_CTL %x TS_DEBUG_DATA %x\n", (int)INREG(TS_CTL), + (int)INREG(TS_DEBUG_DATA)); + ErrorF("TD_CTL %x / %x\n", (int)INREG(TD_CTL), (int)INREG(TD_CTL2)); +} + +/** + * Checks the hardware error state bits. + * + * \return TRUE if any errors were found. + */ +Bool +i830_check_error_state(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + int errors = 0, fatal = 0; + unsigned long temp, head, tail; + + if (!I830IsPrimary(pScrn)) return TRUE; + + /* Check first for page table errors */ + temp = INREG(PGE_ERR); + if (temp != 0) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "PGTBL_ER is 0x%08lx\n", temp); + errors++; + } + temp = INREG(PGETBL_CTL); + if (!(temp & 1)) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "PGTBL_CTL (0x%08lx) indicates GTT is disabled\n", temp); + errors++; + } + temp = INREG(LP_RING + RING_LEN); + if (temp & 1) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "PRB0_CTL (0x%08lx) indicates ring buffer enabled\n", temp); + errors++; + } + head = INREG(LP_RING + RING_HEAD); + tail = INREG(LP_RING + RING_TAIL); + if ((tail & I830_TAIL_MASK) != (head & I830_HEAD_MASK)) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "PRB0_HEAD (0x%08lx) and PRB0_TAIL (0x%08lx) indicate " + "ring buffer not flushed\n", head, tail); + errors++; + } + +#if 0 + if (errors) { + if (IS_I965G(pI830)) + i965_dump_error_state(pScrn); + else + i830_dump_error_state(pScrn); + } +#endif + + if (fatal) + FatalError("i830_check_error_state: can't recover from the above\n"); + + return (errors != 0); +} diff --git a/src/i830_debug.h b/src/i830_debug.h index a365085c..2d2e72bf 100644 --- a/src/i830_debug.h +++ b/src/i830_debug.h @@ -28,3 +28,7 @@ void i830TakeRegSnapshot(ScrnInfoPtr pScrn); void i830CompareRegsToSnapshot(ScrnInfoPtr pScrn, char *where); void i830DumpRegs (ScrnInfoPtr pScrn); +void i830_dump_error_state(ScrnInfoPtr pScrn); +void i965_dump_error_state(ScrnInfoPtr pScrn); +Bool i830_check_error_state(ScrnInfoPtr pScrn); + diff --git a/src/i830_driver.c b/src/i830_driver.c index 46973e77..78804de3 100644 --- a/src/i830_driver.c +++ b/src/i830_driver.c @@ -1948,61 +1948,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags) } /* - * As the name says. Check that the initial state is reasonable. - * If any unrecoverable problems are found, bail out here. - */ -static Bool -CheckInheritedState(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - int errors = 0, fatal = 0; - unsigned long temp, head, tail; - - if (!I830IsPrimary(pScrn)) return TRUE; - - /* Check first for page table errors */ - temp = INREG(PGE_ERR); - if (temp != 0) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "PGTBL_ER is 0x%08lx\n", temp); - errors++; - } - temp = INREG(PGETBL_CTL); - if (!(temp & 1)) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "PGTBL_CTL (0x%08lx) indicates GTT is disabled\n", temp); - errors++; - } - temp = INREG(LP_RING + RING_LEN); - if (temp & 1) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "PRB0_CTL (0x%08lx) indicates ring buffer enabled\n", temp); - errors++; - } - head = INREG(LP_RING + RING_HEAD); - tail = INREG(LP_RING + RING_TAIL); - if ((tail & I830_TAIL_MASK) != (head & I830_HEAD_MASK)) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "PRB0_HEAD (0x%08lx) and PRB0_TAIL (0x%08lx) indicate " - "ring buffer not flushed\n", head, tail); - errors++; - } - -#if 0 - if (errors) { - if (IS_I965G(pI830)) - I965PrintErrorState(pScrn); - else - I830PrintErrorState(pScrn); - } -#endif - - if (fatal) - FatalError("CheckInheritedState: can't recover from the above\n"); - - return (errors != 0); -} - -/* * Reset registers that it doesn't make sense to save/restore to a sane state. * This is basically the ring buffer and fence registers. Restoring these * doesn't make sense without restoring GTT mappings. This is something that @@ -2366,103 +2311,6 @@ InitRegisterRec(ScrnInfoPtr pScrn) i830Reg->Fence[i] = 0; } -/* Famous last words - */ -void -I830PrintErrorState(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - - ErrorF("pgetbl_ctl: 0x%lx pgetbl_err: 0x%lx\n", - (unsigned long)INREG(PGETBL_CTL), (unsigned long)INREG(PGE_ERR)); - - ErrorF("ipeir: %lx iphdr: %lx\n", (unsigned long)INREG(IPEIR), - (unsigned long)INREG(IPEHR)); - - ErrorF("LP ring tail: %lx head: %lx len: %lx start %lx\n", - (unsigned long)INREG(LP_RING + RING_TAIL), - (unsigned long)INREG(LP_RING + RING_HEAD) & HEAD_ADDR, - (unsigned long)INREG(LP_RING + RING_LEN), - (unsigned long)INREG(LP_RING + RING_START)); - - ErrorF("eir: %x esr: %x emr: %x\n", - INREG16(EIR), INREG16(ESR), INREG16(EMR)); - - ErrorF("instdone: %x instpm: %x\n", INREG16(INST_DONE), INREG8(INST_PM)); - - ErrorF("memmode: %lx instps: %lx\n", (unsigned long)INREG(MEMMODE), - (unsigned long)INREG(INST_PS)); - - ErrorF("hwstam: %x ier: %x imr: %x iir: %x\n", - INREG16(HWSTAM), INREG16(IER), INREG16(IMR), INREG16(IIR)); -} - -void -I965PrintErrorState(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - - ErrorF("pgetbl_ctl: 0x%lx pgetbl_err: 0x%lx\n", - INREG(PGETBL_CTL), INREG(PGE_ERR)); - - ErrorF("ipeir: %lx iphdr: %lx\n", INREG(IPEIR_I965), INREG(IPEHR_I965)); - - ErrorF("LP ring tail: %lx head: %lx len: %lx start %lx\n", - INREG(LP_RING + RING_TAIL), - INREG(LP_RING + RING_HEAD) & HEAD_ADDR, - INREG(LP_RING + RING_LEN), INREG(LP_RING + RING_START)); - - ErrorF("Err ID (eir): %x Err Status (esr): %x Err Mask (emr): %x\n", - (int)INREG(EIR), (int)INREG(ESR), (int)INREG(EMR)); - - ErrorF("instdone: %x instdone_1: %x\n", (int)INREG(INST_DONE_I965), - (int)INREG(INST_DONE_1)); - ErrorF("instpm: %x\n", (int)INREG(INST_PM)); - - ErrorF("memmode: %lx instps: %lx\n", INREG(MEMMODE), INREG(INST_PS_I965)); - - ErrorF("HW Status mask (hwstam): %x\nIRQ enable (ier): %x imr: %x iir: %x\n", - (int)INREG(HWSTAM), (int)INREG(IER), (int)INREG(IMR), - (int)INREG(IIR)); - - ErrorF("acthd: %lx dma_fadd_p: %lx\n", INREG(ACTHD), INREG(DMA_FADD_P)); - ErrorF("ecoskpd: %lx excc: %lx\n", INREG(ECOSKPD), INREG(EXCC)); - - ErrorF("cache_mode: %x/%x\n", (int)INREG(CACHE_MODE_0), - (int)INREG(CACHE_MODE_1)); - ErrorF("mi_arb_state: %x\n", (int)INREG(MI_ARB_STATE)); - - ErrorF("IA_VERTICES_COUNT_QW %x/%x\n", (int)INREG(IA_VERTICES_COUNT_QW), - (int)INREG(IA_VERTICES_COUNT_QW+4)); - ErrorF("IA_PRIMITIVES_COUNT_QW %x/%x\n", (int)INREG(IA_PRIMITIVES_COUNT_QW), - (int)INREG(IA_PRIMITIVES_COUNT_QW+4)); - - ErrorF("VS_INVOCATION_COUNT_QW %x/%x\n", (int)INREG(VS_INVOCATION_COUNT_QW), - (int)INREG(VS_INVOCATION_COUNT_QW+4)); - - ErrorF("GS_INVOCATION_COUNT_QW %x/%x\n", (int)INREG(GS_INVOCATION_COUNT_QW), - (int)INREG(GS_INVOCATION_COUNT_QW+4)); - ErrorF("GS_PRIMITIVES_COUNT_QW %x/%x\n", (int)INREG(GS_PRIMITIVES_COUNT_QW), - (int)INREG(GS_PRIMITIVES_COUNT_QW+4)); - - ErrorF("CL_INVOCATION_COUNT_QW %x/%x\n", (int)INREG(CL_INVOCATION_COUNT_QW), - (int)INREG(CL_INVOCATION_COUNT_QW+4)); - ErrorF("CL_PRIMITIVES_COUNT_QW %x/%x\n", (int)INREG(CL_PRIMITIVES_COUNT_QW), - (int)INREG(CL_PRIMITIVES_COUNT_QW+4)); - - ErrorF("PS_INVOCATION_COUNT_QW %x/%x\n", (int)INREG(PS_INVOCATION_COUNT_QW), - (int)INREG(PS_INVOCATION_COUNT_QW+4)); - ErrorF("PS_DEPTH_COUNT_QW %x/%x\n", (int)INREG(PS_DEPTH_COUNT_QW), - (int)INREG(PS_DEPTH_COUNT_QW+4)); - - ErrorF("WIZ_CTL %x\n", (int)INREG(WIZ_CTL)); - ErrorF("TS_CTL %x TS_DEBUG_DATA %x\n", (int)INREG(TS_CTL), - (int)INREG(TS_DEBUG_DATA)); - ErrorF("TD_CTL %x / %x\n", (int)INREG(TD_CTL), (int)INREG(TD_CTL2)); - - -} - static void I830PointerMoved(int index, int x, int y) { @@ -3277,7 +3125,7 @@ I830EnterVT(int scrnIndex, int flags) if (!I830BindAGPMemory(pScrn)) return FALSE; - CheckInheritedState(pScrn); + i830_check_error_state(pScrn); ResetState(pScrn, FALSE); SetHWOperatingState(pScrn); diff --git a/src/i830_video.c b/src/i830_video.c index 986d36a1..59794156 100644 --- a/src/i830_video.c +++ b/src/i830_video.c @@ -2794,7 +2794,7 @@ BroadwaterDisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id, if (pI830->AccelInfoRec) (*pI830->AccelInfoRec->Sync)(pScrn); #if WATCH_STATS - I830PrintErrorState (pScrn); + i830_dump_error_state (pScrn); #endif } |