Remove deprecated GetBufferSize interface.
authorJerome Glisse <glisse@freedesktop.org>
Wed, 1 Nov 2006 16:18:08 +0000 (16:18 +0000)
committerJerome Glisse <glisse@freedesktop.org>
Wed, 1 Nov 2006 16:18:08 +0000 (16:18 +0000)
src/mesa/drivers/dri/r300/radeon_context.c
src/mesa/drivers/dri/r300/radeon_context.h
src/mesa/drivers/dri/r300/radeon_lock.c
src/mesa/drivers/dri/r300/radeon_state.c
src/mesa/drivers/dri/r300/radeon_state.h

index 09321126d69c64a1ed72d2cf766b63caf26a8ed5..62a6e1e5f79877527d5bce9b6139ffbc68e3eb5f 100644 (file)
@@ -98,27 +98,11 @@ static const GLubyte *radeonGetString(GLcontext * ctx, GLenum name)
        }
 }
 
-
-/* Return the width and height of the given buffer.
- */
-static void radeonGetBufferSize(GLframebuffer * buffer,
-                               GLuint * width, GLuint * height)
-{
-       GET_CURRENT_CONTEXT(ctx);
-       radeonContextPtr radeon = RADEON_CONTEXT(ctx);
-
-       LOCK_HARDWARE(radeon);
-       *width = radeon->dri.drawable->w;
-       *height = radeon->dri.drawable->h;
-       UNLOCK_HARDWARE(radeon);
-}
-
-
 /* Initialize the driver's misc functions.
  */
 static void radeonInitDriverFuncs(struct dd_function_table *functions)
 {
-       functions->GetBufferSize = radeonGetBufferSize;
+       functions->GetBufferSize = NULL;
        functions->GetString = radeonGetString;
 }
 
