summaryrefslogtreecommitdiff
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
commit1ab593af7fd822d53a8acf53ca79c191de88a49a (patch)
tree1c42c75fd6c1ec4a6f50a4eb3cae4f3c4b282e26
parentea04846dc5188374067352a375adc7d9eefa4d20 (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.
-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 523d2b7..576295f 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 145b653..3898488 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);