OSDN Git Service

Instead of calling _mesa_ResizeBuffersMESA() in the Viewport function,
authorBrian Paul <brian.paul@tungstengraphics.com>
Wed, 14 Sep 2005 00:36:27 +0000 (00:36 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Wed, 14 Sep 2005 00:36:27 +0000 (00:36 +0000)
call driUpdateFramebufferSize() when window size/position changes.

22 files changed:
src/mesa/drivers/dri/fb/fb_dri.c
src/mesa/drivers/dri/fb/fb_egl.c
src/mesa/drivers/dri/ffb/ffb_state.c
src/mesa/drivers/dri/ffb/ffb_xmesa.c
src/mesa/drivers/dri/gamma/gamma_lock.c
src/mesa/drivers/dri/gamma/gamma_state.c
src/mesa/drivers/dri/i810/i810context.c
src/mesa/drivers/dri/i810/i810state.c
src/mesa/drivers/dri/i830/i830_context.c
src/mesa/drivers/dri/i830/i830_state.c
src/mesa/drivers/dri/mga/mga_xmesa.c
src/mesa/drivers/dri/mga/mgastate.c
src/mesa/drivers/dri/r128/r128_lock.c
src/mesa/drivers/dri/r128/r128_state.c
src/mesa/drivers/dri/savage/savage_xmesa.c
src/mesa/drivers/dri/savage/savagestate.c
src/mesa/drivers/dri/sis/sis_lock.c
src/mesa/drivers/dri/sis/sis_state.c
src/mesa/drivers/dri/tdfx/tdfx_lock.c
src/mesa/drivers/dri/tdfx/tdfx_state.c
src/mesa/drivers/dri/unichrome/via_context.c
src/mesa/drivers/dri/unichrome/via_state.c

index c1fab2d..ee25096 100644 (file)
@@ -41,7 +41,7 @@
  *      that may not be valid everywhere.
  */
 
-#include "driver.h"
+/*#include "driver.h"*/
 #include "drm.h"
 #include "utils.h"
 #include "drirenderbuffer.h"
@@ -114,9 +114,21 @@ get_buffer_size( GLframebuffer *buffer, GLuint *width, GLuint *height )
 
 
 static void
+updateFramebufferSize(GLcontext *ctx)
+{
+   fbContextPtr fbmesa = FB_CONTEXT(ctx);
+   struct gl_framebuffer *fb = ctx->WinSysDrawBuffer;
+   if (fbmesa->dri.drawable->w != fb->Width ||
+       fbmesa->dri.drawable->h != fb->Height) {
+      driUpdateFramebufferSize(ctx, fbmesa->dri.drawable);
+   }
+}
+
+static void
 viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
 {
-   _mesa_ResizeBuffersMESA();
+   /* XXX this should be called after we acquire the DRI lock, not here */
+   updateFramebufferSize(ctx);
 }
 
 
index 94ff9cb..05148b4 100644 (file)
@@ -399,9 +399,21 @@ get_buffer_size( GLframebuffer *buffer, GLuint *width, GLuint *height )
 
 
 static void
+updateFramebufferSize(GLcontext *ctx)
+{
+   fbContextPtr fbmesa = FB_CONTEXT(ctx);
+   struct gl_framebuffer *fb = ctx->WinSysDrawBuffer;
+   if (fbmesa->dri.drawable->w != fb->Width ||
+       fbmesa->dri.drawable->h != fb->Height) {
+      driUpdateFramebufferSize(ctx, fbmesa->dri.drawable);
+   }
+}
+
+static void
 viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
 {
-   _mesa_ResizeBuffersMESA();
+   /* XXX this should be called after we acquire the DRI lock, not here */
+   updateFramebufferSize(ctx);
 }
 
 
index 85c2fb5..b81d94d 100644 (file)
@@ -26,7 +26,6 @@
  */
 
 #include "mtypes.h"
-#include "buffers.h"
 #include "colormac.h"
 #include "mm.h"
 #include "ffb_dd.h"
@@ -450,8 +449,6 @@ void ffbCalcViewport(GLcontext *ctx)
 static void ffbDDViewport(GLcontext *ctx, GLint x, GLint y,
                          GLsizei width, GLsizei height)
 {
-       /* update size of Mesa/software ancillary buffers */
-       _mesa_ResizeBuffersMESA();
        ffbCalcViewport(ctx);
 }
 
index baf4885..ab2a668 100644 (file)
@@ -59,6 +59,8 @@
 
 #include "drm_sarea.h"
 
+#include "drirenderbuffer.h"
+
 static GLboolean
 ffbInitDriver(__DRIscreenPrivate *sPriv)
 {
@@ -595,9 +597,11 @@ void ffbXMesaUpdateState(ffbContextPtr fmesa)
                GLcontext *ctx = fmesa->glCtx;
 
                ffbCalcViewport(ctx);
-               if (ctx->Polygon.StippleFlag)
+               driUpdateFramebufferSize(ctx, dPriv);
+               if (ctx->Polygon.StippleFlag) {
                        ffbXformAreaPattern(fmesa,
                                            (const GLubyte *)ctx->PolygonStipple);
+               }
        }
 }
 
