Sfoglia il codice sorgente

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 anni fa
parent
commit
cdb267a918

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

@@ -1,4 +1,4 @@
# $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
# Version: 5.0
@@ -12,7 +12,7 @@ MESABUILDDIR = ../..
INCLUDES = -I$(MESABUILDDIR) -I$(MESA)/include -I. -I../common \
-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

# The .a files for each mesa module required by this driver:
@@ -22,7 +22,8 @@ COREMESA = $(MESABUILDDIR)/swrast_setup/swrast_setup.a \
$(MESABUILDDIR)/math/math.a \
$(MESABUILDDIR)/array_cache/array_cache.a \
$(MESABUILDDIR)/swrast/swrast.a \
$(MESABUILDDIR)/mesa.a
$(MESABUILDDIR)/mesa.a \
$(MESABUILDDIR)/math/math.a #kludge

DRIVER_SOURCES = server/radeon_dri.c \
radeon_compat.c \
@@ -46,6 +47,7 @@ DRIVER_SOURCES = server/radeon_dri.c \
radeon_vtxfmt_x86.c \
../common/mm.c


C_SOURCES = $(DRIVER_SOURCES) \
$(DRI_SOURCES)

@@ -61,7 +63,7 @@ OBJECTS = $(C_SOURCES:.c=.o) \
.S.o:
$(CC) -c $(CFLAGS) $< -o $@

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

##### TARGETS #####

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

@@ -43,22 +43,26 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "matrix.h"
#include "extensions.h"

#if _HAVE_SWRAST
#include "swrast/swrast.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/t_pipeline.h"
#include "radeon_swtcl.h"
#include "radeon_maos.h"
#endif

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

#if defined(USE_X86_ASM)
#include "X86/common_x86_asm.h"
@@ -200,6 +204,7 @@ static void radeonInitExtensions( GLcontext *ctx )
}
}

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

@@ -234,17 +239,22 @@ static const struct gl_pipeline_stage *radeon_pipeline[] = {
&_tnl_render_stage, /* FALLBACK: */
0,
};
#endif


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

/* Initialize the driver's misc functions.
*/
static void radeonInitDriverFuncs( GLcontext *ctx )
{
ctx->Driver.GetBufferSize = radeonGetBufferSize;
ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
ctx->Driver.GetString = radeonGetString;
ctx->Driver.ResizeBuffers = ResizeBuffers;
ctx->Driver.Error = NULL;
ctx->Driver.DrawPixels = NULL;
ctx->Driver.Bitmap = NULL;
@@ -371,11 +381,18 @@ radeonCreateContext( const __GLcontextModes *glVisual,

/* Initialize the software rasterizer and helper modules.
*/
#if _HAVE_SWRAST
_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 );
_tnl_CreateContext( ctx );
_swsetup_CreateContext( ctx );
_ae_create_context( ctx );

/* Install the customized pipeline:
*/
@@ -385,14 +402,10 @@ radeonCreateContext( const __GLcontextModes *glVisual,
/* Try and keep materials and vertices separate:
*/
_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] );
@@ -406,10 +419,14 @@ radeonCreateContext( const __GLcontextModes *glVisual,
radeonInitDriverFuncs( ctx );
radeonInitIoctlFuncs( ctx );
radeonInitStateFuncs( ctx );
#if _HAVE_SWRAST
radeonInitSpanFuncs( ctx );
#endif
radeonInitTextureFuncs( ctx );
radeonInitState( rmesa );
#if _HAVE_SWTNL
radeonInitSwtcl( ctx );
#endif

rmesa->do_irqs = (rmesa->radeonScreen->irq && !getenv("RADEON_NO_IRQS"));
rmesa->irqsEmitted = 0;
@@ -516,8 +533,9 @@ radeonCreateContext( const __GLcontextModes *glVisual,
if (rmesa->radeonScreen->chipset & RADEON_CHIPSET_TCL) {
if (!getenv("RADEON_NO_VTXFMT"))
radeonVtxfmtInit( ctx );
#if _HAVE_SWTNL
_tnl_need_dlist_norm_lengths( ctx, GL_FALSE );
#endif
}
return GL_TRUE;
}
@@ -563,14 +581,18 @@ radeonDestroyContext( __DRIcontextPrivate *driContextPriv )
}
}


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

