sna: Initialise the TearFree shadow output from the current front buffer
authorChris Wilson <chris@chris-wilson.co.uk>
Tue, 21 Jan 2014 10:17:03 +0000 (10:17 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Tue, 21 Jan 2014 10:38:56 +0000 (10:38 +0000)
Otherwise we may end up in a sitation where we show stale contents for a
(sometimes signification) fraction of a second before it is refreshed
with the correct contents.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73842
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
src/sna/sna_display.c

index f274869..9e811ca 100644 (file)
@@ -1423,6 +1423,8 @@ static struct kgem_bo *sna_crtc_attach(xf86CrtcPtr crtc)
 
                DBG(("%s: attaching to single shadow pixmap\n", __FUNCTION__));
                if (sna->mode.shadow == NULL) {
+                       BoxRec box;
+
                        bo = kgem_create_2d(&sna->kgem,
                                            sna->scrn->virtualX,
                                            sna->scrn->virtualY,
@@ -1432,6 +1434,18 @@ static struct kgem_bo *sna_crtc_attach(xf86CrtcPtr crtc)
                        if (bo == NULL)
                                return NULL;
 
+                       box.x1 = box.y1 = 0;
+                       box.x2 = sna->scrn->virtualX;
+                       box.y2 = sna->scrn->virtualY;
+
+                       if (!sna->render.copy_boxes(sna, GXcopy,
+                                                   sna->front, sna_pixmap(sna->front)->gpu_bo, 0, 0,
+                                                   sna->front, bo, 0, 0,
+                                                   &box, 1, COPY_LAST)) {
+                               kgem_bo_destroy(&sna->kgem, bo);
+                               return NULL;
+                       }
+
                        if (!get_fb(sna, bo,
                                    sna->scrn->virtualX,
                                    sna->scrn->virtualY)) {