From 99845dcb3ba862269b29aec782e2bcef31c0403e Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 19 Jun 2012 10:37:10 +0100 Subject: [PATCH] Post Damage on the Screen Pixmap after a pageflip This issue was raised by Dave Airlie as he is trying to integrate multiple GPUs into the xserver, and a particular setup has a slave rendering device that copies the contents from the GPU over a DisplayLink USB adaptor. As such the slave device is listening for Damage on the Screen Pixmap and needs the update following pageflips. Since we already are posting damage for all the SwapBuffers paths other than pageflip, for consistency we should post damage along the pageflip path as well. Reported-by: Dave Airlie Signed-off-by: Chris Wilson --- src/intel_dri.c | 15 +++++++++++++++ src/sna/sna_dri.c | 11 +++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/intel_dri.c b/src/intel_dri.c index 6bf76d09..88ab2498 100644 --- a/src/intel_dri.c +++ b/src/intel_dri.c @@ -860,6 +860,21 @@ intel_exchange_pixmap_buffers(struct intel_screen_private *intel, PixmapPtr fron new_back->busy = -1; intel_glamor_exchange_buffers(intel, front, back); + + /* Post damage on the new front buffer so that listeners, such + * as DisplayLink know take a copy and shove it over the USB. + */ + { + RegionRec region; + + region.extents.x1 = region.extents.y1 = 0; + region.extents.x2 = front->drawable.width; + region.extents.y2 = front->drawable.height; + region.data = NULL; + DamageRegionAppend(&front->drawable, ®ion); + DamageRegionProcessPending(&front->drawable); + } + return new_front; } diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c index b9f9b85a..5390b5ac 100644 --- a/src/sna/sna_dri.c +++ b/src/sna/sna_dri.c @@ -384,6 +384,7 @@ static void set_bo(PixmapPtr pixmap, struct kgem_bo *bo) { struct sna *sna = to_sna_from_pixmap(pixmap); struct sna_pixmap *priv = sna_pixmap(pixmap); + RegionRec region; sna_damage_all(&priv->gpu_damage, pixmap->drawable.width, @@ -393,6 +394,16 @@ static void set_bo(PixmapPtr pixmap, struct kgem_bo *bo) kgem_bo_destroy(&sna->kgem, priv->gpu_bo); priv->gpu_bo = ref(bo); + + /* Post damage on the new front buffer so that listeners, such + * as DisplayLink know take a copy and shove it over the USB. + */ + region.extents.x1 = region.extents.y1 = 0; + region.extents.x2 = pixmap->drawable.width; + region.extents.y2 = pixmap->drawable.height; + region.data = NULL; + DamageRegionAppend(&pixmap->drawable, ®ion); + DamageRegionProcessPending(&pixmap->drawable); } static struct kgem_bo *