index 4c0970f..2ab387f 100644 (file)
@@ -2,6 +2,7 @@
 
 #include "gamma_context.h"
 #include "gamma_lock.h"
+#include "drirenderbuffer.h"
 
 #ifdef DEBUG_LOCKING
 char *prevLockFile = NULL;
@@ -35,6 +36,7 @@ void gammaGetLock( gammaContextPtr gmesa, GLuint flags )
    DRI_VALIDATE_DRAWABLE_INFO( sPriv, dPriv );
 
    if ( gmesa->lastStamp != dPriv->lastStamp ) {
+      driUpdateFramebufferSize(gmesa->glCtx, dPriv);
       gmesa->lastStamp = dPriv->lastStamp;
       gmesa->new_state |= GAMMA_NEW_WINDOW | GAMMA_NEW_CLIP;
    }
index 3edf009..026ff5e 100644 (file)
@@ -1099,8 +1099,6 @@ void gammaUpdateWindow( GLcontext *ctx )
 static void gammaDDViewport( GLcontext *ctx, GLint x, GLint y,
                            GLsizei width, GLsizei height )
 {
-   /* update size of Mesa/software ancillary buffers */
-   _mesa_ResizeBuffersMESA();
    gammaUpdateWindow( ctx );
 }
 
index d344570..89546b6 100644 (file)
@@ -526,6 +526,7 @@ void i810GetLock( i810ContextPtr imesa, GLuint flags )
     * more broken than usual.
     */
    if (sarea->ctxOwner != me) {
+      driUpdateFramebufferSize(imesa->glCtx, dPriv);
       imesa->upload_cliprects = GL_TRUE;
       imesa->dirty = I810_UPLOAD_CTX|I810_UPLOAD_BUFFERS;
       if (imesa->CurrentTexObj[0]) imesa->dirty |= I810_UPLOAD_TEX0;
index 4a811a0..a79c3a3 100644 (file)
@@ -3,10 +3,8 @@
 #include <stdio.h>
 
 #include "glheader.h"
-#include "buffers.h"
 #include "context.h"
 #include "macros.h"
-#include "enums.h"
 #include "dd.h"
 #include "colormac.h"
 
@@ -690,8 +688,6 @@ static void i810Viewport( GLcontext *ctx,
                          GLint x, GLint y,
                          GLsizei width, GLsizei height )
 {
-   /* update size of Mesa/software ancillary buffers */
-   _mesa_ResizeBuffersMESA();
    i810CalcViewport( ctx );
 }
 
index 45fcbd2..45c3ca5 100644 (file)
@@ -63,7 +63,7 @@
 #include "i830_tris.h"
 #include "i830_ioctl.h"
 
-
+#include "drirenderbuffer.h"
 #include "utils.h"
 
 #define need_GL_ARB_multisample
@@ -573,6 +573,7 @@ void i830GetLock( i830ContextPtr imesa, GLuint flags )
     */
 
    if (sarea->ctxOwner != me) {
+      driUpdateFramebufferSize(imesa->glCtx, dPriv);
       imesa->upload_cliprects = GL_TRUE;
       imesa->dirty |= (I830_UPLOAD_CTX |
                       I830_UPLOAD_BUFFERS | 
index 13e2559..55211f2 100644 (file)
@@ -36,7 +36,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
 #include "glheader.h"
-#include "buffers.h"
 #include "context.h"
 #include "macros.h"
 #include "enums.h"
@@ -1227,8 +1226,6 @@ static void i830Viewport( GLcontext *ctx,
                          GLint x, GLint y,
                          GLsizei width, GLsizei height )
 {
-   /* update size of Mesa/software ancillary buffers */
-   _mesa_ResizeBuffersMESA();
    i830CalcViewport( ctx );
 }
 
index 34f17a2..cd524ad 100644 (file)
@@ -66,6 +66,7 @@
 #include "vblank.h"
 
 #include "extensions.h"
+#include "drirenderbuffer.h"
 
 #include "GL/internal/dri_interface.h"
 
@@ -911,6 +912,7 @@ void mgaGetLock( mgaContextPtr mmesa, GLuint flags )
       mmesa->SetupNewInputs |= VERT_BIT_POS;
       mmesa->dirty_cliprects = (MGA_FRONT|MGA_BACK);
       mgaUpdateRects( mmesa, (MGA_FRONT|MGA_BACK) );
+      driUpdateFramebufferSize(mmesa->glCtx, dPriv);
    }
 
    mmesa->dirty |= MGA_UPLOAD_CONTEXT | MGA_UPLOAD_CLIPRECTS;
index 139a4e2..de3654b 100644 (file)
@@ -28,7 +28,6 @@
 
 
 #include "mtypes.h"
-#include "buffers.h"
 #include "colormac.h"
 #include "dd.h"
 
@@ -699,8 +698,6 @@ static void mgaViewport( GLcontext *ctx,
                          GLint x, GLint y, 
                          GLsizei width, GLsizei height )
 {
-   /* update size of Mesa/software ancillary buffers */
-   _mesa_ResizeBuffersMESA();
    mgaCalcViewport( ctx );
 }
 
index d7c35af..ef67bc6 100644 (file)
@@ -86,6 +86,7 @@ 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;
index 11f0d30..7da3a08 100644 (file)
@@ -41,7 +41,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "r128_tex.h"
 
 #include "context.h"
-#include "buffers.h"
 #include "enums.h"
 #include "colormac.h"
 #include "swrast/swrast.h"
@@ -673,8 +672,6 @@ static void r128Viewport( GLcontext *ctx,
                          GLint x, GLint y,
                          GLsizei width, GLsizei height )
 {
-   /* update size of Mesa/software ancillary buffers */
-   _mesa_ResizeBuffersMESA();
    r128CalcViewport( ctx );
 }
 
@@ -726,8 +723,6 @@ static void r128DDDrawBuffer( GLcontext *ctx, GLenum mode )
     */
    switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
    case BUFFER_BIT_FRONT_LEFT:
-      FALLBACK( rmesa, R128_FALLBACK_DRAW_BUFFER, GL_FALSE );
-      break;
    case BUFFER_BIT_BACK_LEFT:
       FALLBACK( rmesa, R128_FALLBACK_DRAW_BUFFER, GL_FALSE );
       break;
index 2f93ae2..c3c0a8c 100644 (file)
@@ -56,6 +56,7 @@
 
 #include "savage_dri.h"
 
+#include "drirenderbuffer.h"
 #include "texmem.h"
 
 #define need_GL_ARB_multisample
@@ -907,11 +908,10 @@ void savageGetLock( savageContextPtr imesa, GLuint flags )
       DRI_AGE_TEXTURES( imesa->textureHeaps[heap] );
    }
 
-   if (dPriv->lastStamp != stamp)
+   if (dPriv->lastStamp != stamp) {
+      driUpdateFramebufferSize(imesa->glCtx, dPriv);
       savageXMesaWindowMoved( imesa );
-
-  
-   
+   }
 }
 
 
