code if DEBUG not defined.tags/unichrome-last-xinerama
@@ -65,7 +65,9 @@ | |||
#include "utils.h" | |||
viaContextPtr current_mesa; | |||
#ifdef DEBUG | |||
GLuint VIA_DEBUG = 0; | |||
#endif | |||
GLuint DRAW_FRONT = 0; | |||
#define DMA_SIZE 2 | |||
GLuint VIA_PERFORMANCE = 0; | |||
@@ -201,13 +203,11 @@ calculate_buffer_parameters( viaContextPtr vmesa ) | |||
+ extra; | |||
vmesa->back.size = vmesa->back.pitch * vmesa->driDrawable->h; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "viaMakeCurrent backbuffer: w = %d h = %d bpp = %d sizs = %d\n", | |||
vmesa->back.pitch, | |||
vmesa->driDrawable->h, | |||
8 << shift, | |||
vmesa->back.size); | |||
#endif | |||
/* Allocate depth-buffer */ | |||
if ( vmesa->hasStencil || vmesa->hasDepth ) { | |||
@@ -223,13 +223,11 @@ calculate_buffer_parameters( viaContextPtr vmesa ) | |||
(void) memset( & vmesa->depth, 0, sizeof( vmesa->depth ) ); | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "viaMakeCurrent depthbuffer: w = %d h = %d bpp = %d sizs = %d\n", | |||
vmesa->depth.pitch, | |||
vmesa->driDrawable->h, | |||
vmesa->depth.bpp, | |||
vmesa->depth.size); | |||
#endif | |||
/*=* John Sheng [2003.5.31] flip *=*/ | |||
if( (vmesa->viaScreen->width == vmesa->driDrawable->w) | |||
@@ -257,9 +255,7 @@ void viaReAllocateBuffers(GLframebuffer *drawbuffer) | |||
ctx->DrawBuffer->Width = drawbuffer->Width; | |||
ctx->DrawBuffer->Height = drawbuffer->Height; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
ctx->DrawBuffer->Accum = 0; | |||
vmesa->driDrawable->w = ctx->DrawBuffer->Width; | |||
@@ -269,9 +265,7 @@ void viaReAllocateBuffers(GLframebuffer *drawbuffer) | |||
calculate_buffer_parameters( vmesa ); | |||
UNLOCK_HARDWARE(vmesa); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
static void viaBufferSize(GLframebuffer *buffer, GLuint *width, GLuint *height) | |||
@@ -323,9 +317,7 @@ static const struct tnl_pipeline_stage *via_pipeline[] = { | |||
static GLboolean | |||
AllocateDmaBuffer(const GLvisual *visual, viaContextPtr vmesa) | |||
{ | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
if (vmesa->dma) | |||
via_free_dma_buffer(vmesa); | |||
@@ -339,9 +331,7 @@ AllocateDmaBuffer(const GLvisual *visual, viaContextPtr vmesa) | |||
return GL_FALSE; | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
return GL_TRUE; | |||
} | |||
@@ -396,9 +386,7 @@ viaCreateContext(const __GLcontextModes *mesaVis, | |||
if (!vmesa) { | |||
return GL_FALSE; | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
current_mesa = vmesa; | |||
/* pick back buffer */ | |||
if (mesaVis->doubleBufferMode) { | |||
@@ -538,11 +526,13 @@ viaCreateContext(const __GLcontextModes *mesaVis, | |||
viaInitVB(ctx); | |||
viaInitState(ctx); | |||
#ifdef DEBUG | |||
if (getenv("VIA_DEBUG")) | |||
VIA_DEBUG = 1; | |||
else | |||
VIA_DEBUG = 0; | |||
#endif | |||
if (getenv("DRAW_FRONT")) | |||
DRAW_FRONT = 1; | |||
else | |||
@@ -579,13 +569,11 @@ viaCreateContext(const __GLcontextModes *mesaVis, | |||
vmesa->regTranSet = (GLuint *)((GLuint)viaScreen->reg + 0x43C); | |||
vmesa->regTranSpace = (GLuint *)((GLuint)viaScreen->reg + 0x440); | |||
vmesa->agpBase = viaScreen->agpBase; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) { | |||
fprintf(stderr, "regEngineStatus = %x\n", *vmesa->regEngineStatus); | |||
} | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
{ | |||
#ifndef USE_XINERAMA | |||
vmesa->saam = 0; | |||
@@ -630,9 +618,7 @@ void | |||
viaDestroyContext(__DRIcontextPrivate *driContextPriv) | |||
{ | |||
viaContextPtr vmesa = (viaContextPtr)driContextPriv->driverPrivate; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
assert(vmesa); /* should never be null */ | |||
viaFlushPrimsLocked(vmesa); | |||
WAIT_IDLE | |||
@@ -659,9 +645,7 @@ viaDestroyContext(__DRIcontextPrivate *driContextPriv) | |||
if (VIA_PERFORMANCE) fprintf(stderr, "idle = %d\n", idle); | |||
if (VIA_PERFORMANCE) fprintf(stderr, "busy = %d\n", busy); | |||
#endif | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
void viaXMesaSetFrontClipRects(viaContextPtr vmesa) | |||
@@ -885,10 +869,8 @@ void viaXMesaWindowMoved(viaContextPtr vmesa) | |||
GLboolean | |||
viaUnbindContext(__DRIcontextPrivate *driContextPriv) | |||
{ | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
return GL_TRUE; | |||
} | |||
@@ -897,7 +879,6 @@ viaMakeCurrent(__DRIcontextPrivate *driContextPriv, | |||
__DRIdrawablePrivate *driDrawPriv, | |||
__DRIdrawablePrivate *driReadPriv) | |||
{ | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
if (VIA_DEBUG) { | |||
@@ -905,17 +886,13 @@ viaMakeCurrent(__DRIcontextPrivate *driContextPriv, | |||
fprintf(stderr, "driContextPriv = %08x\n", (GLuint)driDrawPriv); | |||
fprintf(stderr, "driContextPriv = %08x\n", (GLuint)driReadPriv); | |||
} | |||
#endif | |||
if (driContextPriv) { | |||
viaContextPtr vmesa = (viaContextPtr)driContextPriv->driverPrivate; | |||
current_mesa = vmesa; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "viaScreen->bitsPerPixel = %d\n", viaScreen->bitsPerPixel); | |||
if (VIA_DEBUG) fprintf(stderr, "viaMakeCurrent: w = %d\n", vmesa->driDrawable->w); | |||
#endif | |||
vmesa->driDrawable = driDrawPriv; | |||
if ( ! calculate_buffer_parameters( vmesa ) ) { | |||
@@ -925,18 +902,14 @@ viaMakeCurrent(__DRIcontextPrivate *driContextPriv, | |||
_mesa_make_current2(vmesa->glCtx, | |||
(GLframebuffer *)driDrawPriv->driverPrivate, | |||
(GLframebuffer *)driReadPriv->driverPrivate); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "Context %d MakeCurrent\n", vmesa->hHWContext); | |||
#endif | |||
viaXMesaWindowMoved(vmesa); | |||
} | |||
else { | |||
_mesa_make_current(0,0); | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
return GL_TRUE; | |||
} | |||
@@ -950,10 +923,8 @@ void viaGetLock(viaContextPtr vmesa, GLuint flags) | |||
__DRIscreenPrivate *psp; | |||
pdp = dPriv; | |||
psp = sPriv; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
if (VIA_DEBUG) fprintf(stderr, "drmGetLock - in\n"); | |||
#endif | |||
drmGetLock(vmesa->driFd, vmesa->hHWContext, flags); | |||
DRI_VALIDATE_DRAWABLE_INFO( sPriv, dPriv ); | |||
@@ -964,9 +935,7 @@ void viaGetLock(viaContextPtr vmesa, GLuint flags) | |||
} | |||
viaXMesaWindowMoved(vmesa); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
void viaLock(viaContextPtr vmesa, GLuint flags) | |||
@@ -1005,26 +974,20 @@ void viaUnLock(viaContextPtr vmesa, GLuint flags) | |||
drm_via_sarea_t *sarea = vmesa->sarea; | |||
int me = vmesa->hHWContext; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
if (VIA_DEBUG) fprintf(stderr, "sarea->ctxOwner = %d\n", sarea->ctxOwner); | |||
if (VIA_DEBUG) fprintf(stderr, "me = %d\n", me); | |||
#endif | |||
if (sarea->ctxOwner == me) { | |||
sarea->ctxOwner = 0; | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
void | |||
viaSwapBuffers(__DRIdrawablePrivate *drawablePrivate) | |||
{ | |||
__DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *)drawablePrivate; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) { | |||
viaContextPtr vmesa; | |||
GLcontext *ctx; | |||
@@ -1046,7 +1009,5 @@ viaSwapBuffers(__DRIdrawablePrivate *drawablePrivate) | |||
else { | |||
_mesa_problem(NULL, "viaSwapBuffers: drawable has no context!\n"); | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} |
@@ -427,7 +427,13 @@ extern hash_element hash_table[HASH_TABLE_SIZE][HASH_TABLE_DEPTH]; | |||
} while (0) | |||
#ifdef DEBUG | |||
extern GLuint VIA_DEBUG; | |||
#else | |||
#define VIA_DEBUG 0 | |||
#endif | |||
extern GLuint DRAW_FRONT; | |||
extern void viaGetLock(viaContextPtr vmesa, GLuint flags); | |||
extern void viaLock(viaContextPtr vmesa, GLuint flags); |
@@ -76,9 +76,7 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2) | |||
GLuint facing; | |||
LOCAL_VARS(3); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M; | |||
#endif | |||
@@ -293,9 +291,7 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2) | |||
} | |||
} | |||
SET_PRIMITIVE_RENDERED | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
#endif | |||
@@ -311,9 +307,7 @@ static void TAG(quad)(GLcontext *ctx, | |||
GLenum mode = GL_FILL; | |||
GLuint facing; | |||
LOCAL_VARS(4); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M; | |||
#endif | |||
@@ -553,17 +547,13 @@ static void TAG(quad)(GLcontext *ctx, | |||
VERT_RESTORE_IND(2); | |||
} | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
#else | |||
static void TAG(quad)(GLcontext *ctx, GLuint e0, | |||
GLuint e1, GLuint e2, GLuint e3) | |||
{ | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M; | |||
#endif | |||
@@ -582,9 +572,7 @@ static void TAG(quad)(GLcontext *ctx, GLuint e0, | |||
TAG(triangle)(ctx, e0, e1, e3); | |||
TAG(triangle)(ctx, e1, e2, e3); | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
#endif | |||
#endif | |||
@@ -595,9 +583,7 @@ static void TAG(line)(GLcontext *ctx, GLuint e0, GLuint e1) | |||
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; | |||
VERTEX *v[2]; | |||
LOCAL_VARS(2); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M; | |||
#endif | |||
@@ -634,9 +620,7 @@ static void TAG(line)(GLcontext *ctx, GLuint e0, GLuint e1) | |||
} | |||
} | |||
SET_PRIMITIVE_RENDERED | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
#endif | |||
@@ -646,9 +630,7 @@ static void TAG(points)(GLcontext *ctx, GLuint first, GLuint last) | |||
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; | |||
int i; | |||
LOCAL_VARS(1); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M; | |||
#endif | |||
@@ -671,9 +653,7 @@ static void TAG(points)(GLcontext *ctx, GLuint first, GLuint last) | |||
} | |||
} | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
#endif | |||
@@ -131,9 +131,7 @@ static void TAG(emit)(GLcontext *ctx, | |||
const GLubyte *mask = VB->ClipMask; | |||
int i; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "TAG-emit for HAVE_HW_DIVIDE || DO_SPEC || DO_TEX0 || DO_FOG || !HAVE_TINY_VERTICE\n"); | |||
#endif | |||
if (HAVE_HW_VIEWPORT && HAVE_HW_DIVIDE && CHECK_HW_DIVIDE) { | |||
(void) s; | |||
@@ -352,12 +350,10 @@ static void TAG(emit)(GLcontext *ctx, GLuint start, GLuint end, | |||
(void) s; | |||
/*ASSERT(stride == 4);*/ | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) { | |||
fprintf(stderr, "TAG-emit for DO_XYZW\n"); | |||
fprintf(stderr, "%s\n", __FUNCTION__); | |||
} | |||
#endif | |||
col = VB->ColorPtr[0]->data; | |||
col_stride = VB->ColorPtr[0]->stride; | |||
@@ -396,12 +392,10 @@ static void TAG(emit)(GLcontext *ctx, GLuint start, GLuint end, | |||
GLuint col_stride; | |||
GLfloat *v = (GLfloat *)dest; | |||
int i; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) { | |||
fprintf(stderr, "TAG-emit for No DO_XYZW\n"); | |||
fprintf(stderr, "%s\n", __FUNCTION__); | |||
} | |||
#endif | |||
if (VB->ColorPtr[0]->Type != GL_UNSIGNED_BYTE) | |||
IMPORT_FLOAT_COLORS( ctx ); | |||
@@ -446,9 +440,7 @@ static GLboolean TAG(check_tex_sizes)(GLcontext *ctx) | |||
/* Force 'missing' texcoords to something valid. | |||
*/ | |||
#ifdef DEBUG | |||
fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
if (DO_TEX3 && VB->TexCoordPtr[2] == 0) | |||
VB->TexCoordPtr[2] = VB->TexCoordPtr[3]; | |||
@@ -466,9 +458,7 @@ static GLboolean TAG(check_tex_sizes)(GLcontext *ctx) | |||
(DO_TEX1 && VB->TexCoordPtr[GET_TEXSOURCE(1)]->size == 4) || | |||
(DO_TEX0 && VB->TexCoordPtr[GET_TEXSOURCE(0)]->size == 4)) | |||
return GL_FALSE; | |||
#ifdef DEBUG | |||
fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
return GL_TRUE; | |||
} | |||
#else | |||
@@ -528,9 +518,7 @@ static void TAG(interp)(GLcontext *ctx, | |||
VERTEX *out = (VERTEX *)(ddverts + (eout << shift)); | |||
(void)s; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
if (HAVE_HW_DIVIDE && CHECK_HW_DIVIDE) { | |||
VIEWPORT_X(dst->v.x, dstclip[0]); | |||
VIEWPORT_Y(dst->v.y, dstclip[1]); | |||
@@ -631,9 +619,7 @@ static void TAG(interp)(GLcontext *ctx, | |||
INTERP_UB(t, dst->ub4[3][2], out->ub4[3][2], in->ub4[3][2]); | |||
INTERP_UB(t, dst->ub4[3][3], out->ub4[3][3], in->ub4[3][3]); | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
#endif /* rgba && xyzw */ |
@@ -77,9 +77,7 @@ static void TAG(render_points_verts)(GLcontext *ctx, | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M_X; | |||
#endif | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); | |||
#endif | |||
if (HAVE_POINTS) { | |||
LOCAL_VARS; | |||
int dmasz = GET_SUBSEQUENT_VB_MAX_VERTS(); | |||
@@ -102,9 +100,7 @@ static void TAG(render_points_verts)(GLcontext *ctx, | |||
else { | |||
VERT_FALLBACK(ctx, start, count, flags); | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); | |||
#endif | |||
} | |||
static void TAG(render_lines_verts)(GLcontext *ctx, | |||
@@ -115,9 +111,7 @@ static void TAG(render_lines_verts)(GLcontext *ctx, | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M_X; | |||
#endif | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); | |||
#endif | |||
if (HAVE_LINES) { | |||
LOCAL_VARS; | |||
int dmasz = GET_SUBSEQUENT_VB_MAX_VERTS(); | |||
@@ -146,9 +140,7 @@ static void TAG(render_lines_verts)(GLcontext *ctx, | |||
else { | |||
VERT_FALLBACK(ctx, start, count, flags); | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); | |||
#endif | |||
} | |||
@@ -160,9 +152,7 @@ static void TAG(render_line_strip_verts)(GLcontext *ctx, | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M_X; | |||
#endif | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); | |||
#endif | |||
if (HAVE_LINE_STRIPS) { | |||
LOCAL_VARS; | |||
int dmasz = GET_SUBSEQUENT_VB_MAX_VERTS(); | |||
@@ -185,9 +175,7 @@ static void TAG(render_line_strip_verts)(GLcontext *ctx, | |||
else { | |||
VERT_FALLBACK(ctx, start, count, flags); | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); | |||
#endif | |||
} | |||
@@ -199,9 +187,7 @@ static void TAG(render_line_loop_verts)(GLcontext *ctx, | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M_X; | |||
#endif | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); | |||
#endif | |||
if (HAVE_LINE_STRIPS) { | |||
LOCAL_VARS; | |||
int dmasz = GET_SUBSEQUENT_VB_MAX_VERTS(); | |||
@@ -237,9 +223,7 @@ static void TAG(render_line_loop_verts)(GLcontext *ctx, | |||
else { | |||
VERT_FALLBACK(ctx, start, count, flags); | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); | |||
#endif | |||
} | |||
@@ -252,9 +236,7 @@ static void TAG(render_triangles_verts)(GLcontext *ctx, | |||
int dmasz = (GET_SUBSEQUENT_VB_MAX_VERTS() / 3) * 3; | |||
int currentsz = (GET_CURRENT_VB_MAX_VERTS() / 3) * 3; | |||
GLuint j, nr; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M_X; | |||
#endif | |||
@@ -274,9 +256,7 @@ static void TAG(render_triangles_verts)(GLcontext *ctx, | |||
currentsz = dmasz; | |||
} | |||
FINISH; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
@@ -288,9 +268,7 @@ static void TAG(render_tri_strip_verts)(GLcontext *ctx, | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M_X; | |||
#endif | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); | |||
#endif | |||
if (HAVE_TRI_STRIPS) { | |||
LOCAL_VARS; | |||
GLuint j, nr; | |||
@@ -320,9 +298,7 @@ static void TAG(render_tri_strip_verts)(GLcontext *ctx, | |||
else { | |||
VERT_FALLBACK(ctx, start, count, flags); | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); | |||
#endif | |||
} | |||
static void TAG(render_tri_fan_verts)(GLcontext *ctx, | |||
@@ -330,9 +306,7 @@ static void TAG(render_tri_fan_verts)(GLcontext *ctx, | |||
GLuint count, | |||
GLuint flags) | |||
{ | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M_X; | |||
#endif | |||
@@ -364,9 +338,7 @@ static void TAG(render_tri_fan_verts)(GLcontext *ctx, | |||
*/ | |||
VERT_FALLBACK(ctx, start, count, flags); | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
@@ -378,9 +350,7 @@ static void TAG(render_poly_verts)(GLcontext *ctx, | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M_X; | |||
#endif | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); | |||
#endif | |||
if (HAVE_POLYGONS) { | |||
LOCAL_VARS; | |||
GLuint j, nr; | |||
@@ -409,9 +379,7 @@ static void TAG(render_poly_verts)(GLcontext *ctx, | |||
else { | |||
VERT_FALLBACK(ctx, start, count, flags); | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); | |||
#endif | |||
} | |||
static void TAG(render_quad_strip_verts)(GLcontext *ctx, | |||
@@ -423,9 +391,7 @@ static void TAG(render_quad_strip_verts)(GLcontext *ctx, | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M_X; | |||
#endif | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); | |||
#endif | |||
if (HAVE_QUAD_STRIPS) { | |||
LOCAL_VARS; | |||
GLuint j, nr; | |||
@@ -483,9 +449,7 @@ static void TAG(render_quad_strip_verts)(GLcontext *ctx, | |||
else { | |||
VERT_FALLBACK(ctx, start, count, flags); | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); | |||
#endif | |||
} | |||
@@ -494,9 +458,7 @@ static void TAG(render_quads_verts)(GLcontext *ctx, | |||
GLuint count, | |||
GLuint flags) | |||
{ | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M_X; | |||
#endif | |||
@@ -566,9 +528,7 @@ static void TAG(render_quads_verts)(GLcontext *ctx, | |||
*/ | |||
VERT_FALLBACK(ctx, start, count, flags); | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
static void TAG(render_noop)(GLcontext *ctx, |
@@ -35,15 +35,11 @@ via_alloc_back_buffer(viaContextPtr vmesa) | |||
{ | |||
drm_via_mem_t fb; | |||
unsigned char *pFB; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
fb.context = vmesa->hHWContext; | |||
fb.size = vmesa->back.size; | |||
fb.type = VIDEO; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "context = %d, size =%d, type = %d\n", fb.context, fb.size, fb.type); | |||
#endif | |||
if (ioctl(vmesa->driFd, DRM_IOCTL_VIA_ALLOCMEM, &fb)) | |||
return GL_FALSE; | |||
@@ -52,14 +48,12 @@ via_alloc_back_buffer(viaContextPtr vmesa) | |||
vmesa->back.offset = fb.offset; | |||
vmesa->back.map = (char *)(fb.offset + (GLuint)pFB); | |||
vmesa->back.index = fb.index; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) { | |||
fprintf(stderr, "back offset = %08x\n", vmesa->back.offset); | |||
fprintf(stderr, "back index = %d\n", vmesa->back.index); | |||
} | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
return GL_TRUE; | |||
} | |||
@@ -68,15 +62,11 @@ via_alloc_front_buffer(viaContextPtr vmesa) | |||
{ | |||
drm_via_mem_t fb; | |||
unsigned char *pFB; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
fb.context = vmesa->hHWContext; | |||
fb.size = vmesa->back.size; | |||
fb.type = VIDEO; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "context = %d, size =%d, type = %d\n", fb.context, fb.size, fb.type); | |||
#endif | |||
if (ioctl(vmesa->driFd, DRM_IOCTL_VIA_ALLOCMEM, &fb)) | |||
return GL_FALSE; | |||
@@ -85,7 +75,6 @@ via_alloc_front_buffer(viaContextPtr vmesa) | |||
vmesa->front.offset = fb.offset; | |||
vmesa->front.map = (char *)(fb.offset + (GLuint)pFB); | |||
vmesa->front.index = fb.index; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) { | |||
fprintf(stderr, "front offset = %08x\n", vmesa->front.offset); | |||
fprintf(stderr, "front index = %d\n", vmesa->front.index); | |||
@@ -93,7 +82,6 @@ via_alloc_front_buffer(viaContextPtr vmesa) | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
return GL_TRUE; | |||
} | |||
@@ -128,9 +116,7 @@ via_alloc_depth_buffer(viaContextPtr vmesa) | |||
{ | |||
drm_via_mem_t fb; | |||
unsigned char *pFB; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
fb.context = vmesa->hHWContext; | |||
fb.size = vmesa->depth.size; | |||
fb.type = VIDEO; | |||
@@ -144,14 +130,12 @@ via_alloc_depth_buffer(viaContextPtr vmesa) | |||
vmesa->depth.offset = fb.offset; | |||
vmesa->depth.map = (char *)(fb.offset + (GLuint)pFB); | |||
vmesa->depth.index = fb.index; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) { | |||
fprintf(stderr, "depth offset = %08x\n", vmesa->depth.offset); | |||
fprintf(stderr, "depth index = %d\n", vmesa->depth.index); | |||
} | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
return GL_TRUE; | |||
} | |||
@@ -173,9 +157,7 @@ via_alloc_dma_buffer(viaContextPtr vmesa) | |||
{ | |||
drmVIADMAInit init; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
vmesa->dma = (GLuint *) malloc(VIA_DMA_BUFSIZ); | |||
/* | |||
@@ -191,9 +173,7 @@ via_alloc_dma_buffer(viaContextPtr vmesa) | |||
else | |||
printf("unichrome_dri.so: Using PCI.\n"); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
return ((vmesa->dma) ? GL_TRUE : GL_FALSE); | |||
} | |||
@@ -209,18 +189,14 @@ GLboolean | |||
via_alloc_texture(viaContextPtr vmesa, viaTextureObjectPtr t) | |||
{ | |||
drm_via_mem_t fb; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
fb.context = vmesa->hHWContext; | |||
fb.size = t->texMem.size; | |||
fb.type = VIDEO; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) { | |||
fprintf(stderr, "texture size = %d\n", fb.size); | |||
fprintf(stderr, "texture type = %d\n", fb.type); | |||
} | |||
#endif | |||
if (ioctl(vmesa->driFd, DRM_IOCTL_VIA_ALLOCMEM, &fb)) { | |||
fprintf(stderr, "via_alloc_texture fail\n"); | |||
return GL_FALSE; | |||
@@ -228,14 +204,10 @@ via_alloc_texture(viaContextPtr vmesa, viaTextureObjectPtr t) | |||
t->texMem.offset = fb.offset; | |||
t->texMem.index = fb.index; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "texture index = %d\n", (GLuint)fb.index); | |||
#endif | |||
t->bufAddr = (unsigned char *)(fb.offset + (GLuint)vmesa->driScreen->pFB); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
return GL_TRUE; | |||
} | |||
/*=* John Sheng [2003.5.31] agp tex *=*/ | |||
@@ -243,18 +215,14 @@ GLboolean | |||
via_alloc_texture_agp(viaContextPtr vmesa, viaTextureObjectPtr t) | |||
{ | |||
drm_via_mem_t fb; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
fb.context = vmesa->hHWContext; | |||
fb.size = t->texMem.size; | |||
fb.type = AGP; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) { | |||
fprintf(stderr, "texture_agp size = %d\n", fb.size); | |||
fprintf(stderr, "texture type = %d\n", fb.type); | |||
} | |||
#endif | |||
if (ioctl(vmesa->driFd, DRM_IOCTL_VIA_ALLOCMEM, &fb)) { | |||
fprintf(stderr, "via_alloc_texture_agp fail\n"); | |||
return GL_FALSE; | |||
@@ -262,16 +230,12 @@ via_alloc_texture_agp(viaContextPtr vmesa, viaTextureObjectPtr t) | |||
t->texMem.offset = fb.offset; | |||
t->texMem.index = fb.index; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "texture agp index = %d\n", (GLuint)fb.index); | |||
#endif | |||
t->bufAddr = (unsigned char *)((GLuint)vmesa->viaScreen->agpLinearStart + fb.offset); | |||
/*=* John Sheng [2003.5.31] agp tex *=*/ | |||
t->inAGP = GL_TRUE; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
return GL_TRUE; | |||
} | |||
@@ -279,14 +243,12 @@ void | |||
via_free_texture(viaContextPtr vmesa, viaTextureObjectPtr t) | |||
{ | |||
drm_via_mem_t fb; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) { | |||
fprintf(stderr, "via_free_texture: index = %d\n", | |||
t->texMem.index); | |||
fprintf(stderr, "via_free_texture: size = %d\n", | |||
t->texMem.size); | |||
} | |||
#endif | |||
if (!vmesa) { | |||
fprintf(stderr, "!mesa\n"); | |||
return; |
@@ -100,9 +100,7 @@ static void viaClear(GLcontext *ctx, GLbitfield mask, GLboolean all, | |||
GLuint scrn = 0, i = 0, side = 0; | |||
scrn = vmesa->saam & S_MASK; | |||
side = vmesa->saam & P_MASK; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); | |||
#endif | |||
VIA_FIREVERTICES(vmesa); | |||
if ((mask & DD_FRONT_LEFT_BIT) && colorMask == ~0) { | |||
@@ -148,9 +146,7 @@ static void viaClear(GLcontext *ctx, GLbitfield mask, GLboolean all, | |||
if (!vmesa->saam) { | |||
if (!all) { | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr,"!all"); | |||
#endif | |||
for (; i < nr; i++) { | |||
GLint x = box[i].x1; | |||
GLint y = box[i].y1; | |||
@@ -308,9 +304,7 @@ static void viaClear(GLcontext *ctx, GLbitfield mask, GLboolean all, | |||
if (mask) | |||
_swrast_Clear(ctx, mask, all, cx, cy, cw, ch); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); | |||
#endif | |||
} | |||
/* | |||
@@ -322,9 +316,7 @@ void viaCopyBuffer(const __DRIdrawablePrivate *dPriv) | |||
drm_clip_rect_t *pbox; | |||
int nbox, i; | |||
GLuint scrn = 0, side = 0; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); | |||
#endif | |||
assert(dPriv); | |||
assert(dPriv->driContextPriv); | |||
assert(dPriv->driContextPriv->driverPrivate); | |||
@@ -340,17 +332,13 @@ void viaCopyBuffer(const __DRIdrawablePrivate *dPriv) | |||
pbox = vmesa->pClipRects; | |||
nbox = vmesa->numClipRects; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s %d cliprects (%d), SAAM (%d)\n", | |||
__FUNCTION__, nbox, vmesa->drawType, vmesa->saam); | |||
#endif | |||
if (vmesa->drawType == GLX_PBUFFER_BIT) { | |||
viaDoSwapPBuffers(vmesa); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s SwapPBuffers\n", __FUNCTION__); | |||
#endif /*=* [DBG] for pbuffer *=*/ | |||
} | |||
else { | |||
GLuint scrn = 0; | |||
@@ -365,9 +353,7 @@ void viaCopyBuffer(const __DRIdrawablePrivate *dPriv) | |||
for (; i < nr; i++) | |||
*b++ = pbox[i]; | |||
viaDoSwapBuffers(vmesa); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s SwapBuffers\n", __FUNCTION__); | |||
#endif | |||
} | |||
} | |||
else if (scrn == S0 || scrn == S1) { | |||
@@ -414,9 +400,7 @@ void viaCopyBuffer(const __DRIdrawablePrivate *dPriv) | |||
} | |||
UNLOCK_HARDWARE(vmesa); | |||
vmesa->uploadCliprects = GL_TRUE; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); | |||
#endif | |||
} | |||
/* | |||
@@ -431,9 +415,7 @@ void viaPageFlip(const __DRIdrawablePrivate *dPriv) | |||
viaBuffer buffer_tmp; | |||
GLcontext *ctx; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
assert(dPriv); | |||
assert(dPriv->driContextPriv); | |||
assert(dPriv->driContextPriv->driverPrivate); | |||
@@ -516,9 +498,7 @@ void viaPageFlip(const __DRIdrawablePrivate *dPriv) | |||
ctx->Driver.DrawBuffer(ctx, GL_FRONT); | |||
} | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
@@ -526,15 +506,11 @@ void viaPageFlip(const __DRIdrawablePrivate *dPriv) | |||
*/ | |||
void viaDmaFinish(viaContextPtr vmesa) | |||
{ | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); | |||
#endif | |||
VIA_FIREVERTICES(vmesa); | |||
LOCK_HARDWARE(vmesa); | |||
UNLOCK_HARDWARE(vmesa); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); | |||
#endif | |||
} | |||
void viaRegetLockQuiescent(viaContextPtr vmesa) | |||
@@ -624,7 +600,7 @@ void viaFlushPrimsLocked(viaContextPtr vmesa) | |||
vmesa->uploadCliprects = GL_TRUE; | |||
} | |||
/*=* John Sheng [2003.5.31] flip *=*/ | |||
/*#ifdef DEBUG | |||
/* | |||
if (VIA_DEBUG) { | |||
GLuint i; | |||
GLuint *data = (GLuint *)vmesa->dmaAddr; | |||
@@ -636,7 +612,7 @@ void viaFlushPrimsLocked(viaContextPtr vmesa) | |||
} | |||
fprintf(stderr, "******************************************\n"); | |||
} | |||
#endif*/ | |||
*/ | |||
if (!nbox || !vmesa->uploadCliprects) { | |||
if (nbox == 1) | |||
sarea->nbox = 0; | |||
@@ -788,7 +764,6 @@ void viaFlushPrimsLocked(viaContextPtr vmesa) | |||
} | |||
} | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) { | |||
GLuint i; | |||
GLuint *data = (GLuint *)vmesa->dmaAddr; | |||
@@ -800,7 +775,6 @@ void viaFlushPrimsLocked(viaContextPtr vmesa) | |||
} | |||
fprintf(stderr, "******************************************\n"); | |||
} | |||
#endif | |||
/* Reset vmesa vars: | |||
*/ | |||
vmesa->dmaLow = DMA_OFFSET; | |||
@@ -811,38 +785,28 @@ void viaFlushPrimsLocked(viaContextPtr vmesa) | |||
void viaFlushPrims(viaContextPtr vmesa) | |||
{ | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); | |||
#endif | |||
if (vmesa->dmaLow) { | |||
LOCK_HARDWARE(vmesa); | |||
viaFlushPrimsLocked(vmesa); | |||
UNLOCK_HARDWARE(vmesa); | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); | |||
#endif | |||
} | |||
static void viaFlush(GLcontext *ctx) | |||
{ | |||
viaContextPtr vmesa = VIA_CONTEXT(ctx); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); | |||
#endif | |||
VIA_FIREVERTICES(vmesa); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); | |||
#endif | |||
} | |||
static void viaFinish(GLcontext *ctx) | |||
{ | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); | |||
if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); | |||
#endif | |||
return; | |||
} | |||
@@ -987,9 +951,7 @@ void viaFillFrontPBuffer(viaContextPtr vmesa) | |||
GLuint pixel = (GLuint)vmesa->ClearColor; | |||
offset = vmesa->front.offset; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "Fill PFront offset = %08x\n", offset); | |||
#endif | |||
nDestBase = offset; | |||
nDestPitch = vmesa->front.pitch; | |||
@@ -1012,9 +974,7 @@ void viaFillBackBuffer(viaContextPtr vmesa) | |||
GLuint bytePerPixel = vmesa->viaScreen->bitsPerPixel >> 3; | |||
offset = vmesa->back.offset; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "Fill Back offset = %08x\n", offset); | |||
#endif | |||
nDestBase = offset; | |||
nDestPitch = vmesa->back.pitch; | |||
offsetX = vmesa->drawXoff; | |||
@@ -1042,12 +1002,10 @@ void viaFillBackBuffer(viaContextPtr vmesa) | |||
b++; | |||
} | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) { | |||
fprintf(stderr," width = %08x\n", nDestWidth); | |||
fprintf(stderr," height = %08x\n", nDestHeight); | |||
} | |||
#endif | |||
} | |||
void viaFillStencilDepthBuffer(viaContextPtr vmesa, GLuint pixel) | |||
@@ -1056,9 +1014,7 @@ void viaFillStencilDepthBuffer(viaContextPtr vmesa, GLuint pixel) | |||
GLuint *vb = viaCheckDma(vmesa, VIA_BLITSIZE); | |||
offset = vmesa->depth.offset; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "Fill Stencil Depth offset = %08x\n", offset); | |||
#endif | |||
nDestBase = offset; | |||
nDestPitch = vmesa->depth.pitch; | |||
offsetX = vmesa->drawXoff; | |||
@@ -1081,9 +1037,7 @@ void viaFillStencilBuffer(viaContextPtr vmesa, GLuint pixel) | |||
GLuint *vb = viaCheckDma(vmesa, VIA_BLITSIZE); | |||
offset = vmesa->depth.offset; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "Fill Stencil offset = %08x\n", offset); | |||
#endif | |||
nDestBase = offset; | |||
nDestPitch = vmesa->depth.pitch; | |||
offsetX = vmesa->drawXoff; | |||
@@ -1106,9 +1060,7 @@ void viaFillDepthBuffer(viaContextPtr vmesa, GLuint pixel) | |||
GLuint *vb = viaCheckDma(vmesa, VIA_BLITSIZE); | |||
offset = vmesa->depth.offset; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "Fill Depth offset = %08x\n", offset); | |||
#endif | |||
nDestBase = offset; | |||
nDestPitch = vmesa->depth.pitch; | |||
offsetX = vmesa->drawXoff; | |||
@@ -1161,9 +1113,7 @@ void viaDoSwapBuffers(viaContextPtr vmesa) | |||
} | |||
viaFlushPrimsLocked(vmesa); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "Do Swap Buffer\n"); | |||
#endif | |||
} | |||
void viaDoSwapBuffersSaam(viaContextPtr vmesa) | |||
@@ -1237,9 +1187,7 @@ void viaDoSwapBuffersSaam(viaContextPtr vmesa) | |||
} | |||
viaFlushPrimsLocked(vmesa); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "Do Swap Buffer\n"); | |||
#endif | |||
} | |||
void viaDoSwapPBuffers(viaContextPtr vmesa) | |||
@@ -1303,9 +1251,7 @@ void viaDoSwapPBuffers(viaContextPtr vmesa) | |||
SetReg2DAGP(0x0, 0x1 | 0xCC000000); | |||
viaFlushPrimsLocked(vmesa); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "Do Swap PBuffer\n"); | |||
#endif | |||
} | |||
@@ -72,9 +72,8 @@ int flush_sys(viaContextPtr vmesa, drm_via_flush_sys_t* buf); | |||
static __inline GLuint *viaCheckDma(viaContextPtr vmesa, int bytes) | |||
{ | |||
if (vmesa->dmaLow + bytes > vmesa->dmaHigh) { | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "buffer overflow in check dma = %d + %d = %d\n", vmesa->dmaLow, bytes, vmesa->dmaLow + bytes); | |||
#endif | |||
if (VIA_DEBUG) fprintf(stderr, "buffer overflow in check dma = %d + %d = %d\n", | |||
vmesa->dmaLow, bytes, vmesa->dmaLow + bytes); | |||
viaFlushPrims(vmesa); | |||
} | |||
@@ -81,18 +81,14 @@ static void VERT_FALLBACK(GLcontext *ctx, | |||
GLuint flags) | |||
{ | |||
TNLcontext *tnl = TNL_CONTEXT(ctx); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
fprintf(stderr, "VERT_FALLBACK\n"); | |||
tnl->Driver.Render.PrimitiveNotify(ctx, flags & PRIM_MODE_MASK); | |||
tnl->Driver.Render.BuildVertices(ctx, start, count, ~0); | |||
tnl->Driver.Render.PrimTabVerts[flags & PRIM_MODE_MASK](ctx, start, | |||
count, flags); | |||
VIA_CONTEXT(ctx)->setupNewInputs = VERT_BIT_CLIP; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
@@ -150,19 +146,15 @@ static GLboolean via_run_fastrender(GLcontext *ctx, | |||
#endif | |||
if (VB->ClipOrMask || vmesa->renderIndex != 0 || VB->Elts) { | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) { | |||
fprintf(stderr, "slow path\n"); | |||
fprintf(stderr, "ClipOrMask = %08x\n", VB->ClipOrMask); | |||
fprintf(stderr, "renderIndex = %08x\n", vmesa->renderIndex); | |||
fprintf(stderr, "Elts = %08x\n", (GLuint)VB->Elts); | |||
} | |||
#endif | |||
return GL_TRUE; | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
vmesa->setupNewInputs = VERT_BIT_CLIP; | |||
vmesa->primitiveRendered = GL_TRUE; | |||
@@ -181,9 +173,7 @@ static GLboolean via_run_fastrender(GLcontext *ctx, | |||
/*=* DBG - viewperf7.0 : fix command buffer overflow *=*/ | |||
if (vmesa->dmaLow > (VIA_DMA_BUFSIZ / 2)) | |||
viaFlushPrims(vmesa); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
return GL_FALSE; /* finished the pipe */ | |||
} | |||
@@ -426,9 +416,7 @@ static GLboolean via_run_render(GLcontext *ctx, | |||
tnl_render_func *tab; | |||
GLuint pass = 0; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M; | |||
#endif | |||
@@ -470,9 +458,7 @@ static GLboolean via_run_render(GLcontext *ctx, | |||
/*=* DBG viewperf7.0 : fix command buffer overflow *=*/ | |||
if (vmesa->dmaLow > (VIA_DMA_BUFSIZ / 2)) | |||
viaFlushPrims(vmesa); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
return GL_FALSE; /* finished the pipe */ | |||
} | |||
@@ -69,9 +69,7 @@ viaInitDriver(__DRIscreenPrivate *sPriv) | |||
{ | |||
viaScreenPrivate *viaScreen; | |||
VIADRIPtr gDRIPriv = (VIADRIPtr)sPriv->pDevPriv; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
/* Allocate the private area */ | |||
@@ -95,7 +93,6 @@ viaInitDriver(__DRIscreenPrivate *sPriv) | |||
#ifdef USE_XINERAMA | |||
viaScreen->drixinerama = gDRIPriv->drixinerama; | |||
#endif | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) { | |||
fprintf(stderr, "deviceID = %08x\n", viaScreen->deviceID); | |||
fprintf(stderr, "width = %08x\n", viaScreen->width); | |||
@@ -103,7 +100,6 @@ viaInitDriver(__DRIscreenPrivate *sPriv) | |||
fprintf(stderr, "cpp = %08x\n", viaScreen->cpp); | |||
fprintf(stderr, "fbOffset = %08x\n", viaScreen->fbOffset); | |||
} | |||
#endif | |||
/* DBG */ | |||
/* | |||
if (gDRIPriv->bitsPerPixel == 15) | |||
@@ -145,9 +141,7 @@ viaInitDriver(__DRIscreenPrivate *sPriv) | |||
viaScreen->agpLinearStart = 0; | |||
viaScreen->sareaPrivOffset = gDRIPriv->sarea_priv_offset; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
return GL_TRUE; | |||
} | |||
@@ -156,15 +150,11 @@ viaDestroyScreen(__DRIscreenPrivate *sPriv) | |||
{ | |||
viaScreenPrivate *viaScreen = (viaScreenPrivate *)sPriv->private; | |||
VIADRIPtr gDRIPriv = (VIADRIPtr)sPriv->pDevPriv; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
drmUnmap(viaScreen->reg, gDRIPriv->regs.size); | |||
if (gDRIPriv->agp.size) | |||
drmUnmap(viaScreen->agpLinearStart, gDRIPriv->agp.size); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
FREE(viaScreen); | |||
sPriv->private = NULL; | |||
} | |||
@@ -176,9 +166,7 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv, | |||
GLboolean isPixmap) | |||
{ | |||
viaContextPtr vmesa = current_mesa; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
/*=* John Sheng [2003.7.2] for visual config & patch viewperf *=*/ | |||
if (mesaVis->depthBits == 32 && vmesa->depthBits == 16) { | |||
vmesa->depthBits = mesaVis->depthBits; | |||
@@ -204,9 +192,7 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv, | |||
GL_FALSE /* s/w alpha planes */); | |||
if (vmesa) vmesa->drawType = GLX_PBUFFER_BIT; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
return (driDrawPriv->driverPrivate != NULL); | |||
} | |||
else { | |||
@@ -218,9 +204,7 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv, | |||
GL_FALSE /* s/w alpha planes */); | |||
if (vmesa) vmesa->drawType = GLX_WINDOW_BIT; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
return (driDrawPriv->driverPrivate != NULL); | |||
} | |||
} | |||
@@ -229,13 +213,9 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv, | |||
static void | |||
viaDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) | |||
{ | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
_mesa_destroy_framebuffer((GLframebuffer *)(driDrawPriv->driverPrivate)); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
@@ -293,9 +293,7 @@ static void viaSetBuffer(GLcontext *ctx, GLframebuffer *colorBuffer, | |||
GLuint bufferBit) | |||
{ | |||
viaContextPtr vmesa = VIA_CONTEXT(ctx); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); | |||
#endif | |||
if (bufferBit == DD_FRONT_LEFT_BIT) { | |||
vmesa->drawMap = (char *)vmesa->driScreen->pFB; | |||
vmesa->readMap = (char *)vmesa->driScreen->pFB; | |||
@@ -311,9 +309,7 @@ static void viaSetBuffer(GLcontext *ctx, GLframebuffer *colorBuffer, | |||
else { | |||
ASSERT(0); | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); | |||
#endif | |||
} | |||
@@ -323,9 +319,7 @@ void viaInitSpanFuncs(GLcontext *ctx) | |||
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx); | |||
swdd->SetBuffer = viaSetBuffer; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); | |||
#endif | |||
if (vmesa->viaScreen->bitsPerPixel == 0x10) { | |||
swdd->WriteRGBASpan = viaWriteRGBASpan_565; | |||
swdd->WriteRGBSpan = viaWriteRGBSpan_565; | |||
@@ -361,7 +355,5 @@ void viaInitSpanFuncs(GLcontext *ctx) | |||
swdd->WriteMonoCIPixels = NULL; | |||
swdd->ReadCI32Span = NULL; | |||
swdd->ReadCI32Pixels = NULL; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); | |||
#endif | |||
} |
@@ -77,9 +77,7 @@ static __inline__ GLuint viaPackColor(GLuint format, | |||
case 0x20: | |||
return PACK_COLOR_8888(a, r, g, b); | |||
default: | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "unknown format %d\n", (int)format); | |||
#endif | |||
return PACK_COLOR_8888(a, r, g, b); | |||
} | |||
} | |||
@@ -92,9 +90,7 @@ static void viaAlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref) | |||
static void viaBlendEquationSeparate(GLcontext *ctx, GLenum rgbMode, GLenum aMode) | |||
{ | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); | |||
#endif | |||
/* GL_EXT_blend_equation_separate not supported */ | |||
ASSERT(rgbMode == aMode); | |||
@@ -108,18 +104,14 @@ static void viaBlendEquationSeparate(GLcontext *ctx, GLenum rgbMode, GLenum aMod | |||
FALLBACK(VIA_CONTEXT(ctx), VIA_FALLBACK_LOGICOP, | |||
(ctx->Color.ColorLogicOpEnabled && | |||
ctx->Color.LogicOp != GL_COPY)); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); | |||
#endif | |||
} | |||
static void viaBlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor) | |||
{ | |||
viaContextPtr vmesa = VIA_CONTEXT(ctx); | |||
GLboolean fallback = GL_FALSE; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); | |||
#endif | |||
switch (ctx->Color.BlendSrcRGB) { | |||
case GL_ZERO: break; | |||
case GL_SRC_ALPHA: break; | |||
@@ -160,9 +152,7 @@ static void viaBlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor) | |||
} | |||
FALLBACK(vmesa, VIA_FALLBACK_BLEND_FUNC, fallback); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); | |||
#endif | |||
} | |||
/* Shouldn't be called as the extension is disabled. | |||
@@ -205,9 +195,7 @@ static void viaScissor(GLcontext *ctx, GLint x, GLint y, | |||
GLsizei w, GLsizei h) | |||
{ | |||
viaContextPtr vmesa = VIA_CONTEXT(ctx); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); | |||
#endif | |||
if (ctx->Scissor.Enabled) { | |||
VIA_FIREVERTICES(vmesa); /* don't pipeline cliprect changes */ | |||
vmesa->uploadCliprects = GL_TRUE; | |||
@@ -217,19 +205,15 @@ static void viaScissor(GLcontext *ctx, GLint x, GLint y, | |||
vmesa->scissorRect.y1 = vmesa->driDrawable->h - (y + h); | |||
vmesa->scissorRect.x2 = x + w; | |||
vmesa->scissorRect.y2 = vmesa->driDrawable->h - y; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); | |||
#endif | |||
} | |||
static void viaLogicOp(GLcontext *ctx, GLenum opcode) | |||
{ | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); | |||
if (VIA_DEBUG) fprintf(stderr, "opcode = %x\n", opcode); | |||
if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); | |||
#endif | |||
} | |||
/* Fallback to swrast for select and feedback. | |||
@@ -237,22 +221,16 @@ static void viaLogicOp(GLcontext *ctx, GLenum opcode) | |||
static void viaRenderMode(GLcontext *ctx, GLenum mode) | |||
{ | |||
viaContextPtr vmesa = VIA_CONTEXT(ctx); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); | |||
#endif | |||
FALLBACK(vmesa, VIA_FALLBACK_RENDERMODE, (mode != GL_RENDER)); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); | |||
#endif | |||
} | |||
static void viaDrawBuffer(GLcontext *ctx, GLenum mode) | |||
{ | |||
viaContextPtr vmesa = VIA_CONTEXT(ctx); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); | |||
#endif | |||
if (mode == GL_FRONT) { | |||
VIA_FIREVERTICES(vmesa); | |||
VIA_STATECHANGE(vmesa, VIA_UPLOAD_BUFFERS); | |||
@@ -279,9 +257,7 @@ static void viaDrawBuffer(GLcontext *ctx, GLenum mode) | |||
FALLBACK(vmesa, VIA_FALLBACK_DRAW_BUFFER, GL_TRUE); | |||
return; | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s out\n", __FUNCTION__); | |||
#endif | |||
} | |||
static void viaClearColor(GLcontext *ctx, const GLfloat color[4]) | |||
@@ -478,7 +454,6 @@ static void viaDepthRange(GLcontext *ctx, | |||
void viaPrintDirty(const char *msg, GLuint state) | |||
{ | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) | |||
fprintf(stderr, "%s (0x%x): %s%s%s%s\n", | |||
msg, | |||
@@ -488,7 +463,6 @@ void viaPrintDirty(const char *msg, GLuint state) | |||
(state & VIA_UPLOAD_CTX) ? "upload-ctx, " : "", | |||
(state & VIA_UPLOAD_BUFFERS) ? "upload-bufs, " : "" | |||
); | |||
#endif | |||
} | |||
@@ -556,18 +530,13 @@ void viaChooseTextureState(GLcontext *ctx) | |||
struct gl_texture_unit *texUnit1 = &ctx->Texture.Unit[1]; | |||
/*=* John Sheng [2003.7.18] texture combine *=*/ | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
if (texUnit0->_ReallyEnabled || texUnit1->_ReallyEnabled) { | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) { | |||
fprintf(stderr, "Texture._ReallyEnabled - in\n"); | |||
fprintf(stderr, "texUnit0->_ReallyEnabled = %x\n",texUnit0->_ReallyEnabled); | |||
} | |||
#endif | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) { | |||
struct gl_texture_object *texObj0 = texUnit0->_Current; | |||
struct gl_texture_object *texObj1 = texUnit1->_Current; | |||
@@ -580,16 +549,13 @@ void viaChooseTextureState(GLcontext *ctx) | |||
if ( (texObj1 != NULL) && (texObj1->Image[0][0] != NULL) ) | |||
fprintf(stderr, "format 1: 0x%04x\n", texObj1->Image[0][0]->Format); | |||
} | |||
#endif | |||
if (texUnit0->_ReallyEnabled) { | |||
struct gl_texture_object *texObj = texUnit0->_Current; | |||
struct gl_texture_image *texImage = texObj->Image[0][0]; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "texUnit0->_ReallyEnabled\n"); | |||
#endif | |||
if (texImage->Border) { | |||
FALLBACK(vmesa, VIA_FALLBACK_TEXTURE, GL_TRUE); | |||
return; | |||
@@ -643,9 +609,7 @@ void viaChooseTextureState(GLcontext *ctx) | |||
vmesa->regHTXnMPMD_0 |= get_wrap_mode( texObj->WrapS, | |||
texObj->WrapT ); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "texUnit0->EnvMode %x\n",texUnit0->EnvMode); | |||
#endif | |||
viaTexCombineState( vmesa, texUnit0->_CurrentCombine, 0 ); | |||
} | |||
@@ -714,7 +678,6 @@ void viaChooseTextureState(GLcontext *ctx) | |||
} | |||
vmesa->dirty |= VIA_UPLOAD_TEXTURE; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) { | |||
fprintf( stderr, "Csat_0 / Cop_0 = 0x%08x / 0x%08x\n", | |||
vmesa->regHTXnTBLCsat_0, vmesa->regHTXnTBLCop_0 ); | |||
@@ -727,7 +690,6 @@ void viaChooseTextureState(GLcontext *ctx) | |||
fprintf( stderr, "RCbias_0 = 0x%08x\n", | |||
vmesa->regHTXnTBLRCbias_0 ); | |||
} | |||
#endif | |||
} | |||
else { | |||
if (ctx->Fog.Enabled) | |||
@@ -737,9 +699,7 @@ void viaChooseTextureState(GLcontext *ctx) | |||
vmesa->regEnable &= (~(HC_HenTXMP_MASK | HC_HenTXCH_MASK | HC_HenTXPP_MASK)); | |||
vmesa->dirty |= VIA_UPLOAD_ENABLE; | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
@@ -752,9 +712,7 @@ void viaChooseColorState(GLcontext *ctx) | |||
/* The HW's blending equation is: | |||
* (Ca * FCa + Cbias + Cb * FCb) << Cshift | |||
*/ | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
if (ctx->Color.BlendEnabled) { | |||
vmesa->regEnable |= HC_HenABL_MASK; | |||
@@ -1039,9 +997,7 @@ void viaChooseColorState(GLcontext *ctx) | |||
else | |||
vmesa->regEnable &= (~HC_HenAW_MASK); | |||
vmesa->dirty |= VIA_UPLOAD_ENABLE; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
void viaChooseFogState(GLcontext *ctx) | |||
@@ -1180,9 +1136,7 @@ void viaChoosePolygonState(GLcontext *ctx) | |||
void viaChooseStencilState(GLcontext *ctx) | |||
{ | |||
viaContextPtr vmesa = VIA_CONTEXT(ctx); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
if (ctx->Stencil.Enabled) { | |||
GLuint temp; | |||
@@ -1265,9 +1219,7 @@ void viaChooseStencilState(GLcontext *ctx) | |||
vmesa->regEnable &= ~HC_HenST_MASK; | |||
vmesa->dirty |= VIA_UPLOAD_ENABLE; | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
void viaChoosePoint(GLcontext *ctx) | |||
@@ -1283,17 +1235,15 @@ void viaChooseLine(GLcontext *ctx) | |||
void viaChooseTriangle(GLcontext *ctx) | |||
{ | |||
viaContextPtr vmesa = VIA_CONTEXT(ctx); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
if (VIA_DEBUG) fprintf(stderr, "GL_CULL_FACE = %x\n", GL_CULL_FACE); | |||
if (VIA_DEBUG) fprintf(stderr, "ctx->Polygon.CullFlag = %x\n", ctx->Polygon.CullFlag); | |||
if (VIA_DEBUG) fprintf(stderr, "GL_FRONT = %x\n", GL_FRONT); | |||
if (VIA_DEBUG) fprintf(stderr, "ctx->Polygon.CullFaceMode = %x\n", ctx->Polygon.CullFaceMode); | |||
if (VIA_DEBUG) fprintf(stderr, "GL_CCW = %x\n", GL_CCW); | |||
if (VIA_DEBUG) fprintf(stderr, "ctx->Polygon.FrontFace = %x\n", ctx->Polygon.FrontFace); | |||
#endif | |||
if (VIA_DEBUG) { | |||
fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
fprintf(stderr, "GL_CULL_FACE = %x\n", GL_CULL_FACE); | |||
fprintf(stderr, "ctx->Polygon.CullFlag = %x\n", ctx->Polygon.CullFlag); | |||
fprintf(stderr, "GL_FRONT = %x\n", GL_FRONT); | |||
fprintf(stderr, "ctx->Polygon.CullFaceMode = %x\n", ctx->Polygon.CullFaceMode); | |||
fprintf(stderr, "GL_CCW = %x\n", GL_CCW); | |||
fprintf(stderr, "ctx->Polygon.FrontFace = %x\n", ctx->Polygon.FrontFace); | |||
} | |||
if (ctx->Polygon.CullFlag == GL_TRUE) { | |||
switch (ctx->Polygon.CullFaceMode) { | |||
case GL_FRONT: | |||
@@ -1312,9 +1262,7 @@ void viaChooseTriangle(GLcontext *ctx) | |||
return; | |||
} | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
static void viaChooseState(GLcontext *ctx, GLuint newState) | |||
@@ -1322,11 +1270,9 @@ static void viaChooseState(GLcontext *ctx, GLuint newState) | |||
viaContextPtr vmesa = VIA_CONTEXT(ctx); | |||
struct gl_texture_unit *texUnit0 = &ctx->Texture.Unit[0]; | |||
struct gl_texture_unit *texUnit1 = &ctx->Texture.Unit[1]; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
if (VIA_DEBUG) fprintf(stderr, "newState = %x\n", newState); | |||
#endif | |||
if (!(newState & (_NEW_COLOR | | |||
_NEW_TEXTURE | | |||
_NEW_DEPTH | | |||
@@ -1374,9 +1320,7 @@ static void viaChooseState(GLcontext *ctx, GLuint newState) | |||
viaChooseTriangle(ctx); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
static void viaInvalidateState(GLcontext *ctx, GLuint newState) |
@@ -105,9 +105,7 @@ static void viaTexImage1D(GLcontext *ctx, GLenum target, GLint level, | |||
struct gl_texture_image *texImage) | |||
{ | |||
viaTextureObjectPtr t = (viaTextureObjectPtr)texObj->DriverData; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "viaTexImage1D - in\n"); | |||
#endif | |||
if (t) { | |||
if (level == 0) { | |||
viaSwapOutTexObj(VIA_CONTEXT(ctx), t); | |||
@@ -127,9 +125,7 @@ static void viaTexImage1D(GLcontext *ctx, GLenum target, GLint level, | |||
_mesa_store_teximage1d(ctx, target, level, internalFormat, | |||
width, border, format, type, | |||
pixels, packing, texObj, texImage); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "viaTexImage1D - out\n"); | |||
#endif | |||
} | |||
static void viaTexSubImage1D(GLcontext *ctx, | |||
GLenum target, | |||
@@ -164,9 +160,7 @@ static void viaTexImage2D(GLcontext *ctx, GLenum target, GLint level, | |||
struct gl_texture_image *texImage) | |||
{ | |||
viaTextureObjectPtr t = (viaTextureObjectPtr)texObj->DriverData; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "viaTexImage2D - in\n"); | |||
#endif | |||
if (t) { | |||
if (level == 0) { | |||
viaSwapOutTexObj(VIA_CONTEXT(ctx), t); | |||
@@ -186,9 +180,7 @@ static void viaTexImage2D(GLcontext *ctx, GLenum target, GLint level, | |||
_mesa_store_teximage2d(ctx, target, level, internalFormat, | |||
width, height, border, format, type, | |||
pixels, packing, texObj, texImage); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "viaTexImage2D - out\n"); | |||
#endif | |||
} | |||
static void viaTexSubImage2D(GLcontext *ctx, | |||
@@ -221,9 +213,7 @@ static void viaTexSubImage2D(GLcontext *ctx, | |||
static void viaBindTexture(GLcontext *ctx, GLenum target, | |||
struct gl_texture_object *texObj) | |||
{ | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "viaBindTexture - in\n"); | |||
#endif | |||
if (target == GL_TEXTURE_2D) { | |||
viaTextureObjectPtr t = (viaTextureObjectPtr)texObj->DriverData; | |||
@@ -237,17 +227,13 @@ static void viaBindTexture(GLcontext *ctx, GLenum target, | |||
texObj->DriverData = t; | |||
} | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "viaBindTexture - out\n"); | |||
#endif | |||
} | |||
static void viaDeleteTexture(GLcontext *ctx, struct gl_texture_object *texObj) | |||
{ | |||
viaTextureObjectPtr t = (viaTextureObjectPtr)texObj->DriverData; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "viaDeleteTexture - in\n"); | |||
#endif | |||
if (t) { | |||
viaContextPtr vmesa = VIA_CONTEXT(ctx); | |||
if (vmesa) { | |||
@@ -260,9 +246,7 @@ static void viaDeleteTexture(GLcontext *ctx, struct gl_texture_object *texObj) | |||
} | |||
texObj->DriverData = 0; | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "viaDeleteTexture - out\n"); | |||
#endif | |||
/* Free mipmap images and the texture object itself */ | |||
_mesa_delete_texture_object(ctx, texObj); | |||
@@ -283,10 +267,8 @@ viaChooseTexFormat(GLcontext *ctx, GLint internalFormat, | |||
viaContextPtr vmesa = VIA_CONTEXT(ctx); | |||
(void)format; | |||
(void)type; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__); | |||
if (VIA_DEBUG) fprintf(stderr, "internalFormat:%d format:%d\n", internalFormat, format); | |||
#endif | |||
switch (internalFormat) { | |||
case 1: | |||
case GL_LUMINANCE: | |||
@@ -307,9 +289,7 @@ viaChooseTexFormat(GLcontext *ctx, GLint internalFormat, | |||
case GL_R3_G3_B2: | |||
case GL_RGB4: | |||
case GL_RGB5: | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "2 &_mesa_texformat_arg565\n"); | |||
#endif | |||
return &_mesa_texformat_rgb565; | |||
case 3: | |||
case GL_RGB: | |||
@@ -318,50 +298,36 @@ viaChooseTexFormat(GLcontext *ctx, GLint internalFormat, | |||
case GL_RGB12: | |||
case GL_RGB16: | |||
if (vmesa->viaScreen->bitsPerPixel == 0x20) { | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr,"3 argb8888\n"); | |||
#endif | |||
return &_mesa_texformat_argb8888; | |||
} | |||
else { | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr,"3 rgb565\n"); | |||
#endif | |||
return &_mesa_texformat_rgb565; | |||
} | |||
case 4: | |||
if (vmesa->viaScreen->bitsPerPixel == 0x20) { | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "4 &_mesa_texformat_argb8888\n"); | |||
#endif | |||
return &_mesa_texformat_argb8888; | |||
} | |||
else { | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "4 &_mesa_texformat_argb4444\n"); | |||
#endif | |||
return &_mesa_texformat_argb4444; | |||
} | |||
case GL_RGBA2: | |||
case GL_RGBA4: | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "GL_RGBA4 &_mesa_texformat_argb4444\n"); | |||
#endif | |||
return &_mesa_texformat_argb4444; | |||
case GL_RGB5_A1: | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "GL_RGB5_A1 &_mesa_texformat_argb1555\n"); | |||
#endif | |||
return &_mesa_texformat_argb1555; | |||
case GL_RGBA: | |||
case GL_RGBA8: | |||
case GL_RGBA12: | |||
case GL_RGBA16: | |||
case GL_RGB10_A2: | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "GL_RGBA &_mesa_texformat_argb8888\n"); | |||
#endif | |||
return &_mesa_texformat_argb8888; | |||
case GL_ALPHA: | |||
case GL_ALPHA4: | |||
@@ -391,9 +357,7 @@ viaChooseTexFormat(GLcontext *ctx, GLint internalFormat, | |||
void viaInitTextureFuncs(struct dd_function_table * functions) | |||
{ | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "viaInitTextureFuncs - in\n"); | |||
#endif | |||
functions->TexEnv = viaTexEnv; | |||
functions->ChooseTextureFormat = viaChooseTexFormat; | |||
functions->TexImage1D = viaTexImage1D; | |||
@@ -416,9 +380,7 @@ void viaInitTextureFuncs(struct dd_function_table * functions) | |||
functions->IsTextureResident = viaIsTextureResident; | |||
functions->TestProxyTexImage = _mesa_test_proxy_teximage; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "viaInitTextureFuncs - out\n"); | |||
#endif | |||
} | |||
void viaInitTextures(GLcontext *ctx) |
@@ -44,9 +44,7 @@ GLuint agpFullCount = 0; | |||
void viaDestroyTexObj(viaContextPtr vmesa, viaTextureObjectPtr t) | |||
{ | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
if (!t) | |||
return; | |||
@@ -77,16 +75,12 @@ void viaDestroyTexObj(viaContextPtr vmesa, viaTextureObjectPtr t) | |||
remove_from_list(t); | |||
free(t); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
void viaSwapOutTexObj(viaContextPtr vmesa, viaTextureObjectPtr t) | |||
{ | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
if (t->bufAddr) { | |||
via_free_texture(vmesa, t); | |||
@@ -96,9 +90,7 @@ void viaSwapOutTexObj(viaContextPtr vmesa, viaTextureObjectPtr t) | |||
t->dirtyImages = ~0; | |||
move_to_tail(&(vmesa->SwappedOut), t); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
/* Upload an image from mesa's internal copy. | |||
@@ -107,21 +99,17 @@ static void viaUploadTexLevel(viaTextureObjectPtr t, int level) | |||
{ | |||
const struct gl_texture_image *image = t->image[level].image; | |||
int i, j; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) { | |||
fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
fprintf(stderr, "width = %d, height = %d \n", image->Width, image->Height); | |||
} | |||
#endif | |||
switch (t->image[level].internalFormat) { | |||
case GL_RGB: | |||
{ | |||
if (image->TexFormat->MesaFormat == MESA_FORMAT_ARGB8888) { | |||
GLuint *dst = (GLuint *)(t->bufAddr + t->image[level].offset); | |||
GLuint *src = (GLuint *)image->Data; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "GL_RGB MESA_FORMAT_ARGB8888\n"); | |||
#endif | |||
if (image->Width < 8) { | |||
for (i = 0; i < image->Height ; i++) { | |||
for (j = 0; j < image->Width ; j++) { | |||
@@ -143,9 +131,7 @@ static void viaUploadTexLevel(viaTextureObjectPtr t, int level) | |||
else { | |||
GLushort *dst = (GLushort *)(t->bufAddr + t->image[level].offset); | |||
GLushort *src = (GLushort *)image->Data; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "GL_RGB !MESA_FORMAT_ARGB8888\n"); | |||
#endif | |||
if (image->Width < 16) { | |||
for (i = 0; i < image->Height ; i++) { | |||
for (j = 0; j < image->Width ; j++) { | |||
@@ -190,16 +176,12 @@ static void viaUploadTexLevel(viaTextureObjectPtr t, int level) | |||
} | |||
} | |||
/*memcpy(dst, src, image->Height * image->Width * sizeof(GLushort));*/ | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "GL_RGBA MESA_FORMAT_ARGB4444\n"); | |||
#endif | |||
} | |||
else if(image->TexFormat->MesaFormat == MESA_FORMAT_ARGB8888) { | |||
GLuint *dst = (GLuint *)(t->bufAddr + t->image[level].offset); | |||
GLuint *src = (GLuint *)image->Data; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "GL_RGBA !MESA_FORMAT_ARGB4444\n"); | |||
#endif | |||
if (image->Width < 8) { | |||
for (i = 0; i < image->Height ; i++) { | |||
for (j = 0; j < image->Width ; j++) { | |||
@@ -238,9 +220,7 @@ static void viaUploadTexLevel(viaTextureObjectPtr t, int level) | |||
} | |||
} | |||
/*memcpy(dst, src, image->Height * image->Width * sizeof(GLushort));*/ | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "GL_RGBA MESA_FORMAT_ARGB1555\n"); | |||
#endif | |||
} | |||
} | |||
break; | |||
@@ -313,14 +293,10 @@ static void viaUploadTexLevel(viaTextureObjectPtr t, int level) | |||
break; | |||
default:; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "Not supported texture format %s\n", | |||
_mesa_lookup_enum_by_nr(image->Format)); | |||
#endif | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
void viaPrintLocalLRU(viaContextPtr vmesa) | |||
@@ -329,7 +305,6 @@ void viaPrintLocalLRU(viaContextPtr vmesa) | |||
foreach (t, &vmesa->TexObjList) { | |||
if (!t->globj) { | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) { | |||
fprintf(stderr, "offset = %x, index = %x, size = %x\n", | |||
t->texMem.offset, | |||
@@ -343,7 +318,6 @@ void viaPrintLocalLRU(viaContextPtr vmesa) | |||
t->texMem.size); | |||
} | |||
} | |||
#endif | |||
} | |||
} | |||
} | |||
@@ -354,17 +328,13 @@ void viaPrintGlobalLRU(viaContextPtr vmesa) | |||
drm_via_tex_region_t *list = vmesa->sarea->texList; | |||
for (i = 0, j = VIA_NR_TEX_REGIONS; i < VIA_NR_TEX_REGIONS; i++) { | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "list[%d] age %d next %d prev %d\n", | |||
j, list[j].age, list[j].next, list[j].prev); | |||
#endif | |||
j = list[j].next; | |||
if (j == VIA_NR_TEX_REGIONS) break; | |||
} | |||
#ifdef DEBUG | |||
if (j != VIA_NR_TEX_REGIONS) | |||
if (VIA_DEBUG) fprintf(stderr, "Loop detected in global LRU\n"); | |||
#endif | |||
} | |||
void viaResetGlobalLRU(viaContextPtr vmesa) | |||
@@ -413,15 +383,11 @@ void viaTexturesGone(viaContextPtr vmesa, | |||
GLuint inUse) | |||
{ | |||
viaTextureObjectPtr t, tmp; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
foreach_s (t, tmp, &vmesa->TexObjList) { | |||
viaSwapOutTexObj(vmesa, t); | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
/* This is called with the lock held. May have to eject our own and/or | |||
@@ -431,9 +397,7 @@ void viaUploadTexImages(viaContextPtr vmesa, viaTextureObjectPtr t) | |||
{ | |||
int i, j; | |||
int numLevels; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
LOCK_HARDWARE(vmesa); | |||
j = 0; | |||
@@ -449,18 +413,14 @@ void viaUploadTexImages(viaContextPtr vmesa, viaTextureObjectPtr t) | |||
agpFullCount++; | |||
if (vmesa->TexObjList.prev == vmesa->CurrentTexObj[0] || | |||
vmesa->TexObjList.prev == vmesa->CurrentTexObj[1]) { | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "Hit bound texture in upload\n"); | |||
#endif | |||
viaPrintLocalLRU(vmesa); | |||
UNLOCK_HARDWARE(vmesa); | |||
return; | |||
} | |||
if (vmesa->TexObjList.prev == &(vmesa->TexObjList)) { | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "Failed to upload texture, sz %d\n", t->totalSize); | |||
#endif | |||
mmDumpMemInfo(vmesa->texHeap); | |||
UNLOCK_HARDWARE(vmesa); | |||
return; | |||
@@ -491,7 +451,5 @@ void viaUploadTexImages(viaContextPtr vmesa, viaTextureObjectPtr t) | |||
t->dirtyImages = 0; | |||
UNLOCK_HARDWARE(vmesa); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} |
@@ -170,9 +170,7 @@ static void viaSetTexImages(viaContextPtr vmesa, | |||
GLuint basH = 0; | |||
GLuint widthExp = 0; | |||
GLuint heightExp = 0; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
switch (baseImage->TexFormat->MesaFormat) { | |||
case MESA_FORMAT_ARGB8888: | |||
if (t->image[tObj->BaseLevel].internalFormat == GL_RGB) | |||
@@ -272,7 +270,6 @@ static void viaSetTexImages(viaContextPtr vmesa, | |||
t->texMem.size = t->totalSize; | |||
t->maxLevel = i - 1; | |||
t->dirty = VIA_UPLOAD_TEX0 | VIA_UPLOAD_TEX1; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) { | |||
fprintf(stderr, "log2Width = %d\n", log2Width); | |||
fprintf(stderr, "log2Height = %d\n", log2Height); | |||
@@ -282,7 +279,6 @@ static void viaSetTexImages(viaContextPtr vmesa, | |||
fprintf(stderr, "actual level = %d\n", t->actualLevel); | |||
fprintf(stderr, "numlevel = %d\n", numLevels); | |||
} | |||
#endif | |||
{ | |||
w = log2Width; | |||
@@ -318,14 +314,12 @@ static void viaSetTexImages(viaContextPtr vmesa, | |||
texBase = (GLuint)vmesa->agpBase + t->texMem.offset + t->image[i].offset; | |||
else | |||
texBase = t->texMem.offset + t->image[i].offset; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) { | |||
fprintf(stderr, "texmem offset = %x\n", t->texMem.offset); | |||
fprintf(stderr, "mipmap%d addr = %x\n", i, t->image[i].offset); | |||
fprintf(stderr, "mipmap%d size = %d, h = %d, w = %d\n", i, (*texSize)[h][w], h, w); | |||
fprintf(stderr, "texBase%d = %x\n", i, texBase); | |||
} | |||
#endif | |||
t->regTexBaseAndPitch[i].baseL = ((HC_SubA_HTXnL0BasL + i) << 24) | (texBase & 0xFFFFFF); | |||
if (p < 5) { | |||
@@ -367,9 +361,7 @@ static void viaSetTexImages(viaContextPtr vmesa, | |||
t->regTexHeightLog2[l] = ((l + HC_SubA_HTXnL0_5HE) << 24 | heightExp); | |||
} | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
/* ================================================================ | |||
@@ -541,9 +533,7 @@ static void viaUpdateTexEnv(GLcontext *ctx, GLuint unit) | |||
const struct gl_texture_object *tObj = texUnit->_Current; | |||
const GLuint format = tObj->Image[0][tObj->BaseLevel]->Format; | |||
GLuint color_combine, alpha_combine; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
switch (texUnit->EnvMode) { | |||
case GL_REPLACE: | |||
if (format == GL_ALPHA) { | |||
@@ -649,18 +639,14 @@ static void viaUpdateTexEnv(GLcontext *ctx, GLuint unit) | |||
default: | |||
return; | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
static void viaUpdateTexUnit(GLcontext *ctx, GLuint unit) | |||
{ | |||
viaContextPtr vmesa = VIA_CONTEXT(ctx); | |||
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
if (texUnit->_ReallyEnabled) { | |||
struct gl_texture_object *tObj = texUnit->_Current; | |||
viaTextureObjectPtr t = (viaTextureObjectPtr)tObj->DriverData; | |||
@@ -704,22 +690,16 @@ static void viaUpdateTexUnit(GLcontext *ctx, GLuint unit) | |||
vmesa->dirty &= ~(VIA_UPLOAD_TEX0 << unit); | |||
VIA_STATECHANGE(vmesa, VIA_UPLOAD_CTX); | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
void viaUpdateTextureState(GLcontext *ctx) | |||
{ | |||
viaContextPtr vmesa = VIA_CONTEXT(ctx); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
FALLBACK(vmesa, VIA_FALLBACK_TEXTURE, GL_FALSE); | |||
viaUpdateTexUnit(ctx, 0); | |||
viaUpdateTexUnit(ctx, 1); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
@@ -78,9 +78,7 @@ static void __inline__ via_draw_triangle(viaContextPtr vmesa, | |||
GLuint *vb = viaCheckDma(vmesa, 3 * 4 * vertsize); | |||
int j; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M; | |||
#endif | |||
@@ -89,9 +87,7 @@ static void __inline__ via_draw_triangle(viaContextPtr vmesa, | |||
COPY_DWORDS(j, vb, vertsize, v2); | |||
vmesa->dmaLow += 3 * 4 * vertsize; | |||
vmesa->primitiveRendered = GL_TRUE; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
@@ -104,9 +100,7 @@ static void __inline__ via_draw_quad(viaContextPtr vmesa, | |||
GLuint vertsize = vmesa->vertexSize; | |||
GLuint *vb = viaCheckDma(vmesa, 6 * 4 * vertsize); | |||
int j; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M; | |||
#endif | |||
@@ -118,9 +112,7 @@ static void __inline__ via_draw_quad(viaContextPtr vmesa, | |||
COPY_DWORDS(j, vb, vertsize, v3); | |||
vmesa->dmaLow += 6 * 4 * vertsize; | |||
vmesa->primitiveRendered = GL_TRUE; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
@@ -132,18 +124,14 @@ static __inline__ void via_draw_point(viaContextPtr vmesa, | |||
/*GLuint *vb = viaCheckDma(vmesa, 2 * 4 * vertsize);*/ | |||
GLuint *vb = viaCheckDma(vmesa, 4 * vertsize); | |||
int j; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M; | |||
#endif | |||
COPY_DWORDS(j, vb, vertsize, v0); | |||
vmesa->dmaLow += 4 * vertsize; | |||
vmesa->primitiveRendered = GL_TRUE; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
@@ -158,9 +146,7 @@ static __inline__ void via_draw_line(viaContextPtr vmesa, | |||
GLuint vertsize = vmesa->vertexSize; | |||
GLuint *vb = viaCheckDma(vmesa, 2 * 4 * vertsize); | |||
int j; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M; | |||
#endif | |||
@@ -168,9 +154,7 @@ static __inline__ void via_draw_line(viaContextPtr vmesa, | |||
COPY_DWORDS(j, vb, vertsize, v1); | |||
vmesa->dmaLow += 2 * 4 * vertsize; | |||
vmesa->primitiveRendered = GL_TRUE; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
@@ -585,9 +569,7 @@ static void viaRenderClippedPoly(GLcontext *ctx, const GLuint *elts, | |||
{ | |||
TNLcontext *tnl = TNL_CONTEXT(ctx); | |||
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M; | |||
#endif | |||
@@ -600,27 +582,21 @@ static void viaRenderClippedPoly(GLcontext *ctx, const GLuint *elts, | |||
PRIM_BEGIN|PRIM_END); | |||
VB->Elts = tmp; | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
static void viaRenderClippedLine(GLcontext *ctx, GLuint ii, GLuint jj) | |||
{ | |||
viaContextPtr vmesa = VIA_CONTEXT(ctx); | |||
TNLcontext *tnl = TNL_CONTEXT(ctx); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M; | |||
#endif | |||
vmesa->primitiveRendered = GL_TRUE; | |||
tnl->Driver.Render.Line(ctx, ii, jj); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
static void viaFastRenderClippedPoly(GLcontext *ctx, const GLuint *elts, | |||
@@ -635,9 +611,7 @@ static void viaFastRenderClippedPoly(GLcontext *ctx, const GLuint *elts, | |||
GLuint *temp1; | |||
GLuint *temp2; | |||
int i,j; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M; | |||
#endif | |||
@@ -655,16 +629,12 @@ static void viaFastRenderClippedPoly(GLcontext *ctx, const GLuint *elts, | |||
temp1 = (GLuint *)V(elts[i - 1]); | |||
COPY_DWORDS(j, vb, vertsize, start); | |||
temp2 = (GLuint *)V(elts[i]); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "start = %d - x = %f, y = %f, z = %f, w = %f, u = %f, v = %f\n", elts[0], *(GLfloat *)&start[0], *(GLfloat *)&start[1], *(GLfloat *)&start[2], *(GLfloat *)&start[3], *(GLfloat *)&start[6], *(GLfloat *)&start[7]); | |||
if (VIA_DEBUG) fprintf(stderr, "%d - x = %f, y = %f, z = %f, w = %f, u = %f, v = %f\n", elts[i - 1], *(GLfloat *)&temp1[0], *(GLfloat *)&temp1[1], *(GLfloat *)&temp1[2], *(GLfloat *)&temp1[3], *(GLfloat *)&temp1[6], *(GLfloat *)&temp1[7]); | |||
if (VIA_DEBUG) fprintf(stderr, "%d - x = %f, y = %f, z = %f, w = %f, u = %f, v = %f\n", elts[i], *(GLfloat *)&temp2[0], *(GLfloat *)&temp2[1], *(GLfloat *)&temp2[2], *(GLfloat *)&temp2[3], *(GLfloat *)&temp2[6], *(GLfloat *)&temp2[7]); | |||
#endif | |||
} | |||
vmesa->dmaLow += (n - 2) * 3 * 4 * vertsize; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
/**********************************************************************/ | |||
@@ -694,11 +664,9 @@ static void viaChooseRenderState(GLcontext *ctx) | |||
viaContextPtr vmesa = VIA_CONTEXT(ctx); | |||
GLuint flags = ctx->_TriangleCaps; | |||
GLuint index = 0; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
if (VIA_DEBUG) fprintf(stderr, "_TriangleCaps = %x\n", flags); | |||
#endif | |||
if (flags & (ANY_FALLBACK_FLAGS|ANY_RASTER_FLAGS)) { | |||
if (flags & ANY_RASTER_FLAGS) { | |||
if (flags & DD_TRI_LIGHT_TWOSIDE) index |= VIA_TWOSIDE_BIT; | |||
@@ -725,21 +693,17 @@ static void viaChooseRenderState(GLcontext *ctx) | |||
index |= VIA_FALLBACK_BIT; | |||
} | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) { | |||
fprintf(stderr, "index = %x\n", index); | |||
fprintf(stderr, "renderIndex = %x\n", vmesa->renderIndex); | |||
} | |||
#endif | |||
if (vmesa->renderIndex != index) { | |||
vmesa->renderIndex = index; | |||
tnl->Driver.Render.Points = rast_tab[index].points; | |||
tnl->Driver.Render.Line = rast_tab[index].line; | |||
tnl->Driver.Render.Triangle = rast_tab[index].triangle; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "tnl->Driver.Render.xxx = rast_tab[index].xxx = %x\n", (unsigned int)tnl->Driver.Render.Triangle); | |||
#endif | |||
tnl->Driver.Render.Quad = rast_tab[index].quad; | |||
if (index == 0) { | |||
@@ -755,9 +719,7 @@ static void viaChooseRenderState(GLcontext *ctx) | |||
tnl->Driver.Render.ClippedPolygon = viaRenderClippedPoly; | |||
} | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
static const GLenum reducedPrim[GL_POLYGON + 1] = { | |||
@@ -780,9 +742,7 @@ static void emit_all_state(viaContextPtr vmesa) | |||
GLuint *vb = viaCheckDma(vmesa, 0x110); | |||
GLuint i = 0; | |||
GLuint j = 0; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M; | |||
#endif | |||
@@ -821,15 +781,11 @@ static void emit_all_state(viaContextPtr vmesa) | |||
/* We haven't support 16bit depth yet */ | |||
format = HC_HZWBFM_16; | |||
/*format = HC_HZWBFM_32;*/ | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "z format = 16\n"); | |||
#endif | |||
} | |||
else { | |||
format = HC_HZWBFM_32; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "z format = 32\n"); | |||
#endif | |||
} | |||
@@ -924,9 +880,7 @@ static void emit_all_state(viaContextPtr vmesa) | |||
*vb++ = (HC_ParaType_Tex << 16) | (HC_SubType_TexGeneral << 24); | |||
if (ctx->Texture._EnabledUnits > 1) { | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "multi texture\n"); | |||
#endif | |||
nDummyValue = (HC_SubA_HTXSMD << 24) | (1 << 3); | |||
if (t && t->needClearCache) { | |||
@@ -939,9 +893,7 @@ static void emit_all_state(viaContextPtr vmesa) | |||
} | |||
} | |||
else { | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "single texture\n"); | |||
#endif | |||
nDummyValue = (HC_SubA_HTXSMD << 24) | 0; | |||
if (t && t->needClearCache) { | |||
@@ -965,12 +917,10 @@ static void emit_all_state(viaContextPtr vmesa) | |||
viaTextureObjectPtr t = (viaTextureObjectPtr)texObj->DriverData; | |||
GLuint numLevels = t->lastLevel - t->firstLevel + 1; | |||
GLuint nDummyValue = 0; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) { | |||
fprintf(stderr, "texture0 enabled\n"); | |||
fprintf(stderr, "texture level %d\n", t->actualLevel); | |||
} | |||
#endif | |||
if (numLevels == 8) { | |||
nDummyValue = t->regTexFM; | |||
*vb++ = HC_HEADER2; | |||
@@ -1097,12 +1047,10 @@ static void emit_all_state(viaContextPtr vmesa) | |||
viaTextureObjectPtr t = (viaTextureObjectPtr)texObj->DriverData; | |||
GLuint numLevels = t->lastLevel - t->firstLevel + 1; | |||
GLuint nDummyValue = 0; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) { | |||
fprintf(stderr, "texture1 enabled\n"); | |||
fprintf(stderr, "texture level %d\n", t->actualLevel); | |||
} | |||
#endif | |||
if (numLevels == 8) { | |||
nDummyValue = t->regTexFM; | |||
*vb++ = HC_HEADER2; | |||
@@ -1270,9 +1218,7 @@ static void emit_all_state(viaContextPtr vmesa) | |||
vmesa->dmaLow += (i << 2); | |||
vmesa->dirty = 0; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
@@ -1283,9 +1229,7 @@ static void emit_partial_state(viaContextPtr vmesa) | |||
GLuint *vb = viaCheckDma(vmesa, 0x110); | |||
GLuint i = 0; | |||
#ifdef DEBUG | |||
if( VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M; | |||
@@ -1367,9 +1311,7 @@ static void emit_partial_state(viaContextPtr vmesa) | |||
vmesa->dmaLow += (i << 2); | |||
vmesa->dirty = 0; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
/**********************************************************************/ | |||
@@ -1388,24 +1330,18 @@ static void viaRenderPrimitive(GLcontext *ctx, GLenum prim) | |||
{ | |||
viaContextPtr vmesa = VIA_CONTEXT(ctx); | |||
GLuint rprim = reducedPrim[prim]; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
vmesa->renderPrimitive = prim; | |||
viaRasterPrimitive(ctx, rprim, rprim); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
static void viaRunPipeline(GLcontext *ctx) | |||
{ | |||
viaContextPtr vmesa = VIA_CONTEXT(ctx); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
if (VIA_DEBUG) fprintf(stderr, "newState = %x\n", vmesa->newState); | |||
#endif | |||
if (vmesa->newState) { | |||
if (vmesa->newState & _NEW_TEXTURE) | |||
@@ -1422,36 +1358,26 @@ static void viaRunPipeline(GLcontext *ctx) | |||
emit_partial_state(vmesa); | |||
_tnl_run_pipeline(ctx); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
static void viaRenderStart(GLcontext *ctx) | |||
{ | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
/* Check for projective texturing. Make sure all texcoord | |||
* pointers point to something. (fix in mesa?) | |||
*/ | |||
viaCheckTexSizes(ctx); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
static void viaRenderFinish(GLcontext *ctx) | |||
{ | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
if (VIA_CONTEXT(ctx)->renderIndex & VIA_FALLBACK_BIT) | |||
_swrast_flush(ctx); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
@@ -1465,12 +1391,10 @@ void viaRasterPrimitive(GLcontext *ctx, | |||
viaContextPtr vmesa = VIA_CONTEXT(ctx); | |||
GLuint *vb = viaCheckDma(vmesa, 32); | |||
GLuint regCmdB; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) { | |||
fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
fprintf(stderr, "hwprim = %x\n", hwprim); | |||
} | |||
#endif | |||
/*=* [DBG] exy : fix wireframe + clipping error *=*/ | |||
if (((rprim == GL_TRIANGLES && (ctx->_TriangleCaps & DD_TRI_UNFILLED)))) { | |||
hwprim = GL_LINES; | |||
@@ -1478,9 +1402,7 @@ void viaRasterPrimitive(GLcontext *ctx, | |||
if (RasterCounter > 0) { | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "enter twice:%d\n",RasterCounter); | |||
#endif | |||
RasterCounter++; | |||
return; | |||
} | |||
@@ -1491,26 +1413,20 @@ void viaRasterPrimitive(GLcontext *ctx, | |||
switch (hwprim) { | |||
case GL_POINTS: | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "Points\n"); | |||
#endif | |||
vmesa->regCmdA_End = vmesa->regCmdA | HC_HPMType_Point | HC_HVCycle_Full; | |||
if (ctx->Light.ShadeModel == GL_FLAT) | |||
vmesa->regCmdA_End |= HC_HShading_FlatA; | |||
break; | |||
case GL_LINES: | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "Lines\n"); | |||
#endif | |||
vmesa->regCmdA_End = vmesa->regCmdA | HC_HPMType_Line | HC_HVCycle_Full; | |||
if (ctx->Light.ShadeModel == GL_FLAT) | |||
vmesa->regCmdA_End |= HC_HShading_FlatB; | |||
break; | |||
case GL_LINE_LOOP: | |||
case GL_LINE_STRIP: | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "Line Loop / Line Strip\n"); | |||
#endif | |||
vmesa->regCmdA_End = vmesa->regCmdA | HC_HPMType_Line | HC_HVCycle_AFP | | |||
HC_HVCycle_AB | HC_HVCycle_NewB; | |||
regCmdB |= HC_HVCycle_AB | HC_HVCycle_NewB | HC_HLPrst_MASK; | |||
@@ -1518,17 +1434,13 @@ void viaRasterPrimitive(GLcontext *ctx, | |||
vmesa->regCmdA_End |= HC_HShading_FlatB; | |||
break; | |||
case GL_TRIANGLES: | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "Triangles\n"); | |||
#endif | |||
vmesa->regCmdA_End = vmesa->regCmdA | HC_HPMType_Tri | HC_HVCycle_Full; | |||
if (ctx->Light.ShadeModel == GL_FLAT) | |||
vmesa->regCmdA_End |= HC_HShading_FlatC; | |||
break; | |||
case GL_TRIANGLE_STRIP: | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "Triangle Strip\n"); | |||
#endif | |||
vmesa->regCmdA_End = vmesa->regCmdA | HC_HPMType_Tri | HC_HVCycle_AFP | | |||
HC_HVCycle_AC | HC_HVCycle_BB | HC_HVCycle_NewC; | |||
regCmdB |= HC_HVCycle_AA | HC_HVCycle_BC | HC_HVCycle_NewC; | |||
@@ -1536,9 +1448,7 @@ void viaRasterPrimitive(GLcontext *ctx, | |||
vmesa->regCmdA_End |= HC_HShading_FlatB; | |||
break; | |||
case GL_TRIANGLE_FAN: | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "Triangle Fan\n"); | |||
#endif | |||
vmesa->regCmdA_End = vmesa->regCmdA | HC_HPMType_Tri | HC_HVCycle_AFP | | |||
HC_HVCycle_AA | HC_HVCycle_BC | HC_HVCycle_NewC; | |||
regCmdB |= HC_HVCycle_AA | HC_HVCycle_BC | HC_HVCycle_NewC; | |||
@@ -1546,19 +1456,13 @@ void viaRasterPrimitive(GLcontext *ctx, | |||
vmesa->regCmdA_End |= HC_HShading_FlatC; | |||
break; | |||
case GL_QUADS: | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "No HW Quads\n"); | |||
#endif | |||
return; | |||
case GL_QUAD_STRIP: | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "No HW Quad Strip\n"); | |||
#endif | |||
return; | |||
case GL_POLYGON: | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "Polygon\n"); | |||
#endif | |||
vmesa->regCmdA_End = vmesa->regCmdA | HC_HPMType_Tri | HC_HVCycle_AFP | | |||
HC_HVCycle_AA | HC_HVCycle_BC | HC_HVCycle_NewC; | |||
regCmdB |= HC_HVCycle_AA | HC_HVCycle_BC | HC_HVCycle_NewC; | |||
@@ -1566,9 +1470,7 @@ void viaRasterPrimitive(GLcontext *ctx, | |||
vmesa->regCmdA_End |= HC_HShading_FlatC; | |||
break; | |||
default: | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "Unknow\n"); | |||
#endif | |||
return; | |||
} | |||
@@ -1585,24 +1487,18 @@ void viaRasterPrimitive(GLcontext *ctx, | |||
vmesa->reducedPrimitive = rprim; | |||
vmesa->hwPrimitive = rprim; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
void viaRasterPrimitiveFinish(GLcontext *ctx) | |||
{ | |||
viaContextPtr vmesa = VIA_CONTEXT(ctx); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
if (VIA_DEBUG) fprintf(stderr, "primitiveRendered = %x\n", vmesa->primitiveRendered); | |||
#endif | |||
if (RasterCounter > 1) { | |||
RasterCounter--; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "finish enter twice: %d\n",RasterCounter); | |||
#endif | |||
return; | |||
} | |||
RasterCounter = 0; | |||
@@ -1646,9 +1542,7 @@ void viaRasterPrimitiveFinish(GLcontext *ctx) | |||
} | |||
#endif | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
@@ -1662,17 +1556,13 @@ void viaFallback(viaContextPtr vmesa, GLuint bit, GLboolean mode) | |||
GLcontext *ctx = vmesa->glCtx; | |||
TNLcontext *tnl = TNL_CONTEXT(ctx); | |||
GLuint oldfallback = vmesa->Fallback; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s old %x bit %x mode %d\n", __FUNCTION__, | |||
vmesa->Fallback, bit, mode); | |||
#endif | |||
if (mode) { | |||
vmesa->Fallback |= bit; | |||
if (oldfallback == 0) { | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "ENTER FALLBACK\n"); | |||
#endif | |||
VIA_FIREVERTICES(vmesa); | |||
_swsetup_Wakeup(ctx); | |||
vmesa->renderIndex = ~0; | |||
@@ -1681,9 +1571,7 @@ void viaFallback(viaContextPtr vmesa, GLuint bit, GLboolean mode) | |||
else { | |||
vmesa->Fallback &= ~bit; | |||
if (oldfallback == bit) { | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "LEAVE FALLBACK\n"); | |||
#endif | |||
tnl->Driver.Render.Start = viaRenderStart; | |||
tnl->Driver.Render.PrimitiveNotify = viaRenderPrimitive; | |||
tnl->Driver.Render.Finish = viaRenderFinish; |
@@ -230,7 +230,6 @@ static void init_setup_tab(void) { | |||
} | |||
void viaPrintSetupFlags(char *msg, GLuint flags) { | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s(%x): %s%s%s%s%s%s\n", | |||
msg, | |||
(int)flags, | |||
@@ -240,18 +239,15 @@ void viaPrintSetupFlags(char *msg, GLuint flags) { | |||
(flags & VIA_FOG_BIT) ? " fog," : "", | |||
(flags & VIA_TEX0_BIT) ? " tex-0," : "", | |||
(flags & VIA_TEX1_BIT) ? " tex-1," : ""); | |||
#endif | |||
} | |||
void viaCheckTexSizes(GLcontext *ctx) { | |||
TNLcontext *tnl = TNL_CONTEXT(ctx); | |||
viaContextPtr vmesa = VIA_CONTEXT(ctx); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) { | |||
fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
fprintf(stderr, "setupIndex = %x\n", vmesa->setupIndex); | |||
} | |||
#endif | |||
if (!setup_tab[vmesa->setupIndex].check_tex_sizes(ctx)) { | |||
/* Invalidate stored verts | |||
*/ | |||
@@ -264,9 +260,7 @@ void viaCheckTexSizes(GLcontext *ctx) { | |||
tnl->Driver.Render.CopyPV = setup_tab[vmesa->setupIndex].copyPv; | |||
} | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
void viaBuildVertices(GLcontext *ctx, | |||
@@ -277,9 +271,7 @@ void viaBuildVertices(GLcontext *ctx, | |||
viaContextPtr vmesa = VIA_CONTEXT(ctx); | |||
GLubyte *v = ((GLubyte *)vmesa->verts + (start << vmesa->vertexStrideShift)); | |||
GLuint stride = 1 << vmesa->vertexStrideShift; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
newinputs |= vmesa->setupNewInputs; | |||
vmesa->setupNewInputs = 0; | |||
if (!newinputs) | |||
@@ -315,18 +307,14 @@ void viaBuildVertices(GLcontext *ctx, | |||
setup_tab[ind].emit(ctx, start, count, v, stride); | |||
} | |||
} | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
void viaChooseVertexState(GLcontext *ctx) { | |||
TNLcontext *tnl = TNL_CONTEXT(ctx); | |||
viaContextPtr vmesa = VIA_CONTEXT(ctx); | |||
GLuint ind = VIA_XYZW_BIT | VIA_RGBA_BIT; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) | |||
ind |= VIA_SPEC_BIT; | |||
@@ -339,9 +327,7 @@ void viaChooseVertexState(GLcontext *ctx) { | |||
ind |= VIA_TEX0_BIT; | |||
vmesa->setupIndex = ind; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "setupIndex = %x\n", vmesa->setupIndex); | |||
#endif | |||
if (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED)) { | |||
tnl->Driver.Render.Interp = via_interp_extras; | |||
@@ -354,9 +340,7 @@ void viaChooseVertexState(GLcontext *ctx) { | |||
vmesa->vertexSize = setup_tab[ind].vertexSize; | |||
vmesa->vertexStrideShift = setup_tab[ind].vertexStrideShift; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
@@ -366,16 +350,12 @@ void via_emit_contiguous_verts(GLcontext *ctx, | |||
viaContextPtr vmesa = VIA_CONTEXT(ctx); | |||
GLuint vertexSize = vmesa->vertexSize * 4; | |||
GLuint *dest = viaCheckDma(vmesa, (count - start) * vertexSize); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
if (VIA_DEBUG) fprintf(stderr, "choose setup_tab[0x%x]\n", vmesa->setupIndex); | |||
#endif | |||
setup_tab[vmesa->setupIndex].emit(ctx, start, count, dest, vertexSize); | |||
vmesa->dmaLow += (count - start) * vertexSize; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
void viaInitVB(GLcontext *ctx) { |
@@ -122,9 +122,7 @@ TAG(clip_line)(GLcontext *ctx, GLuint i, GLuint j, GLubyte mask) | |||
tnl_interp_func interp = tnl->Driver.Render.Interp; | |||
GLfloat (*coord)[4] = VB->ClipPtr->data; | |||
GLuint ii = i, jj = j, p; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M; | |||
#endif | |||
@@ -155,9 +153,7 @@ TAG(clip_line)(GLcontext *ctx, GLuint i, GLuint j, GLubyte mask) | |||
tnl->Driver.Render.CopyPV(ctx, jj, j); | |||
tnl->Driver.Render.ClippedLine(ctx, ii, jj); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
@@ -232,9 +228,7 @@ TAG(clip_quad)(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3, | |||
GLuint p; | |||
GLubyte *clipmask = VB->ClipMask; | |||
GLuint n = 4; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M; | |||
#endif | |||
@@ -271,9 +265,7 @@ TAG(clip_quad)(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3, | |||
} | |||
tnl->Driver.Render.ClippedPolygon(ctx, inlist, n); | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
#undef W |
@@ -105,9 +105,7 @@ static void TAG(render_line_strip)(GLcontext *ctx, | |||
GLuint j; | |||
LOCAL_VARS; | |||
(void)flags; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M; | |||
#endif | |||
@@ -122,9 +120,7 @@ static void TAG(render_line_strip)(GLcontext *ctx, | |||
RENDER_LINE(ELT(j - 1), ELT(j)); | |||
POSTFIX; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
static void TAG(render_line_loop)(GLcontext *ctx, | |||
@@ -135,9 +131,7 @@ static void TAG(render_line_loop)(GLcontext *ctx, | |||
GLuint i; | |||
LOCAL_VARS; | |||
(void)flags; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M; | |||
#endif | |||
@@ -160,9 +154,7 @@ static void TAG(render_line_loop)(GLcontext *ctx, | |||
} | |||
POSTFIX; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
static void TAG(render_triangles)(GLcontext *ctx, | |||
@@ -173,9 +165,7 @@ static void TAG(render_triangles)(GLcontext *ctx, | |||
GLuint j; | |||
LOCAL_VARS; | |||
(void)flags; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M; | |||
#endif | |||
@@ -194,9 +184,7 @@ static void TAG(render_triangles)(GLcontext *ctx, | |||
} | |||
} | |||
POSTFIX; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
static void TAG(render_tri_strip)(GLcontext *ctx, | |||
@@ -207,9 +195,7 @@ static void TAG(render_tri_strip)(GLcontext *ctx, | |||
GLuint j; | |||
GLuint parity = 0; | |||
LOCAL_VARS; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M; | |||
#endif | |||
@@ -241,9 +227,7 @@ static void TAG(render_tri_strip)(GLcontext *ctx, | |||
} | |||
} | |||
POSTFIX; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
static void TAG(render_tri_fan)(GLcontext *ctx, | |||
@@ -254,9 +238,7 @@ static void TAG(render_tri_fan)(GLcontext *ctx, | |||
GLuint j; | |||
LOCAL_VARS; | |||
(void)flags; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M; | |||
#endif | |||
@@ -290,9 +272,7 @@ static void TAG(render_tri_fan)(GLcontext *ctx, | |||
} | |||
POSTFIX; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
static void TAG(render_poly)(GLcontext *ctx, | |||
@@ -303,9 +283,7 @@ static void TAG(render_poly)(GLcontext *ctx, | |||
GLuint j = start + 2; | |||
LOCAL_VARS; | |||
(void)flags; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M; | |||
#endif | |||
@@ -370,9 +348,7 @@ static void TAG(render_poly)(GLcontext *ctx, | |||
} | |||
} | |||
POSTFIX; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
static void TAG(render_quads)(GLcontext *ctx, | |||
@@ -383,9 +359,7 @@ static void TAG(render_quads)(GLcontext *ctx, | |||
GLuint j; | |||
LOCAL_VARS; | |||
(void)flags; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M; | |||
#endif | |||
@@ -404,9 +378,7 @@ static void TAG(render_quads)(GLcontext *ctx, | |||
} | |||
} | |||
POSTFIX; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
static void TAG(render_quad_strip)(GLcontext *ctx, | |||
@@ -417,9 +389,7 @@ static void TAG(render_quad_strip)(GLcontext *ctx, | |||
GLuint j; | |||
LOCAL_VARS; | |||
(void)flags; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__); | |||
#endif | |||
#ifdef PERFORMANCE_MEASURE | |||
if (VIA_PERFORMANCE) P_M; | |||
#endif | |||
@@ -453,9 +423,7 @@ static void TAG(render_quad_strip)(GLcontext *ctx, | |||
} | |||
} | |||
POSTFIX; | |||
#ifdef DEBUG | |||
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__); | |||
#endif | |||
} | |||
static void TAG(render_noop)(GLcontext *ctx, |