Browse Source

Allow the standard radeon driver to be built without the swrast and swtnl

modules.  This effectively merges the radeon-es driver back into the
radeon driver as a compile-time option.
tags/embedded-1-20030120
Keith Whitwell 23 years ago
parent
commit
cdb267a918

+ 6
- 4
src/mesa/drivers/dri/radeon/Makefile View File

# $Id: Makefile,v 1.1.2.8 2002/12/30 15:20:36 keithw Exp $
# $Id: Makefile,v 1.1.2.9 2002/12/30 17:24:05 keithw Exp $


# Mesa 3-D graphics library # Mesa 3-D graphics library
# Version: 5.0 # Version: 5.0
INCLUDES = -I$(MESABUILDDIR) -I$(MESA)/include -I. -I../common \ INCLUDES = -I$(MESABUILDDIR) -I$(MESA)/include -I. -I../common \
-I$(MESABUILDDIR)/miniglx -Iserver -I$(MESABUILDDIR)/miniglx -Iserver


DEFINES = -D_HAVE_SWRAST=1 -D_HAVE_SWTNL=1 -D_HAVE_SANITY=1
DEFINES = -D_HAVE_SWRAST=0 -D_HAVE_SWTNL=0 -D_HAVE_SANITY=1
CFLAGS = $(INCLUDES) $(DEFINES) -g -MD -DGLX_DIRECT_RENDERING CFLAGS = $(INCLUDES) $(DEFINES) -g -MD -DGLX_DIRECT_RENDERING


# The .a files for each mesa module required by this driver: # The .a files for each mesa module required by this driver:
$(MESABUILDDIR)/math/math.a \ $(MESABUILDDIR)/math/math.a \
$(MESABUILDDIR)/array_cache/array_cache.a \ $(MESABUILDDIR)/array_cache/array_cache.a \
$(MESABUILDDIR)/swrast/swrast.a \ $(MESABUILDDIR)/swrast/swrast.a \
$(MESABUILDDIR)/mesa.a
$(MESABUILDDIR)/mesa.a \
$(MESABUILDDIR)/math/math.a #kludge


DRIVER_SOURCES = server/radeon_dri.c \ DRIVER_SOURCES = server/radeon_dri.c \
radeon_compat.c \ radeon_compat.c \
radeon_vtxfmt_x86.c \ radeon_vtxfmt_x86.c \
../common/mm.c ../common/mm.c



C_SOURCES = $(DRIVER_SOURCES) \ C_SOURCES = $(DRIVER_SOURCES) \
$(DRI_SOURCES) $(DRI_SOURCES)


.S.o: .S.o:
$(CC) -c $(CFLAGS) $< -o $@ $(CC) -c $(CFLAGS) $< -o $@


.c.o:
.c.o:
$(CC) -c $(CFLAGS) $< -o $@ $(CC) -c $(CFLAGS) $< -o $@


##### TARGETS ##### ##### TARGETS #####

+ 43
- 25
src/mesa/drivers/dri/radeon/radeon_context.c View File

#include "matrix.h" #include "matrix.h"
#include "extensions.h" #include "extensions.h"


#if _HAVE_SWRAST
#include "swrast/swrast.h" #include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h" #include "swrast_setup/swrast_setup.h"
#include "array_cache/acache.h"
#include "radeon_span.h"
#endif


#if _HAVE_SWTNL
#include "array_cache/acache.h"
#include "tnl/tnl.h" #include "tnl/tnl.h"
#include "tnl/t_pipeline.h" #include "tnl/t_pipeline.h"
#include "radeon_swtcl.h"
#include "radeon_maos.h"
#endif


#include "radeon_context.h" #include "radeon_context.h"
#include "radeon_ioctl.h" #include "radeon_ioctl.h"
#include "radeon_state.h" #include "radeon_state.h"
#include "radeon_span.h"
#include "radeon_tex.h" #include "radeon_tex.h"
#include "radeon_swtcl.h"
#include "radeon_tcl.h" #include "radeon_tcl.h"
#include "radeon_vtxfmt.h" #include "radeon_vtxfmt.h"
#include "radeon_maos.h"


#if defined(USE_X86_ASM) #if defined(USE_X86_ASM)
#include "X86/common_x86_asm.h" #include "X86/common_x86_asm.h"
} }
} }


#if _HAVE_SWTNL
extern const struct gl_pipeline_stage _radeon_render_stage; extern const struct gl_pipeline_stage _radeon_render_stage;
extern const struct gl_pipeline_stage _radeon_tcl_stage; extern const struct gl_pipeline_stage _radeon_tcl_stage;


&_tnl_render_stage, /* FALLBACK: */ &_tnl_render_stage, /* FALLBACK: */
0, 0,
}; };
#endif



static void ResizeBuffers( GLframebuffer *buffer )
{
#if _HAVE_SWRAST
_swrast_alloc_buffers( buffer );
#endif
}