index c3c04d5..1acabcb 100644 (file)
@@ -26,7 +26,6 @@
 #include <stdio.h>
 
 #include "mtypes.h"
-#include "buffers.h"
 #include "enums.h"
 #include "macros.h"
 #include "dd.h"
@@ -718,8 +717,6 @@ static void savageViewport( GLcontext *ctx,
                            GLint x, GLint y, 
                            GLsizei width, GLsizei height )
 {
-   /* update size of Mesa/software ancillary buffers */
-   _mesa_ResizeBuffersMESA();
    savageCalcViewport( ctx );
 }
 
index f598e52..386f99c 100644 (file)
@@ -34,6 +34,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "sis_lock.h"
 #include "sis_dd.h"
 #include "sis_state.h"
+#include "drirenderbuffer.h"
 
 /* Update the hardware state.  This is called if another context has
  * grabbed the hardware lock, which includes the X server.  This
@@ -66,6 +67,7 @@ sisGetLock( sisContextPtr smesa, GLuint flags )
       sisUpdateBufferSize( smesa );
       sisUpdateClipping( smesa->glCtx );
       sisDDDrawBuffer( smesa->glCtx, smesa->glCtx->Color.DrawBuffer[0] );
+      driUpdateFramebufferSize(smesa->glCtx, dPriv);
       smesa->lastStamp = dPriv->lastStamp;
    }
 
index 50c45b6..8349c42 100644 (file)
@@ -39,7 +39,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "sis_tex.h"
 
 #include "context.h"
-#include "buffers.h"
 #include "enums.h"
 #include "colormac.h"
 #include "swrast/swrast.h"
@@ -437,8 +436,6 @@ static void sisDDViewport( GLcontext *ctx,
                           GLint x, GLint y,
                           GLsizei width, GLsizei height )
 {
-   /* update size of Mesa/software ancillary buffers */
-   _mesa_ResizeBuffersMESA();
    sisCalcViewport( ctx );
 }
 
