summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2004-09-17 05:16:45 +0000
committerEric Anholt <anholt@freebsd.org>2004-09-17 05:16:45 +0000
commit17e5f3c1169066be1004306d12b5398cf01cbd35 (patch)
treee0f672be6ef190d38709f7d7b8e9a48dd5260a6a /src
parent29bbee6b8a8dd1b883e07547691ff8e1289459ce (diff)
Bugzilla #1170: Fix an overcounting of DMA in BEGIN_RING that wasn't
harmful. Bugzilla #1169: Add counting for BEGIN_RING/OUT_RING/ADVANCE_RING to avoid these sorts of problems in the future.
Diffstat (limited to 'src')
-rw-r--r--src/radeon.h29
-rw-r--r--src/radeon_render.c2
2 files changed, 28 insertions, 3 deletions
diff --git a/src/radeon.h b/src/radeon.h
index 523d2b72..576295ff 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -543,7 +543,12 @@ typedef struct {
#ifdef PER_CONTEXT_SAREA
int perctx_sarea_size;
#endif
-#endif
+
+ /* Debugging info for BEGIN_RING/ADVANCE_RING pairs. */
+ int dma_begin_count;
+ char *dma_debug_func;
+ int dma_debug_lineno;
+#endif /* XF86DRI */
/* XVideo */
XF86VideoAdaptorPtr adaptor;
@@ -718,13 +723,21 @@ do { \
#define RADEON_VERBOSE 0
-#define RING_LOCALS CARD32 *__head = NULL; int __count = 0
+#define RING_LOCALS CARD32 *__head = NULL; int __expected; int __count = 0
#define BEGIN_RING(n) do { \
if (RADEON_VERBOSE) { \
xf86DrvMsg(pScrn->scrnIndex, X_INFO, \
"BEGIN_RING(%d) in %s\n", n, __FUNCTION__); \
} \
+ if (++info->dma_begin_count != 1) { \
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, \
+ "BEGIN_RING without end at %s:%d\n", \
+ info->dma_debug_func, info->dma_debug_lineno); \
+ info->dma_begin_count = 1; \
+ } \
+ info->dma_debug_func = __FILE__; \
+ info->dma_debug_lineno = __LINE__; \
if (!info->indirectBuffer) { \
info->indirectBuffer = RADEONCPGetBuffer(pScrn); \
info->indirectStart = 0; \
@@ -732,12 +745,24 @@ do { \
info->indirectBuffer->total) { \
RADEONCPFlushIndirect(pScrn, 1); \
} \
+ __expected = n; \
__head = (pointer)((char *)info->indirectBuffer->address + \
info->indirectBuffer->used); \
__count = 0; \
} while (0)
#define ADVANCE_RING() do { \
+ if (info->dma_begin_count-- != 1) { \
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, \
+ "ADVANCE_RING without begin at %s:%d\n", \
+ __FILE__, __LINE__); \
+ info->dma_begin_count = 0; \
+ } \
+ if (__count != __expected) { \
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, \
+ "ADVANCE_RING count != expected (%d vs %d) at %s:%d\n", \
+ __count, __expected, __FILE__, __LINE__); \
+ } \
if (RADEON_VERBOSE) { \
xf86DrvMsg(pScrn->scrnIndex, X_INFO, \
"ADVANCE_RING() start: %d used: %d count: %d\n", \
diff --git a/src/radeon_render.c b/src/radeon_render.c
index 145b6538..38984885 100644
--- a/src/radeon_render.c
+++ b/src/radeon_render.c
@@ -917,7 +917,7 @@ FUNC_NAME(R200SubsequentCPUToScreenTexture) (
fb = srcy + height;
#ifdef ACCEL_CP
- BEGIN_RING(24);
+ BEGIN_RING(22);
OUT_ACCEL_REG(RADEON_RB3D_COLOROFFSET, fboffset);