Remove the VIA_PERFORMANCE code. A step towards moving the driver

back to using the shared template files.
This commit is contained in:
Keith Whitwell 2004-12-23 18:26:40 +00:00
parent 9876730f7a
commit 3deaf21745
8 changed files with 1 additions and 226 deletions

View file

@ -69,12 +69,7 @@
GLuint VIA_DEBUG = 0;
#endif
#define DMA_SIZE 2
GLuint VIA_PERFORMANCE = 0;
#ifdef PERFORMANCE_MEASURE
GLuint busy = 0;
GLuint idle = 0;
hash_element hash_table[HASH_TABLE_SIZE][HASH_TABLE_DEPTH];
#endif
/*=* John Sheng [2003.5.31] agp tex *=*/
static GLboolean
@ -557,22 +552,6 @@ viaCreateContext(const __GLcontextModes *mesaVis,
FALLBACK(vmesa, VIA_FALLBACK_USER_DISABLE, 1);
#ifdef PERFORMANCE_MEASURE
if (getenv("VIA_PERFORMANCE"))
VIA_PERFORMANCE = 1;
else
VIA_PERFORMANCE = 0;
{
int i, j;
for (i = 0; i < HASH_TABLE_SIZE; i++) {
for (j = 0; j < HASH_TABLE_DEPTH; j ++) {
hash_table[i][j].count = 0;
sprintf(hash_table[i][j].func, "%s", "NULL");
}
}
}
#endif
/* I don't understand why this isn't working:
*/
@ -639,12 +618,6 @@ viaDestroyContext(__DRIcontextPrivate *driContextPriv)
FREE(vmesa);
}
P_M_R;
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) fprintf(stderr, "idle = %d\n", idle);
if (VIA_PERFORMANCE) fprintf(stderr, "busy = %d\n", busy);
#endif
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
}

View file

@ -291,70 +291,7 @@ struct via_context_t {
};
/*#define DMA_OFFSET 16*/
#define DMA_OFFSET 32
/*#define PERFORMANCE_MEASURE*/
extern GLuint VIA_PERFORMANCE;
#ifdef PERFORMANCE_MEASURE
#define HASH_TABLE_SIZE 1000
#define HASH_TABLE_DEPTH 10
typedef struct {
char func[50];
GLuint count;
} hash_element;
extern hash_element hash_table[HASH_TABLE_SIZE][HASH_TABLE_DEPTH];
#define P_M \
do { \
GLuint h_index,h_depth; \
h_index = (GLuint)(((GLuint) __FUNCTION__)%HASH_TABLE_SIZE); \
for (h_depth = 0; h_depth < HASH_TABLE_DEPTH; h_depth++) { \
if (!strcmp(hash_table[h_index][h_depth].func, "NULL")) { \
sprintf(hash_table[h_index][h_depth].func, "%s", __FUNCTION__); \
hash_table[h_index][h_depth].count++; \
break; \
} \
else if (!strcmp(hash_table[h_index][h_depth].func, __FUNCTION__)) { \
hash_table[h_index][h_depth].count++; \
break; \
} \
} \
} while (0)
#define P_M_X \
do { \
GLuint h_index,h_depth; \
char str[80]; \
strcpy(str, __FUNCTION__); \
h_index = (GLuint)(((GLuint) __FUNCTION__)%HASH_TABLE_SIZE); \
for (h_depth = 0; h_depth < HASH_TABLE_DEPTH; h_depth++) { \
if (!strcmp(hash_table[h_index][h_depth].func, "NULL")) { \
sprintf(hash_table[h_index][h_depth].func, "%s_X", __FUNCTION__); \
hash_table[h_index][h_depth].count++; \
break; \
} \
else if (!strcmp(hash_table[h_index][h_depth].func, strcat(str, "_X"))) { \
hash_table[h_index][h_depth].count++; \
break; \
} \
} \
} while (0)
#define P_M_R \
do { \
GLuint h_size, h_depth; \
for (h_size = 0; h_size < HASH_TABLE_SIZE; h_size++) { \
for (h_depth = 0; h_depth < HASH_TABLE_DEPTH; h_depth++) { \
if (hash_table[h_size][h_depth].count) { \
fprintf(stderr, "func:%s count:%d\n", hash_table[h_size][h_depth].func, hash_table[h_size][h_depth].count); \
} \
} \
} \
} while (0)
#else /* PERFORMANCE_MEASURE */
#define P_M {}
#define P_M_X {}
#define P_M_R {}
#endif
#define VIA_CONTEXT(ctx) ((viaContextPtr)(ctx->DriverCtx))