radeonDestroySwtcl( rmesa->glCtx );

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

if (rmesa->dma.current.buf) {
radeonReleaseDmaRegion( rmesa, &rmesa->dma.current, __FUNCTION__ );
radeonFlushCmdBuf( rmesa, __FUNCTION__ );
@@ -592,10 +614,6 @@ radeonDestroyContext( __DRIcontextPrivate *driContextPriv )
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 Vedi File

@@ -38,14 +38,18 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "glheader.h"
#include "imports.h"
#include "simple_list.h"

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

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

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

#undef usleep
@@ -400,6 +404,7 @@ static int radeonFlushCmdBufLocked( radeonContextPtr rmesa,


if (RADEON_DEBUG & DEBUG_SANITY) {
#if _HAVE_SANITY
if (rmesa->state.scissor.enabled)
ret = radeonSanityCmdBuffer( rmesa,
rmesa->state.scissor.numClipRects,
@@ -408,6 +413,7 @@ static int radeonFlushCmdBufLocked( radeonContextPtr rmesa,
ret = radeonSanityCmdBuffer( rmesa,
rmesa->numClipRects,
rmesa->pClipRects);
#endif
}

cmd.bufsz = rmesa->store.cmd_used;
@@ -821,6 +827,10 @@ void radeonPageFlip( const __DRIdrawablePrivate *dPriv )
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 );
rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = rmesa->state.color.drawOffset;
rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = rmesa->state.color.drawPitch;
@@ -878,8 +888,10 @@ static void radeonClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
mask &= ~DD_STENCIL_BIT;
}

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

if ( !flags )
return;

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

@@ -61,11 +61,6 @@ radeonUpdatePageFlipping( radeonContextPtr rmesa )
use_back = (rmesa->glCtx->Color._DrawDestMask == BACK_LEFT_BIT);
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 ) {
rmesa->state.color.drawOffset = rmesa->radeonScreen->backOffset;
rmesa->state.color.drawPitch = rmesa->radeonScreen->backPitch;
@@ -74,6 +69,10 @@ radeonUpdatePageFlipping( radeonContextPtr rmesa )
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 );
rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = rmesa->state.color.drawOffset;
rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = rmesa->state.color.drawPitch;

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

@@ -1,4 +1,4 @@
#if _HAVE_SWTNL

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

#endif

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

@@ -1,6 +1,8 @@
#ifndef RADEON_SANITY_H
#define RADEON_SANITY_H

#include "radeon_context.h"

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

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

@@ -35,6 +35,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/

#if _HAVE_SWRAST

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

@@ -327,6 +329,11 @@ static void radeonSetBuffer( GLcontext *ctx,
assert(0);
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
@@ -410,3 +417,5 @@ void radeonInitSpanFuncs( GLcontext *ctx )
swdd->SpanRenderStart = radeonSpanRenderStart;
swdd->SpanRenderFinish = radeonSpanRenderFinish;
}

#endif

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

@@ -35,19 +35,21 @@
#include "enums.h"
#include "colormac.h"

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

#endif

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


@@ -657,6 +659,7 @@ static void radeonPolygonStipple( GLcontext *ctx, const GLubyte *mask )

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

@@ -668,6 +671,7 @@ static void radeonPolygonMode( GLcontext *ctx, GLenum face, GLenum mode )
radeonChooseRenderState( ctx );
radeonChooseVertexState( ctx );
}
#endif
}


@@ -744,12 +748,14 @@ static void radeonUpdateSpecular( GLcontext *ctx )
rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] &= ~RADEON_LIGHTING_ENABLE;
}

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


@@ -1130,10 +1136,12 @@ static void radeonLightModelfv( GLcontext *ctx, GLenum pname,

check_twoside_fallback( ctx );

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

case GL_LIGHT_MODEL_COLOR_CONTROL:
@@ -1582,10 +1590,39 @@ static void radeonDrawBuffer( GLcontext *ctx, GLenum mode )
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()
* gets called.
*/
_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 );
rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = (rmesa->state.color.drawOffset &
@@ -1700,8 +1737,10 @@ static void radeonEnable( GLcontext *ctx, GLenum cap, GLboolean state )
rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~RADEON_TCL_FOG_MASK;
}
radeonUpdateSpecular( ctx ); /* for PK_SPEC */
#if _HAVE_SWTNL
if (rmesa->TclFallback)
radeonChooseVertexState( ctx );
#endif
break;

