From e8695100b17b758359fc4897dbe995231ed224fc Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Thu, 15 Sep 2016 14:28:35 +0200 Subject: [PATCH] modesetting: Fix reverse prime partial update issues on secondary GPU outputs When using reverse prime we do 2 copies, 1 from the primary GPU's framebuffer to a shared pixmap and 1 from the shared pixmap to the secondary GPU's framebuffer. This means that on the primary GPU side the copy MUST be finished, before we start the second copy (before the secondary GPU's driver starts processing the damage on the shared pixmap). This fixes secondary outputs sometimes showning (some) old fb contents, because of the 2 copies racing with each other, for an example of what this looks like see: https://fedorapeople.org/~jwrdegoede/IMG_20160915_130555.jpg Signed-off-by: Hans de Goede Reviewed-by: Dave Airlie Reviewed-by: Eric Anholt --- hw/xfree86/drivers/modesetting/driver.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c index a8e83b291..f98d6da2b 100644 --- a/hw/xfree86/drivers/modesetting/driver.c +++ b/hw/xfree86/drivers/modesetting/driver.c @@ -586,13 +586,24 @@ dispatch_slave_dirty(ScreenPtr pScreen) static void redisplay_dirty(ScreenPtr screen, PixmapDirtyUpdatePtr dirty) { - + modesettingPtr ms = modesettingPTR(xf86ScreenToScrn(screen)); RegionRec pixregion; PixmapRegionInit(&pixregion, dirty->slave_dst); DamageRegionAppend(&dirty->slave_dst->drawable, &pixregion); PixmapSyncDirtyHelper(dirty); + if (!screen->isGPU) { + /* + * When copying from the master framebuffer to the shared pixmap, + * we must ensure the copy is complete before the slave starts a + * copy to its own framebuffer (some slaves scanout directly from + * the shared pixmap, but not all). + */ + if (ms->drmmode.glamor) + glamor_finish(screen); + } + DamageRegionProcessPending(&dirty->slave_dst->drawable); RegionUninit(&pixregion); }