From 7b7af467dd95b0e7c30dd3ba5888d86840a5fd6c Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 4 Mar 2003 17:29:55 +0000 Subject: Restore ability to build full driver. Add config options to choose between full/subset driver, and fbdev vs. DRI windowing systems. --- src/dri-es/Makefile | 48 +++------------ src/mesa/drivers/dri/radeon/Makefile | 82 ++++++++++++------------- src/mesa/drivers/dri/radeon/radeon_context.c | 7 ++- src/mesa/drivers/dri/radeon/radeon_context.h | 77 ++++++++++++----------- src/mesa/drivers/dri/radeon/radeon_lighting.c | 13 ++-- src/mesa/drivers/dri/radeon/radeon_span.h | 1 + src/mesa/drivers/dri/radeon/radeon_state.c | 5 +- src/mesa/drivers/dri/radeon/radeon_state.h | 14 ++++- src/mesa/drivers/dri/radeon/radeon_swtcl.h | 6 +- src/mesa/drivers/dri/radeon/radeon_tcl.c | 3 +- src/mesa/drivers/dri/radeon/radeon_tex.h | 6 ++ src/mesa/drivers/dri/radeon/radeon_vtxfmt.h | 30 +++++++++ src/mesa/drivers/dri/radeon/radeon_vtxfmt_c.c | 2 +- src/mesa/drivers/dri/radeon/radeon_vtxfmt_sse.c | 2 +- src/mesa/drivers/dri/radeon/radeon_vtxfmt_x86.c | 2 +- src/miniglx/example.miniglx.conf | 2 +- 16 files changed, 166 insertions(+), 134 deletions(-) diff --git a/src/dri-es/Makefile b/src/dri-es/Makefile index 5cf418f4c86..d3512743a03 100644 --- a/src/dri-es/Makefile +++ b/src/dri-es/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.1.2.1 2003/02/05 04:37:12 keithw Exp $ +# $Id: Makefile,v 1.1.2.2 2003/03/04 17:29:55 keithw Exp $ # Mesa 3-D graphics library # Version: 5.0 @@ -7,27 +7,18 @@ MESA = ../.. -MESABUILDDIR = .. - +default: dri.a +include $(MESA)/Makefile.include INCLUDES = -I/usr/X11R6/include -I/usr/X11R6/include/X11/extensions -I$(MESA)/include -I. -I.. DEFINES = -CFLAGS = $(INCLUDES) $(DEFINES) -g -MD -Wall -Wpointer-arith \ - -Wstrict-prototypes -Wmissing-prototypes \ - -Wmissing-declarations -Wnested-externs - -# The .a files for each mesa module required by this driver: -# -DRI_SOURCES = dri_glx.c \ - dri_util.c \ - xf86drm.c \ - xf86drmHash.c \ - xf86drmRandom.c \ - xf86drmSL.c - - -C_SOURCES = $(DRI_SOURCES) +C_SOURCES = dri_glx.c \ + dri_util.c \ + xf86drm.c \ + xf86drmHash.c \ + xf86drmRandom.c \ + xf86drmSL.c ASM_SOURCES = @@ -36,32 +27,11 @@ OBJECTS = $(C_SOURCES:.c=.o) \ -##### RULES ##### - -.S.o: - $(CC) -c $(CFLAGS) $< -o $@ - -.c.o: - $(CC) -c $(CFLAGS) $< -o $@ - ##### TARGETS ##### -default: dri.a - dri.a: $(OBJECTS) Makefile rm -f $@ && ar rcv $@ $(OBJECTS) && ranlib $@ -clean: - -rm -f *.o *~ *.d .\#* *.so - -tags: - etags `find . -name \*.[ch]` `find ../include` - ##### DEPENDENCIES ##### -include $(C_SOURCES:.c=.d) - -.SUFFIXES: .c .d - -.c.d: - $(CC) -M $(INCLUDES) $(DEFINES) $< > $@ diff --git a/src/mesa/drivers/dri/radeon/Makefile b/src/mesa/drivers/dri/radeon/Makefile index 5c9bc794d82..74c21531de5 100644 --- a/src/mesa/drivers/dri/radeon/Makefile +++ b/src/mesa/drivers/dri/radeon/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.1.2.25 2003/02/23 20:24:11 keithw Exp $ +# $Id: Makefile,v 1.1.2.26 2003/03/04 17:29:56 keithw Exp $ # Mesa 3-D graphics library # Version: 5.0 @@ -7,12 +7,25 @@ MESA = ../../.. -MESABUILDDIR = ../.. +default: radeon_dri.so +include $(MESA)/Makefile.include -SHARED_INCLUDES = -I$(MESABUILDDIR) -I$(MESA)/include -I. -I../common -Iserver + +SHARED_INCLUDES= -I$(MESABUILDDIR) -I$(MESA)/include -I. -I../common -Iserver MINIGLX_INCLUDES = -I$(MESABUILDDIR)/miniglx DRI_INCLUDES = -I$(MESABUILDDIR)/dri +ifeq ($(FULL_DRIVER),true) +DEFINES = \ + -D_HAVE_SWRAST=1 \ + -D_HAVE_SWTNL=1 \ + -D_HAVE_SANITY=1 \ + -D_HAVE_CODEGEN=1 \ + -D_HAVE_LIGHTING=1 \ + -D_HAVE_TEXGEN=1 \ + -D_HAVE_USERCLIP=1 \ + -D_HAVE_FULL_GL=1 +else DEFINES = \ -D_HAVE_SWRAST=0 \ -D_HAVE_SWTNL=0 \ @@ -22,10 +35,7 @@ DEFINES = \ -D_HAVE_TEXGEN=0 \ -D_HAVE_USERCLIP=0 \ -D_HAVE_FULL_GL=0 - -CFLAGS = $(INCLUDES) $(DEFINES) -g -MD -Wall -Wpointer-arith \ - -Wstrict-prototypes -Wmissing-prototypes \ - -Wmissing-declarations -Wnested-externs +endif # The .a files for each mesa module required by this driver: # @@ -40,7 +50,7 @@ FULL_MESA = $(MESABUILDDIR)/swrast_setup/swrast_setup.a \ SUBSET_MESA = $(MESABUILDDIR)/mesa.a \ $(MESABUILDDIR)/math/math.a -DRI = $(MESABUILDDIR)/dri/dri.a + MINIGLX_SOURCES = server/radeon_dri.c @@ -63,6 +73,7 @@ FULL_DRIVER_SOURCES = \ radeon_tex.c \ radeon_texmem.c \ radeon_texstate.c \ + radeon_texcombine.c \ radeon_lighting.c \ radeon_userclip.c \ radeon_texgen.c \ @@ -81,55 +92,44 @@ FULL_DRIVER_SOURCES = \ INCLUDES = $(MINIGLX_INCLUDES) \ $(SHARED_INCLUDES) + +ifeq ($(FULL_DRIVER),true) +C_SOURCES = $(DRIVER_SOURCES) \ + $(FULL_DRIVER_SOURCES) \ + $(MINIGLX_SOURCES) +MESA_MODULES = $(FULL_MESA) +else C_SOURCES = $(DRIVER_SOURCES) \ $(SUBSET_DRIVER_SOURCES) \ $(MINIGLX_SOURCES) +MESA_MODULES = $(FULL_MESA) +endif -ASM_SOURCES = +ifeq ($(WINDOW_SYSTEM),dri) +WINOBJ=$(MESABUILDDIR)/dri/dri.a +WINLIB= +else +WINOBJ= +WINLIB=-L$(MESA)/src/miniglx +endif + +ASM_SOURCES = OBJECTS = $(C_SOURCES:.c=.o) \ $(ASM_SOURCES:.S=.o) -##### RULES ##### - -.S.o: - $(CC) -c $(CFLAGS) $< -o $@ - -.c.o: - $(CC) -c $(CFLAGS) $< -o $@ - ##### TARGETS ##### -default: radeon_dri.so install - -radeon_dri.so: $(SUBSET_MESA) $(OBJECTS) Makefile - rm -f $@ && gcc -o $@ -shared $(OBJECTS) $(SUBSET_MESA) -L$(MESA)/src/miniglx -lGL -lc -lm - -#radeon_dri.so: $(SUBSET_MESA) $(DRI) $(OBJECTS) Makefile -# rm -f $@ && gcc -o $@ -shared $(OBJECTS) $(SUBSET_MESA) $(DRI) -lc -lm - - -loc: - wc -l $(DRIVER_SOURCES) $(SUBSET_DRIVER_SOURCES) - wc -l $(DRIVER_SOURCES) $(FULL_DRIVER_SOURCES) radeon_maos_verts.c radeon_maos_vbtmp.h -install: +# Build the subset or full driver? +# +radeon_dri.so: $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile + rm -f $@ && gcc -o $@ -shared $(OBJECTS) $(MESA_MODULES) $(WINOBJ) $(WINLIB) -lGL -lc -lm rm -f $(MESA)/lib/radeon_dri.so && \ install radeon_dri.so $(MESA)/lib/radeon_dri.so -clean: - -rm -f *.o *~ *.d .\#* *.so - -tags: - etags `find . -name \*.[ch]` `find ../include` - ##### DEPENDENCIES ##### -include $(C_SOURCES:.c=.d) - -.SUFFIXES: .c .d - -.c.d: - $(CC) -M $(INCLUDES) $(DEFINES) $< > $@ diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c index fa76b8966f8..f6d897379b6 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_context.c @@ -51,6 +51,8 @@ #include "radeon_tcl.h" #include "radeon_vtxfmt.h" #include "radeon_tex.h" +#include "radeon_span.h" +#include "radeon_maos.h" #else #include "radeon_subset.h" #endif @@ -202,8 +204,10 @@ static void radeonInitDriverFuncs( GLcontext *ctx ) ctx->Driver.ResizeBuffers = ResizeBuffers; ctx->Driver.Error = NULL; ctx->Driver.DrawPixels = NULL; +#if !_HAVE_SWRAST ctx->Driver.Bitmap = radeonPointsBitmap; ctx->Driver.ReadPixels = radeonReadPixels; +#endif } @@ -366,8 +370,9 @@ radeonCreateContext( const __GLcontextModes *glVisual, #if _HAVE_SWTNL radeonInitSwtcl( ctx ); #endif +#if !_HAVE_FULL_GL radeonInitSelect( ctx ); - +#endif rmesa->do_irqs = (rmesa->radeonScreen->irq && !getenv("RADEON_NO_IRQS")); rmesa->irqsEmitted = 0; diff --git a/src/mesa/drivers/dri/radeon/radeon_context.h b/src/mesa/drivers/dri/radeon/radeon_context.h index 9c1f5674205..4f041e2d158 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.h +++ b/src/mesa/drivers/dri/radeon/radeon_context.h @@ -49,9 +49,47 @@ typedef struct radeon_context *radeonContextPtr; #include "radeon_screen.h" #include "mm.h" +/** + * \brief Reference counting on DMA buffers. + */ +struct radeon_dma_buffer { + int refcount; /**< \brief number of retained regions in radeon_dma_buffer::buf */ + drmBufPtr buf; /**< \brief DMA buffer */ +}; + +/** + * \brief Get the start of a DMA region. + * + * \param rvb pointer to a radeon_dma_region structure. + * + * \return pointer to the region start. + */ +#define GET_START(rvb) (rmesa->radeonScreen->agp_buffer_offset + \ + (rvb)->address - rmesa->dma.buf0_address + \ + (rvb)->start) + +/** + * \brief A retained DMA region. + * + * e.g. vertices for indexed vertices. + */ +struct radeon_dma_region { + struct radeon_dma_buffer *buf; /**< \brief DMA buffer */ + char *address; /**< \brief buf->address */ + int start; /**< \brief start offset from start of radeon_dma_region::buf */ + int end; /**< \brief end offset from start of radeon_dma_region::buf */ + int ptr; /**< \brief offsets from start of radeon_dma_region::buf */ + int aos_start; /**< \brief array of structures start */ + int aos_stride; /**< \brief array of structures stride */ + int aos_size; /**< \brief array of structures size */ +}; + #if _HAVE_SWTNL #include "radeon_swtcl.h" #endif +#if _HAVE_FULL_GL +#include "radeon_vtxfmt.h" +#endif /** * \brief Color buffer state. @@ -478,40 +516,6 @@ struct radeon_texture { GLint numHeaps; /**< \brief number of active heaps */ }; -/** - * \brief Reference counting on DMA buffers. - */ -struct radeon_dma_buffer { - int refcount; /**< \brief number of retained regions in radeon_dma_buffer::buf */ - drmBufPtr buf; /**< \brief DMA buffer */ -}; - -/** - * \brief Get the start of a DMA region. - * - * \param rvb pointer to a radeon_dma_region structure. - * - * \return pointer to the region start. - */ -#define GET_START(rvb) (rmesa->radeonScreen->agp_buffer_offset + \ - (rvb)->address - rmesa->dma.buf0_address + \ - (rvb)->start) - -/** - * \brief A retained DMA region. - * - * e.g. vertices for indexed vertices. - */ -struct radeon_dma_region { - struct radeon_dma_buffer *buf; /**< \brief DMA buffer */ - char *address; /**< \brief buf->address */ - int start; /**< \brief start offset from start of radeon_dma_region::buf */ - int end; /**< \brief end offset from start of radeon_dma_region::buf */ - int ptr; /**< \brief offsets from start of radeon_dma_region::buf */ - int aos_start; /**< \brief array of structures start */ - int aos_stride; /**< \brief array of structures stride */ - int aos_size; /**< \brief array of structures size */ -}; /** @@ -709,8 +713,9 @@ struct radeon_context { /* radeon_vtxfmt.c */ -/* struct radeon_vbinfo vb; */ - +#if _HAVE_FULL_GL + struct radeon_vbinfo vb; +#endif /** * \brief Mirrors of some DRI state */ diff --git a/src/mesa/drivers/dri/radeon/radeon_lighting.c b/src/mesa/drivers/dri/radeon/radeon_lighting.c index 6a69cc8b2fa..de5e04594c9 100644 --- a/src/mesa/drivers/dri/radeon/radeon_lighting.c +++ b/src/mesa/drivers/dri/radeon/radeon_lighting.c @@ -53,7 +53,7 @@ /* Update on colormaterial, material emmissive/ambient, * lightmodel.globalambient */ - void update_global_ambient( GLcontext *ctx ) +void update_global_ambient( GLcontext *ctx ) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); float *fcmd = (float *)RADEON_DB_STATE( glt ); @@ -137,7 +137,7 @@ void check_twoside_fallback( GLcontext *ctx ) TCL_FALLBACK( ctx, RADEON_TCL_FALLBACK_LIGHT_TWOSIDE, fallback ); } - void radeonColorMaterial( GLcontext *ctx, GLenum face, GLenum mode ) +void radeonColorMaterial( GLcontext *ctx, GLenum face, GLenum mode ) { if (ctx->Light.ColorMaterialEnabled) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); @@ -321,8 +321,9 @@ void radeonUpdateLighting( GLcontext *ctx ) } } - void radeonLightfv( GLcontext *ctx, GLenum light, - GLenum pname, const GLfloat *params ) + +void radeonLightfv( GLcontext *ctx, GLenum light, + GLenum pname, const GLfloat *params ) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); GLint p = light - GL_LIGHT0; @@ -395,8 +396,8 @@ void radeonUpdateLighting( GLcontext *ctx ) - void radeonLightModelfv( GLcontext *ctx, GLenum pname, - const GLfloat *param ) +void radeonLightModelfv( GLcontext *ctx, GLenum pname, + const GLfloat *param ) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/radeon/radeon_span.h b/src/mesa/drivers/dri/radeon/radeon_span.h index 72f8f00c477..7352bc594d3 100644 --- a/src/mesa/drivers/dri/radeon/radeon_span.h +++ b/src/mesa/drivers/dri/radeon/radeon_span.h @@ -38,5 +38,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define __RADEON_SPAN_H__ extern void radeonInitSpanFuncs( GLcontext *ctx ); +extern void radeonCreateSwrastContext( GLcontext *ctx ); #endif diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c index a1c57b5f15f..511d10acfe9 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state.c +++ b/src/mesa/drivers/dri/radeon/radeon_state.c @@ -1307,8 +1307,8 @@ static void radeonEnable( GLcontext *ctx, GLenum cap, GLboolean state ) case GL_CLIP_PLANE2: case GL_CLIP_PLANE3: case GL_CLIP_PLANE4: - case GL_CLIP_PLANE5: - p = cap-GL_CLIP_PLANE0; + case GL_CLIP_PLANE5: { + GLuint p = cap-GL_CLIP_PLANE0; RADEON_STATECHANGE( rmesa, tcl ); if (state) { rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= (RADEON_UCP_ENABLE_0<hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~(RADEON_UCP_ENABLE_0<