@@ -158,7 +142,8 @@ GLboolean radeonInitContext(radeonContextPtr radeon,
        /* DRI fields */
        radeon->dri.context = driContextPriv;
        radeon->dri.screen = sPriv;
-       radeon->dri.drawable = NULL;    /* Set by XMesaMakeCurrent */
+       radeon->dri.drawable = NULL;
+       radeon->dri.readable = NULL;
        radeon->dri.hwContext = driContextPriv->hHWContext;
        radeon->dri.hwLock = &sPriv->pSAREA->lock;
        radeon->dri.fd = sPriv->fd;
@@ -282,12 +267,15 @@ GLboolean radeonMakeCurrent(__DRIcontextPrivate * driContextPriv,
                        fprintf(stderr, "%s ctx %p\n", __FUNCTION__,
                                radeon->glCtx);
 
-               if (radeon->dri.drawable != driDrawPriv) {
+               if ( (radeon->dri.drawable != driDrawPriv)
+                    || (radeon->dri.readable != driReadPriv) ) {
+
                        driDrawableInitVBlank(driDrawPriv,
                                              radeon->vblank_flags,
                                              &radeon->vbl_seq);
                        radeon->dri.drawable = driDrawPriv;
-                       
+                       radeon->dri.readable = driReadPriv;
+
                        r300UpdateWindow(radeon->glCtx);
                        r300UpdateViewportOffset(radeon->glCtx);
                }
index 0ec6466e441778fd5938a1d4606e46ab990885b4..07a0c7cbd6d4dbae33a398c97e56f00205116609 100644 (file)
@@ -120,7 +120,15 @@ extern void radeonTclFallback(GLcontext * ctx, GLuint bit, GLboolean mode);
 struct radeon_dri_mirror {
        __DRIcontextPrivate *context;   /* DRI context */
        __DRIscreenPrivate *screen;     /* DRI screen */
-       __DRIdrawablePrivate *drawable; /* DRI drawable bound to this ctx */
+       /**
+        * DRI drawable bound to this context for drawing.
+        */
+       __DRIdrawablePrivate    *drawable;      
+
+       /**
+        * DRI drawable bound to this context for reading.
+        */
+       __DRIdrawablePrivate    *readable;
 
        drm_context_t hwContext;
        drm_hw_lock_t *hwLock;
index 0e1e6512dbf199ae54c9e30e6cab7f37653d4cff..a00da6c8bc371efb4ffcef3daec30adc84f21f2b 100644 (file)
@@ -75,34 +75,30 @@ static void radeonUpdatePageFlipping(radeonContextPtr radeon)
  * Called by radeonGetLock() after the lock has been obtained.
  */
 static void r300RegainedLock(radeonContextPtr radeon)
-{
-       __DRIdrawablePrivate *dPriv = radeon->dri.drawable;
+{      
        int i;
+       __DRIdrawablePrivate *const drawable = radeon->dri.drawable;
        r300ContextPtr r300 = (r300ContextPtr)radeon;
+       drm_radeon_sarea_t *sarea = radeon->sarea;
 
-       if (radeon->lastStamp != dPriv->lastStamp) {
-               _mesa_resize_framebuffer(radeon->glCtx,
-                       (GLframebuffer*)dPriv->driverPrivate,
-                       dPriv->w, dPriv->h);
-
+       if ( radeon->lastStamp != drawable->lastStamp ) {
                radeonUpdatePageFlipping(radeon);
-
-               if (radeon->glCtx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT)
-                       radeonSetCliprects(radeon, GL_BACK_LEFT);
-               else
-                       radeonSetCliprects(radeon, GL_FRONT_LEFT);
-
+               radeonSetCliprects(radeon);
 #if 1
                r300UpdateViewportOffset( radeon->glCtx );
-               driUpdateFramebufferSize(radeon->glCtx, dPriv);
+               driUpdateFramebufferSize(radeon->glCtx, drawable);
 #else
                radeonUpdateScissor(radeon->glCtx);
 #endif
-               radeon->lastStamp = dPriv->lastStamp;
+               radeon->lastStamp = drawable->lastStamp;
        }
 
-       for (i = 0; i < r300->nr_heaps; i++) {
-               DRI_AGE_TEXTURES(r300->texture_heaps[i]);
+       if (sarea->ctx_owner != radeon->dri.hwContext) {
+               sarea->ctx_owner = radeon->dri.hwContext;
+
+               for (i = 0; i < r300->nr_heaps; i++) {
+                       DRI_AGE_TEXTURES(r300->texture_heaps[i]);
+               }
        }
 }
 
@@ -116,11 +112,11 @@ static void r300RegainedLock(radeonContextPtr radeon)
  */
 void radeonGetLock(radeonContextPtr radeon, GLuint flags)
 {
-       __DRIdrawablePrivate *dPriv = radeon->dri.drawable;
+       __DRIdrawablePrivate *const drawable = radeon->dri.drawable;
+       __DRIdrawablePrivate *const readable = radeon->dri.readable;
        __DRIscreenPrivate *sPriv = radeon->dri.screen;
-       drm_radeon_sarea_t *sarea = radeon->sarea;
        
-       assert (dPriv != NULL);
+       assert (drawable != NULL);
 
        drmGetLock(radeon->dri.fd, radeon->dri.hwContext, flags);
 
@@ -132,10 +128,10 @@ void radeonGetLock(radeonContextPtr radeon, 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);
-
-       if (sarea->ctx_owner != radeon->dri.hwContext)
-               sarea->ctx_owner = radeon->dri.hwContext;
+       DRI_VALIDATE_DRAWABLE_INFO( sPriv, drawable );
+       if (drawable != readable) {
+               DRI_VALIDATE_DRAWABLE_INFO( sPriv, readable );
+       }
 
        if (IS_R300_CLASS(radeon->radeonScreen))
                r300RegainedLock(radeon);
index 917acb7243c5df94c97330edeff4be40dd2c2b97..3142fee98a60a7e3a3c7522e668ab7e2732f0a09 100644 (file)
@@ -49,7 +49,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "radeon_ioctl.h"
 #include "radeon_state.h"
 #include "r300_ioctl.h"
-
+#include "framebuffer.h"
 
 /* =============================================================
  * Scissoring
@@ -134,12 +134,9 @@ void radeonUpdateScissor(GLcontext* ctx)
 
 static void radeonScissor(GLcontext* ctx, GLint x, GLint y, GLsizei w, GLsizei h)
 {
-       radeonContextPtr radeon = RADEON_CONTEXT(ctx);
-
        if (ctx->Scissor.Enabled) {
                /* We don't pipeline cliprect changes */
                r300Flush(ctx);
-
                radeonUpdateScissor(ctx);
        }
 }
@@ -148,31 +145,46 @@ static void radeonScissor(GLcontext* ctx, GLint x, GLint y, GLsizei w, GLsizei h
 /**
  * Update cliprects and scissors.
  */
-void radeonSetCliprects(radeonContextPtr radeon, GLenum mode)
+void radeonSetCliprects(radeonContextPtr radeon)
 {
-       __DRIdrawablePrivate *dPriv = radeon->dri.drawable;
-
-       switch (mode) {
-       case GL_FRONT_LEFT:
-               radeon->numClipRects = dPriv->numClipRects;
-               radeon->pClipRects = dPriv->pClipRects;
-               break;
-       case GL_BACK_LEFT:
-               /* Can't ignore 2d windows if we are page flipping.
-                */
-               if (dPriv->numBackClipRects == 0 || radeon->doPageFlip) {
-                       radeon->numClipRects = dPriv->numClipRects;
-                       radeon->pClipRects = dPriv->pClipRects;
+       __DRIdrawablePrivate *const drawable = radeon->dri.drawable;
+       __DRIdrawablePrivate *const readable = radeon->dri.readable;
+       GLframebuffer *const draw_fb = (GLframebuffer*)drawable->driverPrivate;
+       GLframebuffer *const read_fb = (GLframebuffer*)readable->driverPrivate;
+
+       if (draw_fb->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT) {
+               /* Can't ignore 2d windows if we are page flipping. */
+               if (drawable->numBackClipRects == 0 || radeon->doPageFlip) {
+                       radeon->numClipRects = drawable->numClipRects;
+                       radeon->pClipRects = drawable->pClipRects;
                } else {
-                       radeon->numClipRects = dPriv->numBackClipRects;
-                       radeon->pClipRects = dPriv->pBackClipRects;
+                       radeon->numClipRects = drawable->numBackClipRects;
+                       radeon->pClipRects = drawable->pBackClipRects;
+               }
+       } else {
+               /* front buffer (or none, or multiple buffers */
+               radeon->numClipRects = drawable->numClipRects;
+               radeon->pClipRects = drawable->pClipRects;
+       }
+
+       if ((draw_fb->Width != drawable->w) ||
+           (draw_fb->Height != drawable->h)) {
+               printf("w,h %d %d\n",
+                      radeon->glCtx->DrawBuffer->Width,
+                      radeon->glCtx->DrawBuffer->Height);
+
+               _mesa_resize_framebuffer(radeon->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(radeon->glCtx, read_fb,
+                                                readable->w, readable->h);
+                       read_fb->Initialized = GL_TRUE;
                }
-               break;
-       default:
-               fprintf(stderr, "bad mode in radeonSetCliprects\n");
-               radeon->numClipRects = 0;
-               radeon->pClipRects = 0;
-               return;
        }
 
        if (radeon->state.scissor.enabled)
index 636bf5d0086a7a7494c08657cc42fd34f3fce8c6..c2d041eb4aecf62e5e53757ba0f91022d8eb99f9 100644 (file)
@@ -34,7 +34,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "radeon_context.h"
 
 extern void radeonRecalcScissorRects(radeonContextPtr radeon);
-extern void radeonSetCliprects(radeonContextPtr radeon, GLenum mode);
+extern void radeonSetCliprects(radeonContextPtr radeon);
 extern void radeonUpdateScissor(GLcontext* ctx);
 
 extern void radeonEnable(GLcontext* ctx, GLenum cap, GLboolean state);