/* Initialize the driver's misc functions. /* Initialize the driver's misc functions.
*/ */
static void radeonInitDriverFuncs( GLcontext *ctx ) static void radeonInitDriverFuncs( GLcontext *ctx )
{ {
ctx->Driver.GetBufferSize = radeonGetBufferSize; ctx->Driver.GetBufferSize = radeonGetBufferSize;
ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
ctx->Driver.GetString = radeonGetString; ctx->Driver.GetString = radeonGetString;
ctx->Driver.ResizeBuffers = ResizeBuffers;
ctx->Driver.Error = NULL; ctx->Driver.Error = NULL;
ctx->Driver.DrawPixels = NULL; ctx->Driver.DrawPixels = NULL;
ctx->Driver.Bitmap = NULL; ctx->Driver.Bitmap = NULL;


/* Initialize the software rasterizer and helper modules. /* Initialize the software rasterizer and helper modules.
*/ */
#if _HAVE_SWRAST
_swrast_CreateContext( ctx ); _swrast_CreateContext( ctx );

/* Configure swrast to match hardware characteristics:
*/
_swrast_allow_pixel_fog( ctx, GL_FALSE );
_swrast_allow_vertex_fog( ctx, GL_TRUE );
#endif
_ae_create_context( ctx );
#if _HAVE_SWTNL
_ac_CreateContext( ctx ); _ac_CreateContext( ctx );
_tnl_CreateContext( ctx ); _tnl_CreateContext( ctx );
_swsetup_CreateContext( ctx );
_ae_create_context( ctx );


/* Install the customized pipeline: /* Install the customized pipeline:
*/ */
/* Try and keep materials and vertices separate: /* Try and keep materials and vertices separate:
*/ */
_tnl_isolate_materials( ctx, GL_TRUE ); _tnl_isolate_materials( ctx, GL_TRUE );


/* _mesa_allow_light_in_model( ctx, GL_FALSE ); */

/* Configure swrast to match hardware characteristics:
*/
_swrast_allow_pixel_fog( ctx, GL_FALSE );
_swrast_allow_vertex_fog( ctx, GL_TRUE );
#if _HAVE_SWRAST
_swsetup_CreateContext( ctx );
#endif
#endif




_math_matrix_ctr( &rmesa->TexGenMatrix[0] ); _math_matrix_ctr( &rmesa->TexGenMatrix[0] );
radeonInitDriverFuncs( ctx ); radeonInitDriverFuncs( ctx );
radeonInitIoctlFuncs( ctx ); radeonInitIoctlFuncs( ctx );
radeonInitStateFuncs( ctx ); radeonInitStateFuncs( ctx );
#if _HAVE_SWRAST
radeonInitSpanFuncs( ctx ); radeonInitSpanFuncs( ctx );
#endif
radeonInitTextureFuncs( ctx ); radeonInitTextureFuncs( ctx );
radeonInitState( rmesa ); radeonInitState( rmesa );
#if _HAVE_SWTNL
radeonInitSwtcl( ctx ); radeonInitSwtcl( 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;
if (rmesa->radeonScreen->chipset & RADEON_CHIPSET_TCL) { if (rmesa->radeonScreen->chipset & RADEON_CHIPSET_TCL) {
if (!getenv("RADEON_NO_VTXFMT")) if (!getenv("RADEON_NO_VTXFMT"))
radeonVtxfmtInit( ctx ); radeonVtxfmtInit( ctx );
#if _HAVE_SWTNL
_tnl_need_dlist_norm_lengths( ctx, GL_FALSE ); _tnl_need_dlist_norm_lengths( ctx, GL_FALSE );
#endif
} }
return GL_TRUE; return GL_TRUE;
} }
} }
} }



#if _HAVE_SWRAST
_swsetup_DestroyContext( rmesa->glCtx ); _swsetup_DestroyContext( rmesa->glCtx );
_swrast_DestroyContext( rmesa->glCtx );
#endif
#if _HAVE_SWTNL
_tnl_DestroyContext( rmesa->glCtx ); _tnl_DestroyContext( rmesa->glCtx );
_ac_DestroyContext( rmesa->glCtx ); _ac_DestroyContext( rmesa->glCtx );
_swrast_DestroyContext( rmesa->glCtx );

radeonDestroySwtcl( rmesa->glCtx ); radeonDestroySwtcl( rmesa->glCtx );

radeonReleaseArrays( rmesa->glCtx, ~0 ); radeonReleaseArrays( rmesa->glCtx, ~0 );
#endif

if (rmesa->dma.current.buf) { if (rmesa->dma.current.buf) {
radeonReleaseDmaRegion( rmesa, &rmesa->dma.current, __FUNCTION__ ); radeonReleaseDmaRegion( rmesa, &rmesa->dma.current, __FUNCTION__ );
radeonFlushCmdBuf( rmesa, __FUNCTION__ ); radeonFlushCmdBuf( rmesa, __FUNCTION__ );
FREE( rmesa ); FREE( rmesa );
} }


#if 0
/* Use this to force shared object profiling. */
glx_fini_prof();
#endif
} }





+ 14
- 2
src/mesa/drivers/dri/radeon/radeon_ioctl.c View File

#include "glheader.h" #include "glheader.h"
#include "imports.h" #include "imports.h"
#include "simple_list.h" #include "simple_list.h"

