From 5df82c82bd53db90eb72c5aad4dd20cf6f1116b1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 22 Aug 2003 20:11:43 +0000 Subject: patch to import Jon Smirl's work from Bitkeeper --- src/mesa/drivers/dri/r200/Makefile.X11 | 16 ++++---- src/mesa/drivers/dri/r200/r200_context.c | 5 ++- src/mesa/drivers/dri/r200/r200_context.h | 2 +- src/mesa/drivers/dri/r200/r200_ioctl.c | 6 +-- src/mesa/drivers/dri/r200/r200_swtcl.c | 4 +- src/mesa/drivers/dri/r200/r200_tcl.c | 68 +++++++++++--------------------- 6 files changed, 41 insertions(+), 60 deletions(-) (limited to 'src/mesa/drivers/dri/r200') diff --git a/src/mesa/drivers/dri/r200/Makefile.X11 b/src/mesa/drivers/dri/r200/Makefile.X11 index b182ba559a..f1887b5914 100644 --- a/src/mesa/drivers/dri/r200/Makefile.X11 +++ b/src/mesa/drivers/dri/r200/Makefile.X11 @@ -1,4 +1,4 @@ -# $Id: Makefile.X11,v 1.1 2003/08/06 17:59:57 keithw Exp $ +# $Id: Makefile.X11,v 1.2 2003/08/22 20:11:45 brianp Exp $ # Mesa 3-D graphics library # Version: 5.0 @@ -6,8 +6,10 @@ TOP = ../../../../.. +default: linux-solo + SHARED_INCLUDES = $(INCLUDE_DIRS) -I. -I../common -Iserver -MINIGLX_INCLUDES = -I$(TOP)/src/miniglx +MINIGLX_INCLUDES = -I$(TOP)/src/glx/mini DEFINES += \ -D_HAVE_SWRAST=1 \ @@ -62,7 +64,7 @@ WINOBJ=$(MESABUILDDIR)/dri/dri.a WINLIB= else WINOBJ= -WINLIB=-L$(MESA)/src/miniglx +WINLIB=-L$(MESA)/src/glx/mini endif ASM_SOURCES = @@ -107,7 +109,7 @@ INCLUDE_DIRS = \ ##### TARGETS ##### -targets: r200_dri.so +targets: depend r200_dri.so r200_dri.so: $(SYMLINKS) $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile.X11 rm -f $@ && gcc -o $@ -shared $(OBJECTS) $(MESA_MODULES) $(WINOBJ) $(WINLIB) -lc $(GL_LIB_DEPS) @@ -116,8 +118,8 @@ r200_dri.so: $(SYMLINKS) $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile.X11 # Run 'make -f Makefile.X11 dep' to update the dependencies if you change # what's included by any source file. -dep: $(C_SOURCES) $(ASM_SOURCES) - makedepend -fdepend -Y $(SHARED_INCLUDES) \ +depend: $(C_SOURCES) $(ASM_SOURCES) + makedepend -fdepend -Y $(SHARED_INCLUDES) $(MINIGLX_INCLUDES) \ $(C_SOURCES) $(ASM_SOURCES) @@ -128,7 +130,7 @@ tags: # Remove .o and backup files clean: - -rm -f *.o *~ *.o *~ *.so + -rm -f *.o */*.o *~ *.o *~ *.so server/*.o include $(TOP)/Make-config diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index c5f23effab..ec95f05e6e 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -492,8 +492,9 @@ void r200DestroyContext( __DRIcontextPrivate *driContextPriv ) * texture object data. */ int i; - - assert( is_empty_list( & rmesa->swapped ) ); + + /* this assert is wrong. The default textures are always on swap list + assert( is_empty_list( & rmesa->swapped ) ); */ for ( i = 0 ; i < rmesa->nr_heaps ; i++ ) { driDestroyTextureHeap( rmesa->texture_heaps[ i ] ); diff --git a/src/mesa/drivers/dri/r200/r200_context.h b/src/mesa/drivers/dri/r200/r200_context.h index 3802deead9..9e00d7a358 100644 --- a/src/mesa/drivers/dri/r200/r200_context.h +++ b/src/mesa/drivers/dri/r200/r200_context.h @@ -615,7 +615,7 @@ struct r200_swtcl_info { GLuint vertex_size; GLuint vertex_stride_shift; GLuint vertex_format; - char *verts; + GLubyte *verts; /* Fallback rasterization functions */ diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.c b/src/mesa/drivers/dri/r200/r200_ioctl.c index ea67216238..480121a094 100644 --- a/src/mesa/drivers/dri/r200/r200_ioctl.c +++ b/src/mesa/drivers/dri/r200/r200_ioctl.c @@ -320,7 +320,7 @@ static CARD32 r200GetLastFrame(r200ContextPtr rmesa) CARD32 frame; gp.param = RADEON_PARAM_LAST_FRAME; - gp.value = (int *)&frame; + gp.value = &frame; ret = drmCommandWriteRead( rmesa->dri.fd, DRM_RADEON_GETPARAM, &gp, sizeof(gp) ); if ( ret ) { @@ -404,7 +404,7 @@ void r200CopyBuffer( const __DRIdrawablePrivate *dPriv ) r200ContextPtr rmesa; GLint nbox, i, ret; GLboolean missed_target; - int64_t ust; + uint64_t ust; assert(dPriv); assert(dPriv->driContextPriv); @@ -616,7 +616,7 @@ static void r200Clear( GLcontext *ctx, GLbitfield mask, GLboolean all, int clear; gp.param = RADEON_PARAM_LAST_CLEAR; - gp.value = (int *)&clear; + gp.value = &clear; ret = drmCommandWriteRead( rmesa->dri.fd, DRM_RADEON_GETPARAM, &gp, sizeof(gp) ); diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c b/src/mesa/drivers/dri/r200/r200_swtcl.c index 6a436509a0..dd4025235b 100644 --- a/src/mesa/drivers/dri/r200/r200_swtcl.c +++ b/src/mesa/drivers/dri/r200/r200_swtcl.c @@ -446,7 +446,7 @@ static __inline void *r200AllocDmaLowVerts( r200ContextPtr rmesa, { - GLubyte *head = rmesa->dma.current.address + rmesa->dma.current.ptr; + char *head = rmesa->dma.current.address + rmesa->dma.current.ptr; rmesa->dma.current.ptr += bytes; rmesa->swtcl.numverts += nverts; return head; @@ -1260,7 +1260,7 @@ void r200InitSwtcl( GLcontext *ctx ) tnl->Driver.Render.ResetLineStipple = r200ResetLineStipple; tnl->Driver.Render.BuildVertices = r200BuildVertices; - rmesa->swtcl.verts = (char *)ALIGN_MALLOC( size * 16 * 4, 32 ); + rmesa->swtcl.verts = (GLubyte *)ALIGN_MALLOC( size * 16 * 4, 32 ); rmesa->swtcl.RenderIndex = ~0; rmesa->swtcl.render_primitive = GL_TRIANGLES; rmesa->swtcl.hw_primitive = 0; diff --git a/src/mesa/drivers/dri/r200/r200_tcl.c b/src/mesa/drivers/dri/r200/r200_tcl.c index 994221d80c..9869ad6196 100644 --- a/src/mesa/drivers/dri/r200/r200_tcl.c +++ b/src/mesa/drivers/dri/r200/r200_tcl.c @@ -102,33 +102,23 @@ static GLboolean discrete_prim[0x10] = { }; -#define LOCAL_VARS r200ContextPtr rmesa = R200_CONTEXT(ctx);rmesa = rmesa -#define ELTS_VARS GLushort *dest +#define LOCAL_VARS r200ContextPtr rmesa = R200_CONTEXT(ctx) +#define ELT_TYPE GLushort #define ELT_INIT(prim, hw_prim) \ r200TclPrimitive( ctx, prim, hw_prim | R200_VF_PRIM_WALK_IND ) -#define GET_ELTS() rmesa->tcl.Elts +#define GET_MESA_ELTS() rmesa->tcl.Elts -#define NEW_PRIMITIVE() R200_NEWPRIM( rmesa ) -#define NEW_BUFFER() r200RefillCurrentDmaRegion( rmesa ) - /* Don't really know how many elts will fit in what's left of cmdbuf, * as there is state to emit, etc: */ -#if 0 -#define GET_CURRENT_VB_MAX_ELTS() \ - ((R200_CMD_BUF_SZ - (rmesa->store.cmd_used + 16)) / 2) -#define GET_SUBSEQUENT_VB_MAX_ELTS() ((R200_CMD_BUF_SZ - 16) / 2) -#else /* Testing on isosurf shows a maximum around here. Don't know if it's * the card or driver or kernel module that is causing the behaviour. */ -#define GET_CURRENT_VB_MAX_ELTS() 300 -#define GET_SUBSEQUENT_VB_MAX_ELTS() 300 -#endif +#define GET_MAX_HW_ELTS() 300 #define RESET_STIPPLE() do { \ R200_STATECHANGE( rmesa, lin ); \ @@ -147,32 +137,22 @@ static GLboolean discrete_prim[0x10] = { } while (0) -/* How do you extend an existing primitive? - */ -#define ALLOC_ELTS(nr) \ -do { \ - if (rmesa->dma.flush == r200FlushElts && \ - rmesa->store.cmd_used + nr*2 < R200_CMD_BUF_SZ) { \ - \ - dest = (GLushort *)(rmesa->store.cmd_buf + \ - rmesa->store.cmd_used); \ - rmesa->store.cmd_used += nr*2; \ - } \ - else { \ - if (rmesa->dma.flush) \ - rmesa->dma.flush( rmesa ); \ - \ - r200EmitAOS( rmesa, \ - rmesa->tcl.aos_components, \ - rmesa->tcl.nr_aos_components, \ - 0 ); \ - \ - dest = r200AllocEltsOpenEnded( rmesa, \ - rmesa->tcl.hw_primitive, \ - nr ); \ - } \ -} while (0) +#define ALLOC_ELTS(nr) r200AllocElts( rmesa, nr ) +static GLushort *r200AllocElts( r200ContextPtr rmesa, GLuint nr ) +{ + if (rmesa->dma.flush) + rmesa->dma.flush( rmesa ); + + r200EmitAOS( rmesa, + rmesa->tcl.aos_components, + rmesa->tcl.nr_aos_components, 0 ); + + return r200AllocEltsOpenEnded( rmesa, rmesa->tcl.hw_primitive, nr ); +} + + +#define CLOSE_ELTS() R200_NEWPRIM( rmesa ) /* TODO: Try to extend existing primitive if both are identical, @@ -217,17 +197,15 @@ static void EMIT_PRIM( GLcontext *ctx, #ifdef MESA_BIG_ENDIAN /* We could do without (most of) this ugliness if dest was always 32 bit word aligned... */ -#define EMIT_ELT(offset, x) do { \ +#define EMIT_ELT(dest, offset, x) do { \ int off = offset + ( ( (GLuint)dest & 0x2 ) >> 1 ); \ GLushort *des = (GLushort *)( (GLuint)dest & ~0x2 ); \ (des)[ off + 1 - 2 * ( off & 1 ) ] = (GLushort)(x); } while (0) #else -#define EMIT_ELT(offset, x) (dest)[offset] = (GLushort) (x) +#define EMIT_ELT(dest, offset, x) (dest)[offset] = (GLushort) (x) #endif -#define EMIT_TWO_ELTS(offset, x, y) *(GLuint *)(dest+offset) = ((y)<<16)|(x); -#define INCR_ELTS( nr ) dest += nr -#define RELEASE_ELT_VERTS() \ - r200ReleaseArrays( ctx, ~0 ) + +#define EMIT_TWO_ELTS(dest, offset, x, y) *(GLuint *)((dest)+offset) = ((y)<<16)|(x); -- cgit v1.2.3