#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 );
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();
}
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;
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__);
vmesa->newEmitState = ~0;
}
-static void viaWrapPrimitive( viaContextPtr vmesa )
+void viaWrapPrimitive( viaContextPtr vmesa )
{
GLenum renderPrimitive = vmesa->renderPrimitive;
GLenum hwPrimitive = vmesa->hwPrimitive;
-
-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;
- }
-}
-
-
} 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;
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;
viaInitPointers_8888( swdd );
}
else {
- fprintf(stderr, "%s: failed\n", __FUNCTION__);
assert(0);
}
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;
swdd->WriteMonoCIPixels = NULL;
swdd->ReadCI32Span = NULL;
swdd->ReadCI32Pixels = NULL;
- if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__);
}