Module: Mesa
Branch: master
Commit: 8282235277eb3ff4179feca49aa308273dd42fd3
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8282235277eb3ff4179feca49aa308273dd42fd3

Author: Michel Dänzer <daen...@vmware.com>
Date:   Sun Aug 30 12:37:12 2009 +0200

radeon: DRI1 page flipping fixes.

---

 src/mesa/drivers/dri/radeon/radeon_common.c |   33 ++++++++++----------------
 1 files changed, 13 insertions(+), 20 deletions(-)

diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c 
b/src/mesa/drivers/dri/radeon/radeon_common.c
index 042871c..6b8a86d 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common.c
@@ -178,7 +178,8 @@ void radeon_get_cliprects(radeonContextPtr radeon,
                *x_off = 0;
                *y_off = 0;
        } else if (radeon->front_cliprects ||
-                  rfb->pf_active || dPriv->numBackClipRects == 0) {
+                  rfb->pf_active || rfb->pf_current_page == 1 ||
+                  dPriv->numBackClipRects == 0) {
                *cliprects = dPriv->pClipRects;
                *num_cliprects = dPriv->numClipRects;
                *x_off = dPriv->x;
@@ -589,8 +590,7 @@ static int radeonScheduleSwap(__DRIdrawablePrivate *dPriv, 
GLboolean *missed_tar
 
        if (!dPriv->numClipRects) {
                UNLOCK_HARDWARE(rmesa);
-               usleep(10000);  /* throttle invisible client 10ms */
-               return 0;
+               return -1;
        }
 
        radeonWaitForFrameCompletion(rmesa);
@@ -605,8 +605,6 @@ static GLboolean radeonPageFlip( __DRIdrawablePrivate 
*dPriv )
 {
        radeonContextPtr radeon;
        GLint ret;
-       __DRIscreenPrivate *psp;
-       struct radeon_renderbuffer *rrb;
        struct radeon_framebuffer *rfb;
 
        assert(dPriv);
@@ -615,12 +613,14 @@ static GLboolean radeonPageFlip( __DRIdrawablePrivate 
*dPriv )
 
        radeon = (radeonContextPtr) dPriv->driContextPriv->driverPrivate;
        rfb = dPriv->driverPrivate;
-       rrb = (void *)rfb->base.Attachment[BUFFER_FRONT_LEFT].Renderbuffer;
-
-       psp = dPriv->driScreenPriv;
 
        LOCK_HARDWARE(radeon);
 
+       if (!rfb->pf_active) {
+               UNLOCK_HARDWARE(radeon);
+               return GL_FALSE;
+       }
+
        if ( RADEON_DEBUG & DEBUG_IOCTL ) {
                fprintf(stderr, "%s: pfCurrentPage: %d %d\n", __FUNCTION__,
                        radeon->sarea->pfCurrentPage, radeon->sarea->pfState);
@@ -639,12 +639,7 @@ static GLboolean radeonPageFlip( __DRIdrawablePrivate 
*dPriv )
                return GL_FALSE;
        }
 
-       if (!rfb->pf_active)
-               return GL_FALSE;
-
-       rfb->pf_current_page = radeon->sarea->pfCurrentPage;
-       radeon_flip_renderbuffers(rfb);
-       radeon_draw_buffer(radeon->glCtx, &rfb->base);
+       radeonUpdatePageFlipping(radeon);
 
        return GL_TRUE;
 }
@@ -666,15 +661,13 @@ void radeonSwapBuffers(__DRIdrawablePrivate * dPriv)
                ctx = radeon->glCtx;
 
                if (ctx->Visual.doubleBufferMode) {
-                       GLboolean missed_target;
                        struct radeon_framebuffer *rfb = dPriv->driverPrivate;
+                       GLboolean missed_target;
                        _mesa_notifySwapBuffers(ctx);/* flush pending rendering 
comands */
 
-                       radeonScheduleSwap(dPriv, &missed_target);
-
-                       if (rfb->pf_active) {
-                               radeonPageFlip(dPriv);
-                       } else {
+                       if (radeonScheduleSwap(dPriv, &missed_target) < 0) {
+                               usleep(10000); /* throttle invisible client 
10ms */
+                        } else if (!radeonPageFlip(dPriv)) {
                                radeonCopyBuffer(dPriv, NULL);
                        }
 

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to