intel: fix fullscreen damage posting on pageflip

While playing with MPX and sw cursor I noticed page flips won't
end up misrendering some bits, so the sw cursor was replacing the
bits on the wrong pixmap.

Fix the damage handling to be correct and append damage before swapping
the pointers and process damage after.

This fixes misrendering with MPX cursors under a fullscreen compositor,
that pageflips.

Signed-off-by: Dave Airlie <airlied@redhat.com>
[ickle: The secret is that damage is sometimes reported before the
rendering in DamageRegionAppend, and sometimes afterwards in
DamageRegionProcessPending. For instance, the software cursor operates
prior to being rendered over.]
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Dave Airlie 2012-10-11 14:30:29 +10:00 committed by Chris Wilson
parent a1ea19a3ed
commit dadffd0061
2 changed files with 28 additions and 27 deletions

View File

@ -725,6 +725,17 @@ static struct intel_pixmap *
intel_exchange_pixmap_buffers(struct intel_screen_private *intel, PixmapPtr front, PixmapPtr back)
{
struct intel_pixmap *new_front, *new_back;
RegionRec region;
/* Post damage on the front buffer so that listeners, such
* as DisplayLink know take a copy and shove it over the USB.
* also for sw cursors.
*/
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, &region);
new_front = intel_get_pixmap_private(back);
new_back = intel_get_pixmap_private(front);
@ -735,19 +746,7 @@ intel_exchange_pixmap_buffers(struct intel_screen_private *intel, PixmapPtr fron
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, &region);
DamageRegionProcessPending(&front->drawable);
}
DamageRegionProcessPending(&front->drawable);
return new_front;
}

View File

@ -430,6 +430,16 @@ static void set_bo(PixmapPtr pixmap, struct kgem_bo *bo)
struct sna_pixmap *priv = sna_pixmap(pixmap);
RegionRec region;
/* Post damage on the new front buffer so that listeners, such
* as DisplayLink know take a copy and shove it over the USB,
* also for software cursors and the like.
*/
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, &region);
sna_damage_all(&priv->gpu_damage,
pixmap->drawable.width,
pixmap->drawable.height);
@ -446,14 +456,6 @@ static void set_bo(PixmapPtr pixmap, struct kgem_bo *bo)
if (bo->domain != DOMAIN_GPU)
bo->domain = DOMAIN_NONE;
/* 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, &region);
DamageRegionProcessPending(&pixmap->drawable);
}
@ -618,15 +620,17 @@ sna_dri_copy_to_front(struct sna *sna, DrawablePtr draw, RegionPtr region,
boxes = &clip.extents;
n = 1;
}
pixman_region_translate(region, dx, dy);
DamageRegionAppend(&pixmap->drawable, region);
if (wedged(sna)) {
sna_dri_copy_fallback(sna, draw->bitsPerPixel,
src_bo, -draw->x, -draw->y,
dst_bo, dx, dy,
src_bo, -draw->x-dx, -draw->y-dy,
dst_bo, 0, 0,
boxes, n);
} else {
sna->render.copy_boxes(sna, GXcopy,
(PixmapPtr)draw, src_bo, -draw->x, -draw->y,
pixmap, dst_bo, dx, dy,
(PixmapPtr)draw, src_bo, -draw->x-dx, -draw->y-dy,
pixmap, dst_bo, 0, 0,
boxes, n, COPY_LAST);
DBG(("%s: flushing? %d\n", __FUNCTION__, flush));
@ -637,8 +641,6 @@ sna_dri_copy_to_front(struct sna *sna, DrawablePtr draw, RegionPtr region,
}
}
pixman_region_translate(region, dx, dy);
DamageRegionAppend(&pixmap->drawable, region);
DamageRegionProcessPending(&pixmap->drawable);
if (clip.data)