case GL_LIGHT0:
@@ -1785,7 +1824,9 @@ static void radeonEnable( GLcontext *ctx, GLenum cap, GLboolean state )

case GL_POLYGON_OFFSET_POINT:
if (rmesa->dri.drmMinor == 1) {
#if _HAVE_SWTNL
radeonChooseRenderState( ctx );
#endif
}
else {
RADEON_STATECHANGE( rmesa, set );
@@ -1799,7 +1840,9 @@ static void radeonEnable( GLcontext *ctx, GLenum cap, GLboolean state )

case GL_POLYGON_OFFSET_LINE:
if (rmesa->dri.drmMinor == 1) {
#if _HAVE_SWTNL
radeonChooseRenderState( ctx );
#endif
}
else {
RADEON_STATECHANGE( rmesa, set );
@@ -1813,7 +1856,9 @@ static void radeonEnable( GLcontext *ctx, GLenum cap, GLboolean state )

case GL_POLYGON_OFFSET_FILL:
if (rmesa->dri.drmMinor == 1) {
#if _HAVE_SWTNL
radeonChooseRenderState( ctx );
#endif
}
else {
RADEON_STATECHANGE( rmesa, set );
@@ -2058,15 +2103,20 @@ void radeonValidateState( GLcontext *ctx )

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

#if _HAVE_SWTNL
static void radeonWrapRunPipeline( GLcontext *ctx )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
@@ -2093,7 +2143,7 @@ static void radeonWrapRunPipeline( GLcontext *ctx )
radeonUpdateMaterial( ctx ); /* not needed any more? */
}
}
#endif



@@ -2145,6 +2195,7 @@ void radeonInitStateFuncs( GLcontext *ctx )
ctx->Driver.StencilOp = radeonStencilOp;
ctx->Driver.Viewport = radeonViewport;

#if _HAVE_SWRAST
/* Pixel path fallbacks
*/
ctx->Driver.Accum = _swrast_Accum;
@@ -2159,7 +2210,10 @@ void radeonInitStateFuncs( GLcontext *ctx )
ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
#endif

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

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

@@ -33,18 +33,21 @@
#include "mmath.h"
#include "api_arrayelt.h"

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

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

/* =============================================================
@@ -183,15 +186,29 @@ void radeonInitState( radeonContextPtr rmesa )

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:
*/
@@ -524,7 +541,9 @@ void radeonInitState( radeonContextPtr rmesa )
ctx->Driver.LightModelfv( ctx, GL_LIGHT_MODEL_AMBIENT,
ctx->Light.Model.Ambient );

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

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

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

@@ -32,6 +32,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
* Keith Whitwell <keith@tungstengraphics.com>
*
*/
#if _HAVE_SWTNL

#include "glheader.h"
#include "mtypes.h"
@@ -1189,3 +1190,6 @@ void radeonDestroySwtcl( GLcontext *ctx )
rmesa->UbyteColor.Ptr = 0;
}
}


#endif

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

@@ -40,17 +40,20 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "mtypes.h"
#include "enums.h"

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

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




@@ -231,9 +234,12 @@ static void EMIT_PRIM( GLcontext *ctx,
#endif
#define EMIT_TWO_ELTS(offset, x, y) *(GLuint *)(dest+offset) = ((y)<<16)|(x);
#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
@@ -287,7 +293,7 @@ void radeonTclPrimitive( GLcontext *ctx,
}
}

#if _HAVE_SWTNL
/**********************************************************************/
/* Render pipeline stage */
/**********************************************************************/
@@ -544,3 +550,16 @@ void radeonTclFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
}
}
}
#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 Vedi File