View file

@ -77,9 +77,6 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2)
LOCAL_VARS(3);
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M;
#endif
v[0] = (VERTEX *)GET_VERTEX(e0);
v[1] = (VERTEX *)GET_VERTEX(e1);
@ -308,9 +305,6 @@ static void TAG(quad)(GLcontext *ctx,
GLuint facing;
LOCAL_VARS(4);
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M;
#endif
v[0] = (VERTEX *)GET_VERTEX(e0);
v[1] = (VERTEX *)GET_VERTEX(e1);
v[2] = (VERTEX *)GET_VERTEX(e2);
@ -554,9 +548,6 @@ static void TAG(quad)(GLcontext *ctx, GLuint e0,
GLuint e1, GLuint e2, GLuint e3)
{
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M;
#endif
if (DO_UNFILLED) {
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
GLubyte ef1 = VB->EdgeFlag[e1];
@ -584,9 +575,6 @@ static void TAG(line)(GLcontext *ctx, GLuint e0, GLuint e1)
VERTEX *v[2];
LOCAL_VARS(2);
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M;
#endif
v[0] = (VERTEX *)GET_VERTEX(e0);
v[1] = (VERTEX *)GET_VERTEX(e1);
@ -631,9 +619,6 @@ static void TAG(points)(GLcontext *ctx, GLuint first, GLuint last)
int i;
LOCAL_VARS(1);
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M;
#endif
if (VB->Elts == 0) {
for (i = first; i < last; i++) {
if (VB->ClipMask[i] == 0) {

View file

@ -74,9 +74,6 @@ static void TAG(render_points_verts)(GLcontext *ctx,
GLuint count,
GLuint flags)
{
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M_X;
#endif
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__);
if (HAVE_POINTS) {
LOCAL_VARS;
@ -108,9 +105,6 @@ static void TAG(render_lines_verts)(GLcontext *ctx,
GLuint count,
GLuint flags)
{
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M_X;
#endif
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__);
if (HAVE_LINES) {
LOCAL_VARS;
@ -149,9 +143,6 @@ static void TAG(render_line_strip_verts)(GLcontext *ctx,
GLuint count,
GLuint flags)
{
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M_X;
#endif
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__);
if (HAVE_LINE_STRIPS) {
LOCAL_VARS;
@ -184,9 +175,6 @@ static void TAG(render_line_loop_verts)(GLcontext *ctx,
GLuint count,
GLuint flags)
{
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M_X;
#endif
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__);
if (HAVE_LINE_STRIPS) {
LOCAL_VARS;
@ -237,9 +225,6 @@ static void TAG(render_triangles_verts)(GLcontext *ctx,
int currentsz = (GET_CURRENT_VB_MAX_VERTS() / 3) * 3;
GLuint j, nr;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M_X;
#endif
INIT(GL_TRIANGLES);
/* Emit whole number of tris in total. dmasz is already a multiple
@ -265,9 +250,6 @@ static void TAG(render_tri_strip_verts)(GLcontext *ctx,
GLuint count,
GLuint flags)
{
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M_X;
#endif
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__);
if (HAVE_TRI_STRIPS) {
LOCAL_VARS;
@ -307,9 +289,6 @@ static void TAG(render_tri_fan_verts)(GLcontext *ctx,
GLuint flags)
{
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M_X;
#endif
if (HAVE_TRI_FANS) {
LOCAL_VARS;
GLuint j, nr;
@ -347,9 +326,6 @@ static void TAG(render_poly_verts)(GLcontext *ctx,
GLuint count,
GLuint flags)
{
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M_X;
#endif
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__);
if (HAVE_POLYGONS) {
LOCAL_VARS;
@ -388,9 +364,6 @@ static void TAG(render_quad_strip_verts)(GLcontext *ctx,
GLuint flags)
{
GLuint j, nr;
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M_X;
#endif
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__);
if (HAVE_QUAD_STRIPS) {
LOCAL_VARS;
@ -459,9 +432,6 @@ static void TAG(render_quads_verts)(GLcontext *ctx,
GLuint flags)
{
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M_X;
#endif
if (HAVE_QUADS) {
LOCAL_VARS;
int dmasz = (GET_SUBSEQUENT_VB_MAX_VERTS() / 4) * 4;

View file

@ -141,10 +141,6 @@ static GLboolean via_run_fastrender(GLcontext *ctx,
/* Don't handle clipping or indexed vertices.
*/
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M;
#endif
if (VB->ClipOrMask || vmesa->renderIndex != 0 || VB->Elts) {
if (VIA_DEBUG) {
fprintf(stderr, "slow path\n");
@ -352,9 +348,6 @@ static void clip_elt_triangles(GLcontext *ctx,
GLuint last = count-2;
GLuint j;
(void)flags;
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M;
#endif
tnl->Driver.Render.PrimitiveNotify(ctx, GL_TRIANGLES);
for (j = start; j < last; j += 3) {
@ -417,9 +410,6 @@ static GLboolean via_run_render(GLcontext *ctx,
GLuint pass = 0;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M;
#endif
tnl->Driver.Render.Start(ctx);
tnl->Driver.Render.BuildVertices(ctx, 0, VB->Count, newInputs);
if (VB->ClipOrMask) {

View file

@ -79,9 +79,6 @@ static void __inline__ via_draw_triangle(viaContextPtr vmesa,
int j;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M;
#endif
COPY_DWORDS(j, vb, vertsize, v0);
COPY_DWORDS(j, vb, vertsize, v1);
COPY_DWORDS(j, vb, vertsize, v2);
@ -101,9 +98,6 @@ static void __inline__ via_draw_quad(viaContextPtr vmesa,
GLuint *vb = viaCheckDma(vmesa, 6 * 4 * vertsize);
int j;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M;
#endif
COPY_DWORDS(j, vb, vertsize, v0);
COPY_DWORDS(j, vb, vertsize, v1);
COPY_DWORDS(j, vb, vertsize, v3);
@ -125,9 +119,6 @@ static __inline__ void via_draw_point(viaContextPtr vmesa,
GLuint *vb = viaCheckDma(vmesa, 4 * vertsize);
int j;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M;
#endif
COPY_DWORDS(j, vb, vertsize, v0);
vmesa->dmaLow += 4 * vertsize;
vmesa->primitiveRendered = GL_TRUE;
@ -147,9 +138,6 @@ static __inline__ void via_draw_line(viaContextPtr vmesa,
GLuint *vb = viaCheckDma(vmesa, 2 * 4 * vertsize);
int j;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M;
#endif
COPY_DWORDS(j, vb, vertsize, v0);
COPY_DWORDS(j, vb, vertsize, v1);
vmesa->dmaLow += 2 * 4 * vertsize;
@ -425,9 +413,6 @@ via_fallback_tri(viaContextPtr vmesa,
{
GLcontext *ctx = vmesa->glCtx;
SWvertex v[3];
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M;
#endif
via_translate_vertex(ctx, v0, &v[0]);
via_translate_vertex(ctx, v1, &v[1]);
via_translate_vertex(ctx, v2, &v[2]);
@ -442,9 +427,6 @@ via_fallback_line(viaContextPtr vmesa,
{
GLcontext *ctx = vmesa->glCtx;
SWvertex v[2];
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M;
#endif
via_translate_vertex(ctx, v0, &v[0]);
via_translate_vertex(ctx, v1, &v[1]);
_swrast_Line(ctx, &v[0], &v[1]);
@ -457,9 +439,6 @@ via_fallback_point(viaContextPtr vmesa,
{
GLcontext *ctx = vmesa->glCtx;
SWvertex v[1];
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M;
#endif
via_translate_vertex(ctx, v0, &v[0]);
_swrast_Point(ctx, &v[0]);
}
@ -570,9 +549,6 @@ static void viaRenderClippedPoly(GLcontext *ctx, const GLuint *elts,
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M;
#endif
/* Render the new vertices as an unclipped polygon.
*/
{
@ -590,9 +566,6 @@ static void viaRenderClippedLine(GLcontext *ctx, GLuint ii, GLuint jj)
viaContextPtr vmesa = VIA_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M;
#endif
vmesa->primitiveRendered = GL_TRUE;
tnl->Driver.Render.Line(ctx, ii, jj);
@ -612,9 +585,6 @@ static void viaFastRenderClippedPoly(GLcontext *ctx, const GLuint *elts,
GLuint *temp2;
int i,j;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M;
#endif
vmesa->primitiveRendered = GL_TRUE;
for (i = 2; i < n; i++) {
@ -743,9 +713,6 @@ static void emit_all_state(viaContextPtr vmesa)
GLuint i = 0;
GLuint j = 0;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M;
#endif
*vb++ = HC_HEADER2;
*vb++ = (HC_ParaType_NotTex << 16);
@ -1413,16 +1380,8 @@ void viaRasterPrimitiveFinish(GLcontext *ctx)
volatile GLuint *pnEngBase = (volatile GLuint *)((GLuint)pnMMIOBase + 0x400);
int nStatus = *pnEngBase;
if (((nStatus & 0xFFFEFFFF) == 0x00020000)) {
#ifdef PERFORMANCE_MEASURE
idle++;
#endif
viaFlushPrims(vmesa);
}
#ifdef PERFORMANCE_MEASURE
else {
busy++;
}
#endif
}
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
}

View file

@ -123,9 +123,6 @@ TAG(clip_line)(GLcontext *ctx, GLuint i, GLuint j, GLubyte mask)
GLfloat (*coord)[4] = VB->ClipPtr->data;
GLuint ii = i, jj = j, p;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M;
#endif
VB->LastClipped = VB->Count;
if (mask & 0x3f) {
@ -173,9 +170,6 @@ TAG(clip_tri)(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLubyte mask)
GLubyte *clipmask = VB->ClipMask;
GLuint n = 3;
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M;
#endif
ASSIGN_3V(inlist, v2, v0, v1); /* pv rotated to slot zero */
VB->LastClipped = VB->Count;
@ -229,9 +223,6 @@ TAG(clip_quad)(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3,
GLubyte *clipmask = VB->ClipMask;
GLuint n = 4;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M;
#endif
ASSIGN_4V(inlist, v3, v0, v1, v2); /* pv rotated to slot zero */
VB->LastClipped = VB->Count;

View file

@ -66,9 +66,6 @@ static void TAG(render_points)(GLcontext *ctx,
{
LOCAL_VARS;
(void)flags;
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M;
#endif
RESET_OCCLUSION;
INIT(GL_POINTS);
@ -85,9 +82,6 @@ static void TAG(render_lines)(GLcontext *ctx,
LOCAL_VARS;
(void)flags;
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M;
#endif
RESET_OCCLUSION;
INIT(GL_LINES);
for (j = start + 1; j < count; j += 2) {
@ -106,9 +100,6 @@ static void TAG(render_line_strip)(GLcontext *ctx,
LOCAL_VARS;
(void)flags;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M;
#endif
RESET_OCCLUSION;
INIT(GL_LINES);
@ -132,9 +123,6 @@ static void TAG(render_line_loop)(GLcontext *ctx,
LOCAL_VARS;
(void)flags;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M;
#endif
RESET_OCCLUSION;
INIT(GL_LINES);
@ -166,9 +154,6 @@ static void TAG(render_triangles)(GLcontext *ctx,
LOCAL_VARS;
(void)flags;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M;
#endif
INIT(GL_TRIANGLES);
if (NEED_EDGEFLAG_SETUP) {
for (j = start + 2; j < count; j += 3) {
@ -196,9 +181,6 @@ static void TAG(render_tri_strip)(GLcontext *ctx,
GLuint parity = 0;
LOCAL_VARS;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M;
#endif
INIT(GL_TRIANGLES);
if (NEED_EDGEFLAG_SETUP) {
@ -239,9 +221,6 @@ static void TAG(render_tri_fan)(GLcontext *ctx,
LOCAL_VARS;
(void)flags;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M;
#endif
INIT(GL_TRIANGLES);
if (NEED_EDGEFLAG_SETUP) {
for (j = start + 2; j < count; j++) {
@ -284,9 +263,6 @@ static void TAG(render_poly)(GLcontext *ctx,
LOCAL_VARS;
(void)flags;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M;
#endif
INIT(GL_TRIANGLES);
if (NEED_EDGEFLAG_SETUP) {
@ -360,9 +336,6 @@ static void TAG(render_quads)(GLcontext *ctx,
LOCAL_VARS;
(void)flags;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M;
#endif
INIT(GL_TRIANGLES);
if (NEED_EDGEFLAG_SETUP) {
for (j = start + 3; j < count; j += 4) {
@ -390,9 +363,6 @@ static void TAG(render_quad_strip)(GLcontext *ctx,
LOCAL_VARS;
(void)flags;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M;
#endif
INIT(GL_TRIANGLES);
if (NEED_EDGEFLAG_SETUP) {
for (j = start + 3; j < count; j += 2) {