Remove use of GetBufferSize (depreciated).
authorJerome Glisse <glisse@freedesktop.org>
Wed, 15 Nov 2006 17:45:05 +0000 (17:45 +0000)
committerJerome Glisse <glisse@freedesktop.org>
Wed, 15 Nov 2006 17:45:05 +0000 (17:45 +0000)
src/mesa/drivers/dri/r200/r200_context.c
src/mesa/drivers/dri/r200/r200_context.h
src/mesa/drivers/dri/r200/r200_lock.c
src/mesa/drivers/dri/r200/r200_state.c

index 06b2a152d9fddf1a00384e16d0da99743915091b..bb7a16c9327d7ed2cfbe8f65a64d52f631d7e399 100644 (file)
@@ -87,21 +87,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 int R200_DEBUG = (0);
 #endif
 
-
-/* Return the width and height of the given buffer.
- */
-static void r200GetBufferSize( GLframebuffer *buffer,
-                              GLuint *width, GLuint *height )
-{
-   GET_CURRENT_CONTEXT(ctx);
-   r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
-   LOCK_HARDWARE( rmesa );
-   *width  = rmesa->dri.drawable->w;
-   *height = rmesa->dri.drawable->h;
-   UNLOCK_HARDWARE( rmesa );
-}
-
 /* Return various strings for glGetString().
  */
 static const GLubyte *r200GetString( GLcontext *ctx, GLenum name )