@@ -62,5 +62,18 @@ extern void radeonTclFallback( GLcontext *ctx, GLuint bit, GLboolean 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

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

@@ -42,10 +42,11 @@
#include "radeon_context.h"
#include "radeon_state.h"
#include "radeon_ioctl.h"
#include "radeon_swtcl.h"
#include "radeon_tex.h"


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

/* =============================================================
* Utility functions:
@@ -668,11 +669,14 @@ void radeonInitTextureFuncs( GLcontext *ctx )
ctx->Driver.TexSubImage1D = radeonTexSubImage1D;
ctx->Driver.TexSubImage2D = radeonTexSubImage2D;
ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
#if _HAVE_SWRAST
/* XXX */
ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d;
ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d;
ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d;
ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d;
ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d;
#endif
ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;

ctx->Driver.BindTexture = radeonBindTexture;

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

@@ -33,6 +33,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
* Gareth Hughes <gareth@valinux.com>
*
*/
#include <errno.h>

#include "glheader.h"
#include "imports.h"
@@ -43,7 +44,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.

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

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

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

@@ -46,10 +46,13 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "radeon_context.h"
#include "radeon_state.h"
#include "radeon_ioctl.h"
#include "radeon_swtcl.h"
#include "radeon_tex.h"
#include "radeon_tcl.h"

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


static void radeonSetTexImages( radeonContextPtr rmesa,
struct gl_texture_object *tObj )
@@ -1402,6 +1405,8 @@ void radeonUpdateTextureState( GLcontext *ctx )

FALLBACK( rmesa, RADEON_FALLBACK_TEXTURE, !ok );

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

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

@@ -46,9 +46,11 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "state.h"
#include "vtxfmt.h"

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

#include "radeon_context.h"
#include "radeon_state.h"
@@ -329,6 +331,7 @@ static GLuint copy_dma_verts( radeonContextPtr rmesa, GLfloat (*tmp)[15] )

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

@@ -347,11 +350,15 @@ static void VFMT_FALLBACK_OUTSIDE_BEGIN_END( const char *caller )
rmesa->vb.fell_back = GL_TRUE;
rmesa->vb.installed = GL_FALSE;
vb.context = 0;
#else
fprintf(stderr, "Warning: control reached %s\n", __FUNCTION__);
#endif
}


static void VFMT_FALLBACK( const char *caller )
{
#if _HAVE_SWTNL
GLcontext *ctx = vb.context;
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLfloat tmp[3][15];
@@ -460,6 +467,9 @@ static void VFMT_FALLBACK( const char *caller )

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


@@ -738,6 +748,9 @@ static void radeonVtxfmtValidate( GLcontext *ctx )
fprintf(stderr, "%s: already installed", __FUNCTION__);
}
else {
#if !_HAVE_SWTNL
assert(0);
#else
if (RADEON_DEBUG & DEBUG_VFMT)
fprintf(stderr, "%s: failed\n", __FUNCTION__);

@@ -748,6 +761,7 @@ static void radeonVtxfmtValidate( GLcontext *ctx )
rmesa->vb.installed = GL_FALSE;
vb.context = 0;
}
#endif
}
}

@@ -871,7 +885,7 @@ do { \
#include "vtxfmt_tmp.h"


#if _HAVE_SWTNL
static GLboolean radeonNotifyBegin( GLcontext *ctx, GLenum p )
{
radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
@@ -902,6 +916,7 @@ static GLboolean radeonNotifyBegin( GLcontext *ctx, GLenum p )
radeon_Begin( p );
return GL_TRUE;
}
#endif

static void radeonFlushVertices( GLcontext *ctx, GLuint flags )
{
@@ -1002,7 +1017,9 @@ void radeonVtxfmtInit( GLcontext *ctx )

(void)radeon_fallback_vtxfmt;

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

vb.context = ctx;
rmesa->vb.enabled = 1;
@@ -1037,6 +1054,12 @@ void radeonVtxfmtInit( GLcontext *ctx )
make_empty_list( &rmesa->vb.dfn_cache.MultiTexCoord1fvARB );

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 )
@@ -1051,19 +1074,19 @@ static void free_funcs( struct dynfn *l )

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

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


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

#if defined(THREADS)
static GLboolean ThreadSafe = GL_FALSE; /* In thread-safe mode? */
if (!ThreadSafe) {
@@ -1084,9 +1107,11 @@ void radeonVtxfmtMakeCurrent( GLcontext *ctx )
return;
#endif

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



Loading…
Annulla
Salva