diff options
Diffstat (limited to 'src/mesa/drivers/dri/sis')
-rw-r--r-- | src/mesa/drivers/dri/sis/sis_clear.c | 38 | ||||
-rw-r--r-- | src/mesa/drivers/dri/sis/sis_context.c | 8 | ||||
-rw-r--r-- | src/mesa/drivers/dri/sis/sis_dd.c | 11 | ||||
-rw-r--r-- | src/mesa/drivers/dri/sis/sis_screen.c | 68 | ||||
-rw-r--r-- | src/mesa/drivers/dri/sis/sis_span.c | 74 | ||||
-rw-r--r-- | src/mesa/drivers/dri/sis/sis_span.h | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/sis/sis_state.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/sis/sis_tris.c | 2 |
8 files changed, 179 insertions, 34 deletions
diff --git a/src/mesa/drivers/dri/sis/sis_clear.c b/src/mesa/drivers/dri/sis/sis_clear.c index 7ed7103293..ef4b561ca5 100644 --- a/src/mesa/drivers/dri/sis/sis_clear.c +++ b/src/mesa/drivers/dri/sis/sis_clear.c @@ -119,9 +119,9 @@ sisDDClear( GLcontext * ctx, GLbitfield mask, GLboolean all, /* Mask out any non-existent buffers */ if (ctx->Visual.depthBits == 0 || !ctx->Depth.Mask) - mask &= ~DD_DEPTH_BIT; + mask &= ~BUFFER_BIT_DEPTH; if (ctx->Visual.stencilBits == 0) - mask &= ~DD_STENCIL_BIT; + mask &= ~BUFFER_BIT_STENCIL; LOCK_HARDWARE(); @@ -132,21 +132,21 @@ sisDDClear( GLcontext * ctx, GLbitfield mask, GLboolean all, /* XXX: Appears to be broken with stencil. */ if ((smesa->current.hwCapEnable2 & (MASK_AlphaMaskWriteEnable | MASK_ColorMaskWriteEnable) && - (mask & (DD_BACK_LEFT_BIT | DD_FRONT_LEFT_BIT)) != 0) || - (ctx->Stencil.WriteMask[0] < 0xff && (mask & DD_STENCIL_BIT) != 0) ) + (mask & (BUFFER_BIT_BACK_LEFT | BUFFER_BIT_FRONT_LEFT)) != 0) || + (ctx->Stencil.WriteMask[0] < 0xff && (mask & BUFFER_BIT_STENCIL) != 0) ) { mask = sis_3D_Clear( ctx, mask, x1, y1, width1, height1 ); } - if ( mask & DD_FRONT_LEFT_BIT || mask & DD_BACK_LEFT_BIT) { + if ( mask & BUFFER_BIT_FRONT_LEFT || mask & BUFFER_BIT_BACK_LEFT) { sis_clear_color_buffer( ctx, mask, x1, y1, width1, height1 ); - mask &= ~(DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT); + mask &= ~(BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT); } - if (mask & (DD_DEPTH_BIT | DD_STENCIL_BIT)) { + if (mask & (BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL)) { if (smesa->depthbuffer != NULL) sis_clear_z_stencil_buffer( ctx, mask, x1, y1, width1, height1 ); - mask &= ~(DD_DEPTH_BIT | DD_STENCIL_BIT); + mask &= ~(BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL); } UNLOCK_HARDWARE(); @@ -204,9 +204,9 @@ sis_3D_Clear( GLcontext * ctx, GLbitfield mask, int count; drm_clip_rect_t *pExtents; - bClrColor = (mask & (DD_BACK_LEFT_BIT | DD_FRONT_LEFT_BIT)) != 0; - bClrDepth = (mask & DD_DEPTH_BIT) != 0; - bClrStencil = (mask & DD_STENCIL_BIT) != 0; + bClrColor = (mask & (BUFFER_BIT_BACK_LEFT | BUFFER_BIT_FRONT_LEFT)) != 0; + bClrDepth = (mask & BUFFER_BIT_DEPTH) != 0; + bClrStencil = (mask & BUFFER_BIT_STENCIL) != 0; if (smesa->GlobalFlag & GFLAG_RENDER_STATES) sis_update_render_state( smesa ); @@ -252,7 +252,7 @@ sis_3D_Clear( GLcontext * ctx, GLbitfield mask, dirtyflags |= GFLAG_STENCILSETTING; } - if (mask & DD_FRONT_LEFT_BIT) { + if (mask & BUFFER_BIT_FRONT_LEFT) { pExtents = smesa->driDrawable->pClipRects; count = smesa->driDrawable->numClipRects; } else { @@ -321,14 +321,14 @@ sis_3D_Clear( GLcontext * ctx, GLbitfield mask, mEndPrimitive(); - /* If DD_FRONT_LEFT_BIT is set, we've only cleared the front buffer so far */ - if ((mask & DD_FRONT_LEFT_BIT) != 0 && (mask & DD_BACK_LEFT_BIT) != 0) - sis_3D_Clear( ctx, DD_BACK_LEFT_BIT, x, y, width, height ); + /* If BUFFER_BIT_FRONT_LEFT is set, we've only cleared the front buffer so far */ + if ((mask & BUFFER_BIT_FRONT_LEFT) != 0 && (mask & BUFFER_BIT_BACK_LEFT) != 0) + sis_3D_Clear( ctx, BUFFER_BIT_BACK_LEFT, x, y, width, height ); smesa->GlobalFlag |= dirtyflags; - return mask & ~(DD_DEPTH_BIT | DD_STENCIL_BIT | DD_BACK_LEFT_BIT | - DD_FRONT_LEFT_BIT); + return mask & ~(BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL | BUFFER_BIT_BACK_LEFT | + BUFFER_BIT_FRONT_LEFT); } static void @@ -368,7 +368,7 @@ sis_clear_color_buffer( GLcontext *ctx, GLenum mask, GLint x, GLint y, ENGPACKET stEngPacket; /* Clear back buffer */ - if (mask & DD_BACK_LEFT_BIT) { + if (mask & BUFFER_BIT_BACK_LEFT) { smesa->cbClearPacket.stdwDestPos.wY = y; smesa->cbClearPacket.stdwDestPos.wX = x; smesa->cbClearPacket.stdwDim.wWidth = (GLshort) width; @@ -378,7 +378,7 @@ sis_clear_color_buffer( GLcontext *ctx, GLenum mask, GLint x, GLint y, sis_bitblt_clear_cmd( smesa, &smesa->cbClearPacket ); } - if ((mask & DD_FRONT_LEFT_BIT) == 0) + if ((mask & BUFFER_BIT_FRONT_LEFT) == 0) return; /* Clear front buffer */ diff --git a/src/mesa/drivers/dri/sis/sis_context.c b/src/mesa/drivers/dri/sis/sis_context.c index 3b23b7df4e..ac7fb56dbe 100644 --- a/src/mesa/drivers/dri/sis/sis_context.c +++ b/src/mesa/drivers/dri/sis/sis_context.c @@ -306,14 +306,14 @@ sisMakeCurrent( __DRIcontextPrivate *driContextPriv, newSisCtx->driDrawable = driDrawPriv; - _mesa_make_current2( newSisCtx->glCtx, - (GLframebuffer *) driDrawPriv->driverPrivate, - (GLframebuffer *) driReadPriv->driverPrivate ); + _mesa_make_current( newSisCtx->glCtx, + (GLframebuffer *) driDrawPriv->driverPrivate, + (GLframebuffer *) driReadPriv->driverPrivate ); sisUpdateBufferSize( newSisCtx ); sisUpdateClipping( newSisCtx->glCtx ); } else { - _mesa_make_current( 0, 0 ); + _mesa_make_current( NULL, NULL, NULL ); } return GL_TRUE; diff --git a/src/mesa/drivers/dri/sis/sis_dd.c b/src/mesa/drivers/dri/sis/sis_dd.c index 4049a106b6..4e64c17b3d 100644 --- a/src/mesa/drivers/dri/sis/sis_dd.c +++ b/src/mesa/drivers/dri/sis/sis_dd.c @@ -41,6 +41,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "sis_tris.h" #include "swrast/swrast.h" +#include "framebuffer.h" #include "utils.h" @@ -172,9 +173,9 @@ sisUpdateBufferSize( sisContextPtr smesa ) void sisInitDriverFuncs( struct dd_function_table *functions ) { - functions->GetBufferSize = sisGetBufferSize; - functions->ResizeBuffers = _swrast_alloc_buffers; - functions->GetString = sisGetString; - functions->Finish = sisFinish; - functions->Flush = sisFlush; + functions->GetBufferSize = sisGetBufferSize; + functions->ResizeBuffers = _mesa_resize_framebuffer; + functions->GetString = sisGetString; + functions->Finish = sisFinish; + functions->Flush = sisFlush; } diff --git a/src/mesa/drivers/dri/sis/sis_screen.c b/src/mesa/drivers/dri/sis/sis_screen.c index 8ef6765dc3..ccfa959c9a 100644 --- a/src/mesa/drivers/dri/sis/sis_screen.c +++ b/src/mesa/drivers/dri/sis/sis_screen.c @@ -34,10 +34,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "context.h" #include "utils.h" #include "imports.h" +#include "framebuffer.h" +#include "renderbuffer.h" #include "sis_context.h" #include "sis_dri.h" #include "sis_lock.h" +#include "sis_span.h" #include "xmlpool.h" @@ -196,6 +199,7 @@ sisDestroyScreen( __DRIscreenPrivate *sPriv ) sPriv->private = NULL; } + /* Create and initialize the Mesa and driver specific pixmap buffer * data. */ @@ -205,15 +209,79 @@ sisCreateBuffer( __DRIscreenPrivate *driScrnPriv, const __GLcontextModes *mesaVis, GLboolean isPixmap ) { + sisScreenPtr screen = (sisScreenPtr) driScrnPriv->private; + if (isPixmap) return GL_FALSE; /* not implemented */ +#if 0 driDrawPriv->driverPrivate = (void *)_mesa_create_framebuffer( mesaVis, GL_FALSE, /* software depth buffer? */ mesaVis->stencilBits > 0, mesaVis->accumRedBits > 0, mesaVis->alphaBits > 0 ); /* XXX */ +#else + struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis); + + /* XXX double-check the Offset/Pitch parameters! */ + { + driRenderbuffer *frontRb + = driNewRenderbuffer(GL_RGBA, screen->cpp, + 0, driScrnPriv->fbStride); + sisSetSpanFunctions(frontRb, mesaVis); + _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base); + } + + if (mesaVis->doubleBufferMode) { + driRenderbuffer *backRb + = driNewRenderbuffer(GL_RGBA, screen->cpp, + 0, driScrnPriv->fbStride); + sisSetSpanFunctions(backRb, mesaVis); + _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base); + } + + if (mesaVis->depthBits == 16) { + driRenderbuffer *depthRb + = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp, + 0, driScrnPriv->fbStride); + sisSetSpanFunctions(depthRb, mesaVis); + _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); + } + else if (mesaVis->depthBits == 24) { + driRenderbuffer *depthRb + = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp, + 0, driScrnPriv->fbStride); + sisSetSpanFunctions(depthRb, mesaVis); + _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); + } + else if (mesaVis->depthBits == 32) { + driRenderbuffer *depthRb + = driNewRenderbuffer(GL_DEPTH_COMPONENT32, screen->cpp, + 0, driScrnPriv->fbStride); + sisSetSpanFunctions(depthRb, mesaVis); + _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); + } + + /* no h/w stencil? + if (mesaVis->stencilBits > 0) { + driRenderbuffer *stencilRb + = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT); + sisSetSpanFunctions(stencilRb, mesaVis); + _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base); + } + */ + + _mesa_add_soft_renderbuffers(fb, + GL_FALSE, /* color */ + GL_FALSE, /* depth */ + mesaVis->stencilBits > 0, + mesaVis->accumRedBits > 0, + GL_FALSE, /* alpha */ + GL_FALSE /* aux */); + driDrawPriv->driverPrivate = (void *) fb; +#endif + return (driDrawPriv->driverPrivate != NULL); } diff --git a/src/mesa/drivers/dri/sis/sis_span.c b/src/mesa/drivers/dri/sis/sis_span.c index 8f4b3af62e..abf3d652c0 100644 --- a/src/mesa/drivers/dri/sis/sis_span.c +++ b/src/mesa/drivers/dri/sis/sis_span.c @@ -205,11 +205,11 @@ static void sisDDSetBuffer( GLcontext *ctx, sisContextPtr smesa = SIS_CONTEXT(ctx); switch ( bufferBit ) { - case DD_FRONT_LEFT_BIT: + case BUFFER_BIT_FRONT_LEFT: smesa->drawOffset = smesa->readOffset = smesa->frontOffset; smesa->drawPitch = smesa->readPitch = smesa->frontPitch; break; - case DD_BACK_LEFT_BIT: + case BUFFER_BIT_BACK_LEFT: smesa->drawOffset = smesa->readOffset = smesa->backOffset; smesa->drawPitch = smesa->readPitch = smesa->backPitch; break; @@ -246,6 +246,7 @@ sisDDInitSpanFuncs( GLcontext *ctx ) switch (smesa->zFormat) { case SiS_ZFORMAT_Z16: +#if 0 swdd->ReadDepthSpan = sisReadDepthSpan_16; swdd->ReadDepthPixels = sisReadDepthPixels_16; swdd->WriteDepthSpan = sisWriteDepthSpan_16; @@ -255,8 +256,10 @@ sisDDInitSpanFuncs( GLcontext *ctx ) swdd->ReadStencilPixels = NULL; swdd->WriteStencilSpan = NULL; swdd->WriteStencilPixels = NULL; +#endif break; case SiS_ZFORMAT_Z32: +#if 0 swdd->ReadDepthSpan = sisReadDepthSpan_32; swdd->ReadDepthPixels = sisReadDepthPixels_32; swdd->WriteDepthSpan = sisWriteDepthSpan_32; @@ -266,8 +269,10 @@ sisDDInitSpanFuncs( GLcontext *ctx ) swdd->ReadStencilPixels = NULL; swdd->WriteStencilSpan = NULL; swdd->WriteStencilPixels = NULL; +#endif break; case SiS_ZFORMAT_S8Z24: +#if 0 swdd->ReadDepthSpan = sisReadDepthSpan_24_8; swdd->ReadDepthPixels = sisReadDepthPixels_24_8; swdd->WriteDepthSpan = sisWriteDepthSpan_24_8; @@ -277,9 +282,11 @@ sisDDInitSpanFuncs( GLcontext *ctx ) swdd->ReadStencilPixels = sisReadStencilPixels_24_8; swdd->WriteStencilSpan = sisWriteStencilSpan_24_8; swdd->WriteStencilPixels = sisWriteStencilPixels_24_8; +#endif break; } +#if 0 switch ( smesa->bytesPerPixel ) { case 2: @@ -312,7 +319,70 @@ sisDDInitSpanFuncs( GLcontext *ctx ) swdd->WriteMonoCIPixels = NULL; swdd->ReadCI32Span = NULL; swdd->ReadCI32Pixels = NULL; +#endif swdd->SpanRenderStart = sisSpanRenderStart; swdd->SpanRenderFinish = sisSpanRenderFinish; } + + + +/** + * Plug in the Get/Put routines for the given driRenderbuffer. + */ +void +sisSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis) +{ + if (drb->Base.InternalFormat == GL_RGBA) { + if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) { + drb->Base.GetRow = sisReadRGBASpan_565; + drb->Base.GetValues = sisReadRGBAPixels_565; + drb->Base.PutRow = sisWriteRGBASpan_565; + drb->Base.PutRowRGB = sisWriteRGBSpan_565; + drb->Base.PutMonoRow = sisWriteMonoRGBASpan_565; + drb->Base.PutValues = sisWriteRGBAPixels_565; + drb->Base.PutMonoValues = sisWriteMonoRGBAPixels_565; + } + else { + drb->Base.GetRow = sisReadRGBASpan_8888; + drb->Base.GetValues = sisReadRGBAPixels_8888; + drb->Base.PutRow = sisWriteRGBASpan_8888; + drb->Base.PutRowRGB = sisWriteRGBSpan_8888; + drb->Base.PutMonoRow = sisWriteMonoRGBASpan_8888; + drb->Base.PutValues = sisWriteRGBAPixels_8888; + drb->Base.PutMonoValues = sisWriteMonoRGBAPixels_8888; + } + } + else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) { + drb->Base.GetRow = sisReadDepthSpan_16; + drb->Base.GetValues = sisReadDepthPixels_16; + drb->Base.PutRow = sisWriteDepthSpan_16; + drb->Base.PutMonoRow = sisWriteMonoDepthSpan_16; + drb->Base.PutValues = sisWriteDepthPixels_16; + drb->Base.PutMonoValues = NULL; + } + else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) { + drb->Base.GetRow = sisReadDepthSpan_24_8; + drb->Base.GetValues = sisReadDepthPixels_24_8; + drb->Base.PutRow = sisWriteDepthSpan_24_8; + drb->Base.PutMonoRow = sisWriteMonoDepthSpan_24_8; + drb->Base.PutValues = sisWriteDepthPixels_24_8; + drb->Base.PutMonoValues = NULL; + } + else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT32) { + drb->Base.GetRow = sisReadDepthSpan_32; + drb->Base.GetValues = sisReadDepthPixels_32; + drb->Base.PutRow = sisWriteDepthSpan_32; + drb->Base.PutMonoRow = sisWriteMonoDepthSpan_32; + drb->Base.PutValues = sisWriteDepthPixels_32; + drb->Base.PutMonoValues = NULL; + } + else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) { + drb->Base.GetRow = sisReadStencilSpan_24_8; + drb->Base.GetValues = sisReadStencilPixels_24_8; + drb->Base.PutRow = sisWriteStencilSpan_24_8; + drb->Base.PutMonoRow = sisWriteMonoStencilSpan_24_8; + drb->Base.PutValues = sisWriteStencilPixels_24_8; + drb->Base.PutMonoValues = NULL; + } +} diff --git a/src/mesa/drivers/dri/sis/sis_span.h b/src/mesa/drivers/dri/sis/sis_span.h index c9760e4d26..7c73bc6d3a 100644 --- a/src/mesa/drivers/dri/sis/sis_span.h +++ b/src/mesa/drivers/dri/sis/sis_span.h @@ -32,9 +32,15 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef __SIS_SPAN_H__ #define __SIS_SPAN_H__ +#include "drirenderbuffer.h" + + extern void sisSpanRenderStart( GLcontext *ctx ); extern void sisSpanRenderFinish( GLcontext *ctx ); extern void sisDDInitSpanFuncs( GLcontext *ctx ); +extern void +sisSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis); + #endif diff --git a/src/mesa/drivers/dri/sis/sis_state.c b/src/mesa/drivers/dri/sis/sis_state.c index b269d694b0..db58e9090b 100644 --- a/src/mesa/drivers/dri/sis/sis_state.c +++ b/src/mesa/drivers/dri/sis/sis_state.c @@ -529,9 +529,9 @@ void sisDDDrawBuffer( GLcontext *ctx, GLenum mode ) /* * _DrawDestMask is easier to cope with than <mode>. */ - switch ( ctx->Color._DrawDestMask[0] ) { - case DD_FRONT_LEFT_BIT: - case DD_BACK_LEFT_BIT: + switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) { + case BUFFER_BIT_FRONT_LEFT: + case BUFFER_BIT_BACK_LEFT: FALLBACK( smesa, SIS_FALLBACK_DRAW_BUFFER, GL_FALSE ); break; default: diff --git a/src/mesa/drivers/dri/sis/sis_tris.c b/src/mesa/drivers/dri/sis/sis_tris.c index 45a92e5e92..3af70cf653 100644 --- a/src/mesa/drivers/dri/sis/sis_tris.c +++ b/src/mesa/drivers/dri/sis/sis_tris.c @@ -805,7 +805,7 @@ static void sisRenderStart( GLcontext *ctx ) GLuint AGPParseSet = smesa->AGPParseSet; GLboolean tex_fallback = GL_FALSE; - if (ctx->Color._DrawDestMask[0] == DD_FRONT_LEFT_BIT && + if (ctx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_FRONT_LEFT && smesa->driDrawable->numClipRects != 0) { multipass_cliprect(ctx, 0); |