xf86-video-intel: 2 commits - src/sna/sna_accel.c src/sna/sna_damage.c

Chris Wilson ickle at kemper.freedesktop.org
Sat Dec 24 01:16:07 PST 2011


 src/sna/sna_accel.c  |   16 ++++++++++++++++
 src/sna/sna_damage.c |   28 +++++++++++++++++++++++++---
 2 files changed, 41 insertions(+), 3 deletions(-)

New commits:
commit 7f9ed3ca56466f319d9ec06aebb7055552fb1fe1
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Dec 24 08:57:49 2011 +0000

    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 <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 460b29f..af13658 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, &region);
+
 		DBG(("%s: solid fill [%08x], testing for blt\n",
 		     __FUNCTION__, color));
 
commit 8c987b6ccfa83b99a316a7da49a6d7e30fcdf295
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Dec 24 09:09:58 2011 +0000

    sna: Cheaply reduce damage when subtracting and removing the entire damage
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_damage.c b/src/sna/sna_damage.c
index 85d9d69..b713028 100644
--- a/src/sna/sna_damage.c
+++ b/src/sna/sna_damage.c
@@ -50,6 +50,11 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 static struct sna_damage *__freed_damage;
 
+static inline bool region_is_singular(RegionRec *r)
+{
+	return r->data == NULL;
+}
+
 #if DEBUG_DAMAGE
 #undef DBG
 #define DBG(x) ErrorF x
@@ -915,6 +920,17 @@ struct sna_damage *_sna_damage_is_all(struct sna_damage *damage,
 	return _sna_damage_all(damage, width, height);
 }
 
+static bool box_contains(const BoxRec *a, const BoxRec *b)
+{
+	if (b->x2 <= a->x1 || b->x1 >= a->x2)
+		return false;
+
+	if (b->y2 <= a->y1 || b->y1 >= a->y2)
+		return false;
+
+	return true;
+}
+
 static inline Bool sna_damage_maybe_contains_box(struct sna_damage *damage,
 						 const BoxRec *box)
 {
@@ -947,6 +963,12 @@ static struct sna_damage *__sna_damage_subtract(struct sna_damage *damage,
 		return damage;
 
 	if (damage->mode != DAMAGE_SUBTRACT) {
+		if (region_is_singular(region) &&
+		    box_contains(&region->extents, &damage->extents)) {
+			__sna_damage_destroy(damage);
+			return NULL;
+		}
+
 		if (damage->dirty)
 			__sna_damage_reduce(damage);
 
@@ -960,8 +982,8 @@ static struct sna_damage *__sna_damage_subtract(struct sna_damage *damage,
 			return NULL;
 		}
 
-		if (REGION_NUM_RECTS(&damage->region) == 1 &&
-		    REGION_NUM_RECTS(region) == 1) {
+		if (region_is_singular(&damage->region) &&
+		    region_is_singular(region)) {
 			pixman_region_subtract(&damage->region,
 					       &damage->region,
 					       region);
@@ -1028,7 +1050,7 @@ inline static struct sna_damage *__sna_damage_subtract_box(struct sna_damage *da
 			return NULL;
 		}
 
-		if (REGION_NUM_RECTS(&damage->region) == 1) {
+		if (region_is_singular(&damage->region)) {
 			pixman_region16_t region;
 
 			pixman_region_init_rects(&region, box, 1);


More information about the xorg-commit mailing list