index 6bbfb8d..ae3ba1a 100644 (file)
@@ -41,6 +41,8 @@
 #include "tdfx_texman.h"
 #include "tdfx_tris.h"
 
+#include "drirenderbuffer.h"
+
 
 void tdfxGetLock( tdfxContextPtr fxMesa )
 {
@@ -84,6 +86,7 @@ void tdfxGetLock( tdfxContextPtr fxMesa )
     if ( *dPriv->pStamp != stamp || saPriv->ctxOwner != fxMesa->hHWContext ) {
        tdfxUpdateClipping(fxMesa->glCtx);
        tdfxUploadClipping(fxMesa);
+       driUpdateFramebufferSize(fxMesa->glCtx, dPriv);
     }
 
     DEBUG_LOCK();
index 28d2f13..1869de4 100644 (file)
@@ -40,7 +40,6 @@
  */
 
 #include "mtypes.h"
-#include "buffers.h"
 #include "colormac.h"
 #include "texformat.h"
 #include "texstore.h"
@@ -906,8 +905,6 @@ static void tdfxDDViewport( GLcontext *ctx, GLint x, GLint y,
                            GLsizei w, GLsizei h )
 {
    tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-   /* update size of Mesa/software ancillary buffers */
-   _mesa_ResizeBuffersMESA();
    FLUSH_BATCH( fxMesa );
    fxMesa->new_state |= TDFX_NEW_VIEWPORT;
 }
index 64f4e28..4fae019 100644 (file)
@@ -60,6 +60,7 @@
 
 #include <stdio.h>
 #include "macros.h"
+#include "drirenderbuffer.h"
 
 #define need_GL_ARB_multisample
 #define need_GL_ARB_point_parameters
@@ -852,6 +853,7 @@ void viaGetLock(struct via_context *vmesa, GLuint flags)
 
     if (vmesa->lastStamp != dPriv->lastStamp) {
        viaXMesaWindowMoved(vmesa);
+       driUpdateFramebufferSize(vmesa->glCtx, dPriv);
        vmesa->newEmitState = ~0;
        vmesa->lastStamp = dPriv->lastStamp;
     }
index 324c72b..6a2a99d 100644 (file)
@@ -25,7 +25,6 @@
 #include <stdio.h>
 
 #include "glheader.h"
-#include "buffers.h"
 #include "context.h"
 #include "macros.h"
 #include "colormac.h"
@@ -738,8 +737,6 @@ static void viaViewport(GLcontext *ctx,
                         GLint x, GLint y,
                         GLsizei width, GLsizei height)
 {
-   /* update size of Mesa/software ancillary buffers */
-   _mesa_ResizeBuffersMESA();
     viaCalcViewport(ctx);
 }