From 7f9ed3ca56466f319d9ec06aebb7055552fb1fe1 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sat, 24 Dec 2011 08:57:49 +0000 Subject: [PATCH] sna: reset the pixmap on the initial clear after being swapped out Pixmaps are swapped out into the CPU after a period of inactivity. This then prevents the core rendering routines from migrating the pixmap back to the GPU until it gets used again on a Render path. However, we can clear that CPU damage and enable migration before a number of key steps in the expose process. Signed-off-by: Chris Wilson --- src/sna/sna_accel.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 460b29f0..af13658b 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -7373,6 +7373,19 @@ sna_poly_fill_rect_extents(DrawablePtr drawable, GCPtr gc, return 1 | clipped << 1; } +static bool alu_overwrites(uint8_t alu) +{ + switch (alu) { + case GXclear: + case GXcopy: + case GXcopyInverted: + case GXset: + return true; + default: + return false; + } +} + static void sna_poly_fill_rect(DrawablePtr draw, GCPtr gc, int n, xRectangle *rect) { @@ -7417,6 +7430,9 @@ sna_poly_fill_rect(DrawablePtr draw, GCPtr gc, int n, xRectangle *rect) struct sna_damage **damage; uint32_t color = gc->fillStyle == FillTiled ? gc->tile.pixel : gc->fgPixel; + if (alu_overwrites(gc->alu)) + sna_damage_subtract(&priv->cpu_damage, ®ion); + DBG(("%s: solid fill [%08x], testing for blt\n", __FUNCTION__, color));