chiark / gitweb /
terminal: fix back-buffer selection on DRM page-flip
authorDavid Herrmann <dh.herrmann@gmail.com>
Thu, 2 Oct 2014 11:11:53 +0000 (13:11 +0200)
committerDavid Herrmann <dh.herrmann@gmail.com>
Fri, 3 Oct 2014 13:57:00 +0000 (15:57 +0200)
We currently select front-buffers as new back-buffer if they happen to be
the last buffer in our framebuffer-array. Fix this by never selecting a
new front buffer as back buffer.

src/libsystemd-terminal/grdev-drm.c

index 5393ebf98880c0ae1338e22e32958602f251d411..7a6e1d993b9368f1088a2a0cd57f992cf94ebf6c 100644 (file)
@@ -1362,10 +1362,9 @@ static void grdrm_crtc_flip_complete(grdrm_crtc *crtc, uint32_t counter, struct
                 fb = fb_from_base(pipe->base.fbs[i]);
                 if (counter != 0 && counter == pipe->counter && fb->flipid == counter) {
                         pipe->base.front = &fb->base;
+                        fb->flipid = 0;
                         flipped = true;
-                }
-
-                if (counter - fb->flipid < UINT16_MAX) {
+                } else if (counter - fb->flipid < UINT16_MAX) {
                         fb->flipid = 0;
                         back = fb;
                 } else if (fb->flipid == 0) {
@@ -1373,7 +1372,7 @@ static void grdrm_crtc_flip_complete(grdrm_crtc *crtc, uint32_t counter, struct
                 }
         }
 
-        if (!pipe->base.back)
+        if (!pipe->base.back && back)
                 pipe->base.back = &back->base;
 
         if (flipped) {