#if _HAVE_SWRAST
#include "swrast/swrast.h" #include "swrast/swrast.h"
#endif
#if _HAVE_SANITY
#include "radeon_sanity.h"
#endif


#include "radeon_context.h" #include "radeon_context.h"
#include "radeon_state.h" #include "radeon_state.h"
#include "radeon_ioctl.h" #include "radeon_ioctl.h"
#include "radeon_tcl.h" #include "radeon_tcl.h"
#include "radeon_sanity.h"

#include "radeon_macros.h" /* for INREG() */ #include "radeon_macros.h" /* for INREG() */


#undef usleep #undef usleep




if (RADEON_DEBUG & DEBUG_SANITY) { if (RADEON_DEBUG & DEBUG_SANITY) {
#if _HAVE_SANITY
if (rmesa->state.scissor.enabled) if (rmesa->state.scissor.enabled)
ret = radeonSanityCmdBuffer( rmesa, ret = radeonSanityCmdBuffer( rmesa,
rmesa->state.scissor.numClipRects, rmesa->state.scissor.numClipRects,
ret = radeonSanityCmdBuffer( rmesa, ret = radeonSanityCmdBuffer( rmesa,
rmesa->numClipRects, rmesa->numClipRects,
rmesa->pClipRects); rmesa->pClipRects);
#endif
} }


cmd.bufsz = rmesa->store.cmd_used; cmd.bufsz = rmesa->store.cmd_used;
rmesa->state.color.drawPitch = rmesa->radeonScreen->backPitch; rmesa->state.color.drawPitch = rmesa->radeonScreen->backPitch;
} }


fprintf(stderr, "%s: pfCurrentPage %d COLOROFFSET %x\n", __FUNCTION__,
rmesa->sarea->pfCurrentPage,
rmesa->state.color.drawOffset);

RADEON_STATECHANGE( rmesa, ctx ); RADEON_STATECHANGE( rmesa, ctx );
rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = rmesa->state.color.drawOffset; rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = rmesa->state.color.drawOffset;
rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = rmesa->state.color.drawPitch; rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = rmesa->state.color.drawPitch;
mask &= ~DD_STENCIL_BIT; mask &= ~DD_STENCIL_BIT;
} }


#if _HAVE_SWRAST
if ( mask ) if ( mask )
_swrast_Clear( ctx, mask, all, cx, cy, cw, ch ); _swrast_Clear( ctx, mask, all, cx, cy, cw, ch );
#endif


if ( !flags ) if ( !flags )
return; return;

+ 4
- 5
src/mesa/drivers/dri/radeon/radeon_lock.c View File

use_back = (rmesa->glCtx->Color._DrawDestMask == BACK_LEFT_BIT); use_back = (rmesa->glCtx->Color._DrawDestMask == BACK_LEFT_BIT);
use_back ^= (rmesa->sarea->pfCurrentPage == 1); use_back ^= (rmesa->sarea->pfCurrentPage == 1);


if ( RADEON_DEBUG & DEBUG_VERBOSE )
fprintf(stderr, "%s allow %d current %d\n", __FUNCTION__,
rmesa->doPageFlip,
rmesa->sarea->pfCurrentPage );

if ( use_back ) { if ( use_back ) {
rmesa->state.color.drawOffset = rmesa->radeonScreen->backOffset; rmesa->state.color.drawOffset = rmesa->radeonScreen->backOffset;
rmesa->state.color.drawPitch = rmesa->radeonScreen->backPitch; rmesa->state.color.drawPitch = rmesa->radeonScreen->backPitch;
rmesa->state.color.drawPitch = rmesa->radeonScreen->frontPitch; rmesa->state.color.drawPitch = rmesa->radeonScreen->frontPitch;
} }


fprintf(stderr, "%s: pfCurrentPage %d COLOROFFSET %x\n", __FUNCTION__,
rmesa->sarea->pfCurrentPage,
rmesa->state.color.drawOffset);

RADEON_STATECHANGE( rmesa, ctx ); RADEON_STATECHANGE( rmesa, ctx );
rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = rmesa->state.color.drawOffset; rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = rmesa->state.color.drawOffset;
rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = rmesa->state.color.drawPitch; rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = rmesa->state.color.drawPitch;

+ 3
- 1
src/mesa/drivers/dri/radeon/radeon_maos.c View File

#if _HAVE_SWTNL


/* If using new packets, can choose either verts or arrays. /* If using new packets, can choose either verts or arrays.
* Otherwise, must use verts. * Otherwise, must use verts.
#else #else
#include "radeon_maos_arrays.c" #include "radeon_maos_arrays.c"
#endif #endif

#endif

+ 2
- 0
src/mesa/drivers/dri/radeon/radeon_sanity.h View File

#ifndef RADEON_SANITY_H #ifndef RADEON_SANITY_H
#define RADEON_SANITY_H #define RADEON_SANITY_H


#include "radeon_context.h"

extern int radeonSanityCmdBuffer( radeonContextPtr rmesa, extern int radeonSanityCmdBuffer( radeonContextPtr rmesa,
int nbox, int nbox,
XF86DRIClipRectRec *boxes ); XF86DRIClipRectRec *boxes );

+ 9
- 0
src/mesa/drivers/dri/radeon/radeon_span.c View File

* *
*/ */


