diff options
author | Keith Whitwell <[email protected]> | 2005-01-05 13:51:38 +0000 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2005-01-05 13:51:38 +0000 |
commit | 30f64862766c573505fb7cd03a1c10bbf584c183 (patch) | |
tree | 93c6d28e26211fa951f9fce093cc51bfdf443123 /src/mesa | |
parent | 830e046972842482283f8d0eade8544780ae455f (diff) |
make alloc-dma functions inline, rearrange some debug
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/unichrome/via_ioctl.c | 83 | ||||
-rw-r--r-- | src/mesa/drivers/dri/unichrome/via_ioctl.h | 33 | ||||
-rw-r--r-- | src/mesa/drivers/dri/unichrome/via_span.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/unichrome/via_tris.c | 2 |
4 files changed, 54 insertions, 68 deletions
diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.c b/src/mesa/drivers/dri/unichrome/via_ioctl.c index 579e3004b0e..bbb6651deef 100644 --- a/src/mesa/drivers/dri/unichrome/via_ioctl.c +++ b/src/mesa/drivers/dri/unichrome/via_ioctl.c @@ -73,7 +73,22 @@ #define VIA_BLIT_FILL 0xF0 #define VIA_BLIT_SET 0xFF - +static void dump_dma( viaContextPtr vmesa ) +{ + GLuint i; + GLuint *data = (GLuint *)vmesa->dma; + for (i = 0; i < vmesa->dmaLow; i += 16) { + fprintf(stderr, "%04x: ", i); + fprintf(stderr, "%08x ", *data++); + fprintf(stderr, "%08x ", *data++); + fprintf(stderr, "%08x ", *data++); + fprintf(stderr, "%08x\n", *data++); + } + fprintf(stderr, "******************************************\n"); +} + + + void viaCheckDma(viaContextPtr vmesa, GLuint bytes) { VIA_FINISH_PRIM( vmesa ); @@ -470,7 +485,8 @@ static int fire_buffer(viaContextPtr vmesa) ret = drmCommandWrite(vmesa->driFd, DRM_VIA_PCICMD, &bufI, sizeof(bufI)); if (ret) { - fprintf(stderr, "%s: DRM_VIA_PCICMD returned %d\n", __FUNCTION__, ret); + dump_dma(vmesa); + fprintf(stderr, "%s: DRM_VIA_PCICMD returned %d\n", __FUNCTION__, ret); abort(); } @@ -540,21 +556,6 @@ static int intersect_rect(drm_clip_rect_t *out, return 1; } -static void dump_dma( viaContextPtr vmesa ) -{ - GLuint i; - GLuint *data = (GLuint *)vmesa->dma; - for (i = 0; i < vmesa->dmaLow; i += 16) { - fprintf(stderr, "%04x: ", i); - fprintf(stderr, "%08x ", *data++); - fprintf(stderr, "%08x ", *data++); - fprintf(stderr, "%08x ", *data++); - fprintf(stderr, "%08x\n", *data++); - } - fprintf(stderr, "******************************************\n"); -} - - void viaFlushDmaLocked(viaContextPtr vmesa, GLuint flags) { int i; @@ -653,14 +654,16 @@ void viaFlushDmaLocked(viaContextPtr vmesa, GLuint flags) if (vmesa->glCtx->Scissor.Enabled && !intersect_rect(&b, &b, &vmesa->scissorRect)) continue; - + b.x1 += vmesa->drawXoff; b.x2 += vmesa->drawXoff; via_emit_cliprect(vmesa, &b); - if (fire_buffer(vmesa) != 0) + if (fire_buffer(vmesa) != 0) { + dump_dma( vmesa ); goto done; + } } } else { if (0) fprintf(stderr, "%s: no cliprects\n", __FUNCTION__); @@ -677,7 +680,7 @@ void viaFlushDmaLocked(viaContextPtr vmesa, GLuint flags) vmesa->newEmitState = ~0; } -static void viaWrapPrimitive( viaContextPtr vmesa ) +void viaWrapPrimitive( viaContextPtr vmesa ) { GLenum renderPrimitive = vmesa->renderPrimitive; GLenum hwPrimitive = vmesa->hwPrimitive; @@ -735,43 +738,3 @@ void viaInitIoctlFuncs(GLcontext *ctx) - -GLuint *viaAllocDmaFunc(viaContextPtr vmesa, int bytes, const char *func, int line) -{ - assert(!vmesa->dmaLastPrim); - if (vmesa->dmaLow + bytes > VIA_DMA_HIGHWATER) { - if (VIA_DEBUG) fprintf(stderr, "buffer overflow in check dma = %d + %d = %d\n", - vmesa->dmaLow, bytes, vmesa->dmaLow + bytes); - viaFlushDma(vmesa); - } - - { - GLuint *start = (GLuint *)(vmesa->dma + vmesa->dmaLow); - if (0) - fprintf(stderr, "%s %04x 0x%x bytes\n", func, vmesa->dmaLow, bytes); - vmesa->dmaLow += bytes; - return start; - } -} - - -GLuint *viaExtendPrimitive(viaContextPtr vmesa, int bytes) -{ - if (0) - fprintf(stderr, "%s %d\n", __FUNCTION__, bytes); - - assert(vmesa->dmaLastPrim); - if (vmesa->dmaLow + bytes > VIA_DMA_HIGHWATER) { - viaWrapPrimitive(vmesa); - } - - { - GLuint *start = (GLuint *)(vmesa->dma + vmesa->dmaLow); - if (0) - fprintf(stderr, "%s %04x 0x%x bytes\n", __FUNCTION__, vmesa->dmaLow, bytes); - vmesa->dmaLow += bytes; - return start; - } -} - - diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.h b/src/mesa/drivers/dri/unichrome/via_ioctl.h index b5dd9a8e5cb..5facad50f76 100644 --- a/src/mesa/drivers/dri/unichrome/via_ioctl.h +++ b/src/mesa/drivers/dri/unichrome/via_ioctl.h @@ -49,9 +49,36 @@ void viaCheckDma(viaContextPtr vmesa, GLuint bytes); } while (0) -GLuint *viaExtendPrimitive(viaContextPtr vmesa, int bytes); -GLuint *viaAllocDmaFunc(viaContextPtr vmesa, int bytes, const char *func, int line); -#define viaAllocDma( v, b ) viaAllocDmaFunc(v, b, __FUNCTION__, __LINE__) +void viaWrapPrimitive( viaContextPtr vmesa ); + +static __inline__ GLuint *viaAllocDma(viaContextPtr vmesa, int bytes) +{ + if (vmesa->dmaLow + bytes > VIA_DMA_HIGHWATER) { + viaFlushDma(vmesa); + } + + { + GLuint *start = (GLuint *)(vmesa->dma + vmesa->dmaLow); + vmesa->dmaLow += bytes; + return start; + } +} + + +static GLuint __inline__ *viaExtendPrimitive(viaContextPtr vmesa, int bytes) +{ + if (vmesa->dmaLow + bytes > VIA_DMA_HIGHWATER) { + viaWrapPrimitive(vmesa); + } + + { + GLuint *start = (GLuint *)(vmesa->dma + vmesa->dmaLow); + vmesa->dmaLow += bytes; + return start; + } +} + + #define RING_VARS GLuint *_vb = 0, _nr, _x; diff --git a/src/mesa/drivers/dri/unichrome/via_span.c b/src/mesa/drivers/dri/unichrome/via_span.c index 253e80cddef..b9521a7e617 100644 --- a/src/mesa/drivers/dri/unichrome/via_span.c +++ b/src/mesa/drivers/dri/unichrome/via_span.c @@ -246,7 +246,6 @@ void viaInitSpanFuncs(GLcontext *ctx) struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx); swdd->SetBuffer = viaSetBuffer; - if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); if (vmesa->viaScreen->bitsPerPixel == 16) { swdd->WriteRGBASpan = viaWriteRGBASpan_565; swdd->WriteRGBSpan = viaWriteRGBSpan_565; @@ -260,7 +259,6 @@ void viaInitSpanFuncs(GLcontext *ctx) viaInitPointers_8888( swdd ); } else { - fprintf(stderr, "%s: failed\n", __FUNCTION__); assert(0); } @@ -272,7 +270,6 @@ void viaInitSpanFuncs(GLcontext *ctx) swdd->WriteDepthPixels = viaWriteDepthPixels_16; } else if (vmesa->glCtx->Visual.depthBits == 24) { - fprintf(stderr, "%s: 24/8 span functions\n", __FUNCTION__); swdd->ReadDepthSpan = viaReadDepthSpan_24_8; swdd->WriteDepthSpan = viaWriteDepthSpan_24_8; swdd->ReadDepthPixels = viaReadDepthPixels_24_8; @@ -302,5 +299,4 @@ void viaInitSpanFuncs(GLcontext *ctx) swdd->WriteMonoCIPixels = NULL; swdd->ReadCI32Span = NULL; swdd->ReadCI32Pixels = NULL; - if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); } diff --git a/src/mesa/drivers/dri/unichrome/via_tris.c b/src/mesa/drivers/dri/unichrome/via_tris.c index e7d2750b57b..022399f6981 100644 --- a/src/mesa/drivers/dri/unichrome/via_tris.c +++ b/src/mesa/drivers/dri/unichrome/via_tris.c @@ -844,7 +844,6 @@ static void viaRenderFinish(GLcontext *ctx) } - /* System to flush dma and emit state changes based on the rasterized * primitive. */ @@ -944,6 +943,7 @@ void viaRasterPrimitive(GLcontext *ctx, ADVANCE_RING(); } + assert(vmesa->dmaLastPrim == 0); BEGIN_RING(8); OUT_RING( HC_HEADER2 ); |