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 <hdegoede@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
Hans de Goede 2016-09-15 14:28:35 +02:00 committed by Adam Jackson
parent 862a3dab28
commit e8695100b1
1 changed files with 12 additions and 1 deletions

View File

@ -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);
}