#if _HAVE_SWRAST

#include "glheader.h" #include "glheader.h"
#include "swrast/swrast.h" #include "swrast/swrast.h"


assert(0); assert(0);
break; break;
} }

fprintf(stderr, "%s: pfCurrentPage %d COLOROFFSET %x\n", __FUNCTION__,
rmesa->sarea->pfCurrentPage,
rmesa->state.color.drawOffset);

} }


/* Move locking out to get reasonable span performance (10x better /* Move locking out to get reasonable span performance (10x better
swdd->SpanRenderStart = radeonSpanRenderStart; swdd->SpanRenderStart = radeonSpanRenderStart;
swdd->SpanRenderFinish = radeonSpanRenderFinish; swdd->SpanRenderFinish = radeonSpanRenderFinish;
} }

#endif

+ 58
- 4
src/mesa/drivers/dri/radeon/radeon_state.c View File

#include "enums.h" #include "enums.h"
#include "colormac.h" #include "colormac.h"


#include "swrast/swrast.h"
#if _HAVE_SWTNL
#include "array_cache/acache.h" #include "array_cache/acache.h"
#include "tnl/tnl.h" #include "tnl/tnl.h"
#include "tnl/t_pipeline.h" #include "tnl/t_pipeline.h"
#endif
#if _HAVE_SWRAST
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h" #include "swrast_setup/swrast_setup.h"

#endif


#include "radeon_context.h" #include "radeon_context.h"
#include "radeon_ioctl.h" #include "radeon_ioctl.h"
#include "radeon_state.h" #include "radeon_state.h"
#include "radeon_tcl.h" #include "radeon_tcl.h"
#include "radeon_tex.h" #include "radeon_tex.h"
#include "radeon_swtcl.h"
#include "radeon_vtxfmt.h" #include "radeon_vtxfmt.h"






static void radeonPolygonMode( GLcontext *ctx, GLenum face, GLenum mode ) static void radeonPolygonMode( GLcontext *ctx, GLenum face, GLenum mode )
{ {
#if _HAVE_SWTNL
radeonContextPtr rmesa = RADEON_CONTEXT(ctx); radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLboolean flag = (ctx->_TriangleCaps & DD_TRI_UNFILLED) != 0; GLboolean flag = (ctx->_TriangleCaps & DD_TRI_UNFILLED) != 0;


radeonChooseRenderState( ctx ); radeonChooseRenderState( ctx );
radeonChooseVertexState( ctx ); radeonChooseVertexState( ctx );
} }
#endif
} }




rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] &= ~RADEON_LIGHTING_ENABLE; rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] &= ~RADEON_LIGHTING_ENABLE;
} }


#if _HAVE_SWTNL
/* Update vertex/render formats /* Update vertex/render formats
*/ */
if (rmesa->TclFallback) { if (rmesa->TclFallback) {
radeonChooseRenderState( ctx ); radeonChooseRenderState( ctx );
radeonChooseVertexState( ctx ); radeonChooseVertexState( ctx );
} }
#endif
} }






check_twoside_fallback( ctx ); check_twoside_fallback( ctx );


#if _HAVE_SWTNL
if (rmesa->TclFallback) { if (rmesa->TclFallback) {
radeonChooseRenderState( ctx ); radeonChooseRenderState( ctx );
radeonChooseVertexState( ctx ); radeonChooseVertexState( ctx );
} }
#endif
break; break;


case GL_LIGHT_MODEL_COLOR_CONTROL: case GL_LIGHT_MODEL_COLOR_CONTROL:
return; return;
} }


{
int use_back;

use_back = (rmesa->glCtx->Color._DrawDestMask == BACK_LEFT_BIT);
use_back ^= (rmesa->sarea->pfCurrentPage == 1);

if ( ctx->Visual.doubleBufferMode && use_back ) {
rmesa->state.color.drawOffset = rmesa->radeonScreen->backOffset;
rmesa->state.color.drawPitch = rmesa->radeonScreen->backPitch;
} else {
rmesa->state.color.drawOffset = rmesa->radeonScreen->frontOffset;
rmesa->state.color.drawPitch = rmesa->radeonScreen->frontPitch;
}

fprintf(stderr, "use_back %d doubleBufferMode %d COLOROFFSET %x\n",
use_back,
ctx->Visual.doubleBufferMode,
rmesa->state.color.drawOffset);

rmesa->state.pixel.readOffset = rmesa->state.color.drawOffset;
rmesa->state.pixel.readPitch = rmesa->state.color.drawPitch;
}

#if _HAVE_SWRAST
/* We want to update the s/w rast state too so that r200SetBuffer() /* We want to update the s/w rast state too so that r200SetBuffer()
* gets called. * gets called.
*/ */
_swrast_DrawBuffer(ctx, mode); _swrast_DrawBuffer(ctx, mode);
#endif

fprintf(stderr, "%s: pfCurrentPage %d COLOROFFSET %x\n", __FUNCTION__,
rmesa->sarea->pfCurrentPage,
rmesa->state.color.drawOffset);


