Sophie

Sophie

distrib > Fedora > 14 > i386 > by-pkgid > 42136cd5fec82fd91c21730eaa072e3e > files > 7

xorg-x11-drv-qxl-0.0.21-3.fc14.src.rpm

From 81e3d5c118bbe75688be61d7739a48452f1a9415 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B8ren=20Sandmann=20Pedersen?= <ssp@redhat.com>
Date: Sat, 19 Mar 2011 11:56:00 -0400
Subject: [PATCH 07/13] Don't re-upload read-only surfaces after a software
 fallback.

Surfaces that were used in a read-only way don't need to be uploaded
again since they didn't change. This is a particularly important
optimization for Composite since sources and masks there don't have
tight damage tracking regions.
---
 src/qxl_surface.c |   38 ++++++++++++++++++++++++--------------
 1 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/src/qxl_surface.c b/src/qxl_surface.c
index 993c271..88b3ebb 100644
--- a/src/qxl_surface.c
+++ b/src/qxl_surface.c
@@ -56,6 +56,7 @@ struct qxl_surface_t
     pixman_image_t *	dev_image;
     pixman_image_t *	host_image;
 
+    uxa_access_t	access_type;
     RegionRec		access_region;
 
     void *		address;
@@ -139,6 +140,7 @@ surface_cache_init (surface_cache_t *cache, qxl_screen_t *qxl)
 	
 	REGION_INIT (
 	    NULL, &(cache->all_surfaces[i].access_region), (BoxPtr)NULL, 0);
+	cache->all_surfaces[i].access_type = UXA_ACCESS_RO;
 
 	if (i) /* surface 0 is the primary surface */
 	{
@@ -309,7 +311,7 @@ surface_get_from_cache (surface_cache_t *cache, int width, int height, int bpp)
     return NULL;
 }
 
-static n_live;
+static int n_live;
 
 void
 qxl_surface_recycle (surface_cache_t *cache, uint32_t id)
@@ -401,6 +403,7 @@ qxl_surface_cache_create_primary (surface_cache_t	*cache,
 #endif
     
     REGION_INIT (NULL, &(surface->access_region), (BoxPtr)NULL, 0);
+    surface->access_type = UXA_ACCESS_RO;
     
     return surface;
 }
@@ -945,6 +948,9 @@ qxl_surface_prepare_access (qxl_surface_t  *surface,
     REGION_INIT (NULL, &new, (BoxPtr)NULL, 0);
     REGION_SUBTRACT (NULL, &new, region, &surface->access_region);
 
+    if (access == UXA_ACCESS_RW)
+	surface->access_type = UXA_ACCESS_RW;
+    
     region = &new;
     
     n_boxes = REGION_NUM_RECTS (region);
@@ -1066,25 +1072,29 @@ qxl_surface_finish_access (qxl_surface_t *surface, PixmapPtr pixmap)
     n_boxes = REGION_NUM_RECTS (&surface->access_region);
     boxes = REGION_RECTS (&surface->access_region);
 
-    if (n_boxes < 25)
+    if (surface->access_type == UXA_ACCESS_RW)
     {
-	while (n_boxes--)
+	if (n_boxes < 25)
 	{
-	    upload_box (surface, boxes->x1, boxes->y1, boxes->x2, boxes->y2);
-	
-	    boxes++;
+	    while (n_boxes--)
+	    {
+		upload_box (surface, boxes->x1, boxes->y1, boxes->x2, boxes->y2);
+		
+		boxes++;
+	    }
+	}
+	else
+	{
+	    upload_box (surface,
+			surface->access_region.extents.x1,
+			surface->access_region.extents.y1,
+			surface->access_region.extents.x2,
+			surface->access_region.extents.y2);
 	}
-    }
-    else
-    {
-	upload_box (surface,
-		    surface->access_region.extents.x1,
-		    surface->access_region.extents.y1,
-		    surface->access_region.extents.x2,
-		    surface->access_region.extents.y2);
     }
 
     REGION_EMPTY (pScreen, &surface->access_region);
+    surface->access_type = UXA_ACCESS_RO;
     
     pScreen->ModifyPixmapHeader(pixmap, w, h, -1, -1, 0, NULL);
 }
-- 
1.7.4.4