Commit 7b7af467 authored by Keith Whitwell's avatar Keith Whitwell
Browse files

Restore ability to build full driver.

Add config options to choose between full/subset driver, and fbdev vs. DRI
windowing systems.
parent 3101d43a
# $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 # Mesa 3-D graphics library
# Version: 5.0 # Version: 5.0
...@@ -7,27 +7,18 @@ ...@@ -7,27 +7,18 @@
MESA = ../.. 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.. INCLUDES = -I/usr/X11R6/include -I/usr/X11R6/include/X11/extensions -I$(MESA)/include -I. -I..
DEFINES = DEFINES =
CFLAGS = $(INCLUDES) $(DEFINES) -g -MD -Wall -Wpointer-arith \ C_SOURCES = dri_glx.c \
-Wstrict-prototypes -Wmissing-prototypes \ dri_util.c \
-Wmissing-declarations -Wnested-externs xf86drm.c \
xf86drmHash.c \
# The .a files for each mesa module required by this driver: xf86drmRandom.c \
# xf86drmSL.c
DRI_SOURCES = dri_glx.c \
dri_util.c \
xf86drm.c \
xf86drmHash.c \
xf86drmRandom.c \
xf86drmSL.c
C_SOURCES = $(DRI_SOURCES)
ASM_SOURCES = ASM_SOURCES =
...@@ -36,32 +27,11 @@ OBJECTS = $(C_SOURCES:.c=.o) \ ...@@ -36,32 +27,11 @@ OBJECTS = $(C_SOURCES:.c=.o) \
##### RULES #####
.S.o:
$(CC) -c $(CFLAGS) $< -o $@
.c.o:
$(CC) -c $(CFLAGS) $< -o $@
##### TARGETS ##### ##### TARGETS #####
default: dri.a
dri.a: $(OBJECTS) Makefile dri.a: $(OBJECTS) Makefile
rm -f $@ && ar rcv $@ $(OBJECTS) && ranlib $@ rm -f $@ && ar rcv $@ $(OBJECTS) && ranlib $@
clean:
-rm -f *.o *~ *.d .\#* *.so
tags:
etags `find . -name \*.[ch]` `find ../include`
##### DEPENDENCIES ##### ##### DEPENDENCIES #####
-include $(C_SOURCES:.c=.d) -include $(C_SOURCES:.c=.d)
.SUFFIXES: .c .d
.c.d:
$(CC) -M $(INCLUDES) $(DEFINES) $< > $@
# $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 # Mesa 3-D graphics library
# Version: 5.0 # Version: 5.0
...@@ -7,12 +7,25 @@ ...@@ -7,12 +7,25 @@
MESA = ../../.. 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 MINIGLX_INCLUDES = -I$(MESABUILDDIR)/miniglx
DRI_INCLUDES = -I$(MESABUILDDIR)/dri 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 = \ DEFINES = \
-D_HAVE_SWRAST=0 \ -D_HAVE_SWRAST=0 \
-D_HAVE_SWTNL=0 \ -D_HAVE_SWTNL=0 \
...@@ -22,10 +35,7 @@ DEFINES = \ ...@@ -22,10 +35,7 @@ DEFINES = \
-D_HAVE_TEXGEN=0 \ -D_HAVE_TEXGEN=0 \
-D_HAVE_USERCLIP=0 \ -D_HAVE_USERCLIP=0 \
-D_HAVE_FULL_GL=0 -D_HAVE_FULL_GL=0
endif
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: # The .a files for each mesa module required by this driver:
# #
...@@ -40,7 +50,7 @@ FULL_MESA = $(MESABUILDDIR)/swrast_setup/swrast_setup.a \ ...@@ -40,7 +50,7 @@ FULL_MESA = $(MESABUILDDIR)/swrast_setup/swrast_setup.a \
SUBSET_MESA = $(MESABUILDDIR)/mesa.a \ SUBSET_MESA = $(MESABUILDDIR)/mesa.a \
$(MESABUILDDIR)/math/math.a $(MESABUILDDIR)/math/math.a
DRI = $(MESABUILDDIR)/dri/dri.a
MINIGLX_SOURCES = server/radeon_dri.c MINIGLX_SOURCES = server/radeon_dri.c
...@@ -63,6 +73,7 @@ FULL_DRIVER_SOURCES = \ ...@@ -63,6 +73,7 @@ FULL_DRIVER_SOURCES = \
radeon_tex.c \ radeon_tex.c \
radeon_texmem.c \ radeon_texmem.c \
radeon_texstate.c \ radeon_texstate.c \
radeon_texcombine.c \
radeon_lighting.c \ radeon_lighting.c \
radeon_userclip.c \ radeon_userclip.c \
radeon_texgen.c \ radeon_texgen.c \
...@@ -81,55 +92,44 @@ FULL_DRIVER_SOURCES = \ ...@@ -81,55 +92,44 @@ FULL_DRIVER_SOURCES = \
INCLUDES = $(MINIGLX_INCLUDES) \ INCLUDES = $(MINIGLX_INCLUDES) \
$(SHARED_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) \ C_SOURCES = $(DRIVER_SOURCES) \
$(SUBSET_DRIVER_SOURCES) \ $(SUBSET_DRIVER_SOURCES) \
$(MINIGLX_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) \ OBJECTS = $(C_SOURCES:.c=.o) \
$(ASM_SOURCES:.S=.o) $(ASM_SOURCES:.S=.o)
##### RULES #####
.S.o:
$(CC) -c $(CFLAGS) $< -o $@
.c.o:
$(CC) -c $(CFLAGS) $< -o $@
##### TARGETS ##### ##### 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 && \ rm -f $(MESA)/lib/radeon_dri.so && \
install radeon_dri.so $(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 ##### ##### DEPENDENCIES #####
-include $(C_SOURCES:.c=.d) -include $(C_SOURCES:.c=.d)
.SUFFIXES: .c .d
.c.d:
$(CC) -M $(INCLUDES) $(DEFINES) $< > $@
...@@ -51,6 +51,8 @@ ...@@ -51,6 +51,8 @@
#include "radeon_tcl.h" #include "radeon_tcl.h"
#include "radeon_vtxfmt.h" #include "radeon_vtxfmt.h"
#include "radeon_tex.h" #include "radeon_tex.h"
#include "radeon_span.h"
#include "radeon_maos.h"
#else #else
#include "radeon_subset.h" #include "radeon_subset.h"
#endif #endif
...@@ -202,8 +204,10 @@ static void radeonInitDriverFuncs( GLcontext *ctx ) ...@@ -202,8 +204,10 @@ static void radeonInitDriverFuncs( GLcontext *ctx )
ctx->Driver.ResizeBuffers = ResizeBuffers; ctx->Driver.ResizeBuffers = ResizeBuffers;
ctx->Driver.Error = NULL; ctx->Driver.Error = NULL;
ctx->Driver.DrawPixels = NULL; ctx->Driver.DrawPixels = NULL;
#if !_HAVE_SWRAST
ctx->Driver.Bitmap = radeonPointsBitmap; ctx->Driver.Bitmap = radeonPointsBitmap;
ctx->Driver.ReadPixels = radeonReadPixels; ctx->Driver.ReadPixels = radeonReadPixels;
#endif
} }
...@@ -366,8 +370,9 @@ radeonCreateContext( const __GLcontextModes *glVisual, ...@@ -366,8 +370,9 @@ radeonCreateContext( const __GLcontextModes *glVisual,
#if _HAVE_SWTNL #if _HAVE_SWTNL
radeonInitSwtcl( ctx ); radeonInitSwtcl( ctx );
#endif #endif
#if !_HAVE_FULL_GL
radeonInitSelect( ctx ); radeonInitSelect( ctx );
#endif
rmesa->do_irqs = (rmesa->radeonScreen->irq && !getenv("RADEON_NO_IRQS")); rmesa->do_irqs = (rmesa->radeonScreen->irq && !getenv("RADEON_NO_IRQS"));
rmesa->irqsEmitted = 0; rmesa->irqsEmitted = 0;
......
...@@ -49,9 +49,47 @@ typedef struct radeon_context *radeonContextPtr; ...@@ -49,9 +49,47 @@ typedef struct radeon_context *radeonContextPtr;
#include "radeon_screen.h" #include "radeon_screen.h"
#include "mm.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 #if _HAVE_SWTNL
#include "radeon_swtcl.h" #include "radeon_swtcl.h"
#endif #endif
#if _HAVE_FULL_GL
#include "radeon_vtxfmt.h"
#endif
/** /**
* \brief Color buffer state. * \brief Color buffer state.
...@@ -478,40 +516,6 @@ struct radeon_texture { ...@@ -478,40 +516,6 @@ struct radeon_texture {
GLint numHeaps; /**< \brief number of active heaps */ 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 { ...@@ -709,8 +713,9 @@ struct radeon_context {
/* radeon_vtxfmt.c /* radeon_vtxfmt.c
*/ */
/* struct radeon_vbinfo vb; */ #if _HAVE_FULL_GL
struct radeon_vbinfo vb;
#endif
/** /**
* \brief Mirrors of some DRI state * \brief Mirrors of some DRI state
*/ */
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
/* Update on colormaterial, material emmissive/ambient, /* Update on colormaterial, material emmissive/ambient,
* lightmodel.globalambient * lightmodel.globalambient
*/ */
void update_global_ambient( GLcontext *ctx ) void update_global_ambient( GLcontext *ctx )
{ {
radeonContextPtr rmesa = RADEON_CONTEXT(ctx); radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
float *fcmd = (float *)RADEON_DB_STATE( glt ); float *fcmd = (float *)RADEON_DB_STATE( glt );
...@@ -137,7 +137,7 @@ void check_twoside_fallback( GLcontext *ctx ) ...@@ -137,7 +137,7 @@ void check_twoside_fallback( GLcontext *ctx )
TCL_FALLBACK( ctx, RADEON_TCL_FALLBACK_LIGHT_TWOSIDE, fallback ); 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) { if (ctx->Light.ColorMaterialEnabled) {
radeonContextPtr rmesa = RADEON_CONTEXT(ctx); radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
...@@ -321,8 +321,9 @@ void radeonUpdateLighting( GLcontext *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); radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLint p = light - GL_LIGHT0; GLint p = light - GL_LIGHT0;
...@@ -395,8 +396,8 @@ void radeonUpdateLighting( GLcontext *ctx ) ...@@ -395,8 +396,8 @@ void radeonUpdateLighting( GLcontext *ctx )
void radeonLightModelfv( GLcontext *ctx, GLenum pname, void radeonLightModelfv( GLcontext *ctx, GLenum pname,
const GLfloat *param ) const GLfloat *param )
{ {
radeonContextPtr rmesa = RADEON_CONTEXT(ctx); radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
......
...@@ -38,5 +38,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. ...@@ -38,5 +38,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define __RADEON_SPAN_H__ #define __RADEON_SPAN_H__
extern void radeonInitSpanFuncs( GLcontext *ctx ); extern void radeonInitSpanFuncs( GLcontext *ctx );
extern void radeonCreateSwrastContext( GLcontext *ctx );
#endif #endif
...@@ -1307,8 +1307,8 @@ static void radeonEnable( GLcontext *ctx, GLenum cap, GLboolean state ) ...@@ -1307,8 +1307,8 @@ static void radeonEnable( GLcontext *ctx, GLenum cap, GLboolean state )
case GL_CLIP_PLANE2: case GL_CLIP_PLANE2:
case GL_CLIP_PLANE3: case GL_CLIP_PLANE3:
case GL_CLIP_PLANE4: case GL_CLIP_PLANE4:
case GL_CLIP_PLANE5: case GL_CLIP_PLANE5: {
p = cap-GL_CLIP_PLANE0; GLuint p = cap-GL_CLIP_PLANE0;
RADEON_STATECHANGE( rmesa, tcl ); RADEON_STATECHANGE( rmesa, tcl );
if (state) { if (state) {
rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= (RADEON_UCP_ENABLE_0<<p); rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= (RADEON_UCP_ENABLE_0<<p);
...@@ -1318,6 +1318,7 @@ static void radeonEnable( GLcontext *ctx, GLenum cap, GLboolean state ) ...@@ -1318,6 +1318,7 @@ static void radeonEnable( GLcontext *ctx, GLenum cap, GLboolean state )
rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~(RADEON_UCP_ENABLE_0<<p); rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~(RADEON_UCP_ENABLE_0<<p);
} }
break; break;
}
#endif #endif
case GL_CULL_FACE: case GL_CULL_FACE:
......
...@@ -75,7 +75,6 @@ extern void radeonFallback( GLcontext *ctx, GLuint bit, GLboolean mode ); ...@@ -75,7 +75,6 @@ extern void radeonFallback( GLcontext *ctx, GLuint bit, GLboolean mode );
#define TEXMAT_2 5 #define TEXMAT_2 5
extern void radeonUpdateSpecular( GLcontext *ctx ); extern void radeonUpdateSpecular( GLcontext *ctx );
extern void radeonClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq );
extern void radeonUploadMatrixTranspose( radeonContextPtr rmesa, GLfloat *src, extern void radeonUploadMatrixTranspose( radeonContextPtr rmesa, GLfloat *src,
int idx ); int idx );
...@@ -83,5 +82,18 @@ extern void radeonUploadMatrix( radeonContextPtr rmesa, GLfloat *src, int idx ); ...@@ -83,5 +82,18 @@ extern void radeonUploadMatrix( radeonContextPtr rmesa, GLfloat *src, int idx );
extern void radeonUpdateScissor( GLcontext *ctx ); extern void radeonUpdateScissor( GLcontext *ctx );
/* radeon_lighting.c
*/
extern void radeonInitLightStateFuncs( GLcontext *ctx );
extern void radeonColorMaterial( GLcontext *ctx, GLenum face, GLenum mode );
extern void check_twoside_fallback( GLcontext *ctx );
extern void radeonUpdateLighting( GLcontext *ctx );
/* radeon_userclip.c
*/
extern void radeonClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq );
extern void radeonInitUserClip( GLcontext *ctx );
extern void radeonUpdateClipPlanes( GLcontext *ctx );
#endif #endif
...@@ -33,13 +33,12 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. ...@@ -33,13 +33,12 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
* *
*/ */
#ifndef __RADEON_TRIS_H__ #ifndef __RADEON_SWTCL_H__
#define __RADEON_TRIS_H__ #define __RADEON_SWTCL_H__
#include "mtypes.h" #include "mtypes.h"
#include "swrast/swrast.h" #include "swrast/swrast.h"
/* Flags for software fallback cases */ /* Flags for software fallback cases */
/* See correponding strings in radeon_swtcl.c */ /* See correponding strings in radeon_swtcl.c */
#define RADEON_FALLBACK_TEXTURE 0x0001 #define RADEON_FALLBACK_TEXTURE 0x0001
...@@ -94,6 +93,7 @@ struct radeon_swtcl_info { ...@@ -94,6 +93,7 @@ struct radeon_swtcl_info {
struct radeon_dma_region indexed_verts; struct radeon_dma_region indexed_verts;
}; };
extern void radeonCreateTnlContext( GLcontext *ctx );
extern void radeonInitSwtcl( GLcontext *ctx ); extern void radeonInitSwtcl( GLcontext *ctx );
extern void radeonDestroySwtcl( GLcontext *ctx ); extern void radeonDestroySwtcl( GLcontext *ctx );
......
...@@ -40,6 +40,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. ...@@ -40,6 +40,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "mtypes.h" #include "mtypes.h"
#include "enums.h" #include "enums.h"
#include "radeon_context.h"
#if _HAVE_SWTNL #if _HAVE_SWTNL
#include "array_cache/acache.h" #include "array_cache/acache.h"
#include "tnl/tnl.h" #include "tnl/tnl.h"
...@@ -48,7 +50,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. ...@@ -48,7 +50,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.