RADEON_STATECHANGE( rmesa, ctx ); RADEON_STATECHANGE( rmesa, ctx );
rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = (rmesa->state.color.drawOffset & rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = (rmesa->state.color.drawOffset &
rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~RADEON_TCL_FOG_MASK; rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~RADEON_TCL_FOG_MASK;
} }
radeonUpdateSpecular( ctx ); /* for PK_SPEC */ radeonUpdateSpecular( ctx ); /* for PK_SPEC */
#if _HAVE_SWTNL
if (rmesa->TclFallback) if (rmesa->TclFallback)
radeonChooseVertexState( ctx ); radeonChooseVertexState( ctx );
#endif
break; break;


case GL_LIGHT0: case GL_LIGHT0:


case GL_POLYGON_OFFSET_POINT: case GL_POLYGON_OFFSET_POINT:
if (rmesa->dri.drmMinor == 1) { if (rmesa->dri.drmMinor == 1) {
#if _HAVE_SWTNL
radeonChooseRenderState( ctx ); radeonChooseRenderState( ctx );
#endif
} }
else { else {
RADEON_STATECHANGE( rmesa, set ); RADEON_STATECHANGE( rmesa, set );


case GL_POLYGON_OFFSET_LINE: case GL_POLYGON_OFFSET_LINE:
if (rmesa->dri.drmMinor == 1) { if (rmesa->dri.drmMinor == 1) {
#if _HAVE_SWTNL
radeonChooseRenderState( ctx ); radeonChooseRenderState( ctx );
#endif
} }
else { else {
RADEON_STATECHANGE( rmesa, set ); RADEON_STATECHANGE( rmesa, set );


case GL_POLYGON_OFFSET_FILL: case GL_POLYGON_OFFSET_FILL:
if (rmesa->dri.drmMinor == 1) { if (rmesa->dri.drmMinor == 1) {
#if _HAVE_SWTNL
radeonChooseRenderState( ctx ); radeonChooseRenderState( ctx );
#endif
} }
else { else {
RADEON_STATECHANGE( rmesa, set ); RADEON_STATECHANGE( rmesa, set );


static void radeonInvalidateState( GLcontext *ctx, GLuint new_state ) static void radeonInvalidateState( GLcontext *ctx, GLuint new_state )
{ {
#if _HAVE_SWRAST
_swrast_InvalidateState( ctx, new_state ); _swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state ); _swsetup_InvalidateState( ctx, new_state );
#endif
#if _HAVE_SWTNL
_ac_InvalidateState( ctx, new_state ); _ac_InvalidateState( ctx, new_state );
_tnl_InvalidateState( ctx, new_state ); _tnl_InvalidateState( ctx, new_state );
#endif
_ae_invalidate_state( ctx, new_state ); _ae_invalidate_state( ctx, new_state );
RADEON_CONTEXT(ctx)->NewGLState |= new_state; RADEON_CONTEXT(ctx)->NewGLState |= new_state;
radeonVtxfmtInvalidate( ctx ); radeonVtxfmtInvalidate( ctx );
} }


#if _HAVE_SWTNL
static void radeonWrapRunPipeline( GLcontext *ctx ) static void radeonWrapRunPipeline( GLcontext *ctx )
{ {
radeonContextPtr rmesa = RADEON_CONTEXT(ctx); radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
radeonUpdateMaterial( ctx ); /* not needed any more? */ radeonUpdateMaterial( ctx ); /* not needed any more? */
} }
} }
#endif






ctx->Driver.StencilOp = radeonStencilOp; ctx->Driver.StencilOp = radeonStencilOp;
ctx->Driver.Viewport = radeonViewport; ctx->Driver.Viewport = radeonViewport;


#if _HAVE_SWRAST
/* Pixel path fallbacks /* Pixel path fallbacks
*/ */
ctx->Driver.Accum = _swrast_Accum; ctx->Driver.Accum = _swrast_Accum;
ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable; ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D; ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D; ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
#endif


#if _HAVE_SWTNL
TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange = radeonUpdateMaterial; TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange = radeonUpdateMaterial;
TNL_CONTEXT(ctx)->Driver.RunPipeline = radeonWrapRunPipeline; TNL_CONTEXT(ctx)->Driver.RunPipeline = radeonWrapRunPipeline;
#endif
} }

+ 29
- 10
src/mesa/drivers/dri/radeon/radeon_state_init.c View File

#include "mmath.h" #include "mmath.h"
#include "api_arrayelt.h" #include "api_arrayelt.h"


#if _HAVE_SWRAST
#include "swrast/swrast.h" #include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#endif
#if _HAVE_SWTNL
#include "array_cache/acache.h" #include "array_cache/acache.h"
#include "tnl/tnl.h" #include "tnl/tnl.h"
#include "tnl/t_pipeline.h" #include "tnl/t_pipeline.h"
#include "swrast_setup/swrast_setup.h"
#endif


#include "radeon_context.h" #include "radeon_context.h"
#include "radeon_ioctl.h" #include "radeon_ioctl.h"
#include "radeon_state.h" #include "radeon_state.h"
#include "radeon_tcl.h" #include "radeon_tcl.h"
#include "radeon_tex.h" #include "radeon_tex.h"
#include "radeon_swtcl.h"
#include "radeon_vtxfmt.h" #include "radeon_vtxfmt.h"


/* ============================================================= /* =============================================================


rmesa->Fallback = 0; rmesa->Fallback = 0;


if ( ctx->Visual.doubleBufferMode && rmesa->sarea->pfCurrentPage == 0 ) {
rmesa->state.color.drawOffset = rmesa->radeonScreen->backOffset;
rmesa->state.color.drawPitch = rmesa->radeonScreen->backPitch;
} else {
rmesa->state.color.drawOffset = rmesa->radeonScreen->frontOffset;
rmesa->state.color.drawPitch = rmesa->radeonScreen->frontPitch;

{
int use_back;

use_back = (rmesa->glCtx->Color._DrawDestMask == BACK_LEFT_BIT);
use_back ^= (rmesa->sarea->pfCurrentPage == 1);

if ( ctx->Visual.doubleBufferMode && use_back ) {
rmesa->state.color.drawOffset = rmesa->radeonScreen->backOffset;
rmesa->state.color.drawPitch = rmesa->radeonScreen->backPitch;
} else {
rmesa->state.color.drawOffset = rmesa->radeonScreen->frontOffset;
rmesa->state.color.drawPitch = rmesa->radeonScreen->frontPitch;
}

fprintf(stderr, "use_back %d doubleBufferMode %d COLOROFFSET %x\n",
use_back,
ctx->Visual.doubleBufferMode,
rmesa->state.color.drawOffset);

rmesa->state.pixel.readOffset = rmesa->state.color.drawOffset;
rmesa->state.pixel.readPitch = rmesa->state.color.drawPitch;
} }
rmesa->state.pixel.readOffset = rmesa->state.color.drawOffset;
rmesa->state.pixel.readPitch = rmesa->state.color.drawPitch;


/* Initialize lists: /* Initialize lists:
*/ */
ctx->Driver.LightModelfv( ctx, GL_LIGHT_MODEL_AMBIENT, ctx->Driver.LightModelfv( ctx, GL_LIGHT_MODEL_AMBIENT,
ctx->Light.Model.Ambient ); ctx->Light.Model.Ambient );


#if _HAVE_SWTNL
TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx ); TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx );
#endif


