From fe6ab444ad9d138aa011df6cee9f2cee65dbf493 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 24 Sep 2014 07:54:39 +0100 Subject: [PATCH] sna: Initialise the per-CRTC shadow bo on first use When we create the shadow pixmap for the CRTC, we should copy the framebuffer contents into the shadow before we show it the first time. This saves us from showing stale contents until the next redrawn in the BlockHandler - with the proviso that we can do the copy on the GPU. Signed-off-by: Chris Wilson --- src/sna/sna_display.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index 2a98fb94..3ca56f1f 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -1872,6 +1872,29 @@ static struct kgem_bo *sna_crtc_attach(xf86CrtcPtr crtc) return NULL; } + if (__sna_pixmap_get_bo(sna->front)) { + DrawableRec tmp; + + DBG(("%s: copying onto shadow CRTC: (%d, %d), (%d, %d), handle=%d\n", + __FUNCTION__, + crtc->bounds.x1, + crtc->bounds.y1, + crtc->bounds.x2, + crtc->bounds.y2, + bo->handle)); + + tmp.width = crtc->mode.HDisplay; + tmp.height = crtc->mode.VDisplay; + tmp.depth = sna->front->drawable.depth; + tmp.bitsPerPixel = sna->front->drawable.bitsPerPixel; + + (void)sna->render.copy_boxes(sna, GXcopy, + &sna->front->drawable, __sna_pixmap_get_bo(sna->front), 0, 0, + &tmp, bo, -crtc->bounds.x1, -crtc->bounds.y1, + &crtc->bounds, 1, + 0); + } + sna_crtc->transform = true; return bo; } else {