From ff9d235042bb80daf0a6f5af41f7abcb1d552a80 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 14 Sep 2005 00:36:27 +0000 Subject: [PATCH] Instead of calling _mesa_ResizeBuffersMESA() in the Viewport function, call driUpdateFramebufferSize() when window size/position changes. --- src/mesa/drivers/dri/fb/fb_dri.c | 16 ++++++++++++++-- src/mesa/drivers/dri/fb/fb_egl.c | 14 +++++++++++++- src/mesa/drivers/dri/ffb/ffb_state.c | 3 --- src/mesa/drivers/dri/ffb/ffb_xmesa.c | 6 +++++- src/mesa/drivers/dri/gamma/gamma_lock.c | 2 ++ src/mesa/drivers/dri/gamma/gamma_state.c | 2 -- src/mesa/drivers/dri/i810/i810context.c | 1 + src/mesa/drivers/dri/i810/i810state.c | 4 ---- src/mesa/drivers/dri/i830/i830_context.c | 3 ++- src/mesa/drivers/dri/i830/i830_state.c | 3 --- src/mesa/drivers/dri/mga/mga_xmesa.c | 2 ++ src/mesa/drivers/dri/mga/mgastate.c | 3 --- src/mesa/drivers/dri/r128/r128_lock.c | 1 + src/mesa/drivers/dri/r128/r128_state.c | 5 ----- src/mesa/drivers/dri/savage/savage_xmesa.c | 8 ++++---- src/mesa/drivers/dri/savage/savagestate.c | 3 --- src/mesa/drivers/dri/sis/sis_lock.c | 2 ++ src/mesa/drivers/dri/sis/sis_state.c | 3 --- src/mesa/drivers/dri/tdfx/tdfx_lock.c | 3 +++ src/mesa/drivers/dri/tdfx/tdfx_state.c | 3 --- src/mesa/drivers/dri/unichrome/via_context.c | 2 ++ src/mesa/drivers/dri/unichrome/via_state.c | 3 --- 22 files changed, 51 insertions(+), 41 deletions(-) diff --git a/src/mesa/drivers/dri/fb/fb_dri.c b/src/mesa/drivers/dri/fb/fb_dri.c index c1fab2d5867..ee250965261 100644 --- a/src/mesa/drivers/dri/fb/fb_dri.c +++ b/src/mesa/drivers/dri/fb/fb_dri.c @@ -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" @@ -113,10 +113,22 @@ 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); } diff --git a/src/mesa/drivers/dri/fb/fb_egl.c b/src/mesa/drivers/dri/fb/fb_egl.c index 94ff9cbb622..05148b445cc 100644 --- a/src/mesa/drivers/dri/fb/fb_egl.c +++ b/src/mesa/drivers/dri/fb/fb_egl.c @@ -398,10 +398,22 @@ 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); } diff --git a/src/mesa/drivers/dri/ffb/ffb_state.c b/src/mesa/drivers/dri/ffb/ffb_state.c index 85c2fb5e8bf..b81d94de252 100644 --- a/src/mesa/drivers/dri/ffb/ffb_state.c +++ b/src/mesa/drivers/dri/ffb/ffb_state.c @@ -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); } diff --git a/src/mesa/drivers/dri/ffb/ffb_xmesa.c b/src/mesa/drivers/dri/ffb/ffb_xmesa.c index baf4885a3be..ab2a6688bab 100644 --- a/src/mesa/drivers/dri/ffb/ffb_xmesa.c +++ b/src/mesa/drivers/dri/ffb/ffb_xmesa.c @@ -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); + } } } diff --git a/src/mesa/drivers/dri/gamma/gamma_lock.c b/src/mesa/drivers/dri/gamma/gamma_lock.c index 4c0970f0908..2ab387fa27d 100644 --- a/src/mesa/drivers/dri/gamma/gamma_lock.c +++ b/src/mesa/drivers/dri/gamma/gamma_lock.c @@ -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; } diff --git a/src/mesa/drivers/dri/gamma/gamma_state.c b/src/mesa/drivers/dri/gamma/gamma_state.c index 3edf009c787..026ff5efbff 100644 --- a/src/mesa/drivers/dri/gamma/gamma_state.c +++ b/src/mesa/drivers/dri/gamma/gamma_state.c @@ -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 ); } diff --git a/src/mesa/drivers/dri/i810/i810context.c b/src/mesa/drivers/dri/i810/i810context.c index d3445706a48..89546b6ae28 100644 --- a/src/mesa/drivers/dri/i810/i810context.c +++ b/src/mesa/drivers/dri/i810/i810context.c @@ -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; diff --git a/src/mesa/drivers/dri/i810/i810state.c b/src/mesa/drivers/dri/i810/i810state.c index 4a811a0d032..a79c3a3e4df 100644 --- a/src/mesa/drivers/dri/i810/i810state.c +++ b/src/mesa/drivers/dri/i810/i810state.c @@ -3,10 +3,8 @@ #include #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 ); } diff --git a/src/mesa/drivers/dri/i830/i830_context.c b/src/mesa/drivers/dri/i830/i830_context.c index 45fcbd2e3b6..45c3ca57f47 100644 --- a/src/mesa/drivers/dri/i830/i830_context.c +++ b/src/mesa/drivers/dri/i830/i830_context.c @@ -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 | diff --git a/src/mesa/drivers/dri/i830/i830_state.c b/src/mesa/drivers/dri/i830/i830_state.c index 13e25596629..55211f20a09 100644 --- a/src/mesa/drivers/dri/i830/i830_state.c +++ b/src/mesa/drivers/dri/i830/i830_state.c @@ -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 ); } diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index 34f17a2f647..cd524adc44f 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -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; diff --git a/src/mesa/drivers/dri/mga/mgastate.c b/src/mesa/drivers/dri/mga/mgastate.c index 139a4e2abd2..de3654bacb3 100644 --- a/src/mesa/drivers/dri/mga/mgastate.c +++ b/src/mesa/drivers/dri/mga/mgastate.c @@ -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 ); } diff --git a/src/mesa/drivers/dri/r128/r128_lock.c b/src/mesa/drivers/dri/r128/r128_lock.c index d7c35afff37..ef67bc6a43a 100644 --- a/src/mesa/drivers/dri/r128/r128_lock.c +++ b/src/mesa/drivers/dri/r128/r128_lock.c @@ -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; diff --git a/src/mesa/drivers/dri/r128/r128_state.c b/src/mesa/drivers/dri/r128/r128_state.c index 11f0d309e4a..7da3a081904 100644 --- a/src/mesa/drivers/dri/r128/r128_state.c +++ b/src/mesa/drivers/dri/r128/r128_state.c @@ -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; diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c index 2f93ae24500..c3c0a8c9716 100644 --- a/src/mesa/drivers/dri/savage/savage_xmesa.c +++ b/src/mesa/drivers/dri/savage/savage_xmesa.c @@ -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 ); - - - + } } diff --git a/src/mesa/drivers/dri/savage/savagestate.c b/src/mesa/drivers/dri/savage/savagestate.c index c3c04d587eb..1acabcb5f47 100644 --- a/src/mesa/drivers/dri/savage/savagestate.c +++ b/src/mesa/drivers/dri/savage/savagestate.c @@ -26,7 +26,6 @@ #include #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 ); } diff --git a/src/mesa/drivers/dri/sis/sis_lock.c b/src/mesa/drivers/dri/sis/sis_lock.c index f598e52d921..386f99ca27d 100644 --- a/src/mesa/drivers/dri/sis/sis_lock.c +++ b/src/mesa/drivers/dri/sis/sis_lock.c @@ -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; } diff --git a/src/mesa/drivers/dri/sis/sis_state.c b/src/mesa/drivers/dri/sis/sis_state.c index 50c45b63ed5..8349c42d297 100644 --- a/src/mesa/drivers/dri/sis/sis_state.c +++ b/src/mesa/drivers/dri/sis/sis_state.c @@ -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 ); } diff --git a/src/mesa/drivers/dri/tdfx/tdfx_lock.c b/src/mesa/drivers/dri/tdfx/tdfx_lock.c index 6bbfb8d3a2c..ae3ba1a8321 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_lock.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_lock.c @@ -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(); diff --git a/src/mesa/drivers/dri/tdfx/tdfx_state.c b/src/mesa/drivers/dri/tdfx/tdfx_state.c index 28d2f13ea8f..1869de47374 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_state.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_state.c @@ -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; } diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c index 64f4e286d72..4fae0192474 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.c +++ b/src/mesa/drivers/dri/unichrome/via_context.c @@ -60,6 +60,7 @@ #include #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; } diff --git a/src/mesa/drivers/dri/unichrome/via_state.c b/src/mesa/drivers/dri/unichrome/via_state.c index 324c72b46ab..6a2a99df3bc 100644 --- a/src/mesa/drivers/dri/unichrome/via_state.c +++ b/src/mesa/drivers/dri/unichrome/via_state.c @@ -25,7 +25,6 @@ #include #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); } -- 2.30.2