diff options
author | Brian Paul <[email protected]> | 2005-09-03 16:43:02 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2005-09-03 16:43:02 +0000 |
commit | 687918b794d12a0ff5d395b8cf87880dbe8012bf (patch) | |
tree | 280d1b882dc3bfd0e105d14a1f9d90c7cef935dd /src/mesa/drivers/dri/r128 | |
parent | e6925b51e1e71dc45079636ce336a09806356999 (diff) |
SetBuffer, renderbuffer changes
Diffstat (limited to 'src/mesa/drivers/dri/r128')
-rw-r--r-- | src/mesa/drivers/dri/r128/r128_context.h | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r128/r128_ioctl.c | 15 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r128/r128_lock.c | 24 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r128/r128_screen.c | 10 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r128/r128_span.c | 84 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r128/r128_state.c | 32 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r128/r128_state.h | 2 |
7 files changed, 37 insertions, 135 deletions
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 |