summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_span.c2
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_state.c17
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_xmesa.c10
-rw-r--r--src/mesa/drivers/dri/i810/i810context.c7
-rw-r--r--src/mesa/drivers/dri/i810/i810context.h2
-rw-r--r--src/mesa/drivers/dri/i810/i810screen.c3
-rw-r--r--src/mesa/drivers/dri/i810/i810span.c76
-rw-r--r--src/mesa/drivers/dri/i810/i810state.c9
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_screen.c11
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_span.c93
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_state.c5
-rw-r--r--src/mesa/drivers/dri/mga/mgaspan.c126
-rw-r--r--src/mesa/drivers/dri/mga/mgastate.c5
-rw-r--r--src/mesa/drivers/dri/r128/r128_context.h5
-rw-r--r--src/mesa/drivers/dri/r128/r128_ioctl.c15
-rw-r--r--src/mesa/drivers/dri/r128/r128_lock.c24
-rw-r--r--src/mesa/drivers/dri/r128/r128_screen.c10
-rw-r--r--src/mesa/drivers/dri/r128/r128_span.c84
-rw-r--r--src/mesa/drivers/dri/r128/r128_state.c32
-rw-r--r--src/mesa/drivers/dri/r128/r128_state.h2
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_context.h1
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_span.c158
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_xmesa.c1
-rw-r--r--src/mesa/drivers/dri/savage/savage_xmesa.c35
-rw-r--r--src/mesa/drivers/dri/savage/savagecontext.h9
-rw-r--r--src/mesa/drivers/dri/savage/savageioctl.c6
-rw-r--r--src/mesa/drivers/dri/savage/savagespan.c119
-rw-r--r--src/mesa/drivers/dri/savage/savagestate.c7
-rw-r--r--src/mesa/drivers/dri/sis/sis_context.h1
-rw-r--r--src/mesa/drivers/dri/sis/sis_screen.c11
-rw-r--r--src/mesa/drivers/dri/sis/sis_span.c68
-rw-r--r--src/mesa/drivers/dri/sis/sis_state.c13
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_span.c27
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_state.c5
-rw-r--r--src/mesa/drivers/dri/unichrome/via_context.c107
-rw-r--r--src/mesa/drivers/dri/unichrome/via_context.h19
-rw-r--r--src/mesa/drivers/dri/unichrome/via_fb.c4
-rw-r--r--src/mesa/drivers/dri/unichrome/via_fb.h4
-rw-r--r--src/mesa/drivers/dri/unichrome/via_ioctl.c26
-rw-r--r--src/mesa/drivers/dri/unichrome/via_screen.c23
-rw-r--r--src/mesa/drivers/dri/unichrome/via_span.c152
-rw-r--r--src/mesa/drivers/dri/unichrome/via_span.h4
-rw-r--r--src/mesa/drivers/dri/unichrome/via_state.c9
43 files changed, 380 insertions, 967 deletions
diff --git a/src/mesa/drivers/dri/ffb/ffb_span.c b/src/mesa/drivers/dri/ffb/ffb_span.c
index f4698c64e4a..a23f4c66f0a 100644
--- a/src/mesa/drivers/dri/ffb/ffb_span.c
+++ b/src/mesa/drivers/dri/ffb/ffb_span.c
@@ -114,7 +114,7 @@ do { GLuint p = *(GLuint *)(buf + ((__x)<<2) + ((__y)<<13)); \
#define TAG(x) ffb##x##_888
-#include <spantmp.h>
+#include "spantmp.h"
/**
* Plug in the Get/Put routines for the given driRenderbuffer.
diff --git a/src/mesa/drivers/dri/ffb/ffb_state.c b/src/mesa/drivers/dri/ffb/ffb_state.c
index 86df5b4bcac..95ff820e104 100644
--- a/src/mesa/drivers/dri/ffb/ffb_state.c
+++ b/src/mesa/drivers/dri/ffb/ffb_state.c
@@ -510,6 +510,13 @@ static void ffbDDReadBuffer(GLcontext *ctx, GLenum buffer)
/*
* Specifies buffer for sw fallbacks (spans)
*/
+#if 000
+/* XXX
+ * This function is obsolete. It's not clear how this really effected
+ * span reading/writing above. The span functions should use the
+ * incoming driRenderbuffer (gl_renderbuffer) pointer to determine how
+ * to read from the specified bufer.
+ */
static void ffbDDSetBuffer(GLcontext *ctx, GLframebuffer *colorBuffer,
GLuint bufferBit)
{
@@ -546,6 +553,8 @@ static void ffbDDSetBuffer(GLcontext *ctx, GLframebuffer *colorBuffer,
FFB_MAKE_DIRTY(fmesa, FFB_STATE_FBC, 1);
}
}
+#endif
+
static void ffbDDClearColor(GLcontext *ctx, const GLfloat color[4])
{
@@ -1091,14 +1100,6 @@ void ffbDDInitStateFuncs(GLcontext *ctx)
ctx->Driver.ClearIndex = 0;
ctx->Driver.IndexMask = 0;
*/
-
- {
- struct swrast_device_driver *swdd =
- _swrast_GetDeviceDriverReference(ctx);
- swdd->SetBuffer = ffbDDSetBuffer;
- }
-
-
}
void ffbDDInitContextHwState(GLcontext *ctx)
diff --git a/src/mesa/drivers/dri/ffb/ffb_xmesa.c b/src/mesa/drivers/dri/ffb/ffb_xmesa.c
index 530c5373a9d..29aab4acba7 100644
--- a/src/mesa/drivers/dri/ffb/ffb_xmesa.c
+++ b/src/mesa/drivers/dri/ffb/ffb_xmesa.c
@@ -339,14 +339,6 @@ ffbCreateBuffer(__DRIscreenPrivate *driScrnPriv,
} else {
GLboolean swStencil = (mesaVis->stencilBits > 0 &&
mesaVis->depthBits != 24);
-#if 0
- driDrawPriv->driverPrivate = (void *)
- _mesa_create_framebuffer(mesaVis,
- GL_FALSE, /* software depth buffer? */
- mesaVis->stencilBits > 0,
- mesaVis->accumRedBits > 0,
- mesaVis->alphaBits > 0);
-#else
struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
{
@@ -385,7 +377,7 @@ ffbCreateBuffer(__DRIscreenPrivate *driScrnPriv,
GL_FALSE, /* alpha */
GL_FALSE /* aux */);
driDrawPriv->driverPrivate = (void *) fb;
-#endif
+
return (driDrawPriv->driverPrivate != NULL);
}
}
diff --git a/src/mesa/drivers/dri/i810/i810context.c b/src/mesa/drivers/dri/i810/i810context.c
index fd80e7675c4..d3445706a48 100644
--- a/src/mesa/drivers/dri/i810/i810context.c
+++ b/src/mesa/drivers/dri/i810/i810context.c
@@ -60,6 +60,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "i810vb.h"
#include "i810ioctl.h"
+#include "drirenderbuffer.h"
#include "utils.h"
#define need_GL_ARB_multisample
@@ -489,15 +490,13 @@ i810UpdatePageFlipping( i810ContextPtr imesa )
if ( imesa->sarea->pf_current_page == 1 )
front ^= 1;
+
+ driFlipRenderbuffers(ctx->WinSysDrawBuffer, front);
if (front) {
imesa->BufferSetup[I810_DESTREG_DI1] = imesa->i810Screen->fbOffset | imesa->i810Screen->backPitchBits;
- imesa->drawMap = (char *)imesa->driScreen->pFB;
- imesa->readMap = (char *)imesa->driScreen->pFB;
} else {
imesa->BufferSetup[I810_DESTREG_DI1] = imesa->i810Screen->backOffset | imesa->i810Screen->backPitchBits;
- imesa->drawMap = imesa->i810Screen->back.map;
- imesa->readMap = imesa->i810Screen->back.map;
}
imesa->dirty |= I810_UPLOAD_BUFFERS;
diff --git a/src/mesa/drivers/dri/i810/i810context.h b/src/mesa/drivers/dri/i810/i810context.h
index a2202e148f9..b83500bbd0c 100644
--- a/src/mesa/drivers/dri/i810/i810context.h
+++ b/src/mesa/drivers/dri/i810/i810context.h
@@ -152,8 +152,6 @@ struct i810_context_t {
/* These refer to the current draw (front vs. back) buffer:
*/
- char *drawMap; /* draw buffer address in virtual mem */
- char *readMap;
int drawX; /* origin of drawable in draw buffer */
int drawY;
GLuint numClipRects; /* cliprects for that buffer */
diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c
index 991c7cb2316..af8e0cc08ab 100644
--- a/src/mesa/drivers/dri/i810/i810screen.c
+++ b/src/mesa/drivers/dri/i810/i810screen.c
@@ -362,6 +362,7 @@ i810CreateBuffer( __DRIscreenPrivate *driScrnPriv,
/*screen->frontOffset*/0, screen->backPitch);
i810SetSpanFunctions(frontRb, mesaVis);
_mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
+ frontRb->Base.Data = driScrnPriv->pFB;
}
if (mesaVis->doubleBufferMode) {
@@ -370,6 +371,7 @@ i810CreateBuffer( __DRIscreenPrivate *driScrnPriv,
screen->backOffset, screen->backPitch);
i810SetSpanFunctions(backRb, mesaVis);
_mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
+ backRb->Base.Data = (GLubyte *) screen->back.map;
}
if (mesaVis->depthBits == 16) {
@@ -378,6 +380,7 @@ i810CreateBuffer( __DRIscreenPrivate *driScrnPriv,
screen->depthOffset, screen->backPitch);
i810SetSpanFunctions(depthRb, mesaVis);
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
+ depthRb->Base.Data = (GLubyte *) screen->depth.map;
}
_mesa_add_soft_renderbuffers(fb,
diff --git a/src/mesa/drivers/dri/i810/i810span.c b/src/mesa/drivers/dri/i810/i810span.c
index 1a976048c89..ac901066648 100644
--- a/src/mesa/drivers/dri/i810/i810span.c
+++ b/src/mesa/drivers/dri/i810/i810span.c
@@ -16,25 +16,23 @@
#define LOCAL_VARS \
i810ContextPtr imesa = I810_CONTEXT(ctx); \
__DRIdrawablePrivate *dPriv = imesa->driDrawable; \
- i810ScreenPrivate *i810Screen = imesa->i810Screen; \
- GLuint pitch = i810Screen->backPitch; \
+ driRenderbuffer *drb = (driRenderbuffer *) rb; \
+ GLuint pitch = drb->pitch; \
GLuint height = dPriv->h; \
GLushort p; \
- char *buf = (char *)(imesa->drawMap + \
+ char *buf = (char *)(drb->flippedData + \
dPriv->x * 2 + \
dPriv->y * pitch); \
- char *read_buf = (char *)(imesa->readMap + \
- dPriv->x * 2 + \
- dPriv->y * pitch); \
+ char *read_buf = buf; \
(void) read_buf; (void) buf; (void) p
#define LOCAL_DEPTH_VARS \
i810ContextPtr imesa = I810_CONTEXT(ctx); \
__DRIdrawablePrivate *dPriv = imesa->driDrawable; \
- i810ScreenPrivate *i810Screen = imesa->i810Screen; \
- GLuint pitch = i810Screen->backPitch; \
+ driRenderbuffer *drb = (driRenderbuffer *) rb; \
+ GLuint pitch = drb->pitch; \
GLuint height = dPriv->h; \
- char *buf = (char *)(i810Screen->depth.map + \
+ char *buf = (char *)(drb->Base.Data + \
dPriv->x * 2 + \
dPriv->y * pitch)
@@ -76,41 +74,10 @@ do { \
#define READ_DEPTH( d, _x, _y ) \
d = *(GLushort *)(buf + (_x)*2 + (_y)*pitch);
-#define TAG(x) i810##x##_16
+#define TAG(x) i810##x##_z16
#include "depthtmp.h"
-/*
- * This function is called to specify which buffer to read and write
- * for software rasterization (swrast) fallbacks. This doesn't necessarily
- * correspond to glDrawBuffer() or glReadBuffer() calls.
- */
-static void i810SetBuffer(GLcontext *ctx, GLframebuffer *buffer,
- GLuint bufferBit )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- (void) buffer;
-
- switch(bufferBit) {
- case BUFFER_BIT_FRONT_LEFT:
- if ( imesa->sarea->pf_current_page == 1)
- imesa->readMap = imesa->i810Screen->back.map;
- else
- imesa->readMap = (char*)imesa->driScreen->pFB;
- break;
- case BUFFER_BIT_BACK_LEFT:
- if ( imesa->sarea->pf_current_page == 1)
- imesa->readMap = (char*)imesa->driScreen->pFB;
- else
- imesa->readMap = imesa->i810Screen->back.map;
- break;
- default:
- ASSERT(0);
- break;
- }
- imesa->drawMap = imesa->readMap;
-}
-
/* Move locking out to get reasonable span performance.
*/
void i810SpanRenderStart( GLcontext *ctx )
@@ -131,26 +98,6 @@ void i810SpanRenderFinish( GLcontext *ctx )
void i810InitSpanFuncs( GLcontext *ctx )
{
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
-
- swdd->SetBuffer = i810SetBuffer;
-
-#if 0
- swdd->WriteRGBASpan = i810WriteRGBASpan_565;
- swdd->WriteRGBSpan = i810WriteRGBSpan_565;
- swdd->WriteMonoRGBASpan = i810WriteMonoRGBASpan_565;
- swdd->WriteRGBAPixels = i810WriteRGBAPixels_565;
- swdd->WriteMonoRGBAPixels = i810WriteMonoRGBAPixels_565;
- swdd->ReadRGBASpan = i810ReadRGBASpan_565;
- swdd->ReadRGBAPixels = i810ReadRGBAPixels_565;
-#endif
-
-#if 0
- swdd->ReadDepthSpan = i810ReadDepthSpan_16;
- swdd->WriteDepthSpan = i810WriteDepthSpan_16;
- swdd->ReadDepthPixels = i810ReadDepthPixels_16;
- swdd->WriteDepthPixels = i810WriteDepthPixels_16;
-#endif
-
swdd->SpanRenderStart = i810SpanRenderStart;
swdd->SpanRenderFinish = i810SpanRenderFinish;
}
@@ -174,12 +121,7 @@ i810SetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
drb->Base.PutMonoValues = i810WriteMonoRGBAPixels_565;
}
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
- drb->Base.GetRow = i810ReadDepthSpan_16;
- drb->Base.GetValues = i810ReadDepthPixels_16;
- drb->Base.PutRow = i810WriteDepthSpan_16;
- drb->Base.PutMonoRow = i810WriteMonoDepthSpan_16;
- drb->Base.PutValues = i810WriteDepthPixels_16;
- drb->Base.PutMonoValues = NULL;
+ i810InitDepthPointers_z16(&drb->Base);
}
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
/* should never get here */
diff --git a/src/mesa/drivers/dri/i810/i810state.c b/src/mesa/drivers/dri/i810/i810state.c
index c4662e89580..4a811a0d032 100644
--- a/src/mesa/drivers/dri/i810/i810state.c
+++ b/src/mesa/drivers/dri/i810/i810state.c
@@ -329,11 +329,6 @@ void i810DrawBuffer(GLcontext *ctx, GLenum mode )
imesa->i810Screen->backPitchBits);
i810XMesaSetBackClipRects( imesa );
}
-
- /* We want to update the s/w rast state too so that r200SetBuffer()
- * gets called.
- */
- _swrast_DrawBuffer(ctx, mode);
}
@@ -939,14 +934,10 @@ void i810InitState( GLcontext *ctx )
if (imesa->glCtx->Visual.doubleBufferMode && imesa->sarea->pf_current_page == 0) {
/* use back buffer by default */
- imesa->drawMap = i810Screen->back.map;
- imesa->readMap = i810Screen->back.map;
imesa->BufferSetup[I810_DESTREG_DI1] = (i810Screen->backOffset |
i810Screen->backPitchBits);
} else {
/* use front buffer by default */
- imesa->drawMap = (char *)imesa->driScreen->pFB;
- imesa->readMap = (char *)imesa->driScreen->pFB;
imesa->BufferSetup[I810_DESTREG_DI1] = (i810Screen->fbOffset |
i810Screen->backPitchBits);
}
diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c
index bcdaea166d0..62b1bc2ba52 100644
--- a/src/mesa/drivers/dri/mach64/mach64_screen.c
+++ b/src/mesa/drivers/dri/mach64/mach64_screen.c
@@ -372,14 +372,6 @@ mach64CreateBuffer( __DRIscreenPrivate *driScrnPriv,
return GL_FALSE; /* not implemented */
}
else {
-#if 0
- driDrawPriv->driverPrivate = (void *)
- _mesa_create_framebuffer( mesaVis,
- GL_FALSE, /* software depth buffer? */
- mesaVis->stencilBits > 0,
- mesaVis->accumRedBits > 0,
- mesaVis->alphaBits > 0 );
-#else
struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
{
@@ -406,6 +398,7 @@ mach64CreateBuffer( __DRIscreenPrivate *driScrnPriv,
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
}
else if (mesaVis->depthBits == 24) {
+ /* XXX I don't think 24-bit Z is supported - so this isn't used */
driRenderbuffer *depthRb
= driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp,
screen->depthOffset, screen->depthPitch);
@@ -421,7 +414,7 @@ mach64CreateBuffer( __DRIscreenPrivate *driScrnPriv,
GL_FALSE, /* alpha */
GL_FALSE /* aux */);
driDrawPriv->driverPrivate = (void *) fb;
-#endif
+
return (driDrawPriv->driverPrivate != NULL);
}
}
diff --git a/src/mesa/drivers/dri/mach64/mach64_span.c b/src/mesa/drivers/dri/mach64/mach64_span.c
index 0ac0eeaa604..dc9f27caeec 100644
--- a/src/mesa/drivers/dri/mach64/mach64_span.c
+++ b/src/mesa/drivers/dri/mach64/mach64_span.c
@@ -38,35 +38,26 @@
#define DBG 0
+#define GET_PTR(X,Y) (sPriv->pFB + drb->offset \
+ + ((dPriv->y + (Y)) * drb->pitch + (dPriv->x + (X))) * drb->cpp)
+
#define LOCAL_VARS \
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); \
- mach64ScreenRec *mach64Screen = mmesa->mach64Screen; \
- __DRIscreenPrivate *driScreen = mmesa->driScreen; \
+ __DRIscreenPrivate *sPriv = mmesa->driScreen; \
__DRIdrawablePrivate *dPriv = mmesa->driDrawable; \
- GLuint pitch = mmesa->drawPitch * mach64Screen->cpp; \
+ driRenderbuffer *drb = (driRenderbuffer *) rb; \
GLuint height = dPriv->h; \
- char *buf = (char *)(driScreen->pFB + \
- mmesa->drawOffset + \
- (dPriv->x * mach64Screen->cpp) + \
- (dPriv->y * pitch)); \
- char *read_buf = (char *)(driScreen->pFB + \
- mmesa->readOffset + \
- (dPriv->x * mach64Screen->cpp) + \
- (dPriv->y * pitch)); \
GLushort p; \
- (void) read_buf; (void) buf; (void) p
+ (void) p;
#define LOCAL_DEPTH_VARS \
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); \
- mach64ScreenRec *mach64Screen = mmesa->mach64Screen; \
__DRIdrawablePrivate *dPriv = mmesa->driDrawable; \
__DRIscreenPrivate *driScreen = mmesa->driScreen; \
- GLuint pitch = mach64Screen->depthPitch * 2; \
+ driRenderbuffer *drb = (driRenderbuffer *) rb; \
GLuint height = dPriv->h; \
- char *buf = (char *)(driScreen->pFB + \
- mach64Screen->depthOffset + \
- dPriv->x * 2 + \
- dPriv->y * pitch)
+ char *buf = (char *)(driScreen->pFB + drb->offset + \
+ (dPriv->x + dPriv->y * drb->pitch) * 2)
#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
@@ -104,6 +95,8 @@
#define TAG(x) mach64##x##_RGB565
#define TAG2(x,y) mach64##x##_RGB565##y
+#define GET_SRC_PTR(X,Y) GET_PTR(X,Y)
+#define GET_DST_PTR(X,Y) GET_SRC_PTR(X,Y)
#include "spantmp2.h"
@@ -116,6 +109,8 @@
#define TAG(x) mach64##x##_ARGB8888
#define TAG2(x,y) mach64##x##_ARGB8888##y
+#define GET_SRC_PTR(X,Y) GET_PTR(X,Y)
+#define GET_DST_PTR(X,Y) GET_SRC_PTR(X,Y)
#include "spantmp2.h"
@@ -126,44 +121,15 @@
/* 16 bit depthbuffer functions.
*/
#define WRITE_DEPTH( _x, _y, d ) \
- *(GLushort *)(buf + (_x)*2 + (_y)*pitch) = d;
+ *(GLushort *)(buf + ((_x) + (_y) * drb->pitch) * 2) = d;
#define READ_DEPTH( d, _x, _y ) \
- d = *(GLushort *)(buf + (_x)*2 + (_y)*pitch);
+ d = *(GLushort *)(buf + ((_x) + (_y) * drb->pitch) * 2);
-#define TAG(x) mach64##x##_16
+#define TAG(x) mach64##x##_z16
#include "depthtmp.h"
-/*
- * This function is called to specify which buffer to read and write
- * for software rasterization (swrast) fallbacks. This doesn't necessarily
- * correspond to glDrawBuffer() or glReadBuffer() calls.
- */
-static void mach64DDSetBuffer( GLcontext *ctx,
- GLframebuffer *colorBuffer,
- GLuint bufferBit )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
-
- switch ( bufferBit ) {
- case BUFFER_BIT_FRONT_LEFT:
- if (MACH64_DEBUG & DEBUG_VERBOSE_MSG)
- fprintf(stderr,"%s: BUFFER_BIT_FRONT_LEFT\n", __FUNCTION__);
- mmesa->drawOffset = mmesa->readOffset = mmesa->mach64Screen->frontOffset;
- mmesa->drawPitch = mmesa->readPitch = mmesa->mach64Screen->frontPitch;
- break;
- case BUFFER_BIT_BACK_LEFT:
- if (MACH64_DEBUG & DEBUG_VERBOSE_MSG)
- fprintf(stderr,"%s: BUFFER_BIT_BACK_LEFT\n", __FUNCTION__);
- mmesa->drawOffset = mmesa->readOffset = mmesa->mach64Screen->backOffset;
- mmesa->drawPitch = mmesa->readPitch = mmesa->mach64Screen->backPitch;
- break;
- default:
- break;
- }
-}
-
static void mach64SpanRenderStart( GLcontext *ctx )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
@@ -181,8 +147,6 @@ static void mach64SpanRenderFinish( GLcontext *ctx )
void mach64DDInitSpanFuncs( GLcontext *ctx )
{
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
-
- swdd->SetBuffer = mach64DDSetBuffer;
swdd->SpanRenderStart = mach64SpanRenderStart;
swdd->SpanRenderFinish = mach64SpanRenderFinish;
}
@@ -203,29 +167,6 @@ mach64SetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
}
}
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
- drb->Base.GetRow = mach64ReadDepthSpan_16;
- drb->Base.GetValues = mach64ReadDepthPixels_16;
- drb->Base.PutRow = mach64WriteDepthSpan_16;
- drb->Base.PutMonoRow = mach64WriteMonoDepthSpan_16;
- drb->Base.PutValues = mach64WriteDepthPixels_16;
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
- /* never */
- drb->Base.GetRow = NULL;
- drb->Base.GetValues = NULL;
- drb->Base.PutRow = NULL;
- drb->Base.PutMonoRow = NULL;
- drb->Base.PutValues = NULL;
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
- /* never */
- drb->Base.GetRow = NULL;
- drb->Base.GetValues = NULL;
- drb->Base.PutRow = NULL;
- drb->Base.PutMonoRow = NULL;
- drb->Base.PutValues = NULL;
- drb->Base.PutMonoValues = NULL;
+ mach64InitDepthPointers_z16(&drb->Base);
}
}
diff --git a/src/mesa/drivers/dri/mach64/mach64_state.c b/src/mesa/drivers/dri/mach64/mach64_state.c
index d9b5725a638..1eb4b6e73c2 100644
--- a/src/mesa/drivers/dri/mach64/mach64_state.c
+++ b/src/mesa/drivers/dri/mach64/mach64_state.c
@@ -753,11 +753,6 @@ static void mach64DDDrawBuffer( GLcontext *ctx, GLenum mode )
break;
}
- /* We want to update the s/w rast state too so that mach64SetBuffer()
- * gets called.
- */
- _swrast_DrawBuffer(ctx, mode);
-
mmesa->setup.dst_off_pitch = (((mmesa->drawPitch/8) << 22) |
(mmesa->drawOffset >> 3));
diff --git a/src/mesa/drivers/dri/mga/mgaspan.c b/src/mesa/drivers/dri/mga/mgaspan.c
index c62b1c875a2..494d1a36b60 100644
--- a/src/mesa/drivers/dri/mga/mgaspan.c
+++ b/src/mesa/drivers/dri/mga/mgaspan.c
@@ -24,7 +24,6 @@
* Authors:
* Keith Whitwell <[email protected]>
*/
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgaspan.c,v 1.11 2002/10/30 12:51:36 alanh Exp $ */
#include "mtypes.h"
#include "mgadd.h"
@@ -36,20 +35,17 @@
#define DBG 0
#define LOCAL_VARS \
- mgaContextPtr mmesa = MGA_CONTEXT(ctx); \
+ mgaContextPtr mmesa = MGA_CONTEXT(ctx); \
__DRIdrawablePrivate *dPriv = mmesa->mesa_drawable; \
- mgaScreenPrivate *mgaScreen = mmesa->mgaScreen; \
__DRIscreenPrivate *sPriv = mmesa->driScreen; \
- GLuint pitch = mgaScreen->frontPitch; \
+ driRenderbuffer *drb = (driRenderbuffer *) rb; \
+ GLuint pitch = drb->pitch; \
GLuint height = dPriv->h; \
- char *read_buf = (char *)(sPriv->pFB + \
- mmesa->readOffset + \
- dPriv->x * mgaScreen->cpp + \
- dPriv->y * pitch); \
char *buf = (char *)(sPriv->pFB + \
- mmesa->drawOffset + \
- dPriv->x * mgaScreen->cpp + \
+ drb->offset + \
+ dPriv->x * drb->cpp + \
dPriv->y * pitch); \
+ char *read_buf = buf; \
GLuint p; \
(void) read_buf; (void) buf; (void) p
@@ -58,13 +54,13 @@
#define LOCAL_DEPTH_VARS \
mgaContextPtr mmesa = MGA_CONTEXT(ctx); \
__DRIdrawablePrivate *dPriv = mmesa->mesa_drawable; \
- mgaScreenPrivate *mgaScreen = mmesa->mgaScreen; \
__DRIscreenPrivate *sPriv = mmesa->driScreen; \
- GLuint pitch = mgaScreen->frontPitch; \
+ driRenderbuffer *drb = (driRenderbuffer *) rb; \
+ GLuint pitch = drb->pitch; \
GLuint height = dPriv->h; \
char *buf = (char *)(sPriv->pFB + \
- mgaScreen->depthOffset + \
- dPriv->x * mgaScreen->cpp + \
+ drb->offset + \
+ dPriv->x * drb->cpp + \
dPriv->y * pitch)
#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
@@ -118,7 +114,7 @@
#define READ_DEPTH( d, _x, _y ) \
d = *(GLushort *)(buf + (_x)*2 + (_y)*pitch);
-#define TAG(x) mga##x##_16
+#define TAG(x) mga##x##_z16
#include "depthtmp.h"
@@ -132,7 +128,7 @@
#define READ_DEPTH( d, _x, _y ) \
d = *(GLuint *)(buf + (_x)*4 + (_y)*pitch);
-#define TAG(x) mga##x##_32
+#define TAG(x) mga##x##_z32
#include "depthtmp.h"
@@ -150,7 +146,7 @@
d = (*(GLuint *)(buf + (_x)*4 + (_y)*pitch) & ~0xff) >> 8; \
}
-#define TAG(x) mga##x##_24_8
+#define TAG(x) mga##x##_z24_s8
#include "depthtmp.h"
#define WRITE_STENCIL( _x, _y, d ) { \
@@ -163,38 +159,10 @@
#define READ_STENCIL( d, _x, _y ) \
d = *(GLuint *)(buf + _x*4 + _y*pitch) & 0xff;
-#define TAG(x) mga##x##_24_8
+#define TAG(x) mga##x##_z24_s8
#include "stenciltmp.h"
-
-/*
- * This function is called to specify which buffer to read and write
- * for software rasterization (swrast) fallbacks. This doesn't necessarily
- * correspond to glDrawBuffer() or glReadBuffer() calls.
- */
-static void mgaDDSetBuffer(GLcontext *ctx, GLframebuffer *buffer,
- GLuint bufferBit)
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- unsigned int offset;
-
- assert((bufferBit == BUFFER_BIT_FRONT_LEFT) || (bufferBit == BUFFER_BIT_BACK_LEFT));
-
- offset = (bufferBit == BUFFER_BIT_FRONT_LEFT)
- ? mmesa->mgaScreen->frontOffset
- : mmesa->mgaScreen->backOffset;
-
- mmesa->drawOffset = offset;
- mmesa->readOffset = offset;
-
- assert( (buffer == mmesa->driDrawable->driverPrivate)
- || (buffer == mmesa->driReadable->driverPrivate) );
-
- mmesa->mesa_drawable = (buffer == mmesa->driDrawable->driverPrivate)
- ? mmesa->driDrawable : mmesa->driReadable;
-}
-
void mgaSpanRenderStart( GLcontext *ctx )
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
@@ -219,45 +187,7 @@ void mgaSpanRenderFinish( GLcontext *ctx )
*/
void mgaDDInitSpanFuncs( GLcontext *ctx )
{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
-
- swdd->SetBuffer = mgaDDSetBuffer;
-
- switch (mmesa->mgaScreen->cpp) {
- case 2:
-#if 0
- mgaInitPointers_565( swdd );
- swdd->ReadDepthSpan = mgaReadDepthSpan_16;
- swdd->WriteDepthSpan = mgaWriteDepthSpan_16;
- swdd->ReadDepthPixels = mgaReadDepthPixels_16;
- swdd->WriteDepthPixels = mgaWriteDepthPixels_16;
-#endif
- break;
-
- case 4:
-#if 0
- mgaInitPointers_8888( swdd );
-
- if (!mmesa->hw_stencil) {
- swdd->ReadDepthSpan = mgaReadDepthSpan_32;
- swdd->WriteDepthSpan = mgaWriteDepthSpan_32;
- swdd->ReadDepthPixels = mgaReadDepthPixels_32;
- swdd->WriteDepthPixels = mgaWriteDepthPixels_32;
- } else {
- swdd->ReadDepthSpan = mgaReadDepthSpan_24_8;
- swdd->WriteDepthSpan = mgaWriteDepthSpan_24_8;
- swdd->ReadDepthPixels = mgaReadDepthPixels_24_8;
- swdd->WriteDepthPixels = mgaWriteDepthPixels_24_8;
-
- swdd->ReadStencilSpan = mgaReadStencilSpan_24_8;
- swdd->WriteStencilSpan = mgaWriteStencilSpan_24_8;
- swdd->ReadStencilPixels = mgaReadStencilPixels_24_8;
- swdd->WriteStencilPixels = mgaWriteStencilPixels_24_8;
- }
-#endif
- break;
- }
swdd->SpanRenderStart = mgaSpanRenderStart;
swdd->SpanRenderFinish = mgaSpanRenderFinish;
}
@@ -278,35 +208,15 @@ mgaSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
}
}
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
- drb->Base.GetRow = mgaReadDepthSpan_16;
- drb->Base.GetValues = mgaReadDepthPixels_16;
- drb->Base.PutRow = mgaWriteDepthSpan_16;
- drb->Base.PutMonoRow = mgaWriteMonoDepthSpan_16;
- drb->Base.PutValues = mgaWriteDepthPixels_16;
- drb->Base.PutMonoValues = NULL;
+ mgaInitDepthPointers_z16(&drb->Base);
}
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
- drb->Base.GetRow = mgaReadDepthSpan_24_8;
- drb->Base.GetValues = mgaReadDepthPixels_24_8;
- drb->Base.PutRow = mgaWriteDepthSpan_24_8;
- drb->Base.PutMonoRow = mgaWriteMonoDepthSpan_24_8;
- drb->Base.PutValues = mgaWriteDepthPixels_24_8;
- drb->Base.PutMonoValues = NULL;
+ mgaInitDepthPointers_z24_s8(&drb->Base);
}
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT32) {
- drb->Base.GetRow = mgaReadDepthSpan_32;
- drb->Base.GetValues = mgaReadDepthPixels_32;
- drb->Base.PutRow = mgaWriteDepthSpan_32;
- drb->Base.PutMonoRow = mgaWriteMonoDepthSpan_32;
- drb->Base.PutValues = mgaWriteDepthPixels_32;
- drb->Base.PutMonoValues = NULL;
+ mgaInitDepthPointers_z32(&drb->Base);
}
else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
- drb->Base.GetRow = mgaReadStencilSpan_24_8;
- drb->Base.GetValues = mgaReadStencilPixels_24_8;
- drb->Base.PutRow = mgaWriteStencilSpan_24_8;
- drb->Base.PutMonoRow = mgaWriteMonoStencilSpan_24_8;
- drb->Base.PutValues = mgaWriteStencilPixels_24_8;
- drb->Base.PutMonoValues = NULL;
+ mgaInitStencilPointers_z24_s8(&drb->Base);
}
}
diff --git a/src/mesa/drivers/dri/mga/mgastate.c b/src/mesa/drivers/dri/mga/mgastate.c
index 72d5c9fb082..7ba3cdb776c 100644
--- a/src/mesa/drivers/dri/mga/mgastate.c
+++ b/src/mesa/drivers/dri/mga/mgastate.c
@@ -845,11 +845,6 @@ static void mgaDDDrawBuffer(GLcontext *ctx, GLenum mode )
FALLBACK( ctx, MGA_FALLBACK_DRAW_BUFFER, GL_TRUE );
return;
}
-
- /* We want to update the s/w rast state too so that r200SetBuffer()
- * gets called.
- */
- _swrast_DrawBuffer(ctx, mode);
}
diff --git a/src/mesa/drivers/dri/r128/r128_context.h b/src/mesa/drivers/dri/r128/r128_context.h
index e91257f7fc8..b3552ac7639 100644
--- a/src/mesa/drivers/dri/r128/r128_context.h
+++ b/src/mesa/drivers/dri/r128/r128_context.h
@@ -177,11 +177,8 @@ struct r128_context {
*/
GLuint doPageFlip;
- /* Drawable, cliprect and scissor information
+ /* Cliprect and scissor information
*/
- GLint drawOffset, drawPitch;
- GLint readOffset, readPitch;
-
GLuint numClipRects; /* Cliprects for the draw buffer */
drm_clip_rect_t *pClipRects;
diff --git a/src/mesa/drivers/dri/r128/r128_ioctl.c b/src/mesa/drivers/dri/r128/r128_ioctl.c
index fc017329ca2..150d62577ed 100644
--- a/src/mesa/drivers/dri/r128/r128_ioctl.c
+++ b/src/mesa/drivers/dri/r128/r128_ioctl.c
@@ -44,6 +44,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "vblank.h"
#include "mmio.h"
+#include "drirenderbuffer.h"
#define R128_TIMEOUT 2048
#define R128_IDLE_RETRY 32
@@ -373,16 +374,12 @@ void r128PageFlip( const __DRIdrawablePrivate *dPriv )
exit( 1 );
}
- if ( rmesa->sarea->pfCurrentPage == 1 ) {
- rmesa->drawOffset = rmesa->r128Screen->frontOffset;
- rmesa->drawPitch = rmesa->r128Screen->frontPitch;
- } else {
- rmesa->drawOffset = rmesa->r128Screen->backOffset;
- rmesa->drawPitch = rmesa->r128Screen->backPitch;
- }
+ /* Get ready for drawing next frame. Update the renderbuffers'
+ * flippedOffset/Pitch fields so we draw into the right place.
+ */
+ driFlipRenderbuffers(rmesa->glCtx->WinSysDrawBuffer,
+ rmesa->sarea->pfCurrentPage);
- rmesa->setup.dst_pitch_offset_c = (((rmesa->drawPitch/8) << 21) |
- (rmesa->drawOffset >> 5));
rmesa->new_state |= R128_NEW_WINDOW;
/* FIXME: Do we need this anymore? */
diff --git a/src/mesa/drivers/dri/r128/r128_lock.c b/src/mesa/drivers/dri/r128/r128_lock.c
index ea4ccfb2ec9..ff11eb68480 100644
--- a/src/mesa/drivers/dri/r128/r128_lock.c
+++ b/src/mesa/drivers/dri/r128/r128_lock.c
@@ -37,6 +37,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r128_tex.h"
#include "r128_state.h"
+#include "drirenderbuffer.h"
+
+
#if DEBUG_LOCKING
char *prevLockFile = NULL;
int prevLockLine = 0;
@@ -48,28 +51,11 @@ int prevLockLine = 0;
static void
r128UpdatePageFlipping( r128ContextPtr rmesa )
{
- int use_back;
-
rmesa->doPageFlip = rmesa->sarea->pfAllowPageFlip;
-
- use_back = (rmesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT);
- use_back ^= (rmesa->sarea->pfCurrentPage == 1);
-
- if ( R128_DEBUG & DEBUG_VERBOSE_API )
- fprintf(stderr, "%s allow %d current %d\n", __FUNCTION__,
- rmesa->doPageFlip,
- rmesa->sarea->pfCurrentPage );
-
- if ( use_back ) {
- rmesa->drawOffset = rmesa->r128Screen->backOffset;
- rmesa->drawPitch = rmesa->r128Screen->backPitch;
- } else {
- rmesa->drawOffset = rmesa->r128Screen->frontOffset;
- rmesa->drawPitch = rmesa->r128Screen->frontPitch;
+ if (!rmesa->doPageFlip) {
+ driFlipRenderbuffers(rmesa->glCtx->WinSysDrawBuffer, GL_FALSE);
}
- rmesa->setup.dst_pitch_offset_c = (((rmesa->drawPitch/8) << 21) |
- (rmesa->drawOffset >> 5));
rmesa->new_state |= R128_NEW_WINDOW;
}
diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c
index c6c598cc3b8..442eb6b9ecf 100644
--- a/src/mesa/drivers/dri/r128/r128_screen.c
+++ b/src/mesa/drivers/dri/r128/r128_screen.c
@@ -271,14 +271,6 @@ r128CreateBuffer( __DRIscreenPrivate *driScrnPriv,
return GL_FALSE; /* not implemented */
}
else {
-#if 0
- driDrawPriv->driverPrivate = (void *)
- _mesa_create_framebuffer( mesaVis,
- GL_FALSE, /* software depth buffer? */
- mesaVis->stencilBits > 0,
- mesaVis->accumRedBits > 0,
- mesaVis->alphaBits > 0 );
-#else
struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
{
@@ -320,7 +312,7 @@ r128CreateBuffer( __DRIscreenPrivate *driScrnPriv,
GL_FALSE, /* alpha */
GL_FALSE /* aux */);
driDrawPriv->driverPrivate = (void *) fb;
-#endif
+
return (driDrawPriv->driverPrivate != NULL);
}
}
diff --git a/src/mesa/drivers/dri/r128/r128_span.c b/src/mesa/drivers/dri/r128/r128_span.c
index fd4722b3b36..e64282b8a75 100644
--- a/src/mesa/drivers/dri/r128/r128_span.c
+++ b/src/mesa/drivers/dri/r128/r128_span.c
@@ -44,26 +44,20 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define DBG 0
+#define GET_PTR(X,Y) (sPriv->pFB + drb->flippedOffset \
+ + ((dPriv->y + (Y)) * drb->flippedPitch + (dPriv->x + (X))) * drb->cpp)
+
#define HAVE_HW_DEPTH_SPANS 1
#define HAVE_HW_DEPTH_PIXELS 1
#define LOCAL_VARS \
r128ContextPtr rmesa = R128_CONTEXT(ctx); \
- r128ScreenPtr r128scrn = rmesa->r128Screen; \
__DRIscreenPrivate *sPriv = rmesa->driScreen; \
__DRIdrawablePrivate *dPriv = rmesa->driDrawable; \
- GLuint pitch = r128scrn->frontPitch * r128scrn->cpp; \
+ driRenderbuffer *drb = (driRenderbuffer *) rb; \
GLuint height = dPriv->h; \
- char *buf = (char *)(sPriv->pFB + \
- rmesa->drawOffset + \
- (dPriv->x * r128scrn->cpp) + \
- (dPriv->y * pitch)); \
- char *read_buf = (char *)(sPriv->pFB + \
- rmesa->readOffset + \
- (dPriv->x * r128scrn->cpp) + \
- (dPriv->y * pitch)); \
GLuint p; \
- (void) read_buf; (void) buf; (void) p
+ (void) p;
#define LOCAL_DEPTH_VARS \
r128ContextPtr rmesa = R128_CONTEXT(ctx); \
@@ -94,6 +88,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define TAG(x) r128##x##_RGB565
#define TAG2(x,y) r128##x##_RGB565##y
+#define GET_SRC_PTR(X,Y) GET_PTR(X,Y)
+#define GET_DST_PTR(X,Y) GET_PTR(X,Y)
#include "spantmp2.h"
@@ -104,6 +100,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define TAG(x) r128##x##_ARGB8888
#define TAG2(x,y) r128##x##_ARGB8888##y
+#define GET_SRC_PTR(X,Y) GET_PTR(X,Y)
+#define GET_DST_PTR(X,Y) GET_PTR(X,Y)
#include "spantmp2.h"
@@ -181,7 +179,7 @@ do { \
} \
} while (0)
-#define TAG(x) r128##x##_16
+#define TAG(x) r128##x##_z16
#include "depthtmp.h"
@@ -254,7 +252,7 @@ do { \
} \
} while (0)
-#define TAG(x) r128##x##_24_8
+#define TAG(x) r128##x##_z24_s8
#include "depthtmp.h"
@@ -266,41 +264,6 @@ do { \
/* FIXME: Add support for hardware stencil buffers.
*/
-/*
- * This function is called to specify which buffer to read and write
- * for software rasterization (swrast) fallbacks. This doesn't necessarily
- * correspond to glDrawBuffer() or glReadBuffer() calls.
- */
-static void r128DDSetBuffer( GLcontext *ctx,
- GLframebuffer *colorBuffer,
- GLuint bufferBit )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- switch ( bufferBit ) {
- case BUFFER_BIT_FRONT_LEFT:
- if ( rmesa->sarea->pfCurrentPage == 1 ) {
- rmesa->drawOffset = rmesa->readOffset = rmesa->r128Screen->backOffset;
- rmesa->drawPitch = rmesa->readPitch = rmesa->r128Screen->backPitch;
- } else {
- rmesa->drawOffset = rmesa->readOffset = rmesa->r128Screen->frontOffset;
- rmesa->drawPitch = rmesa->readPitch = rmesa->r128Screen->frontPitch;
- }
- break;
- case BUFFER_BIT_BACK_LEFT:
- if ( rmesa->sarea->pfCurrentPage == 1 ) {
- rmesa->drawOffset = rmesa->readOffset = rmesa->r128Screen->frontOffset;
- rmesa->drawPitch = rmesa->readPitch = rmesa->r128Screen->frontPitch;
- } else {
- rmesa->drawOffset = rmesa->readOffset = rmesa->r128Screen->backOffset;
- rmesa->drawPitch = rmesa->readPitch = rmesa->r128Screen->backPitch;
- }
- break;
- default:
- break;
- }
-}
-
void r128SpanRenderStart( GLcontext *ctx )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
@@ -318,10 +281,7 @@ void r128SpanRenderFinish( GLcontext *ctx )
void r128DDInitSpanFuncs( GLcontext *ctx )
{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
-
- swdd->SetBuffer = r128DDSetBuffer;
swdd->SpanRenderStart = r128SpanRenderStart;
swdd->SpanRenderFinish = r128SpanRenderFinish;
}
@@ -342,27 +302,9 @@ r128SetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
}
}
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
- drb->Base.GetRow = r128ReadDepthSpan_16;
- drb->Base.GetValues = r128ReadDepthPixels_16;
- drb->Base.PutRow = r128WriteDepthSpan_16;
- drb->Base.PutMonoRow = r128WriteMonoDepthSpan_16;
- drb->Base.PutValues = r128WriteDepthPixels_16;
- drb->Base.PutMonoValues = NULL;
+ r128InitDepthPointers_z16(&drb->Base);
}
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
- drb->Base.GetRow = r128ReadDepthSpan_24_8;
- drb->Base.GetValues = r128ReadDepthPixels_24_8;
- drb->Base.PutRow = r128WriteDepthSpan_24_8;
- drb->Base.PutMonoRow = r128WriteMonoDepthSpan_24_8;
- drb->Base.PutValues = r128WriteDepthPixels_24_8;
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
- drb->Base.GetRow = NULL;
- drb->Base.GetValues = NULL;
- drb->Base.PutRow = NULL;
- drb->Base.PutMonoRow = NULL;
- drb->Base.PutValues = NULL;
- drb->Base.PutMonoValues = NULL;
+ r128InitDepthPointers_z24_s8(&drb->Base);
}
}
diff --git a/src/mesa/drivers/dri/r128/r128_state.c b/src/mesa/drivers/dri/r128/r128_state.c
index 29f490da89d..a1cb6aafeb2 100644
--- a/src/mesa/drivers/dri/r128/r128_state.c
+++ b/src/mesa/drivers/dri/r128/r128_state.c
@@ -51,6 +51,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "tnl/t_pipeline.h"
+#include "drirenderbuffer.h"
+
/* =============================================================
* Alpha blending
@@ -628,23 +630,29 @@ static void r128DDShadeModel( GLcontext *ctx, GLenum mode )
* Window position
*/
-void r128UpdateWindow( GLcontext *ctx )
+static void r128UpdateWindow( GLcontext *ctx )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
int x = rmesa->driDrawable->x;
int y = rmesa->driDrawable->y;
+ struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0][0];
+ driRenderbuffer *drb = (driRenderbuffer *) rb;
rmesa->setup.window_xy_offset = ((y << R128_WINDOW_Y_SHIFT) |
(x << R128_WINDOW_X_SHIFT));
+ rmesa->setup.dst_pitch_offset_c = (((drb->flippedPitch/8) << 21) |
+ (drb->flippedOffset >> 5));
+
+
rmesa->dirty |= R128_UPLOAD_CONTEXT | R128_UPLOAD_WINDOW;
}
+
/* =============================================================
* Viewport
*/
-
static void r128CalcViewport( GLcontext *ctx )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
@@ -729,13 +737,6 @@ static void r128DDDrawBuffer( GLcontext *ctx, GLenum mode )
break;
}
- /* We want to update the s/w rast state too so that r128DDSetBuffer()
- * gets called.
- */
- _swrast_DrawBuffer(ctx, mode);
-
- rmesa->setup.dst_pitch_offset_c = (((rmesa->drawPitch/8) << 21) |
- (rmesa->drawOffset >> 5));
rmesa->new_state |= R128_NEW_WINDOW;
}
@@ -1094,19 +1095,8 @@ void r128DDInitState( r128ContextPtr rmesa )
rmesa->Fallback = 0;
- if ( rmesa->glCtx->Visual.doubleBufferMode && rmesa->sarea->pfCurrentPage == 0 ) {
- rmesa->drawOffset = rmesa->readOffset = rmesa->r128Screen->backOffset;
- rmesa->drawPitch = rmesa->readPitch = rmesa->r128Screen->backPitch;
- } else {
- rmesa->drawOffset = rmesa->readOffset = rmesa->r128Screen->frontOffset;
- rmesa->drawPitch = rmesa->readPitch = rmesa->r128Screen->frontPitch;
- }
-
- /* Harware state:
+ /* Hardware state:
*/
- rmesa->setup.dst_pitch_offset_c = (((rmesa->drawPitch/8) << 21) |
- (rmesa->drawOffset >> 5));
-
rmesa->setup.dp_gui_master_cntl_c = (R128_GMC_DST_PITCH_OFFSET_CNTL |
R128_GMC_DST_CLIPPING |
R128_GMC_BRUSH_SOLID_COLOR |
diff --git a/src/mesa/drivers/dri/r128/r128_state.h b/src/mesa/drivers/dri/r128/r128_state.h
index ac33853b167..6f0a6a65573 100644
--- a/src/mesa/drivers/dri/r128/r128_state.h
+++ b/src/mesa/drivers/dri/r128/r128_state.h
@@ -44,8 +44,6 @@ extern void r128DDInitStateFuncs( GLcontext *ctx );
extern void r128DDUpdateState( GLcontext *ctx );
extern void r128DDUpdateHWState( GLcontext *ctx );
-extern void r128UpdateWindow( GLcontext *ctx );
-
extern void r128EmitHwStateLocked( r128ContextPtr rmesa );
#endif
diff --git a/src/mesa/drivers/dri/s3v/s3v_context.h b/src/mesa/drivers/dri/s3v/s3v_context.h
index b94fee6a8ee..4b409fbf374 100644
--- a/src/mesa/drivers/dri/s3v/s3v_context.h
+++ b/src/mesa/drivers/dri/s3v/s3v_context.h
@@ -162,7 +162,6 @@ void s3vEmitHwState( s3vContextPtr vmesa );
void s3vGetLock( s3vContextPtr vmesa, GLuint flags );
void s3vInitExtensions( GLcontext *ctx );
void s3vInitDriverFuncs( GLcontext *ctx );
-void s3vInitSpanFuncs( GLcontext *ctx );
void s3vSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis);
void s3vInitState( s3vContextPtr vmesa );
void s3vInitHW( s3vContextPtr vmesa );
diff --git a/src/mesa/drivers/dri/s3v/s3v_span.c b/src/mesa/drivers/dri/s3v/s3v_span.c
index 49135a9c3ff..b8ebd5f30ec 100644
--- a/src/mesa/drivers/dri/s3v/s3v_span.c
+++ b/src/mesa/drivers/dri/s3v/s3v_span.c
@@ -11,36 +11,29 @@
#define DBG 0
#define LOCAL_VARS \
- s3vContextPtr vmesa = S3V_CONTEXT(ctx); \
- s3vScreenPtr s3vscrn = vmesa->s3vScreen; \
- __DRIscreenPrivate *sPriv = vmesa->driScreen; \
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable; \
- GLuint pitch = ( (vmesa->Flags & S3V_BACK_BUFFER) ? \
- ((dPriv->w+31)&~31) * s3vscrn->cpp \
- : sPriv->fbWidth * s3vscrn->cpp); \
- GLuint height = dPriv->h; \
- char *buf = ( (vmesa->Flags & S3V_BACK_BUFFER) ? \
- (char *)(sPriv->pFB + vmesa->drawOffset) \
- : (char *)(sPriv->pFB + vmesa->drawOffset \
- + dPriv->x * s3vscrn->cpp + dPriv->y * pitch) ); \
- char *read_buf = ( (vmesa->Flags & S3V_BACK_BUFFER) ? \
- (char *)(sPriv->pFB + vmesa->drawOffset) \
- : (char *)(sPriv->pFB + vmesa->drawOffset \
- + dPriv->x * s3vscrn->cpp + dPriv->y * pitch) ); \
+ s3vContextPtr vmesa = S3V_CONTEXT(ctx); \
+ __DRIscreenPrivate *sPriv = vmesa->driScreen; \
+ __DRIdrawablePrivate *dPriv = vmesa->driDrawable; \
+ driRenderbuffer *drb = (driRenderbuffer *) rb; \
+ GLuint cpp = drb->cpp; \
+ GLuint pitch = ( (drb->backBuffer) ? \
+ ((dPriv->w+31)&~31) * cpp \
+ : sPriv->fbWidth * cpp); \
+ GLuint height = dPriv->h; \
+ char *buf = (char *)(sPriv->pFB + drb->offset \
+ + (drb->backBuffer ? 0 : dPriv->x * cpp + dPriv->y * pitch));\
+ char *read_buf = buf; \
GLuint p; \
(void) read_buf; (void) buf; (void) p; (void) pitch
/* FIXME! Depth/Stencil read/writes don't work ! */
-#define LOCAL_DEPTH_VARS \
- s3vScreenPtr s3vscrn = vmesa->s3vScreen; \
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable; \
- __DRIscreenPrivate *sPriv = vmesa->driScreen; \
- GLuint pitch = s3vscrn->depthPitch; \
- GLuint height = dPriv->h; \
- char *buf = (char *)(sPriv->pFB + \
- s3vscrn->depthOffset); /* + \
- dPriv->x * s3vscrn->cpp + \
- dPriv->y * pitch)*/ \
+#define LOCAL_DEPTH_VARS \
+ __DRIdrawablePrivate *dPriv = vmesa->driDrawable; \
+ __DRIscreenPrivate *sPriv = vmesa->driScreen; \
+ driRenderbuffer *drb = (driRenderbuffer *) rb; \
+ GLuint pitch = drb->pitch; \
+ GLuint height = dPriv->h; \
+ char *buf = (char *)(sPriv->pFB + drb->offset); \
(void) pitch
#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
@@ -81,8 +74,8 @@ do { \
*(GLushort *)(buf + _x*2 + _y*pitch) = ((((int)r & 0xf8) << 7) | \
(((int)g & 0xf8) << 2) | \
(((int)b & 0xf8) >> 3)); \
- DEBUG(("buf=0x%x drawOffset=0x%x dPriv->x=%i s3vscrn->cpp=%i dPriv->y=%i pitch=%i\n", \
- sPriv->pFB, vmesa->drawOffset, dPriv->x, s3vscrn->cpp, dPriv->y, pitch)); \
+ DEBUG(("buf=0x%x drawOffset=0x%x dPriv->x=%i drb->cpp=%i dPriv->y=%i pitch=%i\n", \
+ sPriv->pFB, vmesa->drawOffset, dPriv->x, drb->cpp, dPriv->y, pitch)); \
DEBUG(("dPriv->w = %i\n", dPriv->w)); \
} while(0)
@@ -142,7 +135,7 @@ do { \
#define READ_DEPTH( d, _x, _y ) \
d = *(GLushort *)(buf + _x*2 + _y*dPriv->w*2);
-#define TAG(x) s3v##x##_16
+#define TAG(x) s3v##x##_z16
#include "depthtmp.h"
@@ -194,92 +187,6 @@ do { \
#endif
-static void s3vSetBuffer( GLcontext *ctx, GLframebuffer *colorBuffer,
- GLuint bufferBit )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
-
- switch ( bufferBit ) {
- case BUFFER_BIT_FRONT_LEFT:
- vmesa->drawOffset = vmesa->readOffset = 0;
- break;
- case BUFFER_BIT_BACK_LEFT:
- vmesa->drawOffset = vmesa->readOffset = vmesa->driScreen->fbHeight *
- vmesa->driScreen->fbWidth *
- vmesa->s3vScreen->cpp;
- break;
- }
-}
-
-
-void s3vInitSpanFuncs( GLcontext *ctx )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
-
- swdd->SetBuffer = s3vSetBuffer;
-
-#if 0
- switch ( vmesa->s3vScreen->cpp ) {
- case 2:
- swdd->WriteRGBASpan = s3vWriteRGBASpan_RGB555;
- swdd->WriteRGBSpan = s3vWriteRGBSpan_RGB555;
- swdd->WriteMonoRGBASpan = s3vWriteMonoRGBASpan_RGB555;
- swdd->WriteRGBAPixels = s3vWriteRGBAPixels_RGB555;
- swdd->WriteMonoRGBAPixels = s3vWriteMonoRGBAPixels_RGB555;
- swdd->ReadRGBASpan = s3vReadRGBASpan_RGB555;
- swdd->ReadRGBAPixels = s3vReadRGBAPixels_RGB555;
- break;
-
- case 4:
- swdd->WriteRGBASpan = s3vWriteRGBASpan_ARGB8888;
- swdd->WriteRGBSpan = s3vWriteRGBSpan_ARGB8888;
- swdd->WriteMonoRGBASpan = s3vWriteMonoRGBASpan_ARGB8888;
- swdd->WriteRGBAPixels = s3vWriteRGBAPixels_ARGB8888;
- swdd->WriteMonoRGBAPixels = s3vWriteMonoRGBAPixels_ARGB8888;
-#if 1
- swdd->ReadRGBASpan = s3vReadRGBASpan_ARGB8888;
-#else
- swdd->ReadRGBASpan = s3vReadRGBASpan8888;
-#endif
- swdd->ReadRGBAPixels = s3vReadRGBAPixels_ARGB8888;
- break;
-
- default:
- break;
- }
-#endif
-
- switch ( vmesa->glCtx->Visual.depthBits ) {
- case 15:
- case 16:
-#if 0
- swdd->ReadDepthSpan = s3vReadDepthSpan_16;
- swdd->WriteDepthSpan = s3vWriteDepthSpan_16;
- swdd->ReadDepthPixels = s3vReadDepthPixels_16;
- swdd->WriteDepthPixels = s3vWriteDepthPixels_16;
-#endif
- break;
-
-#if 0
- case 24:
- swdd->ReadDepthSpan = s3vReadDepthSpan_24_8;
- swdd->WriteDepthSpan = s3vWriteDepthSpan_24_8;
- swdd->ReadDepthPixels = s3vReadDepthPixels_24_8;
- swdd->WriteDepthPixels = s3vWriteDepthPixels_24_8;
-
- swdd->ReadStencilSpan = s3vReadStencilSpan_24_8;
- swdd->WriteStencilSpan = s3vWriteStencilSpan_24_8;
- swdd->ReadStencilPixels = s3vReadStencilPixels_24_8;
- swdd->WriteStencilPixels = s3vWriteStencilPixels_24_8;
- break;
-#endif
-
- default:
- break;
- }
-}
-
/**
* Plug in the Get/Put routines for the given driRenderbuffer.
@@ -308,27 +215,12 @@ s3vSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
}
}
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
- drb->Base.GetRow = s3vReadDepthSpan_16;
- drb->Base.GetValues = s3vReadDepthPixels_16;
- drb->Base.PutRow = s3vWriteDepthSpan_16;
- drb->Base.PutMonoRow = s3vWriteMonoDepthSpan_16;
- drb->Base.PutValues = s3vWriteDepthPixels_16;
- drb->Base.PutMonoValues = NULL;
+ s3vInitDepthPointers_z16(&drb->Base);
}
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
- drb->Base.GetRow = NULL;
- drb->Base.GetValues = NULL;
- drb->Base.PutRow = NULL;
- drb->Base.PutMonoRow = NULL;
- drb->Base.PutValues = NULL;
- drb->Base.PutMonoValues = NULL;
+ /* not done yet */
}
else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
- drb->Base.GetRow = NULL;
- drb->Base.GetValues = NULL;
- drb->Base.PutRow = NULL;
- drb->Base.PutMonoRow = NULL;
- drb->Base.PutValues = NULL;
- drb->Base.PutMonoValues = NULL;
+ /* not done yet */
}
}
diff --git a/src/mesa/drivers/dri/s3v/s3v_xmesa.c b/src/mesa/drivers/dri/s3v/s3v_xmesa.c
index 4cdda1b5871..603c4168b50 100644
--- a/src/mesa/drivers/dri/s3v/s3v_xmesa.c
+++ b/src/mesa/drivers/dri/s3v/s3v_xmesa.c
@@ -90,6 +90,7 @@ s3vCreateBuffer( __DRIscreenPrivate *driScrnPriv,
screen->backOffset, screen->backPitch);
s3vSetSpanFunctions(backRb, mesaVis);
_mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
+ backRb->backBuffer = GL_TRUE;
}
if (mesaVis->depthBits == 16) {
diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c
index 12cf78535ad..477564cad3b 100644
--- a/src/mesa/drivers/dri/savage/savage_xmesa.c
+++ b/src/mesa/drivers/dri/savage/savage_xmesa.c
@@ -634,6 +634,8 @@ savageCreateBuffer( __DRIscreenPrivate *driScrnPriv,
screen->frontOffset, screen->aperturePitch);
savageSetSpanFunctions(frontRb, mesaVis, float_depth);
_mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
+ frontRb->Base.Data = frontRb->flippedData
+ = (GLubyte *) screen->aperture.map + 0x01000000 * TARGET_FRONT;
}
if (mesaVis->doubleBufferMode) {
@@ -642,26 +644,32 @@ savageCreateBuffer( __DRIscreenPrivate *driScrnPriv,
screen->backOffset, screen->aperturePitch);
savageSetSpanFunctions(backRb, mesaVis, float_depth);
_mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
+ backRb->Base.Data = backRb->flippedData
+ = (GLubyte *) screen->aperture.map + 0x01000000 * TARGET_BACK;
}
if (mesaVis->depthBits == 16) {
driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp,
+ = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->zpp,
screen->depthOffset, screen->aperturePitch);
savageSetSpanFunctions(depthRb, mesaVis, float_depth);
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
+ depthRb->Base.Data = depthRb->flippedData
+ = (GLubyte *) screen->aperture.map + 0x01000000 * TARGET_DEPTH;
}
else if (mesaVis->depthBits == 24) {
driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp,
+ = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->zpp,
screen->depthOffset, screen->aperturePitch);
savageSetSpanFunctions(depthRb, mesaVis, float_depth);
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
+ depthRb->Base.Data = depthRb->flippedData
+ = (GLubyte *) screen->aperture.map + 0x01000000 * TARGET_DEPTH;
}
if (mesaVis->stencilBits > 0 && !swStencil) {
driRenderbuffer *stencilRb
- = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, screen->cpp,
+ = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, screen->zpp,
screen->depthOffset, screen->aperturePitch);
savageSetSpanFunctions(stencilRb, mesaVis, float_depth);
_mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base);
@@ -805,16 +813,25 @@ savageMakeCurrent(__DRIcontextPrivate *driContextPriv,
__DRIdrawablePrivate *driReadPriv)
{
if (driContextPriv) {
- savageContextPtr imesa = (savageContextPtr) driContextPriv->driverPrivate;
-
+ savageContextPtr imesa
+ = (savageContextPtr) driContextPriv->driverPrivate;
+ struct gl_framebuffer *drawBuffer
+ = (GLframebuffer *) driDrawPriv->driverPrivate;
+ struct gl_framebuffer *readBuffer
+ = (GLframebuffer *) driReadPriv->driverPrivate;
+ driRenderbuffer *frontRb = (driRenderbuffer *)
+ drawBuffer->Attachment[BUFFER_FRONT_LEFT].Renderbuffer;
+ driRenderbuffer *backRb = (driRenderbuffer *)
+ drawBuffer->Attachment[BUFFER_BACK_LEFT].Renderbuffer;
+
+ assert(frontRb->Base.Data);
+ assert(backRb->Base.Data);
+
imesa->driReadable = driReadPriv;
imesa->driDrawable = driDrawPriv;
- imesa->mesa_drawable = driDrawPriv;
imesa->dirty = ~0;
- _mesa_make_current(imesa->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate);
+ _mesa_make_current(imesa->glCtx, drawBuffer, readBuffer);
savageXMesaWindowMoved( imesa );
}
diff --git a/src/mesa/drivers/dri/savage/savagecontext.h b/src/mesa/drivers/dri/savage/savagecontext.h
index 4c095996851..c4573b0da41 100644
--- a/src/mesa/drivers/dri/savage/savagecontext.h
+++ b/src/mesa/drivers/dri/savage/savagecontext.h
@@ -236,8 +236,6 @@ struct savage_context_t {
/* These refer to the current draw (front vs. back) buffer:
*/
- GLubyte *drawMap; /* draw buffer address in virtual mem */
- GLubyte *readMap;
int drawX; /* origin of drawable in draw buffer */
int drawY;
GLuint numClipRects; /* cliprects for that buffer */
@@ -277,13 +275,6 @@ struct savage_context_t {
__DRIdrawablePrivate *driDrawable;
__DRIdrawablePrivate *driReadable;
- /**
- * Drawable used by Mesa for software fallbacks for reading and
- * writing. It is set by Mesa's \c SetBuffer callback, and will always be
- * either \c mga_context_t::driDrawable or \c mga_context_t::driReadable.
- */
- __DRIdrawablePrivate *mesa_drawable;
-
__DRIscreenPrivate *driScreen;
savageScreenPrivate *savageScreen;
drm_savage_sarea_t *sarea;
diff --git a/src/mesa/drivers/dri/savage/savageioctl.c b/src/mesa/drivers/dri/savage/savageioctl.c
index 30d008e1be8..1906c78cc34 100644
--- a/src/mesa/drivers/dri/savage/savageioctl.c
+++ b/src/mesa/drivers/dri/savage/savageioctl.c
@@ -254,9 +254,9 @@ static void savage_BCI_swap(savageContextPtr imesa)
else
imesa->toggle = TARGET_BACK;
- imesa->drawMap = (char *)imesa->apertureBase[imesa->toggle];
- imesa->readMap = (char *)imesa->apertureBase[imesa->toggle];
-
+ driFlipRenderbuffers(imesa->glCtx->DrawBuffer,
+ imesa->toggle != TARGET_FRONT);
+
imesa->regs.s4.destCtrl.ni.offset = imesa->savageScreen->backOffset>>11;
imesa->dirty |= SAVAGE_UPLOAD_GLOBAL;
bciptr = SAVAGE_GET_BCI_POINTER(imesa,3);
diff --git a/src/mesa/drivers/dri/savage/savagespan.c b/src/mesa/drivers/dri/savage/savagespan.c
index 2158391c103..6396332794f 100644
--- a/src/mesa/drivers/dri/savage/savagespan.c
+++ b/src/mesa/drivers/dri/savage/savagespan.c
@@ -32,30 +32,26 @@
#define DBG 0
-#define LOCAL_VARS \
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx); \
- __DRIdrawablePrivate *dPriv = imesa->mesa_drawable; \
- savageScreenPrivate *savageScreen = imesa->savageScreen; \
- GLuint cpp = savageScreen->cpp; \
- GLuint pitch = imesa->aperturePitch; \
- GLuint height = dPriv->h; \
- GLubyte *buf = map + \
- dPriv->x * cpp + \
- dPriv->y * pitch; \
- GLubyte *read_buf = buf; \
- GLuint p; \
+#define LOCAL_VARS \
+ savageContextPtr imesa = SAVAGE_CONTEXT(ctx); \
+ __DRIdrawablePrivate *dPriv = imesa->driDrawable; \
+ driRenderbuffer *drb = (driRenderbuffer *) rb; \
+ GLuint cpp = drb->cpp; \
+ GLuint pitch = drb->pitch; \
+ GLuint height = dPriv->h; \
+ GLubyte *buf = drb->Base.Data + dPriv->x * cpp + dPriv->y * pitch; \
+ GLubyte *read_buf = buf; \
+ GLuint p; \
(void) p; (void) read_buf;
-#define LOCAL_DEPTH_VARS \
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx); \
- __DRIdrawablePrivate *dPriv = imesa->mesa_drawable; \
- savageScreenPrivate *savageScreen = imesa->savageScreen; \
- GLuint zpp = savageScreen->zpp; \
- GLuint pitch = imesa->aperturePitch; \
- GLuint height = dPriv->h; \
- GLubyte *buf = imesa->apertureBase[TARGET_DEPTH] + \
- dPriv->x * zpp + \
- dPriv->y * pitch
+#define LOCAL_DEPTH_VARS \
+ savageContextPtr imesa = SAVAGE_CONTEXT(ctx); \
+ __DRIdrawablePrivate *dPriv = imesa->driDrawable; \
+ driRenderbuffer *drb = (driRenderbuffer *) rb; \
+ GLuint zpp = drb->cpp; \
+ GLuint pitch = drb->pitch; \
+ GLuint height = dPriv->h; \
+ GLubyte *buf = drb->Base.Data + dPriv->x * zpp + dPriv->y * pitch;
#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
@@ -65,13 +61,9 @@
#define HW_UNLOCK()
-#define HW_WRITE_LOCK() \
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx); \
- GLubyte *map = imesa->drawMap;
+#define HW_WRITE_LOCK()
-#define HW_READ_LOCK() \
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx); \
- GLubyte *map = imesa->readMap;
+#define HW_READ_LOCK()
/* 16 bit, 565 rgb color spanline and pixel functions
@@ -110,7 +102,7 @@
#define READ_DEPTH( d, _x, _y ) \
d = 0xFFFF - *(GLushort *)(buf + ((_x)<<1) + (_y)*pitch)
-#define TAG(x) savage##x##_16
+#define TAG(x) savage##x##_z16
#include "depthtmp.h"
@@ -127,7 +119,7 @@
savageDecodeFloat16( *(GLushort *)(buf + ((_x)<<1) + (_y)*pitch) ) * \
65535.0
-#define TAG(x) savage##x##_16f
+#define TAG(x) savage##x##_z16f
#include "depthtmp.h"
@@ -146,7 +138,7 @@
#define READ_DEPTH( d, _x, _y ) \
d = 0x00FFFFFF - (*(GLuint *)(buf + ((_x)<<2) + (_y)*pitch) & 0x00FFFFFF)
-#define TAG(x) savage##x##_8_24
+#define TAG(x) savage##x##_s8_z24
#include "depthtmp.h"
@@ -166,7 +158,7 @@
*(GLuint *)(buf + ((_x)<<2) + (_y)*pitch) & 0x00FFFFFF) \
* 16777215.0
-#define TAG(x) savage##x##_8_24f
+#define TAG(x) savage##x##_s8_z24f
#include "depthtmp.h"
@@ -180,36 +172,10 @@
#define READ_STENCIL( d, _x, _y ) \
d = (GLstencil)((*(GLuint *)(buf + ((_x)<<2) + (_y)*pitch) & 0xFF000000) >> 24)
-#define TAG(x) savage##x##_8_24
+#define TAG(x) savage##x##_s8_z24
#include "stenciltmp.h"
-/*
- * This function is called to specify which buffer to read and write
- * for software rasterization (swrast) fallbacks. This doesn't necessarily
- * correspond to glDrawBuffer() or glReadBuffer() calls.
- */
-static void savageDDSetBuffer(GLcontext *ctx, GLframebuffer *buffer,
- GLuint bufferBit)
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- GLubyte *map;
-
- assert((bufferBit == BUFFER_BIT_FRONT_LEFT) || (bufferBit == BUFFER_BIT_BACK_LEFT));
-
- map = (bufferBit == BUFFER_BIT_FRONT_LEFT)
- ? imesa->apertureBase[TARGET_FRONT]
- : imesa->apertureBase[TARGET_BACK];
-
- imesa->drawMap = map;
- imesa->readMap = map;
-
- assert( (buffer == imesa->driDrawable->driverPrivate)
- || (buffer == imesa->driReadable->driverPrivate) );
-
- imesa->mesa_drawable = (buffer == imesa->driDrawable->driverPrivate)
- ? imesa->driDrawable : imesa->driReadable;
-}
/*
* Wrappers around _swrast_Copy/Draw/ReadPixels that make sure all
@@ -267,8 +233,6 @@ static void savageSpanRenderStart( GLcontext *ctx )
void savageDDInitSpanFuncs( GLcontext *ctx )
{
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
-
- swdd->SetBuffer = savageDDSetBuffer;
swdd->SpanRenderStart = savageSpanRenderStart;
/* Pixel path fallbacks.
@@ -299,44 +263,21 @@ savageSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis,
}
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
if (float_depth) {
- drb->Base.GetRow = savageReadDepthSpan_16f;
- drb->Base.GetValues = savageReadDepthPixels_16f;
- drb->Base.PutRow = savageWriteDepthSpan_16f;
- drb->Base.PutMonoRow = savageWriteMonoDepthSpan_16f;
- drb->Base.PutValues = savageWriteDepthPixels_16f;
+ savageInitDepthPointers_z16f(&drb->Base);
}
else {
- drb->Base.GetRow = savageReadDepthSpan_16;
- drb->Base.GetValues = savageReadDepthPixels_16;
- drb->Base.PutRow = savageWriteDepthSpan_16;
- drb->Base.PutMonoRow = savageWriteMonoDepthSpan_16;
- drb->Base.PutValues = savageWriteDepthPixels_16;
+ savageInitDepthPointers_z16(&drb->Base);
}
- drb->Base.PutMonoValues = NULL;
}
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
if (float_depth) {
- drb->Base.GetRow = savageReadDepthSpan_8_24f;
- drb->Base.GetValues = savageReadDepthPixels_8_24f;
- drb->Base.PutRow = savageWriteDepthSpan_8_24f;
- drb->Base.PutMonoRow = savageWriteMonoDepthSpan_8_24f;
- drb->Base.PutValues = savageWriteDepthPixels_8_24f;
+ savageInitDepthPointers_s8_z24f(&drb->Base);
}
else {
- drb->Base.GetRow = savageReadDepthSpan_8_24;
- drb->Base.GetValues = savageReadDepthPixels_8_24;
- drb->Base.PutRow = savageWriteDepthSpan_8_24;
- drb->Base.PutMonoRow = savageWriteMonoDepthSpan_8_24;
- drb->Base.PutValues = savageWriteDepthPixels_8_24;
+ savageInitDepthPointers_s8_z24(&drb->Base);
}
- drb->Base.PutMonoValues = NULL;
}
else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
- drb->Base.GetRow = savageReadStencilSpan_8_24;
- drb->Base.GetValues = savageReadStencilPixels_8_24;
- drb->Base.PutRow = savageWriteStencilSpan_8_24;
- drb->Base.PutMonoRow = savageWriteMonoStencilSpan_8_24;
- drb->Base.PutValues = savageWriteStencilPixels_8_24;
- drb->Base.PutMonoValues = NULL;
+ savageInitStencilPointers_s8_z24(&drb->Base);
}
}
diff --git a/src/mesa/drivers/dri/savage/savagestate.c b/src/mesa/drivers/dri/savage/savagestate.c
index 996d5b91717..4affe8799b9 100644
--- a/src/mesa/drivers/dri/savage/savagestate.c
+++ b/src/mesa/drivers/dri/savage/savagestate.c
@@ -665,11 +665,6 @@ static void savageDDDrawBuffer(GLcontext *ctx, GLenum mode )
return;
}
- /* We want to update the s/w rast state too so that r200SetBuffer() (?)
- * gets called.
- */
- _swrast_DrawBuffer(ctx, mode);
-
if (destCtrl != imesa->regs.s4.destCtrl.ui)
imesa->dirty |= SAVAGE_UPLOAD_GLOBAL;
}
@@ -1663,8 +1658,6 @@ void savageDDInitState( savageContextPtr imesa ) {
imesa->regs.s4.destCtrl.ni.dstWidthInTile =
(imesa->savageScreen->width+31)>>5;
}
- imesa->drawMap = imesa->apertureBase[imesa->toggle];
- imesa->readMap = imesa->apertureBase[imesa->toggle];
imesa->NotFirstFrame = GL_FALSE;
imesa->regs.s4.zBufOffset.ni.offset=imesa->savageScreen->depthOffset>>11;
diff --git a/src/mesa/drivers/dri/sis/sis_context.h b/src/mesa/drivers/dri/sis/sis_context.h
index 36754022215..fee8f6ead11 100644
--- a/src/mesa/drivers/dri/sis/sis_context.h
+++ b/src/mesa/drivers/dri/sis/sis_context.h
@@ -345,7 +345,6 @@ struct sis_context
/* Drawable, cliprect and scissor information
*/
GLint drawOffset, drawPitch;
- GLint readOffset, readPitch;
/* Mirrors of some DRI state
*/
diff --git a/src/mesa/drivers/dri/sis/sis_screen.c b/src/mesa/drivers/dri/sis/sis_screen.c
index 8815d0e8326..dcbf62640b8 100644
--- a/src/mesa/drivers/dri/sis/sis_screen.c
+++ b/src/mesa/drivers/dri/sis/sis_screen.c
@@ -209,14 +209,7 @@ sisCreateBuffer( __DRIscreenPrivate *driScrnPriv,
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! */
@@ -275,7 +268,7 @@ sisCreateBuffer( __DRIscreenPrivate *driScrnPriv,
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 f0cf771d616..5e3d7b9e4e8 100644
--- a/src/mesa/drivers/dri/sis/sis_span.c
+++ b/src/mesa/drivers/dri/sis/sis_span.c
@@ -44,9 +44,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define LOCAL_VARS \
sisContextPtr smesa = SIS_CONTEXT(ctx); \
__DRIdrawablePrivate *dPriv = smesa->driDrawable; \
- GLuint pitch = smesa->drawPitch; \
- char *buf = (char *)(smesa->FbBase + smesa->drawOffset); \
- char *read_buf = (char *)(smesa->FbBase + smesa->readOffset); \
+ driRenderbuffer *drb = (driRenderbuffer *) rb; \
+ GLuint pitch = drb->pitch; \
+ char *buf = (char *)(smesa->FbBase + drb->offset); \
+ char *read_buf = buf; \
GLuint p; \
(void) read_buf; (void) buf; (void) p
@@ -89,7 +90,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define READ_DEPTH( d, _x, _y ) \
d = *(GLushort *)(buf + (_x)*2 + (_y)*smesa->depthPitch);
-#define TAG(x) sis##x##_16
+#define TAG(x) sis##x##_z16
#include "depthtmp.h"
@@ -101,7 +102,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define READ_DEPTH( d, _x, _y ) \
d = *(GLuint *)(buf + (_x)*4 + (_y)*smesa->depthPitch);
-#define TAG(x) sis##x##_32
+#define TAG(x) sis##x##_z32
#include "depthtmp.h"
@@ -118,7 +119,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
d = *(GLuint *)(buf + (_x)*4 + (_y)*smesa->depthPitch) & 0x00ffffff; \
}
-#define TAG(x) sis##x##_24_8
+#define TAG(x) sis##x##_z24_s8
#include "depthtmp.h"
#define WRITE_STENCIL( _x, _y, d ) { \
@@ -131,33 +132,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define READ_STENCIL( d, _x, _y ) \
d = (*(GLuint *)(buf + (_x)*4 + (_y)*smesa->depthPitch) & 0xff000000) >> 24;
-#define TAG(x) sis##x##_24_8
+#define TAG(x) sis##x##_z24_s8
#include "stenciltmp.h"
-/*
- * This function is called to specify which buffer to read and write
- * for software rasterization (swrast) fallbacks. This doesn't necessarily
- * correspond to glDrawBuffer() or glReadBuffer() calls.
- */
-static void sisDDSetBuffer( GLcontext *ctx,
- GLframebuffer *colorBuffer,
- GLuint bufferBit )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- switch ( bufferBit ) {
- case BUFFER_BIT_FRONT_LEFT:
- smesa->drawOffset = smesa->readOffset = smesa->frontOffset;
- smesa->drawPitch = smesa->readPitch = smesa->frontPitch;
- break;
- case BUFFER_BIT_BACK_LEFT:
- smesa->drawOffset = smesa->readOffset = smesa->backOffset;
- smesa->drawPitch = smesa->readPitch = smesa->backPitch;
- break;
- default:
- break;
- }
-}
void sisSpanRenderStart( GLcontext *ctx )
{
@@ -180,8 +158,6 @@ void
sisDDInitSpanFuncs( GLcontext *ctx )
{
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
-
- swdd->SetBuffer = sisDDSetBuffer;
swdd->SpanRenderStart = sisSpanRenderStart;
swdd->SpanRenderFinish = sisSpanRenderFinish;
}
@@ -203,35 +179,15 @@ sisSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
}
}
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;
+ sisInitDepthPointers_z16(&drb->Base);
}
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;
+ sisInitDepthPointers_z24_s8(&drb->Base);
}
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;
+ sisInitDepthPointers_z32(&drb->Base);
}
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;
+ sisInitStencilPointers_z24_s8(&drb->Base);
}
}
diff --git a/src/mesa/drivers/dri/sis/sis_state.c b/src/mesa/drivers/dri/sis/sis_state.c
index db58e9090bc..50c45b63ed5 100644
--- a/src/mesa/drivers/dri/sis/sis_state.c
+++ b/src/mesa/drivers/dri/sis/sis_state.c
@@ -522,17 +522,21 @@ sisDDLogicOpCode( GLcontext *ctx, GLenum opcode )
void sisDDDrawBuffer( GLcontext *ctx, GLenum mode )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
-
__GLSiSHardware *prev = &smesa->prev;
__GLSiSHardware *current = &smesa->current;
+ int pitch;
/*
* _DrawDestMask is easier to cope with than <mode>.
*/
switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
case BUFFER_BIT_FRONT_LEFT:
+ FALLBACK( smesa, SIS_FALLBACK_DRAW_BUFFER, GL_FALSE );
+ pitch = smesa->frontPitch;
+ break;
case BUFFER_BIT_BACK_LEFT:
FALLBACK( smesa, SIS_FALLBACK_DRAW_BUFFER, GL_FALSE );
+ pitch = smesa->backPitch;
break;
default:
/* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
@@ -540,14 +544,9 @@ void sisDDDrawBuffer( GLcontext *ctx, GLenum mode )
return;
}
- /* We want to update the s/w rast state too so that sisDDSetBuffer()
- * gets called.
- */
- _swrast_DrawBuffer(ctx, mode);
-
current->hwOffsetDest = (smesa->drawOffset) >> 1;
current->hwDstSet &= ~MASK_DstBufferPitch;
- current->hwDstSet |= smesa->drawPitch >> 2;
+ current->hwDstSet |= pitch >> 2;
if (current->hwDstSet != prev->hwDstSet) {
prev->hwDstSet = current->hwDstSet;
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_span.c b/src/mesa/drivers/dri/tdfx/tdfx_span.c
index b00b7ad8dba..142beb404fc 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_span.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_span.c
@@ -49,9 +49,10 @@
#define LOCAL_VARS \
__DRIdrawablePrivate *dPriv = fxMesa->driDrawable; \
tdfxScreenPrivate *fxPriv = fxMesa->fxScreen; \
- GLuint pitch = (fxMesa->glCtx->Color.DrawBuffer[0] == GL_FRONT) \
- ? (fxMesa->screen_width * BYTESPERPIXEL) : \
- (info.strideInBytes); \
+ GLboolean isFront = (ctx->DrawBuffer->_ColorDrawBufferMask[0] \
+ == BUFFER_BIT_FRONT_LEFT); \
+ GLuint pitch = isFront ? (fxMesa->screen_width * BYTESPERPIXEL) \
+ : info.strideInBytes; \
GLuint height = fxMesa->height; \
char *buf = (char *)((char *)info.lfbPtr + \
dPriv->x * fxPriv->cpp + \
@@ -1334,25 +1335,6 @@ static void tdfxSpanRenderFinish( GLcontext *ctx )
UNLOCK_HARDWARE(fxMesa);
}
-/* Set the buffer used for reading */
-static void tdfxDDSetBuffer( GLcontext *ctx,
- GLframebuffer *buffer, GLuint bufferBit )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- (void) buffer;
-
- switch ( bufferBit ) {
- case BUFFER_BIT_FRONT_LEFT:
- fxMesa->DrawBuffer = fxMesa->ReadBuffer = GR_BUFFER_FRONTBUFFER;
- break;
- case BUFFER_BIT_BACK_LEFT:
- fxMesa->DrawBuffer = fxMesa->ReadBuffer = GR_BUFFER_BACKBUFFER;
- break;
- default:
- break;
- }
-}
-
/**********************************************************************/
/* Initialize swrast device driver */
/**********************************************************************/
@@ -1360,7 +1342,6 @@ static void tdfxDDSetBuffer( GLcontext *ctx,
void tdfxDDInitSpanFuncs( GLcontext *ctx )
{
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference( ctx );
- swdd->SetBuffer = tdfxDDSetBuffer;
swdd->SpanRenderStart = tdfxSpanRenderStart;
swdd->SpanRenderFinish = tdfxSpanRenderFinish;
}
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_state.c b/src/mesa/drivers/dri/tdfx/tdfx_state.c
index 85d99bb05e7..73dad6e086a 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_state.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_state.c
@@ -1055,11 +1055,6 @@ static void tdfxDDDrawBuffer( GLcontext *ctx, GLenum mode )
FALLBACK( fxMesa, TDFX_FALLBACK_DRAW_BUFFER, GL_TRUE );
break;
}
-
- /* We want to update the s/w rast state too so that tdfxDDSetBuffer()
- * gets called.
- */
- _swrast_DrawBuffer(ctx, mode);
}
diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c
index abcdcd70a5e..0dd787e9897 100644
--- a/src/mesa/drivers/dri/unichrome/via_context.c
+++ b/src/mesa/drivers/dri/unichrome/via_context.c
@@ -37,6 +37,7 @@
#include "simple_list.h"
#include "extensions.h"
#include "framebuffer.h"
+#include "renderbuffer.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
@@ -127,6 +128,53 @@ buffer_align( unsigned width )
}
+static void
+nop_delete_renderbuffer(struct gl_renderbuffer *rb)
+{
+ /* Don't free() since we're contained in via_context struct. */
+}
+
+
+static void
+viaInitRenderbuffer(struct gl_renderbuffer *rb, GLenum format)
+{
+ const GLuint name = 0;
+
+ _mesa_init_renderbuffer(rb, name);
+
+ /* Make sure we're using a null-valued GetPointer routine */
+ assert(rb->GetPointer(NULL, rb, 0, 0) == NULL);
+
+ rb->InternalFormat = format;
+
+ if (format == GL_RGBA) {
+ /* Color */
+ rb->_BaseFormat = GL_RGBA;
+ rb->DataType = GL_UNSIGNED_BYTE;
+ }
+ else if (format == GL_DEPTH_COMPONENT16) {
+ /* Depth */
+ rb->_BaseFormat = GL_DEPTH_COMPONENT;
+ /* we always Get/Put 32-bit Z values */
+ rb->DataType = GL_UNSIGNED_INT;
+ }
+ else if (format == GL_DEPTH_COMPONENT24) {
+ /* Depth */
+ rb->_BaseFormat = GL_DEPTH_COMPONENT;
+ /* we always Get/Put 32-bit Z values */
+ rb->DataType = GL_UNSIGNED_INT;
+ }
+ else {
+ /* Stencil */
+ ASSERT(format == GL_STENCIL_INDEX8);
+ rb->_BaseFormat = GL_STENCIL_INDEX;
+ rb->DataType = GL_UNSIGNED_BYTE;
+ }
+
+ rb->Delete = nop_delete_renderbuffer;
+}
+
+
/**
* Calculate the framebuffer parameters for all buffers (front, back, depth,
* and stencil) associated with the specified context.
@@ -138,20 +186,47 @@ buffer_align( unsigned width )
* \sa AllocateBuffer
*/
static GLboolean
-calculate_buffer_parameters( struct via_context *vmesa )
+calculate_buffer_parameters( struct via_context *vmesa,
+ struct gl_framebuffer *fb )
{
const unsigned shift = vmesa->viaScreen->bitsPerPixel / 16;
const unsigned extra = 32;
unsigned w;
unsigned h;
+ /* Normally, the renderbuffer would be added to the framebuffer just once
+ * when the framebuffer was created. The VIA driver is a bit funny
+ * though in that the front/back/depth renderbuffers are in the per-context
+ * state!
+ * That should be fixed someday.
+ */
+ _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &vmesa->front.Base);
+ _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &vmesa->back.Base);
+ _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &vmesa->depth.Base);
+ _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &vmesa->stencil.Base);
+
+ if (!vmesa->front.Base.InternalFormat) {
+ /* do one-time init for the renderbuffers */
+ viaInitRenderbuffer(&vmesa->front.Base, GL_RGBA);
+ viaInitRenderbuffer(&vmesa->back.Base, GL_RGBA);
+ if (vmesa->glCtx->Visual.depthBits > 0) {
+ viaInitRenderbuffer(&vmesa->depth.Base,
+ (vmesa->glCtx->Visual.depthBits == 16
+ ? GL_DEPTH_COMPONENT16 : GL_DEPTH_COMPONENT24));
+ }
+ if (vmesa->glCtx->Visual.stencilBits > 0) {
+ viaInitRenderbuffer(&vmesa->stencil.Base, GL_STENCIL_INDEX8_EXT);
+ }
+ }
+
+
/* Allocate front-buffer */
if (vmesa->drawType == GLX_PBUFFER_BIT) {
w = vmesa->driDrawable->w;
h = vmesa->driDrawable->h;
vmesa->front.bpp = vmesa->viaScreen->bitsPerPixel;
- vmesa->front.pitch = buffer_align( w ) << shift;
+ vmesa->front.pitch = buffer_align( w ) << shift; /* bytes, not pixels */
vmesa->front.size = vmesa->front.pitch * h;
if (vmesa->front.map)
@@ -164,7 +239,7 @@ calculate_buffer_parameters( struct via_context *vmesa )
h = vmesa->viaScreen->height;
vmesa->front.bpp = vmesa->viaScreen->bitsPerPixel;
- vmesa->front.pitch = buffer_align( w ) << shift;
+ vmesa->front.pitch = buffer_align( w ) << shift; /* bytes, not pixels */
vmesa->front.size = vmesa->front.pitch * h;
if (getenv("ALTERNATE_SCREEN"))
vmesa->front.offset = vmesa->front.size;
@@ -215,6 +290,17 @@ calculate_buffer_parameters( struct via_context *vmesa )
(void) memset( & vmesa->depth, 0, sizeof( vmesa->depth ) );
}
+ /* stencil buffer is same as depth buffer */
+ vmesa->stencil.handle = vmesa->depth.handle;
+ vmesa->stencil.size = vmesa->depth.size;
+ vmesa->stencil.offset = vmesa->depth.offset;
+ vmesa->stencil.index = vmesa->depth.index;
+ vmesa->stencil.pitch = vmesa->depth.pitch;
+ vmesa->stencil.bpp = vmesa->depth.bpp;
+ vmesa->stencil.map = vmesa->depth.map;
+ vmesa->stencil.orig = vmesa->depth.orig;
+ vmesa->stencil.origMap = vmesa->depth.origMap;
+
if( vmesa->viaScreen->width == vmesa->driDrawable->w &&
vmesa->viaScreen->height == vmesa->driDrawable->h ) {
vmesa->doPageFlip = vmesa->allowPageFlip;
@@ -238,7 +324,7 @@ void viaReAllocateBuffers(GLcontext *ctx, GLframebuffer *drawbuffer,
_mesa_resize_framebuffer(ctx, drawbuffer, width, height);
#endif
- calculate_buffer_parameters( vmesa );
+ calculate_buffer_parameters( vmesa, drawbuffer );
}
static void viaBufferSize(GLframebuffer *buffer, GLuint *width, GLuint *height)
@@ -646,7 +732,7 @@ void viaXMesaWindowMoved(struct via_context *vmesa)
if (vmesa->drawW != dPriv->w ||
vmesa->drawH != dPriv->h)
- calculate_buffer_parameters( vmesa );
+ calculate_buffer_parameters( vmesa, vmesa->glCtx->DrawBuffer );
vmesa->drawXoff = (GLuint)(((dPriv->x * bytePerPixel) & 0x1f) /
bytePerPixel);
@@ -692,19 +778,20 @@ viaMakeCurrent(__DRIcontextPrivate *driContextPriv,
struct via_context *vmesa =
(struct via_context *)driContextPriv->driverPrivate;
GLcontext *ctx = vmesa->glCtx;
+ struct gl_framebuffer *drawBuffer, *readBuffer;
+
+ drawBuffer = (GLframebuffer *)driDrawPriv->driverPrivate;
+ readBuffer = (GLframebuffer *)driReadPriv->driverPrivate;
if ( vmesa->driDrawable != driDrawPriv ) {
driDrawableInitVBlank( driDrawPriv, vmesa->vblank_flags );
vmesa->driDrawable = driDrawPriv;
- if ( ! calculate_buffer_parameters( vmesa ) ) {
+ if ( ! calculate_buffer_parameters( vmesa, drawBuffer ) ) {
return GL_FALSE;
}
}
- _mesa_make_current(vmesa->glCtx,
- (GLframebuffer *)driDrawPriv->driverPrivate,
- (GLframebuffer *)driReadPriv->driverPrivate);
-
+ _mesa_make_current(vmesa->glCtx, drawBuffer, readBuffer);
ctx->Driver.DrawBuffer( ctx, ctx->Color.DrawBuffer[0] );
diff --git a/src/mesa/drivers/dri/unichrome/via_context.h b/src/mesa/drivers/dri/unichrome/via_context.h
index a4b1afc02bb..4ee56515b9c 100644
--- a/src/mesa/drivers/dri/unichrome/via_context.h
+++ b/src/mesa/drivers/dri/unichrome/via_context.h
@@ -82,7 +82,11 @@ typedef void (*via_tri_func)(struct via_context *, viaVertex *, viaVertex *,
typedef void (*via_line_func)(struct via_context *, viaVertex *, viaVertex *);
typedef void (*via_point_func)(struct via_context *, viaVertex *);
-struct via_buffer {
+/**
+ * Derived from gl_renderbuffer.
+ */
+struct via_renderbuffer {
+ struct gl_renderbuffer Base; /* must be first! */
drm_handle_t handle;
drmSize size;
GLuint offset;
@@ -144,10 +148,12 @@ struct via_context {
GLcontext *glCtx;
GLcontext *shareCtx;
- struct via_buffer front;
- struct via_buffer back;
- struct via_buffer depth;
- struct via_buffer breadcrumb;
+ /* XXX These don't belong here. They should be per-drawable state. */
+ struct via_renderbuffer front;
+ struct via_renderbuffer back;
+ struct via_renderbuffer depth;
+ struct via_renderbuffer stencil; /* mirrors depth */
+ struct via_renderbuffer breadcrumb;
GLboolean hasBack;
GLboolean hasDepth;
@@ -264,8 +270,7 @@ struct via_context {
*/
GLboolean doPageFlip;
- struct via_buffer *drawBuffer;
- struct via_buffer *readBuffer;
+ struct via_renderbuffer *drawBuffer;
int drawX; /* origin of drawable in draw buffer */
int drawY;
diff --git a/src/mesa/drivers/dri/unichrome/via_fb.c b/src/mesa/drivers/dri/unichrome/via_fb.c
index e07c200b321..9ac98d1445c 100644
--- a/src/mesa/drivers/dri/unichrome/via_fb.c
+++ b/src/mesa/drivers/dri/unichrome/via_fb.c
@@ -33,7 +33,7 @@
#include <sys/ioctl.h>
GLboolean
-via_alloc_draw_buffer(struct via_context *vmesa, struct via_buffer *buf)
+via_alloc_draw_buffer(struct via_context *vmesa, struct via_renderbuffer *buf)
{
drm_via_mem_t mem;
mem.context = vmesa->hHWContext;
@@ -53,7 +53,7 @@ via_alloc_draw_buffer(struct via_context *vmesa, struct via_buffer *buf)
}
void
-via_free_draw_buffer(struct via_context *vmesa, struct via_buffer *buf)
+via_free_draw_buffer(struct via_context *vmesa, struct via_renderbuffer *buf)
{
drm_via_mem_t mem;
diff --git a/src/mesa/drivers/dri/unichrome/via_fb.h b/src/mesa/drivers/dri/unichrome/via_fb.h
index 7ee153f474f..2d329ac2a7d 100644
--- a/src/mesa/drivers/dri/unichrome/via_fb.h
+++ b/src/mesa/drivers/dri/unichrome/via_fb.h
@@ -27,7 +27,7 @@
#include "via_context.h"
-extern GLboolean via_alloc_draw_buffer(struct via_context *vmesa, struct via_buffer *buf);
+extern GLboolean via_alloc_draw_buffer(struct via_context *vmesa, struct via_renderbuffer *buf);
extern GLboolean via_alloc_dma_buffer(struct via_context *vmesa);
struct via_tex_buffer *
@@ -35,7 +35,7 @@ via_alloc_texture(struct via_context *vmesa,
GLuint size,
GLuint memType);
-extern void via_free_draw_buffer(struct via_context *vmesa, struct via_buffer *buf);
+extern void via_free_draw_buffer(struct via_context *vmesa, struct via_renderbuffer *buf);
extern void via_free_dma_buffer(struct via_context *vmesa);
extern void via_free_texture(struct via_context *vmesa, struct via_tex_buffer *t);
void via_release_pending_textures( struct via_context *vmesa );
diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.c b/src/mesa/drivers/dri/unichrome/via_ioctl.c
index 435fd20f778..db178c134d0 100644
--- a/src/mesa/drivers/dri/unichrome/via_ioctl.c
+++ b/src/mesa/drivers/dri/unichrome/via_ioctl.c
@@ -172,7 +172,7 @@ static void viaBlit(struct via_context *vmesa, GLuint bpp,
}
static void viaFillBuffer(struct via_context *vmesa,
- struct via_buffer *buffer,
+ struct via_renderbuffer *buffer,
drm_clip_rect_t *pbox,
int nboxes,
GLuint pixel,
@@ -339,8 +339,8 @@ static void viaDoSwapBuffers(struct via_context *vmesa,
GLuint nbox)
{
GLuint bytePerPixel = vmesa->viaScreen->bitsPerPixel >> 3;
- struct via_buffer *front = &vmesa->front;
- struct via_buffer *back = &vmesa->back;
+ struct via_renderbuffer *front = &vmesa->front;
+ struct via_renderbuffer *back = &vmesa->back;
GLuint i;
for (i = 0; i < nbox; i++, b++) {
@@ -366,7 +366,7 @@ static void viaDoSwapBuffers(struct via_context *vmesa,
static void viaEmitBreadcrumbLocked( struct via_context *vmesa )
{
- struct via_buffer *buffer = &vmesa->breadcrumb;
+ struct via_renderbuffer *buffer = &vmesa->breadcrumb;
GLuint value = vmesa->lastBreadcrumbWrite + 1;
if (VIA_DEBUG & DEBUG_IOCTL)
@@ -562,10 +562,10 @@ void viaResetPageFlippingLocked(struct via_context *vmesa)
viaDoPageFlipLocked( vmesa, 0 );
if (vmesa->front.offset != 0) {
- struct via_buffer buffer_tmp;
- memcpy(&buffer_tmp, &vmesa->back, sizeof(struct via_buffer));
- memcpy(&vmesa->back, &vmesa->front, sizeof(struct via_buffer));
- memcpy(&vmesa->front, &buffer_tmp, sizeof(struct via_buffer));
+ struct via_renderbuffer buffer_tmp;
+ memcpy(&buffer_tmp, &vmesa->back, sizeof(struct via_renderbuffer));
+ memcpy(&vmesa->back, &vmesa->front, sizeof(struct via_renderbuffer));
+ memcpy(&vmesa->front, &buffer_tmp, sizeof(struct via_renderbuffer));
}
assert(vmesa->front.offset == 0);
@@ -623,7 +623,7 @@ void viaPageFlip(const __DRIdrawablePrivate *dPriv)
{
struct via_context *vmesa =
(struct via_context *)dPriv->driContextPriv->driverPrivate;
- struct via_buffer buffer_tmp;
+ struct via_renderbuffer buffer_tmp;
VIA_FLUSH_DMA(vmesa);
if (vmesa->vblank_flags == VBLANK_FLAG_SYNC &&
@@ -645,9 +645,9 @@ void viaPageFlip(const __DRIdrawablePrivate *dPriv)
/* KW: FIXME: When buffers are freed, could free frontbuffer by
* accident:
*/
- memcpy(&buffer_tmp, &vmesa->back, sizeof(struct via_buffer));
- memcpy(&vmesa->back, &vmesa->front, sizeof(struct via_buffer));
- memcpy(&vmesa->front, &buffer_tmp, sizeof(struct via_buffer));
+ memcpy(&buffer_tmp, &vmesa->back, sizeof(struct via_renderbuffer));
+ memcpy(&vmesa->back, &vmesa->front, sizeof(struct via_renderbuffer));
+ memcpy(&vmesa->front, &buffer_tmp, sizeof(struct via_renderbuffer));
}
@@ -724,7 +724,7 @@ static int fire_buffer(struct via_context *vmesa)
static void via_emit_cliprect(struct via_context *vmesa,
drm_clip_rect_t *b)
{
- struct via_buffer *buffer = vmesa->drawBuffer;
+ struct via_renderbuffer *buffer = vmesa->drawBuffer;
GLuint *vb = (GLuint *)(vmesa->dma + vmesa->dmaCliprectAddr);
GLuint format = (vmesa->viaScreen->bitsPerPixel == 0x20
diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c
index 1b2e22ef299..ddd360cc240 100644
--- a/src/mesa/drivers/dri/unichrome/via_screen.c
+++ b/src/mesa/drivers/dri/unichrome/via_screen.c
@@ -214,7 +214,7 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv,
GLboolean swStencil = (mesaVis->stencilBits > 0 &&
mesaVis->depthBits != 24);
-
+ GLboolean swAccum = mesaVis->accumRedBits > 0;
if (isPixmap) {
/* KW: This needs work, disabled for now:
@@ -232,16 +232,14 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv,
return GL_FALSE;
}
else {
-#if 0
- driDrawPriv->driverPrivate = (void *)
- _mesa_create_framebuffer(mesaVis,
- GL_FALSE, /* software depth buffer? */
- swStencil,
- mesaVis->accumRedBits > 0,
- GL_FALSE /* s/w alpha planes */);
-#else
struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
+ /* The front color, back color and depth renderbuffers are
+ * set up later in calculate_buffer_parameters().
+ * Only create/connect software-based buffers here.
+ */
+
+#if 000
/* XXX check/fix the offset/pitch parameters! */
{
driRenderbuffer *frontRb
@@ -288,17 +286,18 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv,
viaSetSpanFunctions(stencilRb, mesaVis);
_mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base);
}
+#endif
_mesa_add_soft_renderbuffers(fb,
GL_FALSE, /* color */
GL_FALSE, /* depth */
swStencil,
- mesaVis->accumRedBits > 0,
+ swAccum,
GL_FALSE, /* alpha */
GL_FALSE /* aux */);
driDrawPriv->driverPrivate = (void *) fb;
-#endif
- return (driDrawPriv->driverPrivate != NULL);
+
+ return (driDrawPriv->driverPrivate != NULL);
}
}
diff --git a/src/mesa/drivers/dri/unichrome/via_span.c b/src/mesa/drivers/dri/unichrome/via_span.c
index 16a1aa8b367..5bffade9408 100644
--- a/src/mesa/drivers/dri/unichrome/via_span.c
+++ b/src/mesa/drivers/dri/unichrome/via_span.c
@@ -43,13 +43,12 @@
#define LOCAL_VARS \
struct via_context *vmesa = VIA_CONTEXT(ctx); \
__DRIdrawablePrivate *dPriv = vmesa->driDrawable; \
- GLuint draw_pitch = vmesa->drawBuffer->pitch; \
- GLuint read_pitch = vmesa->readBuffer->pitch; \
+ struct via_renderbuffer *vrb = (struct via_renderbuffer *) rb; \
+ GLuint pitch = vrb->pitch; \
GLuint height = dPriv->h; \
GLint p = 0; \
- char *buf = (char *)(vmesa->drawBuffer->origMap + vmesa->drawXoff * vmesa->viaScreen->bytesPerPixel); \
- char *read_buf = (char *)(vmesa->readBuffer->origMap + vmesa->drawXoff * vmesa->viaScreen->bytesPerPixel); \
- (void) (read_pitch && draw_pitch && buf && read_buf && p);
+ char *buf = (char *)(vrb->origMap + vmesa->drawXoff * vrb->bpp); \
+ (void) p;
/* ================================================================
* Color buffer
@@ -57,8 +56,8 @@
/* 16 bit, RGB565 color spanline and pixel functions
*/
-#define GET_SRC_PTR(_x, _y) (read_buf + (_x) * 2 + (_y) * read_pitch)
-#define GET_DST_PTR(_x, _y) ( buf + (_x) * 2 + (_y) * draw_pitch)
+#define GET_SRC_PTR(_x, _y) (buf + (_x) * 2 + (_y) * pitch)
+#define GET_DST_PTR(_x, _y) GET_SRC_PTR(_x, _y);
#define SPANTMP_PIXEL_FMT GL_RGB
#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5
@@ -69,8 +68,8 @@
/* 32 bit, ARGB8888 color spanline and pixel functions
*/
-#define GET_SRC_PTR(_x, _y) (read_buf + (_x) * 4 + (_y) * read_pitch)
-#define GET_DST_PTR(_x, _y) ( buf + (_x) * 4 + (_y) * draw_pitch)
+#define GET_SRC_PTR(_x, _y) (buf + (_x) * 4 + (_y) * pitch)
+#define GET_DST_PTR(_x, _y) GET_SRC_PTR(_x, _y);
#define SPANTMP_PIXEL_FMT GL_BGRA
#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
@@ -81,12 +80,13 @@
/* 16 bit depthbuffer functions.
*/
-#define LOCAL_DEPTH_VARS \
- struct via_context *vmesa = VIA_CONTEXT(ctx); \
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable; \
- GLuint depth_pitch = vmesa->depth.pitch; \
- GLuint height = dPriv->h; \
- char *buf = (char *)(vmesa->depth.map + (vmesa->drawXoff * vmesa->depth.bpp/8))
+#define LOCAL_DEPTH_VARS \
+ struct via_context *vmesa = VIA_CONTEXT(ctx); \
+ __DRIdrawablePrivate *dPriv = vmesa->driDrawable; \
+ struct via_renderbuffer *vrb = (struct via_renderbuffer *) rb; \
+ GLuint depth_pitch = vrb->pitch; \
+ GLuint height = dPriv->h; \
+ char *buf = (char *)(vrb->map + (vmesa->drawXoff * vrb->bpp/8))
#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
@@ -97,7 +97,7 @@
#define READ_DEPTH(d, _x, _y) \
d = *(volatile GLushort *)(buf + (_x) * 2 + (_y) * depth_pitch);
-#define TAG(x) via##x##_16
+#define TAG(x) via##x##_z16
#include "depthtmp.h"
/* 32 bit depthbuffer functions.
@@ -108,7 +108,7 @@
#define READ_DEPTH(d, _x, _y) \
d = *(volatile GLuint *)(buf + (_x) * 4 + (_y) * depth_pitch);
-#define TAG(x) via##x##_32
+#define TAG(x) via##x##_z32
#include "depthtmp.h"
@@ -126,7 +126,7 @@
d = (*(GLuint *)(buf + (_x)*4 + (_y)*depth_pitch)) >> 8;
-#define TAG(x) via##x##_24_8
+#define TAG(x) via##x##_z24_s8
#include "depthtmp.h"
#define WRITE_STENCIL( _x, _y, d ) { \
@@ -139,26 +139,11 @@
#define READ_STENCIL( d, _x, _y ) \
d = *(GLuint *)(buf + (_x)*4 + (_y)*depth_pitch) & 0xff;
-#define TAG(x) via##x##_24_8
+#define TAG(x) via##x##_z24_s8
#include "stenciltmp.h"
-static void viaSetBuffer(GLcontext *ctx, GLframebuffer *colorBuffer,
- GLuint bufferBit)
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
-
- if (bufferBit == BUFFER_BIT_FRONT_LEFT) {
- vmesa->drawBuffer = vmesa->readBuffer = &vmesa->front;
- }
- else if (bufferBit == BUFFER_BIT_BACK_LEFT) {
- vmesa->drawBuffer = vmesa->readBuffer = &vmesa->back;
- }
- else {
- ASSERT(0);
- }
-}
/* Move locking out to get reasonable span performance.
*/
@@ -178,64 +163,9 @@ void viaSpanRenderFinish( GLcontext *ctx )
void viaInitSpanFuncs(GLcontext *ctx)
{
-#if 0
- struct via_context *vmesa = VIA_CONTEXT(ctx);
-#endif
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
-
- swdd->SetBuffer = viaSetBuffer;
-#if 0
- if (vmesa->viaScreen->bitsPerPixel == 16) {
- viaInitPointers_565( swdd );
- }
- else if (vmesa->viaScreen->bitsPerPixel == 32) {
- viaInitPointers_8888( swdd );
- }
- else {
- assert(0);
- }
-#endif
-#if 0
- if (vmesa->glCtx->Visual.depthBits == 16) {
- swdd->ReadDepthSpan = viaReadDepthSpan_16;
- swdd->WriteDepthSpan = viaWriteDepthSpan_16;
- swdd->WriteMonoDepthSpan = viaWriteMonoDepthSpan_16;
- swdd->ReadDepthPixels = viaReadDepthPixels_16;
- swdd->WriteDepthPixels = viaWriteDepthPixels_16;
- }
- else if (vmesa->glCtx->Visual.depthBits == 24) {
- swdd->ReadDepthSpan = viaReadDepthSpan_24_8;
- swdd->WriteDepthSpan = viaWriteDepthSpan_24_8;
- swdd->WriteMonoDepthSpan = viaWriteMonoDepthSpan_24_8;
- swdd->ReadDepthPixels = viaReadDepthPixels_24_8;
- swdd->WriteDepthPixels = viaWriteDepthPixels_24_8;
-
- swdd->WriteStencilSpan = viaWriteStencilSpan_24_8;
- swdd->ReadStencilSpan = viaReadStencilSpan_24_8;
- swdd->WriteStencilPixels = viaWriteStencilPixels_24_8;
- swdd->ReadStencilPixels = viaReadStencilPixels_24_8;
- }
- else if (vmesa->glCtx->Visual.depthBits == 32) {
- swdd->ReadDepthSpan = viaReadDepthSpan_32;
- swdd->WriteDepthSpan = viaWriteDepthSpan_32;
- swdd->WriteMonoDepthSpan = viaWriteMonoDepthSpan_32;
- swdd->ReadDepthPixels = viaReadDepthPixels_32;
- swdd->WriteDepthPixels = viaWriteDepthPixels_32;
- }
-#endif
-
swdd->SpanRenderStart = viaSpanRenderStart;
swdd->SpanRenderFinish = viaSpanRenderFinish;
-
-#if 0
- swdd->WriteCI8Span = NULL;
- swdd->WriteCI32Span = NULL;
- swdd->WriteMonoCISpan = NULL;
- swdd->WriteCI32Pixels = NULL;
- swdd->WriteMonoCIPixels = NULL;
- swdd->ReadCI32Span = NULL;
- swdd->ReadCI32Pixels = NULL;
-#endif
}
@@ -244,46 +174,26 @@ void viaInitSpanFuncs(GLcontext *ctx)
* Plug in the Get/Put routines for the given driRenderbuffer.
*/
void
-viaSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
+viaSetSpanFunctions(struct via_renderbuffer *vrb, const GLvisual *vis)
{
- if (drb->Base.InternalFormat == GL_RGBA) {
+ if (vrb->Base.InternalFormat == GL_RGBA) {
if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
- viaInitPointers_565(&drb->Base);
+ viaInitPointers_565(&vrb->Base);
}
else {
- viaInitPointers_8888(&drb->Base);
+ viaInitPointers_8888(&vrb->Base);
}
}
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
- drb->Base.GetRow = viaReadDepthSpan_16;
- drb->Base.GetValues = viaReadDepthPixels_16;
- drb->Base.PutRow = viaWriteDepthSpan_16;
- drb->Base.PutMonoRow = viaWriteMonoDepthSpan_16;
- drb->Base.PutValues = viaWriteDepthPixels_16;
- drb->Base.PutMonoValues = NULL;
+ else if (vrb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
+ viaInitDepthPointers_z16(&vrb->Base);
}
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
- drb->Base.GetRow = viaReadDepthSpan_24_8;
- drb->Base.GetValues = viaReadDepthPixels_24_8;
- drb->Base.PutRow = viaWriteDepthSpan_24_8;
- drb->Base.PutMonoRow = viaWriteMonoDepthSpan_24_8;
- drb->Base.PutValues = viaWriteDepthPixels_24_8;
- drb->Base.PutMonoValues = NULL;
+ else if (vrb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
+ viaInitDepthPointers_z24_s8(&vrb->Base);
}
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT32) {
- drb->Base.GetRow = viaReadDepthSpan_32;
- drb->Base.GetValues = viaReadDepthPixels_32;
- drb->Base.PutRow = viaWriteDepthSpan_32;
- drb->Base.PutMonoRow = viaWriteMonoDepthSpan_32;
- drb->Base.PutValues = viaWriteDepthPixels_32;
- drb->Base.PutMonoValues = NULL;
+ else if (vrb->Base.InternalFormat == GL_DEPTH_COMPONENT32) {
+ viaInitDepthPointers_z32(&vrb->Base);
}
- else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
- drb->Base.GetRow = viaReadStencilSpan_24_8;
- drb->Base.GetValues = viaReadStencilPixels_24_8;
- drb->Base.PutRow = viaWriteStencilSpan_24_8;
- drb->Base.PutMonoRow = viaWriteMonoStencilSpan_24_8;
- drb->Base.PutValues = viaWriteStencilPixels_24_8;
- drb->Base.PutMonoValues = NULL;
+ else if (vrb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
+ viaInitStencilPointers_z24_s8(&vrb->Base);
}
}
diff --git a/src/mesa/drivers/dri/unichrome/via_span.h b/src/mesa/drivers/dri/unichrome/via_span.h
index c3bd24b0e78..3dca0d56619 100644
--- a/src/mesa/drivers/dri/unichrome/via_span.h
+++ b/src/mesa/drivers/dri/unichrome/via_span.h
@@ -25,13 +25,11 @@
#ifndef _VIA_SPAN_H
#define _VIA_SPAN_H
-#include "drirenderbuffer.h"
-
extern void viaInitSpanFuncs(GLcontext *ctx);
extern void viaSpanRenderStart( GLcontext *ctx );
extern void viaSpanRenderFinish( GLcontext *ctx );
extern void
-viaSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis);
+viaSetSpanFunctions(struct via_renderbuffer *vrb, const GLvisual *vis);
#endif
diff --git a/src/mesa/drivers/dri/unichrome/via_state.c b/src/mesa/drivers/dri/unichrome/via_state.c
index 4037d14fff9..324c72b46ab 100644
--- a/src/mesa/drivers/dri/unichrome/via_state.c
+++ b/src/mesa/drivers/dri/unichrome/via_state.c
@@ -659,12 +659,12 @@ static void viaDrawBuffer(GLcontext *ctx, GLenum mode)
switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
case BUFFER_BIT_FRONT_LEFT:
VIA_FLUSH_DMA(vmesa);
- vmesa->drawBuffer = vmesa->readBuffer = &vmesa->front;
+ vmesa->drawBuffer = &vmesa->front;
FALLBACK(vmesa, VIA_FALLBACK_DRAW_BUFFER, GL_FALSE);
break;
case BUFFER_BIT_BACK_LEFT:
VIA_FLUSH_DMA(vmesa);
- vmesa->drawBuffer = vmesa->readBuffer = &vmesa->back;
+ vmesa->drawBuffer = &vmesa->back;
FALLBACK(vmesa, VIA_FALLBACK_DRAW_BUFFER, GL_FALSE);
break;
default:
@@ -674,11 +674,6 @@ static void viaDrawBuffer(GLcontext *ctx, GLenum mode)
viaXMesaWindowMoved(vmesa);
-
- /* We want to update the s/w rast state too so that viaSetBuffer()
- * gets called.
- */
- _swrast_DrawBuffer(ctx, mode);
}
static void viaClearColor(GLcontext *ctx, const GLfloat color[4])