diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2005-09-14 00:36:27 +0000 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2005-09-14 00:36:27 +0000 |
commit | ff9d235042bb80daf0a6f5af41f7abcb1d552a80 (patch) | |
tree | 072f5e9684e019d3309b942ef7ee038fe027df4f | |
parent | 48799287b3e88105cdf3f83e97e8bb4a90f8650b (diff) |
Instead of calling _mesa_ResizeBuffersMESA() in the Viewport function,
call driUpdateFramebufferSize() when window size/position changes.
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 c1fab2d586..ee25096526 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" @@ -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); } diff --git a/src/mesa/drivers/dri/fb/fb_egl.c b/src/mesa/drivers/dri/fb/fb_egl.c index 94ff9cbb62..05148b445c 100644 --- a/src/mesa/drivers/dri/fb/fb_egl.c +++ b/src/mesa/drivers/dri/fb/fb_egl.c @@ -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); } diff --git a/src/mesa/drivers/dri/ffb/ffb_state.c b/src/mesa/drivers/dri/ffb/ffb_state.c index 85c2fb5e8b..b81d94de25 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 baf4885a3b..ab2a6688ba 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 4c0970f090..2ab387fa27 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 3edf009c78..026ff5efbf 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 d3445706a4..89546b6ae2 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 4a811a0d03..a79c3a3e4d 100644 --- a/src/mesa/drivers/dri/i810/i810state.c +++ b/src/mesa/drivers/dri/i810/i810state.c @@ -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 ); } diff --git a/src/mesa/drivers/dri/i830/i830_context.c b/src/mesa/drivers/dri/i830/i830_context.c index 45fcbd2e3b..45c3ca57f4 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 13e2559662..55211f20a0 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 34f17a2f64..cd524adc44 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 139a4e2abd..de3654bacb 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 d7c35afff3..ef67bc6a43 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 11f0d309e4..7da3a08190 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 2f93ae2450..c3c0a8c971 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 c3c04d587e..1acabcb5f4 100644 --- a/src/mesa/drivers/dri/savage/savagestate.c +++ b/src/mesa/drivers/dri/savage/savagestate.c @@ -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 ); } diff --git a/src/mesa/drivers/dri/sis/sis_lock.c b/src/mesa/drivers/dri/sis/sis_lock.c index f598e52d92..386f99ca27 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 50c45b63ed..8349c42d29 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 6bbfb8d3a2..ae3ba1a832 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 28d2f13ea8..1869de4737 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 64f4e286d7..4fae019247 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.c +++ b/src/mesa/drivers/dri/unichrome/via_context.c @@ -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; } diff --git a/src/mesa/drivers/dri/unichrome/via_state.c b/src/mesa/drivers/dri/unichrome/via_state.c index 324c72b46a..6a2a99df3b 100644 --- a/src/mesa/drivers/dri/unichrome/via_state.c +++ b/src/mesa/drivers/dri/unichrome/via_state.c @@ -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); } |