@@ -233,7 +218,7 @@ static const struct tnl_pipeline_stage *r200_pipeline[] = {
  */
 static void r200InitDriverFuncs( struct dd_function_table *functions )
 {
-    functions->GetBufferSize           = r200GetBufferSize;
+    functions->GetBufferSize           = NULL; /* OBSOLETE */
     functions->GetString               = r200GetString;
 }
 
@@ -700,7 +685,13 @@ r200MakeCurrent( __DRIcontextPrivate *driContextPriv,
       if ( newCtx->dri.drawable != driDrawPriv ) {
         driDrawableInitVBlank( driDrawPriv, newCtx->vblank_flags,
                                &newCtx->vbl_seq );
+      }
+
+      if ( newCtx->dri.drawable != driDrawPriv ||
+           newCtx->dri.readable != driReadPriv ) {
         newCtx->dri.drawable = driDrawPriv;
+        newCtx->dri.readable = driReadPriv;
+
         r200UpdateWindow( newCtx->glCtx );
         r200UpdateViewportOffset( newCtx->glCtx );
       }
index c6910f5238a1432e0ba92840628f5fcbd03c8fe7..9f109e07ff511700d16e155f32f7c20d0e56f504 100644 (file)
@@ -699,6 +699,7 @@ struct r200_dri_mirror {
    __DRIcontextPrivate *context;       /* DRI context */
    __DRIscreenPrivate  *screen;        /* DRI screen */
    __DRIdrawablePrivate        *drawable;      /* DRI drawable bound to this ctx */
+   __DRIdrawablePrivate        *readable;      /* DRI readable bound to this ctx */
 
    drm_context_t hwContext;
    drm_hw_lock_t *hwLock;
index 66bb075864f95411fb808ef42d464ebd3c3d7566..bcc0c9163967639e1817204feab9a39267b15f44 100644 (file)
@@ -69,7 +69,8 @@ r200UpdatePageFlipping( r200ContextPtr rmesa )
  */
 void r200GetLock( r200ContextPtr rmesa, GLuint flags )
 {
-   __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
+   __DRIdrawablePrivate *drawable = rmesa->dri.drawable;
+   __DRIdrawablePrivate *readable = rmesa->dri.readable;
    __DRIscreenPrivate *sPriv = rmesa->dri.screen;
    drm_radeon_sarea_t *sarea = rmesa->sarea;
    int i;
@@ -84,17 +85,20 @@ void r200GetLock( r200ContextPtr rmesa, GLuint flags )
     * Since the hardware state depends on having the latest drawable
     * clip rects, all state checking must be done _after_ this call.
     */
-   DRI_VALIDATE_DRAWABLE_INFO( sPriv, dPriv );
+   DRI_VALIDATE_DRAWABLE_INFO( sPriv, drawable );
+   if (drawable != readable) {
+      DRI_VALIDATE_DRAWABLE_INFO( sPriv, readable );
+   }
 
-   if ( rmesa->lastStamp != dPriv->lastStamp ) {
+   if ( rmesa->lastStamp != drawable->lastStamp ) {
       r200UpdatePageFlipping( rmesa );
       if (rmesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT)
          r200SetCliprects( rmesa, GL_BACK_LEFT );
       else
          r200SetCliprects( rmesa, GL_FRONT_LEFT );
       r200UpdateViewportOffset( rmesa->glCtx );
-      driUpdateFramebufferSize(rmesa->glCtx, dPriv);
-      rmesa->lastStamp = dPriv->lastStamp;
+      driUpdateFramebufferSize(rmesa->glCtx, drawable);
+      rmesa->lastStamp = drawable->lastStamp;
    }
 
    R200_STATECHANGE( rmesa, ctx );
index 097fbc868a454ab30e7927cddf9554df2d592fc9..dc1fbef72ee386ebf38a5af14c4bfe3082fa2920 100644 (file)
@@ -40,6 +40,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "enums.h"
 #include "colormac.h"
 #include "light.h"
+#include "framebuffer.h"
 
 #include "swrast/swrast.h"
 #include "array_cache/acache.h"
@@ -1845,23 +1846,26 @@ static void r200LogicOpCode( GLcontext *ctx, GLenum opcode )
 
 void r200SetCliprects( r200ContextPtr rmesa, GLenum mode )
 {
-   __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
+   __DRIdrawablePrivate *const drawable = rmesa->dri.drawable;
+   __DRIdrawablePrivate *const readable = rmesa->dri.readable;
+   GLframebuffer *const draw_fb = (GLframebuffer*) drawable->driverPrivate;
+   GLframebuffer *const read_fb = (GLframebuffer*) readable->driverPrivate;
 
    switch ( mode ) {
    case GL_FRONT_LEFT:
-      rmesa->numClipRects = dPriv->numClipRects;
-      rmesa->pClipRects = dPriv->pClipRects;
+      rmesa->numClipRects = drawable->numClipRects;
+      rmesa->pClipRects = drawable->pClipRects;
       break;
    case GL_BACK_LEFT:
       /* Can't ignore 2d windows if we are page flipping.
        */
-      if ( dPriv->numBackClipRects == 0 || rmesa->doPageFlip ) {
-        rmesa->numClipRects = dPriv->numClipRects;
-        rmesa->pClipRects = dPriv->pClipRects;
+      if ( drawable->numBackClipRects == 0 || rmesa->doPageFlip ) {
+         rmesa->numClipRects = drawable->numClipRects;
+         rmesa->pClipRects = drawable->pClipRects;
       }
       else {
-        rmesa->numClipRects = dPriv->numBackClipRects;
-        rmesa->pClipRects = dPriv->pBackClipRects;
+         rmesa->numClipRects = drawable->numBackClipRects;
+         rmesa->pClipRects = drawable->pBackClipRects;
       }
       break;
    default:
@@ -1869,6 +1873,21 @@ void r200SetCliprects( r200ContextPtr rmesa, GLenum mode )
       return;
    }
 
+   if ((draw_fb->Width != drawable->w) || (draw_fb->Height != drawable->h)) {
+      _mesa_resize_framebuffer(rmesa->glCtx, draw_fb,
+                              drawable->w, drawable->h);
+      draw_fb->Initialized = GL_TRUE;
+   }
+
+   if (drawable != readable) {
+      if ((read_fb->Width != readable->w) ||
+         (read_fb->Height != readable->h)) {
+        _mesa_resize_framebuffer(rmesa->glCtx, read_fb,
+                                 readable->w, readable->h);
+        read_fb->Initialized = GL_TRUE;
+      }
+   }
+
    if (rmesa->state.scissor.enabled)
       r200RecalcScissorRects( rmesa );
 }