Merge branch 'mesa_7_5_branch'
[mesa.git] / src / mesa / drivers / dri / r128 / r128_lock.c
index 876db765755bcf656e1b8421b2f5a1eab1bda1db..81488a27424312b307924b70c541a716433e8e60 100644 (file)
@@ -1,4 +1,3 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_lock.c,v 1.5 2002/10/30 12:51:38 alanh Exp $ */
 /**************************************************************************
 
 Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
@@ -37,6 +36,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,32 +50,15 @@ int prevLockLine = 0;
 static void
 r128UpdatePageFlipping( r128ContextPtr rmesa )
 {
-   int use_back;
-
    rmesa->doPageFlip = rmesa->sarea->pfAllowPageFlip;
-
-   use_back = (rmesa->glCtx->Color._DrawDestMask == DD_BACK_LEFT_BIT);
-   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->glCtx->WinSysDrawBuffer) {
+      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;
 }
 
-/* Update the hardware state.  This is called if another context has
+/* Update the hardware state.  This is called if another main/context.has
  * grabbed the hardware lock, which includes the X server.  This
  * function also updates the driver's window state after the X server
  * moves, resizes or restacks a window -- the change will be reflected
@@ -102,9 +87,10 @@ void r128GetLock( r128ContextPtr rmesa, GLuint flags )
 
    if ( rmesa->lastStamp != dPriv->lastStamp ) {
       r128UpdatePageFlipping( rmesa );
+      driUpdateFramebufferSize(rmesa->glCtx, dPriv);
       rmesa->lastStamp = dPriv->lastStamp;
       rmesa->new_state |= R128_NEW_CLIP;
-      rmesa->tnl_state = ~0;
+      RENDERINPUTS_ONES( rmesa->tnl_state_bitset );
    }
 
    rmesa->dirty |= R128_UPLOAD_CONTEXT | R128_UPLOAD_CLIPRECTS;