summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2005-09-01 04:03:44 +0000
committerBrian Paul <[email protected]>2005-09-01 04:03:44 +0000
commitfcbfeb5d28aea87c60f2d02daa213d0c0c2516e8 (patch)
tree783872f7936fc274c1786dd8a06e227494939c7a
parent982e8e4d5c95e9e9040b4b70d7322a2a8a9396d9 (diff)
Finish up some of the gl_renderbuffer work.
Use driRenderbuffer's offset, pitch fields in the span routines. Remove the SetBuffer driver function. Consolidate the code for setting CTX_RB3D_COLOROFFSET and CTX_RB3D_COLORPITCH state in new radeonUpdateDrawBuffer() function. Old code is surrounded by #if 000 / #endif, temporarily.
-rw-r--r--src/mesa/drivers/dri/r200/r200_context.c2
-rw-r--r--src/mesa/drivers/dri/r200/r200_context.h6
-rw-r--r--src/mesa/drivers/dri/r200/r200_ioctl.c4
-rw-r--r--src/mesa/drivers/dri/r200/r200_lock.c39
-rw-r--r--src/mesa/drivers/dri/r200/r200_pixel.c16
-rw-r--r--src/mesa/drivers/dri/r200/r200_span.c65
-rw-r--r--src/mesa/drivers/dri/r200/r200_state.c57
-rw-r--r--src/mesa/drivers/dri/r200/r200_state.h1
-rw-r--r--src/mesa/drivers/dri/r200/r200_state_init.c20
9 files changed, 183 insertions, 27 deletions
diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c
index 6f8f78ef57a..d8a17e7e33d 100644
--- a/src/mesa/drivers/dri/r200/r200_context.c
+++ b/src/mesa/drivers/dri/r200/r200_context.c
@@ -75,7 +75,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define need_GL_NV_vertex_program
#include "extension_helper.h"
-#define DRIVER_DATE "20041207"
+#define DRIVER_DATE "20050831"
#include "vblank.h"
#include "utils.h"
diff --git a/src/mesa/drivers/dri/r200/r200_context.h b/src/mesa/drivers/dri/r200/r200_context.h
index 89b0b35a8a4..d2902f9e6ab 100644
--- a/src/mesa/drivers/dri/r200/r200_context.h
+++ b/src/mesa/drivers/dri/r200/r200_context.h
@@ -92,7 +92,9 @@ typedef void (*r200_point_func)( r200ContextPtr,
struct r200_colorbuffer_state {
GLuint clear;
+#if 000
GLint drawOffset, drawPitch;
+#endif
int roundEnable;
};
@@ -102,9 +104,11 @@ struct r200_depthbuffer_state {
GLfloat scale;
};
+#if 000
struct r200_pixel_state {
GLint readOffset, readPitch;
};
+#endif
struct r200_scissor_state {
drm_clip_rect_t rect;
@@ -539,7 +543,9 @@ struct r200_state {
*/
struct r200_colorbuffer_state color;
struct r200_depthbuffer_state depth;
+#if 00
struct r200_pixel_state pixel;
+#endif
struct r200_scissor_state scissor;
struct r200_stencilbuffer_state stencil;
struct r200_stipple_state stipple;
diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.c b/src/mesa/drivers/dri/r200/r200_ioctl.c
index a2336ce4f3d..bf2d0917591 100644
--- a/src/mesa/drivers/dri/r200/r200_ioctl.c
+++ b/src/mesa/drivers/dri/r200/r200_ioctl.c
@@ -556,6 +556,7 @@ void r200PageFlip( const __DRIdrawablePrivate *dPriv )
rmesa->swap_count++;
(void) (*dri_interface->getUST)( & rmesa->swap_ust );
+#if 000
if ( rmesa->sarea->pfCurrentPage == 1 ) {
rmesa->state.color.drawOffset = rmesa->r200Screen->frontOffset;
rmesa->state.color.drawPitch = rmesa->r200Screen->frontPitch;
@@ -571,6 +572,9 @@ void r200PageFlip( const __DRIdrawablePrivate *dPriv )
if (rmesa->sarea->tiling_enabled) {
rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] |= R200_COLOR_TILE_ENABLE;
}
+#else
+ r200UpdateDrawBuffer(rmesa->glCtx);
+#endif
}
diff --git a/src/mesa/drivers/dri/r200/r200_lock.c b/src/mesa/drivers/dri/r200/r200_lock.c
index 9b82c18d1fe..f0858f2c313 100644
--- a/src/mesa/drivers/dri/r200/r200_lock.c
+++ b/src/mesa/drivers/dri/r200/r200_lock.c
@@ -39,6 +39,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r200_tex.h"
#include "r200_state.h"
#include "r200_ioctl.h"
+#include "drirenderbuffer.h"
#if DEBUG_LOCKING
char *prevLockFile = NULL;
@@ -50,6 +51,7 @@ int prevLockLine = 0;
static void
r200UpdatePageFlipping( r200ContextPtr rmesa )
{
+#if 000
int use_back;
rmesa->doPageFlip = rmesa->sarea->pfState;
@@ -68,6 +70,43 @@ r200UpdatePageFlipping( r200ContextPtr rmesa )
rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = rmesa->state.color.drawOffset
+ rmesa->r200Screen->fbLocation;
rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = rmesa->state.color.drawPitch;
+#else
+ if (rmesa->doPageFlip != rmesa->sarea->pfState
+ || rmesa->sarea->pfState) {
+ /* If page flipping is on, re we're turning it on/off now we need
+ * to update the flipped buffer info.
+ */
+ struct gl_framebuffer *fb = rmesa->glCtx->WinSysDrawBuffer;
+ driRenderbuffer *front_drb
+ = (driRenderbuffer *) fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer;
+ driRenderbuffer *back_drb
+ = (driRenderbuffer *) fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer;
+
+ if (rmesa->sarea->pfState && rmesa->sarea->pfCurrentPage == 1) {
+ /* flipped buffers */
+ front_drb->flippedOffset = back_drb->offset;
+ front_drb->flippedPitch = back_drb->pitch;
+ back_drb->flippedOffset = front_drb->offset;
+ back_drb->flippedPitch = front_drb->pitch;
+ }
+ else {
+ /* unflipped buffers */
+ front_drb->flippedOffset = front_drb->offset;
+ front_drb->flippedPitch = front_drb->pitch;
+ if (back_drb) {
+ /* back buffer is non-existant when single buffered */
+ back_drb->flippedOffset = back_drb->offset;
+ back_drb->flippedPitch = back_drb->pitch;
+ }
+ }
+
+ /* update local state */
+ rmesa->doPageFlip = rmesa->sarea->pfState;
+
+ /* set hw.ctx.cmd state here */
+ r200UpdateDrawBuffer(rmesa->glCtx);
+ }
+#endif
}
diff --git a/src/mesa/drivers/dri/r200/r200_pixel.c b/src/mesa/drivers/dri/r200/r200_pixel.c
index ad3ec20b4e9..c3489b6c621 100644
--- a/src/mesa/drivers/dri/r200/r200_pixel.c
+++ b/src/mesa/drivers/dri/r200/r200_pixel.c
@@ -43,6 +43,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r200_pixel.h"
#include "r200_swtcl.h"
+#include "drirenderbuffer.h"
static GLboolean
@@ -213,10 +214,11 @@ r200TryReadPixels( GLcontext *ctx,
{
__DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
+ driRenderbuffer *drb = (driRenderbuffer *) ctx->ReadBuffer->_ColorReadBuffer;
int nbox = dPriv->numClipRects;
- int src_offset = rmesa->state.color.drawOffset
+ int src_offset = drb->offset
+ rmesa->r200Screen->fbLocation;
- int src_pitch = rmesa->state.color.drawPitch * rmesa->r200Screen->cpp;
+ int src_pitch = drb->pitch * drb->cpp;
int dst_offset = r200GartOffsetFromVirtual( rmesa, pixels );
int dst_pitch = pitch * rmesa->r200Screen->cpp;
drm_clip_rect_t *box = dPriv->pClipRects;
@@ -293,6 +295,8 @@ static void do_draw_pix( GLcontext *ctx,
r200ContextPtr rmesa = R200_CONTEXT(ctx);
__DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
drm_clip_rect_t *box = dPriv->pClipRects;
+ struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorDrawBuffers[0][0];
+ driRenderbuffer *drb = (driRenderbuffer *) rb;
int nbox = dPriv->numClipRects;
int i;
int blit_format;
@@ -353,8 +357,8 @@ static void do_draw_pix( GLcontext *ctx,
r200EmitBlit( rmesa,
blit_format,
src_pitch, src_offset,
- rmesa->state.color.drawPitch * rmesa->r200Screen->cpp,
- rmesa->state.color.drawOffset + rmesa->r200Screen->fbLocation,
+ drb->pitch * drb->cpp,
+ drb->offset + rmesa->r200Screen->fbLocation,
bx - x, by - y,
bx, by,
bw, bh );
@@ -384,6 +388,10 @@ r200TryDrawPixels( GLcontext *ctx,
if (R200_DEBUG & DEBUG_PIXEL)
fprintf(stderr, "%s\n", __FUNCTION__);
+ /* check that we're drawing to exactly one color buffer */
+ if (ctx->DrawBuffer->_NumColorDrawBuffers[0] != 1)
+ return GL_FALSE;
+
switch (format) {
case GL_RGB:
case GL_RGBA:
diff --git a/src/mesa/drivers/dri/r200/r200_span.c b/src/mesa/drivers/dri/r200/r200_span.c
index 024e89461ed..898ff61e76a 100644
--- a/src/mesa/drivers/dri/r200/r200_span.c
+++ b/src/mesa/drivers/dri/r200/r200_span.c
@@ -46,6 +46,10 @@ WITH THE SOFTWARE OR THE 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)
+
+#if 000
#define LOCAL_VARS \
r200ContextPtr rmesa = R200_CONTEXT(ctx); \
r200ScreenPtr r200Screen = rmesa->r200Screen; \
@@ -63,17 +67,26 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
(dPriv->y * pitch)); \
GLuint p; \
(void) read_buf; (void) buf; (void) p
+#else
+#define LOCAL_VARS \
+ r200ContextPtr rmesa = R200_CONTEXT(ctx); \
+ __DRIscreenPrivate *sPriv = rmesa->dri.screen; \
+ __DRIdrawablePrivate *dPriv = rmesa->dri.drawable; \
+ driRenderbuffer *drb = (driRenderbuffer *) rb; \
+ GLuint height = dPriv->h; \
+ GLuint p; \
+ (void) p;
+#endif
#define LOCAL_DEPTH_VARS \
r200ContextPtr rmesa = R200_CONTEXT(ctx); \
- r200ScreenPtr r200Screen = rmesa->r200Screen; \
__DRIscreenPrivate *sPriv = rmesa->dri.screen; \
__DRIdrawablePrivate *dPriv = rmesa->dri.drawable; \
+ driRenderbuffer *drb = (driRenderbuffer *) rb; \
GLuint height = dPriv->h; \
GLuint xo = dPriv->x; \
GLuint yo = dPriv->y; \
- char *buf = (char *)(sPriv->pFB + r200Screen->depthOffset); \
- (void) buf
+ char *buf = (char *)(sPriv->pFB + drb->offset);
#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
@@ -96,6 +109,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define TAG(x) r200##x##_RGB565
#define TAG2(x,y) r200##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"
/* 32 bit, ARGB8888 color spanline and pixel functions
@@ -105,6 +120,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define TAG(x) r200##x##_ARGB8888
#define TAG2(x,y) r200##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"
@@ -122,12 +139,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#define BIT(x,b) ((x & (1<<b))>>b)
-static GLuint r200_mba_z32( r200ContextPtr rmesa,
- GLint x, GLint y )
+
+static GLuint
+r200_mba_z32( driRenderbuffer *drb, GLint x, GLint y )
{
- GLuint pitch = rmesa->r200Screen->frontPitch;
- if (rmesa->r200Screen->depthHasSurface) {
- return 4*(x + y*pitch);
+ GLuint pitch = drb->pitch;
+ if (drb->depthHasSurface) {
+ return 4 * (x + y * pitch);
}
else {
GLuint b = ((y & 0x7FF) >> 4) * ((pitch & 0xFFF) >> 5) + ((x & 0x7FF) >> 5);
@@ -147,11 +165,12 @@ static GLuint r200_mba_z32( r200ContextPtr rmesa,
}
}
-static GLuint r200_mba_z16( r200ContextPtr rmesa, GLint x, GLint y )
+static GLuint
+r200_mba_z16( driRenderbuffer *drb, GLint x, GLint y )
{
- GLuint pitch = rmesa->r200Screen->frontPitch;
- if (rmesa->r200Screen->depthHasSurface) {
- return 2*(x + y*pitch);
+ GLuint pitch = drb->pitch;
+ if (drb->depthHasSurface) {
+ return 2 * (x + y * pitch);
}
else {
GLuint b = ((y & 0x7FF) >> 4) * ((pitch & 0xFFF) >> 6) + ((x & 0x7FF) >> 6);
@@ -177,10 +196,10 @@ static GLuint r200_mba_z16( r200ContextPtr rmesa, GLint x, GLint y )
*/
#define WRITE_DEPTH( _x, _y, d ) \
- *(GLushort *)(buf + r200_mba_z16( rmesa, _x + xo, _y + yo )) = d;
+ *(GLushort *)(buf + r200_mba_z16( drb, _x + xo, _y + yo )) = d;
#define READ_DEPTH( d, _x, _y ) \
- d = *(GLushort *)(buf + r200_mba_z16( rmesa, _x + xo, _y + yo ));
+ d = *(GLushort *)(buf + r200_mba_z16( drb, _x + xo, _y + yo ));
#define TAG(x) r200##x##_16
#include "depthtmp.h"
@@ -191,7 +210,7 @@ static GLuint r200_mba_z16( r200ContextPtr rmesa, GLint x, GLint y )
#define WRITE_DEPTH( _x, _y, d ) \
do { \
- GLuint offset = r200_mba_z32( rmesa, _x + xo, _y + yo ); \
+ GLuint offset = r200_mba_z32( drb, _x + xo, _y + yo ); \
GLuint tmp = *(GLuint *)(buf + offset); \
tmp &= 0xff000000; \
tmp |= ((d) & 0x00ffffff); \
@@ -199,7 +218,7 @@ do { \
} while (0)
#define READ_DEPTH( d, _x, _y ) \
- d = *(GLuint *)(buf + r200_mba_z32( rmesa, _x + xo, \
+ d = *(GLuint *)(buf + r200_mba_z32( drb, _x + xo, \
_y + yo )) & 0x00ffffff;
#define TAG(x) r200##x##_24_8
@@ -214,7 +233,7 @@ do { \
*/
#define WRITE_STENCIL( _x, _y, d ) \
do { \
- GLuint offset = r200_mba_z32( rmesa, _x + xo, _y + yo ); \
+ GLuint offset = r200_mba_z32( drb, _x + xo, _y + yo ); \
GLuint tmp = *(GLuint *)(buf + offset); \
tmp &= 0x00ffffff; \
tmp |= (((d) & 0xff) << 24); \
@@ -223,7 +242,7 @@ do { \
#define READ_STENCIL( d, _x, _y ) \
do { \
- GLuint offset = r200_mba_z32( rmesa, _x + xo, _y + yo ); \
+ GLuint offset = r200_mba_z32( drb, _x + xo, _y + yo ); \
GLuint tmp = *(GLuint *)(buf + offset); \
tmp &= 0xff000000; \
d = tmp >> 24; \
@@ -233,6 +252,7 @@ do { \
#include "stenciltmp.h"
+#if 000
/*
* This function is called to specify which buffer to read and write
* for software rasterization (swrast) fallbacks. This doesn't necessarily
@@ -276,6 +296,7 @@ static void r200SetBuffer( GLcontext *ctx,
break;
}
}
+#endif
/* Move locking out to get reasonable span performance (10x better
* than doing this in HW_LOCK above). WaitForIdle() is the main
@@ -301,8 +322,10 @@ static void r200SpanRenderStart( GLcontext *ctx )
*/
{
int p;
- volatile int *read_buf = (volatile int *)(rmesa->dri.screen->pFB +
- rmesa->state.pixel.readOffset);
+ driRenderbuffer *drb =
+ (driRenderbuffer *) ctx->WinSysDrawBuffer->_ColorDrawBuffers[0][0];
+ volatile int *read_buf =
+ (volatile int *)(rmesa->dri.screen->pFB + drb->offset);
p = *read_buf;
*read_buf = p;
}
@@ -319,7 +342,9 @@ void r200InitSpanFuncs( GLcontext *ctx )
{
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
+#if 000
swdd->SetBuffer = r200SetBuffer;
+#endif
swdd->SpanRenderStart = r200SpanRenderStart;
swdd->SpanRenderFinish = r200SpanRenderFinish;
}
diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c
index 93f6dfc6d7a..36dd9ca8870 100644
--- a/src/mesa/drivers/dri/r200/r200_state.c
+++ b/src/mesa/drivers/dri/r200/r200_state.c
@@ -48,7 +48,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "tnl/t_pipeline.h"
#include "swrast_setup/swrast_setup.h"
-
#include "r200_context.h"
#include "r200_ioctl.h"
#include "r200_state.h"
@@ -57,6 +56,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r200_swtcl.h"
#include "r200_vtxfmt.h"
+#include "drirenderbuffer.h"
+
/* =============================================================
* Alpha blending
@@ -1794,7 +1795,8 @@ static void r200DrawBuffer( GLcontext *ctx, GLenum mode )
R200_FIREVERTICES(rmesa); /* don't pipeline cliprect changes */
/*
- * _DrawDestMask is easier to cope with than <mode>.
+ * _ColorDrawBufferMask is easier to cope with than <mode>.
+ * Check for software fallback, update cliprects.
*/
switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
case BUFFER_BIT_FRONT_LEFT:
@@ -1811,6 +1813,7 @@ static void r200DrawBuffer( GLcontext *ctx, GLenum mode )
return;
}
+#if 000
/* We want to update the s/w rast state too so that r200SetBuffer()
* gets called.
*/
@@ -1824,6 +1827,11 @@ static void r200DrawBuffer( GLcontext *ctx, GLenum mode )
if (rmesa->sarea->tiling_enabled) {
rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] |= R200_COLOR_TILE_ENABLE;
}
+#else
+ /* We'll set the drawing engine's offset/pitch parameters later
+ * when we update other state.
+ */
+#endif
}
@@ -2218,11 +2226,56 @@ static void update_texturematrix( GLcontext *ctx )
+/**
+ * Tell the card where to render (offset, pitch).
+ * Effected by glDrawBuffer, etc
+ */
+void
+r200UpdateDrawBuffer(GLcontext *ctx)
+{
+ r200ContextPtr rmesa = R200_CONTEXT(ctx);
+ struct gl_framebuffer *fb = ctx->DrawBuffer;
+ driRenderbuffer *drb;
+
+ if (fb->_ColorDrawBufferMask[0] == BUFFER_BIT_FRONT_LEFT) {
+ /* draw to front */
+ drb = (driRenderbuffer *) fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer;
+ }
+ else if (fb->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT) {
+ /* draw to back */
+ drb = (driRenderbuffer *) fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer;
+ }
+ else {
+ /* drawing to multiple buffers, or none */
+ return;
+ }
+
+ assert(drb);
+ assert(drb->flippedPitch);
+
+ R200_STATECHANGE( rmesa, ctx );
+
+ /* Note: we used the (possibly) page-flipped values */
+ rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET]
+ = ((drb->flippedOffset + rmesa->r200Screen->fbLocation)
+ & R200_COLOROFFSET_MASK);
+ rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = drb->flippedPitch;
+ if (rmesa->sarea->tiling_enabled) {
+ rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] |= R200_COLOR_TILE_ENABLE;
+ }
+}
+
+
+
void r200ValidateState( GLcontext *ctx )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLuint new_state = rmesa->NewGLState;
+ if (new_state & (_NEW_BUFFERS | _NEW_COLOR | _NEW_PIXEL)) {
+ r200UpdateDrawBuffer(ctx);
+ }
+
if (new_state & _NEW_TEXTURE) {
r200UpdateTextureState( ctx );
new_state |= rmesa->NewGLState; /* may add TEXTURE_MATRIX */
diff --git a/src/mesa/drivers/dri/r200/r200_state.h b/src/mesa/drivers/dri/r200/r200_state.h
index d467d73bd80..98c6fbe40bb 100644
--- a/src/mesa/drivers/dri/r200/r200_state.h
+++ b/src/mesa/drivers/dri/r200/r200_state.h
@@ -48,6 +48,7 @@ extern void r200SetCliprects( r200ContextPtr rmesa, GLenum mode );
extern void r200RecalcScissorRects( r200ContextPtr rmesa );
extern void r200UpdateViewportOffset( GLcontext *ctx );
extern void r200UpdateWindow( GLcontext *ctx );
+extern void r200UpdateDrawBuffer(GLcontext *ctx);
extern void r200ValidateState( GLcontext *ctx );
diff --git a/src/mesa/drivers/dri/r200/r200_state_init.c b/src/mesa/drivers/dri/r200/r200_state_init.c
index 30e0dfa4616..27c0b946b1e 100644
--- a/src/mesa/drivers/dri/r200/r200_state_init.c
+++ b/src/mesa/drivers/dri/r200/r200_state_init.c
@@ -155,6 +155,7 @@ void r200InitState( r200ContextPtr rmesa )
{
GLcontext *ctx = rmesa->glCtx;
GLuint color_fmt, depth_fmt, i;
+ GLint drawPitch, drawOffset;
switch ( rmesa->r200Screen->cpp ) {
case 2:
@@ -196,6 +197,14 @@ void r200InitState( r200ContextPtr rmesa )
rmesa->Fallback = 0;
if ( ctx->Visual.doubleBufferMode && rmesa->sarea->pfCurrentPage == 0 ) {
+ drawOffset = rmesa->r200Screen->backOffset;
+ drawPitch = rmesa->r200Screen->backPitch;
+ } else {
+ drawOffset = rmesa->r200Screen->frontOffset;
+ drawPitch = rmesa->r200Screen->frontPitch;
+ }
+#if 000
+ if ( ctx->Visual.doubleBufferMode && rmesa->sarea->pfCurrentPage == 0 ) {
rmesa->state.color.drawOffset = rmesa->r200Screen->backOffset;
rmesa->state.color.drawPitch = rmesa->r200Screen->backPitch;
} else {
@@ -205,6 +214,7 @@ void r200InitState( r200ContextPtr rmesa )
rmesa->state.pixel.readOffset = rmesa->state.color.drawOffset;
rmesa->state.pixel.readPitch = rmesa->state.color.drawPitch;
+#endif
rmesa->hw.max_state_size = 0;
@@ -502,6 +512,7 @@ void r200InitState( r200ContextPtr rmesa )
else
rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= rmesa->state.color.roundEnable;
+#if 000
rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = ((rmesa->state.color.drawOffset +
rmesa->r200Screen->fbLocation)
& R200_COLOROFFSET_MASK);
@@ -509,6 +520,15 @@ void r200InitState( r200ContextPtr rmesa )
rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = ((rmesa->state.color.drawPitch &
R200_COLORPITCH_MASK) |
R200_COLOR_ENDIAN_NO_SWAP);
+#else
+ rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = ((drawOffset +
+ rmesa->r200Screen->fbLocation)
+ & R200_COLOROFFSET_MASK);
+
+ rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = ((drawPitch &
+ R200_COLORPITCH_MASK) |
+ R200_COLOR_ENDIAN_NO_SWAP);
+#endif
/* (fixed size) sarea is initialized to zero afaics so can omit version check. Phew! */
if (rmesa->sarea->tiling_enabled) {
rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] |= R200_COLOR_TILE_ENABLE;