sna: Clear the resized framebuffer if wedged

We always try to make sure the scanout is initialised before use, but if
the GPU is wedged we need to fallback to use the CPU to do the clears.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2015-02-05 08:12:56 +00:00
parent f93aab9bbc
commit 7dd16e5684
1 changed files with 25 additions and 11 deletions

View File

@ -4282,12 +4282,19 @@ static void copy_front(struct sna *sna, PixmapPtr old, PixmapPtr new)
return;
if (old_priv->clear) {
(void)sna->render.fill_one(sna, new, new_priv->gpu_bo,
old_priv->clear_color,
0, 0,
new->drawable.width,
new->drawable.height,
GXcopy);
bool ok = false;
if (!wedged(sna))
ok = sna->render.fill_one(sna, new, new_priv->gpu_bo,
old_priv->clear_color,
0, 0,
new->drawable.width,
new->drawable.height,
GXcopy);
if (!ok) {
void *ptr = kgem_bo_map__gtt(&sna->kgem, new_priv->gpu_bo);
if (ptr)
memset(ptr, 0, new_priv->gpu_bo->pitch*new->drawable.height);
}
new_priv->clear = true;
new_priv->clear_color = old_priv->clear_color;
} else {
@ -4343,11 +4350,18 @@ static void copy_front(struct sna *sna, PixmapPtr old, PixmapPtr new)
__FUNCTION__, box.x2, box.y2, sx, sy, dx, dy));
if (box.x2 != new->drawable.width || box.y2 != new->drawable.height) {
(void)sna->render.fill_one(sna, new, new_priv->gpu_bo, 0,
0, 0,
new->drawable.width,
new->drawable.height,
GXclear);
bool ok = false;
if (!wedged(sna))
ok = sna->render.fill_one(sna, new, new_priv->gpu_bo, 0,
0, 0,
new->drawable.width,
new->drawable.height,
GXclear);
if (!ok) {
void *ptr = kgem_bo_map__gtt(&sna->kgem, new_priv->gpu_bo);
if (ptr)
memset(ptr, 0, new_priv->gpu_bo->pitch*new->drawable.height);
}
}
(void)sna->render.copy_boxes(sna, GXcopy,
&old->drawable, old_priv->gpu_bo, sx, sy,