for (i = 0 ; i < 6; i++) { for (i = 0 ; i < 6; i++) {
ctx->Driver.ClipPlane( ctx, GL_CLIP_PLANE0 + i, NULL ); ctx->Driver.ClipPlane( ctx, GL_CLIP_PLANE0 + i, NULL );

+ 4
- 0
src/mesa/drivers/dri/radeon/radeon_swtcl.c View File

* Keith Whitwell <keith@tungstengraphics.com> * Keith Whitwell <keith@tungstengraphics.com>
* *
*/ */
#if _HAVE_SWTNL


#include "glheader.h" #include "glheader.h"
#include "mtypes.h" #include "mtypes.h"
rmesa->UbyteColor.Ptr = 0; rmesa->UbyteColor.Ptr = 0;
} }
} }


#endif

+ 24
- 5
src/mesa/drivers/dri/radeon/radeon_tcl.c View File

#include "mtypes.h" #include "mtypes.h"
#include "enums.h" #include "enums.h"


#if _HAVE_SWTNL
#include "array_cache/acache.h" #include "array_cache/acache.h"
#include "tnl/tnl.h" #include "tnl/tnl.h"
#include "tnl/t_pipeline.h" #include "tnl/t_pipeline.h"
#include "radeon_swtcl.h"
#include "radeon_maos.h"
#endif


#include "radeon_context.h" #include "radeon_context.h"
#include "radeon_state.h" #include "radeon_state.h"
#include "radeon_ioctl.h" #include "radeon_ioctl.h"
#include "radeon_tex.h" #include "radeon_tex.h"
#include "radeon_tcl.h" #include "radeon_tcl.h"
#include "radeon_swtcl.h"
#include "radeon_maos.h"







#endif #endif
#define EMIT_TWO_ELTS(offset, x, y) *(GLuint *)(dest+offset) = ((y)<<16)|(x); #define EMIT_TWO_ELTS(offset, x, y) *(GLuint *)(dest+offset) = ((y)<<16)|(x);
#define INCR_ELTS( nr ) dest += nr #define INCR_ELTS( nr ) dest += nr
#define RELEASE_ELT_VERTS() \
radeonReleaseArrays( ctx, ~0 )


#if _HAVE_SWTNL
#define RELEASE_ELT_VERTS() radeonReleaseArrays( ctx, ~0 )
#else
#define RELEASE_ELT_VERTS()
#endif




#define TAG(x) tcl_##x #define TAG(x) tcl_##x
} }
} }


#if _HAVE_SWTNL
/**********************************************************************/ /**********************************************************************/
/* Render pipeline stage */ /* Render pipeline stage */
/**********************************************************************/ /**********************************************************************/
} }
} }
} }
#else
void radeonFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
{
if (mode)
fprintf(stderr, "Warning: hit nonexistant fallback path!\n");
}

void radeonTclFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
{
if (mode)
fprintf(stderr, "Warning: hit nonexistant fallback path!\n");
}
#endif

+ 13
- 0
src/mesa/drivers/dri/radeon/radeon_tcl.h View File

#define TCL_FALLBACK( ctx, bit, mode ) radeonTclFallback( ctx, bit, mode ) #define TCL_FALLBACK( ctx, bit, mode ) radeonTclFallback( ctx, bit, mode )




#if !_HAVE_SWTNL

#define PRIM_MODE_MASK 0xff /* Extract the actual primitive */
#define PRIM_BEGIN 0x100 /* The prim starts here (not wrapped) */
#define PRIM_END 0x200 /* The prim ends in this VB (does not wrap) */
#define PRIM_PARITY 0x400 /* The prim wrapped on an odd number of verts */
#define PRIM_LAST 0x800 /* No more prims in the VB */

typedef void (*render_func)( GLcontext *ctx, GLuint start, GLuint count,
GLuint flags );

#endif

#endif #endif
#endif #endif

+ 6
- 2
src/mesa/drivers/dri/radeon/radeon_tex.c View File

#include "radeon_context.h" #include "radeon_context.h"
#include "radeon_state.h" #include "radeon_state.h"
#include "radeon_ioctl.h" #include "radeon_ioctl.h"
#include "radeon_swtcl.h"
#include "radeon_tex.h" #include "radeon_tex.h"



#if _HAVE_SWTNL
#include "radeon_swtcl.h"
#endif


/* ============================================================= /* =============================================================
* Utility functions: * Utility functions:
ctx->Driver.TexSubImage1D = radeonTexSubImage1D; ctx->Driver.TexSubImage1D = radeonTexSubImage1D;
ctx->Driver.TexSubImage2D = radeonTexSubImage2D; ctx->Driver.TexSubImage2D = radeonTexSubImage2D;
ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d; ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
#if _HAVE_SWRAST
/* XXX */
ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d; ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d;
ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d; ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d;
ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d; ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d;
ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d; ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d;
ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d; ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d;
#endif
ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage; ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;


ctx->Driver.BindTexture = radeonBindTexture; ctx->Driver.BindTexture = radeonBindTexture;

+ 2
- 1
src/mesa/drivers/dri/radeon/radeon_texmem.c View File

* Gareth Hughes <gareth@valinux.com> * Gareth Hughes <gareth@valinux.com>
* *
*/ */
#include <errno.h>


#include "glheader.h" #include "glheader.h"
#include "imports.h" #include "imports.h"


#include "radeon_context.h" #include "radeon_context.h"
#include "radeon_tex.h" #include "radeon_tex.h"
#include <errno.h>


/* Destroy hardware state associated with texture `t'. /* Destroy hardware state associated with texture `t'.
*/ */

+ 6
- 1
src/mesa/drivers/dri/radeon/radeon_texstate.c View File

#include "radeon_context.h" #include "radeon_context.h"
#include "radeon_state.h" #include "radeon_state.h"
#include "radeon_ioctl.h" #include "radeon_ioctl.h"
#include "radeon_swtcl.h"
#include "radeon_tex.h" #include "radeon_tex.h"
#include "radeon_tcl.h" #include "radeon_tcl.h"


#if _HAVE_SWTNL
#include "radeon_swtcl.h"
#endif



static void radeonSetTexImages( radeonContextPtr rmesa, static void radeonSetTexImages( radeonContextPtr rmesa,
struct gl_texture_object *tObj ) struct gl_texture_object *tObj )


FALLBACK( rmesa, RADEON_FALLBACK_TEXTURE, !ok ); FALLBACK( rmesa, RADEON_FALLBACK_TEXTURE, !ok );


#if _HAVE_SWTNL
if (rmesa->TclFallback) if (rmesa->TclFallback)
radeonChooseVertexState( ctx ); radeonChooseVertexState( ctx );
#endif
} }

+ 29
- 4
src/mesa/drivers/dri/radeon/radeon_vtxfmt.c View File

#include "state.h" #include "state.h"
#include "vtxfmt.h" #include "vtxfmt.h"


#if _HAVE_SWTNL
#include "tnl/tnl.h" #include "tnl/tnl.h"
#include "tnl/t_context.h" #include "tnl/t_context.h"
#include "tnl/t_array_api.h" #include "tnl/t_array_api.h"
#endif


#include "radeon_context.h" #include "radeon_context.h"
#include "radeon_state.h" #include "radeon_state.h"


static void VFMT_FALLBACK_OUTSIDE_BEGIN_END( const char *caller ) static void VFMT_FALLBACK_OUTSIDE_BEGIN_END( const char *caller )
{ {
#if _HAVE_SWTNL
GLcontext *ctx = vb.context; GLcontext *ctx = vb.context;
radeonContextPtr rmesa = RADEON_CONTEXT(ctx); radeonContextPtr rmesa = RADEON_CONTEXT(ctx);


rmesa->vb.fell_back = GL_TRUE; rmesa->vb.fell_back = GL_TRUE;
rmesa->vb.installed = GL_FALSE; rmesa->vb.installed = GL_FALSE;
vb.context = 0; vb.context = 0;
#else
fprintf(stderr, "Warning: control reached %s\n", __FUNCTION__);
#endif
} }




static void VFMT_FALLBACK( const char *caller ) static void VFMT_FALLBACK( const char *caller )
{ {
#if _HAVE_SWTNL
GLcontext *ctx = vb.context; GLcontext *ctx = vb.context;
radeonContextPtr rmesa = RADEON_CONTEXT(ctx); radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLfloat tmp[3][15]; GLfloat tmp[3][15];


if (ind & RADEON_CP_VC_FRMT_ST1) if (ind & RADEON_CP_VC_FRMT_ST1)
glMultiTexCoord2fvARB( GL_TEXTURE1_ARB, vb.texcoordptr[1] ); glMultiTexCoord2fvARB( GL_TEXTURE1_ARB, vb.texcoordptr[1] );
#else
fprintf(stderr, "Warning: control reached %s\n", __FUNCTION__);
#endif
} }




fprintf(stderr, "%s: already installed", __FUNCTION__); fprintf(stderr, "%s: already installed", __FUNCTION__);
} }
else { else {
#if !_HAVE_SWTNL
assert(0);
#else
if (RADEON_DEBUG & DEBUG_VFMT) if (RADEON_DEBUG & DEBUG_VFMT)
fprintf(stderr, "%s: failed\n", __FUNCTION__); fprintf(stderr, "%s: failed\n", __FUNCTION__);


rmesa->vb.installed = GL_FALSE; rmesa->vb.installed = GL_FALSE;
vb.context = 0; vb.context = 0;
} }
#endif
} }
} }


#include "vtxfmt_tmp.h" #include "vtxfmt_tmp.h"




#if _HAVE_SWTNL
static GLboolean radeonNotifyBegin( GLcontext *ctx, GLenum p ) static GLboolean radeonNotifyBegin( GLcontext *ctx, GLenum p )
{ {
radeonContextPtr rmesa = RADEON_CONTEXT( ctx ); radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
radeon_Begin( p ); radeon_Begin( p );
return GL_TRUE; return GL_TRUE;
} }
#endif


static void radeonFlushVertices( GLcontext *ctx, GLuint flags ) static void radeonFlushVertices( GLcontext *ctx, GLuint flags )
{ {


(void)radeon_fallback_vtxfmt; (void)radeon_fallback_vtxfmt;


#if _HAVE_SWTNL
TNL_CONTEXT(ctx)->Driver.NotifyBegin = radeonNotifyBegin; TNL_CONTEXT(ctx)->Driver.NotifyBegin = radeonNotifyBegin;
#endif


vb.context = ctx; vb.context = ctx;
rmesa->vb.enabled = 1; rmesa->vb.enabled = 1;
make_empty_list( &rmesa->vb.dfn_cache.MultiTexCoord1fvARB ); make_empty_list( &rmesa->vb.dfn_cache.MultiTexCoord1fvARB );


radeonInitCodegen( &rmesa->vb.codegen ); radeonInitCodegen( &rmesa->vb.codegen );

#if !_HAVE_SWTNL
ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END;
radeonVtxfmtValidate( ctx );
assert( rmesa->vb.installed );
#endif
} }


static void free_funcs( struct dynfn *l ) static void free_funcs( struct dynfn *l )


void radeonVtxfmtUnbindContext( GLcontext *ctx ) void radeonVtxfmtUnbindContext( GLcontext *ctx )
{ {
#if _HAVE_SWTNL
if (RADEON_CONTEXT(ctx)->vb.installed) { if (RADEON_CONTEXT(ctx)->vb.installed) {
assert(vb.context == ctx); assert(vb.context == ctx);
VFMT_FALLBACK_OUTSIDE_BEGIN_END( __FUNCTION__ ); VFMT_FALLBACK_OUTSIDE_BEGIN_END( __FUNCTION__ );
} }


TNL_CONTEXT(ctx)->Driver.NotifyBegin = 0; TNL_CONTEXT(ctx)->Driver.NotifyBegin = 0;
#endif
} }




void radeonVtxfmtMakeCurrent( GLcontext *ctx ) void radeonVtxfmtMakeCurrent( GLcontext *ctx )
{ {
radeonContextPtr rmesa = RADEON_CONTEXT( ctx );

#if defined(THREADS) #if defined(THREADS)
static GLboolean ThreadSafe = GL_FALSE; /* In thread-safe mode? */ static GLboolean ThreadSafe = GL_FALSE; /* In thread-safe mode? */
if (!ThreadSafe) { if (!ThreadSafe) {
return; return;
#endif #endif


if (rmesa->vb.enabled) {
#if _HAVE_SWTNL
if (RADEON_CONTEXT(ctx)->vb.enabled) {
TNL_CONTEXT(ctx)->Driver.NotifyBegin = radeonNotifyBegin; TNL_CONTEXT(ctx)->Driver.NotifyBegin = radeonNotifyBegin;
} }
#endif
} }





Loading…
Cancel
Save