[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xserver-xorg-video-intel: Changes to 'debian-experimental'



 ChangeLog                   |  369 ++++++++++++++++++++++++++++++++++++++++++++
 debian/changelog            |    8 
 debian/rules                |   12 +
 src/intel_glamor.c          |   14 -
 src/intel_glamor.h          |    2 
 src/sna/blt.c               |    4 
 src/sna/gen3_render.c       |  152 ++++++++++--------
 src/sna/kgem.c              |  192 ++++++++++++++++------
 src/sna/kgem.h              |    3 
 src/sna/sna.h               |   20 ++
 src/sna/sna_accel.c         |  151 +++++++++++++-----
 src/sna/sna_blt.c           |   23 ++
 src/sna/sna_composite.c     |   22 ++
 src/sna/sna_damage.c        |  188 +++++++++++++++-------
 src/sna/sna_damage.h        |    4 
 src/sna/sna_render_inline.h |    4 
 src/sna/sna_trapezoids.c    |   14 -
 uxa/uxa-accel.c             |  142 ++++++++++++++++
 uxa/uxa-glamor.h            |   11 +
 uxa/uxa.c                   |   12 +
 20 files changed, 1098 insertions(+), 249 deletions(-)

New commits:
commit e3c225103b9b417da59155bdf87d208966921b21
Author: Cyril Brulebois <kibi@debian.org>
Date:   Wed Jan 4 22:19:23 2012 +0100

    Upload to experimental.

diff --git a/debian/changelog b/debian/changelog
index 87a3051..65f974a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,10 +1,10 @@
-xserver-xorg-video-intel (2:2.17.0+git20120104-1) UNRELEASED; urgency=low
+xserver-xorg-video-intel (2:2.17.0+git20120104-1) experimental; urgency=low
 
   * New upstream snapshot:
     - Merge from upstream master up to 4119e68fb1.
   * Implement a generate-snapshot rule to ease packaging snapshots.
 
- -- Cyril Brulebois <kibi@debian.org>  Wed, 04 Jan 2012 21:59:03 +0100
+ -- Cyril Brulebois <kibi@debian.org>  Wed, 04 Jan 2012 22:19:19 +0100
 
 xserver-xorg-video-intel (2:2.17.0+git20120101-2) experimental; urgency=low
 

commit ec819e9f0134bcc19d8c71f23f3fc25e596af6d7
Author: Cyril Brulebois <kibi@debian.org>
Date:   Wed Jan 4 22:19:04 2012 +0100

    Implement a generate-snapshot rule to ease packaging snapshots.

diff --git a/debian/changelog b/debian/changelog
index 358ad0a..87a3051 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,7 @@ xserver-xorg-video-intel (2:2.17.0+git20120104-1) UNRELEASED; urgency=low
 
   * New upstream snapshot:
     - Merge from upstream master up to 4119e68fb1.
+  * Implement a generate-snapshot rule to ease packaging snapshots.
 
  -- Cyril Brulebois <kibi@debian.org>  Wed, 04 Jan 2012 21:59:03 +0100
 
diff --git a/debian/rules b/debian/rules
index c5098e2..0f2ede8 100755
--- a/debian/rules
+++ b/debian/rules
@@ -29,3 +29,15 @@ override_dh_shlibdeps:
 
 %:
 	dh $@ --with quilt,autoreconf,xsf --builddirectory=build/
+
+# Snapshots should only target experimental:
+generate-snapshot: UPSTREAM_VERSION = $(shell echo $(SOURCE_VERSION) | sed 's/^[0-9]*://;s/-.*$$//')
+generate-snapshot: UPSTREAM_BRANCH ?= upstream-experimental
+generate-snapshot: ORIG             = ../$(SOURCE_NAME)_$(UPSTREAM_VERSION).orig.tar.gz
+generate-snapshot:
+	if [ -f $(ORIG) ]; then \
+	  echo "$(ORIG) already exists, stopping"; exit 1; \
+	fi
+	git archive --format=tar --prefix=$(SOURCE_NAME)-$(UPSTREAM_VERSION)/ $(UPSTREAM_BRANCH) \
+	  | gzip -9 > $(ORIG)
+	pristine-tar commit $(ORIG) $(UPSTREAM_BRANCH)

commit 84b05b2889a5238373ba3fdbefe56d71cde06f41
Author: Cyril Brulebois <kibi@debian.org>
Date:   Wed Jan 4 21:59:47 2012 +0100

    Bump changelogs.

diff --git a/ChangeLog b/ChangeLog
index 9443914..fe0fe2f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,372 @@
+commit 4119e68fb157fc612bce5e9c5669112ce35b4ca1
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Wed Jan 4 19:35:30 2012 +0000
+
+    sna/damage: Fix reduction to copy the boxes correctly
+    
+    We need to be carefully to copy the boxes in a strict lifo order so as
+    to avoid overwritting the last boxes when reusing the array allocations.
+    
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit 71b0924b586d9a60397e92e941e3d0cfa636ee61
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Wed Jan 4 19:34:41 2012 +0000
+
+    sna: Mark tiny CPU pixmaps as completely dirty
+    
+    Avoid the overhead of tracking damage on small pixmaps when using CPU
+    rasterisation; the extra cost of sending the whole pixmap compared to
+    the damage is negligble should it ever be required on the GPU.
+    
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit fc14e63256a9b756c7c77ffe73f2f13784396c5a
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Wed Jan 4 19:33:30 2012 +0000
+
+    sna: Only request page size allocations for the replacement buffer
+    
+    A precondition on bo creation is that the size must be page aligned.
+    
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit 89739b711f42c3dbed7d3f4e6da0cdd61a5205ae
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Wed Jan 4 17:41:16 2012 +0000
+
+    sna: Expand small stipples into 8x8 patterns
+    
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit 878fbfe509da0a25dff8515d6d3b38ca3826466e
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Wed Jan 4 16:56:55 2012 +0000
+
+    sna: Align tiled stipple uploads with the stipple pixmap correctly
+    
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit 28a222a66bb450c7f6d61aef16fe73332854c8ce
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Wed Jan 4 12:48:25 2012 +0000
+
+    sna: Always prefer to use cacheable operations after the GPU is wedged
+    
+    As rasterisation will be performed upon the CPU we need to avoid the
+    readbacks form uncached memory and so we should restrict ourselves to
+    only create further damage within the CPU pixmap.
+    
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit 99ff83a3bebf1aa25c44a87f2c344307d20bc062
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Wed Jan 4 12:35:12 2012 +0000
+
+    sna: Prevent creation of bo purely for GTT mapping when wedged
+    
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit a7c35fa4c3155d10ad75ac33aefb03dafa010aba
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Wed Jan 4 12:33:09 2012 +0000
+
+    sna: Only allow mappable pixmaps to be mapped
+    
+    If we did not allocate the pixel data, such as for wedged pixmaps or
+    scratch buffers, then we cannot perform the pointer dance nor do we want
+    to create the GPU buffer.
+    
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit 2cbc97d28aae138566e49df05e16d274b533ea86
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Wed Jan 4 12:32:06 2012 +0000
+
+    sna: Force creation of ordinary pixmaps when wedged.
+    
+    If the pixmap was intended for scanout, then the GPU bo will be created
+    upon attachment to the fb.
+    
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit f6cc73ba66f34d190b7c17421a62aa1256698431
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Wed Jan 4 12:56:31 2012 +0000
+
+    sna: The batch is counted in dwords, not bytes!
+    
+    Yikes, I choose the wrong units for the max_batch_size.
+    
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit 227fbb90c4884bbc58c6c0cfff9663ec9ca54171
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Wed Jan 4 11:47:32 2012 +0000
+
+    sna: Carefully free the freed_pixmap upon exit
+    
+    As the contents of the pixmap are now rubbish, we need to manually
+    destroy it rather than pass it to the normal sna_pixmap_destroy()
+    routines.
+    
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit 0ed758cd2176ee4f34e03d05d05130d52d75e577
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Wed Jan 4 12:18:20 2012 +0000
+
+    sna: Limit batch to a single page on 865g
+    
+    Verified on real hw, this undocumented (at least in the bspec before me)
+    bug truly exists.
+    
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit 3449f1cbe184a618e662d2a662167f05362b82e5
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Wed Jan 4 02:38:16 2012 +0000
+
+    sna: Guard against NULL damage deref
+    
+    The fast version of damage checking assumes that the damage has already
+    been determined to be non-NULL, so make sure it is.
+    
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit 04a6260016fb5ebefc1056ed6acf5001ec535d5c
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Wed Jan 4 01:14:19 2012 +0000
+
+    sna: Fix typo during partial list deletion
+    
+    And keep the asserts that lead to its discovery.
+    
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit f1dc1eadd84097fc691e85c636535ceeeb601a18
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Wed Jan 4 00:09:30 2012 +0000
+
+    sna/gen3: Remove incorrect premultiplication of solid component-alpha mask
+    
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit 8cb9b8d7d7a1eb62eb3b20e6a50d3f1c9bde40c1
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Tue Jan 3 23:13:24 2012 +0000
+
+    sna: Discard mask and source for PictOpClear
+    
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit feb75c55d6105a9ecc5f5ec7830276d1654918b9
+Author: Zhigang Gong <zhigang.gong@linux.intel.com>
+Date:   Sat Dec 31 21:18:15 2011 +0800
+
+    uxa/glamor: Route some missing drawing function to glamor
+    
+    We have to route all the drawing function to glamor first, when
+    glamor is enabled. This adds a few more functions that were previously
+    just falling back to swrast and passes them to glamor instead.
+    
+    Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit f4ea732d7181d4ef7f97fb2585e87cdcaef99d46
+Author: Zhigang Gong <zhigang.gong@linux.intel.com>
+Date:   Tue Dec 27 17:09:17 2011 +0800
+
+    uxa/glamor: Let glamor do the GC validation
+    
+    If we are using GLAMOR, then a tile pixmap or stipple pixmap
+    may be pure glamor pixmap and thus UXA will not know how to
+    render to them, and we need to let glamor do the validation.
+    
+    Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit e8aa9cedbfca09e22d46ec8882b9bebb3eb83022
+Author: Zhigang Gong <zhigang.gong@linux.intel.com>
+Date:   Tue Dec 27 17:09:16 2011 +0800
+
+    uxa/glamor: Remove extraneous flush
+    
+    When glamor is enabled, a pixmap will not be accessed by UXA's
+    accelerated functions. Only unaccelerated functions may access those
+    pixmaps, and before each unaccelerated rendering, it calls
+    uxa_prepare_access which will do a glFlush. Combined with a flush before
+    sending to DRI clients, we no longer need to flush after every
+    operation.
+    
+    Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit 4ca94ed91fab7a9de5eed1053b891e8420cdf43d
+Author: Zhigang Gong <zhigang.gong@linux.intel.com>
+Date:   Tue Dec 27 17:09:15 2011 +0800
+
+    uxa/glamor: Remove dead code.
+    
+    Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit 5576afc7d12ec0f028e416f4b4a076fc6d3c29d9
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Tue Jan 3 16:48:52 2012 +0000
+
+    sna: Inline checks for over-sized buffers during pixmap creation
+    
+    Make the tests for acceptable GPU pixmaps explicit and upfront.
+    
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit b2dc17678fa3a548be61e1055d4d321dbd6494c3
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Tue Jan 3 15:50:21 2012 +0000
+
+    sna: Always search for an exact active match first from the bo-cache
+    
+    And accept second-best only if permitted by flags.
+    
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit caf41ae23d263c7baed6b23a80693690c4dfe563
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Tue Jan 3 15:11:13 2012 +0000
+
+    sna: Force tiling on medium pitches if not reduced for other reasons
+    
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit 1b688ca0cfc1e623f896e60a6a6abf724d57efb4
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Tue Jan 3 14:18:05 2012 +0000
+
+    sna: Delete the last buffer if destroyed without being used on the GPU
+    
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit 4a68e7277104d7dccbdc4739eb5651902b9ccc20
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Tue Jan 3 12:19:24 2012 +0000
+
+    sna/gen3: Prefer to use the blitter for solid fills
+    
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit 199e357dc693cfe232464e4faa82d9223a8325d6
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Tue Jan 3 12:16:48 2012 +0000
+
+    sna/trapezoids: Pass the sna pointer to the callees
+    
+    Avoid the repeated multiple indirect dereferences.
+    
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit bd7aa1754dcf9d58d7deb92d99da9b78c91a0eb2
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Tue Jan 3 12:46:40 2012 +0000
+
+    sna: Avoid unnecessary call overhead for read-only move-to-cpu
+    
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit 294c8791c435acf5933109fbcab85623a55b2c6c
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Tue Jan 3 12:09:51 2012 +0000
+
+    sna: Use a cheaper no-reduction damage check for simply discarding further damage
+    
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit 7ff42e9c83cdb17660a64901497704b38032af8c
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Tue Jan 3 19:15:07 2012 +0000
+
+    sna/damage: Mark the box as packed so that the embedded_box is aligned correctly
+    
+    valgrind was complaining about an overlapping memcpy on a 64-bit
+    platform as gcc padded the sna_damage_box to 28 bytes...
+    
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit 4652a20de5fee0d5d1a8baadc4a93b6a93525564
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Tue Jan 3 21:20:09 2012 +0000
+
+    sna/gen3: Check for a non-NULL bo before incrementing its ref in reuse_source()
+    
+    For gen3, we may reduce a source into a constant operator and so
+    dispense with keeping a bo. When duplicated into the mask channel, we
+    then need to be careful not to dereference the NULL pointer.
+    
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit 777fcc9b11e8cbfe942aa6bf898749f552acb3cf
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Sun Jan 1 16:03:42 2012 +0000
+
+    sna: Prefer not to force the creation of gpu bo for pixmap uploads
+    
+    As this causes a significant regression when benchmarking firefox on SNB
+    with firefox-planet-gnome if we already have CPU buffers.
+    
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit 1a6c16a24cb74f82df9757c034c50f2cf141523f
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Sun Jan 1 14:32:48 2012 +0000
+
+    sna: Keep a freelist of buffers
+    
+    As reallocation of bo is the most frequent cause of malloc/free.
+    
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit f008a2a90c632d843f07846426f6d14af728c13b
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Sun Jan 1 10:24:49 2012 +0000
+
+    sna: Tune blt routine
+    
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit b57c7248acc2ad6a51b7eac74449d155defc998f
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Sun Jan 1 14:10:20 2012 +0000
+
+    sna: Delete some redundant code
+    
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit 83d16455b70e2f0348e51f95128d4fcae3736e7f
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Sun Jan 1 13:58:44 2012 +0000
+
+    sna: Eliminate one union pass when reducing damage-add
+    
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit 2f5b769e7144c7b85010429e6d8aebf9c9fc1628
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Sun Jan 1 10:00:37 2012 +0000
+
+    sna: Move some checks against programming errors to asserts
+    
+    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit 24bf59c43fbedd9d85c913ac3c7f0e752c232eb4
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Sat Dec 31 18:57:57 2011 +0000
+
+    Revert "sna: Increase the minimum alignment constraint for g33"
+    
+    This reverts commit 2934e778f01cdf1307732b248b11a31c0e79e866. The actual
+    cause of the bug I was seeing on my PNV box turned out to be
+    a1f585a3d0a, so time to reinvestigate the alignment issues.
+
 commit 770a953ff03bb8328c3f29e274d225528840f30c
 Author: Chris Wilson <chris@chris-wilson.co.uk>
 Date:   Sat Dec 31 17:19:08 2011 +0000
diff --git a/debian/changelog b/debian/changelog
index a5c80eb..358ad0a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+xserver-xorg-video-intel (2:2.17.0+git20120104-1) UNRELEASED; urgency=low
+
+  * New upstream snapshot:
+    - Merge from upstream master up to 4119e68fb1.
+
+ -- Cyril Brulebois <kibi@debian.org>  Wed, 04 Jan 2012 21:59:03 +0100
+
 xserver-xorg-video-intel (2:2.17.0+git20120101-2) experimental; urgency=low
 
   * Build against Xserver 1.12 RC1 (Closes: #653914).

commit 4119e68fb157fc612bce5e9c5669112ce35b4ca1
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Jan 4 19:35:30 2012 +0000

    sna/damage: Fix reduction to copy the boxes correctly
    
    We need to be carefully to copy the boxes in a strict lifo order so as
    to avoid overwritting the last boxes when reusing the array allocations.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna_damage.c b/src/sna/sna_damage.c
index 4cccbdc..18ca10d 100644
--- a/src/sna/sna_damage.c
+++ b/src/sna/sna_damage.c
@@ -219,7 +219,8 @@ _sna_damage_create_elt(struct sna_damage *damage,
 {
 	int n;
 
-	DBG(("    %s: prev=(remain %d)\n", __FUNCTION__, damage->remain));
+	DBG(("    %s: prev=(remain %d), count=%d\n",
+	     __FUNCTION__, damage->remain, count));
 
 	damage->dirty = true;
 	n = count;
@@ -297,7 +298,8 @@ _sna_damage_create_elt_from_rectangles(struct sna_damage *damage,
 {
 	int i, n;
 
-	DBG(("    %s: prev=(remain %d)\n", __FUNCTION__, damage->remain));
+	DBG(("    %s: prev=(remain %d), count=%d\n",
+	     __FUNCTION__, damage->remain, count));
 
 	n = count;
 	if (n > damage->remain)
@@ -340,7 +342,8 @@ _sna_damage_create_elt_from_points(struct sna_damage *damage,
 {
 	int i, n;
 
-	DBG(("    %s: prev=(remain %d)\n", __FUNCTION__, damage->remain));
+	DBG(("    %s: prev=(remain %d), count=%d\n",
+	     __FUNCTION__, damage->remain, count));
 
 	n = count;
 	if (n > damage->remain)
@@ -412,6 +415,7 @@ static void __sna_damage_reduce(struct sna_damage *damage)
 			  list);
 	n = iter->size - damage->remain;
 	boxes = (BoxRec *)(iter+1);
+	DBG(("   last box count=%d/%d, need=%d\n", n, iter->size, nboxes));
 	if (nboxes > iter->size) {
 		boxes = malloc(sizeof(BoxRec)*nboxes);
 		if (boxes == NULL)
@@ -422,29 +426,36 @@ static void __sna_damage_reduce(struct sna_damage *damage)
 
 	if (boxes != damage->embedded_box.box) {
 		if (list_is_empty(&damage->embedded_box.list)) {
+			DBG(("   copying embedded boxes\n"));
 			memcpy(boxes,
 			       damage->embedded_box.box,
 			       n*sizeof(BoxRec));
 		} else {
-			if (damage->mode == DAMAGE_ADD)
-				nboxes -= REGION_NUM_RECTS(region);
+			if (boxes != (BoxPtr)(iter+1)) {
+				DBG(("   copying %d boxes from last\n", n));
+				memcpy(boxes, iter+1, n*sizeof(BoxRec));
+			}
 
-			memcpy(boxes,
-			       damage->embedded_box.box,
-			       sizeof(damage->embedded_box.box));
-			n = damage->embedded_box.size;
-
-			list_for_each_entry(iter, &damage->embedded_box.list, list) {
-				int len = iter->size;
-				if (n + len > nboxes)
-					len = nboxes - n;
-				DBG(("   copy %d/%d boxes from %d\n", len, iter->size, n));
-				memcpy(boxes + n, iter+1, len * sizeof(BoxRec));
-				n += len;
+			iter = list_entry(iter->list.prev,
+					  struct sna_damage_box,
+					  list);
+			while (&iter->list != &damage->embedded_box.list) {
+				DBG(("   copy %d boxes from %d\n",
+				     iter->size, n));
+				memcpy(boxes + n, iter+1,
+				       iter->size * sizeof(BoxRec));
+				n += iter->size;
+
+				iter = list_entry(iter->list.prev,
+						  struct sna_damage_box,
+						  list);
 			}
 
-			if (damage->mode == DAMAGE_ADD)
-				nboxes += REGION_NUM_RECTS(region);
+			DBG(("   copying embedded boxes to %d\n", n));
+			memcpy(boxes + n,
+			       damage->embedded_box.box,
+			       sizeof(damage->embedded_box.box));
+			n += damage->embedded_box.size;
 		}
 	}
 
@@ -455,19 +466,28 @@ static void __sna_damage_reduce(struct sna_damage *damage)
 		assert(n + REGION_NUM_RECTS(region) == nboxes);
 		pixman_region_fini(region);
 		pixman_region_init_rects(region, boxes, nboxes);
+
+		assert(damage->extents.x1 == region->extents.x1 &&
+		       damage->extents.y1 == region->extents.y1 &&
+		       damage->extents.x2 == region->extents.x2 &&
+		       damage->extents.y2 == region->extents.y2);
 	} else {
 		pixman_region16_t tmp;
 
 		pixman_region_init_rects(&tmp, boxes, nboxes);
 		pixman_region_subtract(region, region, &tmp);
 		pixman_region_fini(&tmp);
+
+		assert(damage->extents.x1 <= region->extents.x1 &&
+		       damage->extents.y1 <= region->extents.y1 &&
+		       damage->extents.x2 >= region->extents.x2 &&
+		       damage->extents.y2 >= region->extents.y2);
+		damage->extents = region->extents;
 	}
 
 	if (free_boxes)
 		free(boxes);
 
-	damage->extents = region->extents;
-
 done:
 	damage->mode = DAMAGE_ADD;
 	free_list(&damage->embedded_box.list);
@@ -595,7 +615,7 @@ __sna_damage_add_boxes(struct sna_damage *damage,
 	_sna_damage_create_elt_from_boxes(damage, box, n, dx, dy);
 
 	if (REGION_NUM_RECTS(&damage->region) == 0) {
-		damage->region.extents = box[0];
+		damage->region.extents = damage->embedded_box.box[0];
 		damage->region.data = NULL;
 		damage->extents = extents;
 	} else {
@@ -698,10 +718,7 @@ __sna_damage_add_rectangles(struct sna_damage *damage,
 	_sna_damage_create_elt_from_rectangles(damage, r, n, dx, dy);
 
 	if (REGION_NUM_RECTS(&damage->region) == 0) {
-		damage->region.extents.x1 = r[0].x + dx;
-		damage->region.extents.x2 = r[0].x + r[0].width + dx;
-		damage->region.extents.y1 = r[0].y + dy;
-		damage->region.extents.y2 = r[0].y + r[0].height + dy;
+		damage->region.extents = damage->embedded_box.box[0];
 		damage->region.data = NULL;
 		damage->extents = extents;
 	} else {
@@ -795,10 +812,7 @@ __sna_damage_add_points(struct sna_damage *damage,
 	_sna_damage_create_elt_from_points(damage, p, n, dx, dy);
 
 	if (REGION_NUM_RECTS(&damage->region) == 0) {
-		damage->region.extents.x1 = p[0].x + dx;
-		damage->region.extents.x2 = p[0].x + dx + 1;
-		damage->region.extents.y1 = p[0].y + dy;
-		damage->region.extents.y2 = p[0].y + dy + 1;
+		damage->region.extents = damage->embedded_box.box[0];
 		damage->region.data = NULL;
 		damage->extents = extents;
 	} else {
@@ -940,12 +954,18 @@ struct sna_damage *_sna_damage_all(struct sna_damage *damage,
 struct sna_damage *_sna_damage_is_all(struct sna_damage *damage,
 				      int width, int height)
 {
+	DBG(("%s(%d, %d)%s\n", __FUNCTION__, width, height,
+	     damage->dirty ? "*" : ""));
+	assert(damage->mode == DAMAGE_ADD);
+
+	assert(damage->extents.x1 == 0 &&
+	       damage->extents.y1 == 0 &&
+	       damage->extents.x2 == width &&
+	       damage->extents.y2 == height);
+
 	if (damage->dirty) {
 		__sna_damage_reduce(damage);
-		if (!RegionNotEmpty(&damage->region)) {
-			__sna_damage_destroy(damage);
-			return NULL;
-		}
+		assert(RegionNotEmpty(&damage->region));
 	}
 
 	if (damage->region.data)

commit 71b0924b586d9a60397e92e941e3d0cfa636ee61
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Jan 4 19:34:41 2012 +0000

    sna: Mark tiny CPU pixmaps as completely dirty
    
    Avoid the overhead of tracking damage on small pixmaps when using CPU
    rasterisation; the extra cost of sending the whole pixmap compared to
    the damage is negligble should it ever be required on the GPU.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index da13efa..68c10a5 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -897,6 +897,9 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
 		return true;
 	}
 
+	if (priv->stride == 0 && priv->gpu_bo == NULL && flags & MOVE_WRITE)
+		return _sna_pixmap_move_to_cpu(pixmap, flags);
+
 	get_drawable_deltas(drawable, pixmap, &dx, &dy);
 	DBG(("%s: delta=(%d, %d)\n", __FUNCTION__, dx, dy));
 	if (dx | dy)

commit fc14e63256a9b756c7c77ffe73f2f13784396c5a
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Jan 4 19:33:30 2012 +0000

    sna: Only request page size allocations for the replacement buffer
    
    A precondition on bo creation is that the size must be page aligned.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index d34fbd5..51b56eb 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -3131,6 +3131,7 @@ kgem_replace_bo(struct kgem *kgem,
 	assert(src->tiling == I915_TILING_NONE);
 
 	size = height * pitch;
+	size = ALIGN(size, PAGE_SIZE);
 
 	dst = search_linear_cache(kgem, size, 0);
 	if (dst == NULL)

commit 89739b711f42c3dbed7d3f4e6da0cdd61a5205ae
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Jan 4 17:41:16 2012 +0000

    sna: Expand small stipples into 8x8 patterns
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna.h b/src/sna/sna.h
index 32288ca..b4d109c 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -703,4 +703,9 @@ memcpy_blt(const void *src, void *dst, int bpp,
 #define SNA_CREATE_FB 0x10
 #define SNA_CREATE_SCRATCH 0x11
 
+inline static bool is_power_of_two(unsigned x)
+{
+	return (x & (x-1)) == 0;
+}
+
 #endif /* _SNA_H */
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index ea178f3..da13efa 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -7008,6 +7008,58 @@ sna_poly_fill_rect_stippled_8x8_blt(DrawablePtr drawable,
 }
 
 static bool
+sna_poly_fill_rect_stippled_nxm_blt(DrawablePtr drawable,
+				    struct kgem_bo *bo,
+				    struct sna_damage **damage,
+				    GCPtr gc, int n, xRectangle *r,
+				    const BoxRec *extents, unsigned clipped)
+{
+	PixmapPtr scratch, stipple;
+	uint8_t bytes[8], *dst = bytes;
+	const uint8_t *src, *end;
+	int j, stride;
+	bool ret;
+
+	DBG(("%s: expanding %dx%d stipple to 8x8\n",
+	     __FUNCTION__,
+	     gc->stipple->drawable.width,
+	     gc->stipple->drawable.height));
+
+	scratch = GetScratchPixmapHeader(drawable->pScreen,
+					 8, 8, 1, 1, 1, bytes);
+	if (scratch == NullPixmap)
+		return false;
+
+	stipple = gc->stipple;
+	gc->stipple = scratch;
+
+	stride = stipple->devKind;
+	src = stipple->devPrivate.ptr;
+	end = src + stride * stipple->drawable.height;
+	for(j = 0; j < 8; j++) {
+		switch (stipple->drawable.width) {
+		case 1: *dst = (*src & 1) * 0xff; break;
+		case 2: *dst = (*src & 3) * 0x55; break;
+		case 4: *dst = (*src & 15) * 0x11; break;
+		case 8: *dst = *src; break;
+		default: assert(0); break;
+		}
+		dst++;
+		src += stride;
+		if (src == end)
+			src = stipple->devPrivate.ptr;
+	}
+
+	ret = sna_poly_fill_rect_stippled_8x8_blt(drawable, bo, damage,
+						  gc, n, r, extents, clipped);
+
+	gc->stipple = stipple;
+	FreeScratchPixmapHeader(scratch);
+
+	return ret;
+}
+
+static bool
 sna_poly_fill_rect_stippled_1_blt(DrawablePtr drawable,
 				  struct kgem_bo *bo,
 				  struct sna_damage **damage,
@@ -7685,11 +7737,18 @@ sna_poly_fill_rect_stippled_blt(DrawablePtr drawable,
 	     extents->y2 - gc->patOrg.y - drawable->y,
 	     stipple->drawable.width, stipple->drawable.height));
 
-	if (stipple->drawable.width == 8 && stipple->drawable.height == 8)
+	if ((stipple->drawable.width | stipple->drawable.height) == 8)
 		return sna_poly_fill_rect_stippled_8x8_blt(drawable, bo, damage,
 							   gc, n, rect,
 							   extents, clipped);
 
+	if ((stipple->drawable.width | stipple->drawable.height) <= 0xc &&
+	    is_power_of_two(stipple->drawable.width) &&
+	    is_power_of_two(stipple->drawable.height))
+		return sna_poly_fill_rect_stippled_nxm_blt(drawable, bo, damage,
+							   gc, n, rect,
+							   extents, clipped);
+
 	if (extents->x2 - gc->patOrg.x - drawable->x <= stipple->drawable.width &&
 	    extents->y2 - gc->patOrg.y - drawable->y <= stipple->drawable.height) {
 		if (stipple->drawable.width <= 8 && stipple->drawable.height <= 8)

commit 878fbfe509da0a25dff8515d6d3b38ca3826466e
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Jan 4 16:56:55 2012 +0000

    sna: Align tiled stipple uploads with the stipple pixmap correctly
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 43d7aa1..ea178f3 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -7474,15 +7474,15 @@ sna_poly_fill_rect_stippled_n_box(struct sna *sna,
 			bx2 = ox + (x2 - x1);
 			if (bx2 - bx1 > gc->stipple->drawable.width) {
 				bx2 = bx1 + gc->stipple->drawable.width;
-				x2 = x1 + (bx2 - bx1);
+				x2 = x1 + (bx1-ox) + gc->stipple->drawable.width;
 			}
-			bx2 = (bx2 + 7) &~7;
+			bx2 = (bx2 + 7) & ~7;
 			bw = (bx2 - bx1)/8;
 			bw = ALIGN(bw, 2);
 			bh = y2 - y1;
 
-			DBG(("%s: box(%d, %d), (%d, %d) pat=(%d, %d)\n",
-			     __FUNCTION__, x1, y1, x2, y2, ox, oy));
+			DBG(("%s: box(%d, %d), (%d, %d) pat=(%d, %d), up=(%d, %d)\n",
+			     __FUNCTION__, x1, y1, x2, y2, ox, oy, bx1, bx2));
 
 			len = bw*bh;
 			len = ALIGN(len, 8) / 4;
@@ -7494,8 +7494,7 @@ sna_poly_fill_rect_stippled_n_box(struct sna *sna,
 			}
 
 			b = sna->kgem.batch + sna->kgem.nbatch;
-			b[0] = XY_MONO_SRC_COPY_IMM | (5 + len) | br00;
-			b[0] |= (ox & 7) << 17;
+			b[0] = br00 | (5 + len) | (ox & 7) << 17;
 			b[1] = br13;
 			b[2] = y1 << 16 | x1;
 			b[3] = y2 << 16 | x2;
@@ -7541,10 +7540,11 @@ sna_poly_fill_rect_stippled_n_blt(DrawablePtr drawable,
 	int16_t dx, dy;
 	uint32_t br00, br13;
 
-	DBG(("%s: upload (%d, %d), (%d, %d), origin (%d, %d)\n", __FUNCTION__,
+	DBG(("%s: upload (%d, %d), (%d, %d), origin (%d, %d), clipped=%d\n", __FUNCTION__,
 	     extents->x1, extents->y1,
 	     extents->x2, extents->y2,
-	     origin.x, origin.y));
+	     origin.x, origin.y,
+	     clipped));
 
 	if (gc->stipple->drawable.width > 32 ||
 	    gc->stipple->drawable.height > 32)
@@ -7553,7 +7553,7 @@ sna_poly_fill_rect_stippled_n_blt(DrawablePtr drawable,
 	get_drawable_deltas(drawable, pixmap, &dx, &dy);
 	kgem_set_mode(&sna->kgem, KGEM_BLT);
 
-	br00 = 3 << 20;
+	br00 = XY_MONO_SRC_COPY_IMM | 3 << 20;
 	br13 = bo->pitch;
 	if (sna->kgem.gen >= 40) {
 		if (bo->tiling)

commit 28a222a66bb450c7f6d61aef16fe73332854c8ce
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Jan 4 12:48:25 2012 +0000

    sna: Always prefer to use cacheable operations after the GPU is wedged
    
    As rasterisation will be performed upon the CPU we need to avoid the
    readbacks form uncached memory and so we should restrict ourselves to
    only create further damage within the CPU pixmap.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index ff02849..43d7aa1 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -662,6 +662,9 @@ static inline bool pixmap_inplace(struct sna *sna,
 	if (FORCE_INPLACE)
 		return FORCE_INPLACE > 0;
 
+	if (wedged(sna))
+		return false;
+
 	if (priv->mapped)
 		return true;
 
@@ -838,6 +841,9 @@ static inline bool region_inplace(struct sna *sna,
 	if (FORCE_INPLACE)
 		return FORCE_INPLACE > 0;
 
+	if (wedged(sna))
+		return false;
+
 	if (priv->mapped)
 		return true;
 

commit 99ff83a3bebf1aa25c44a87f2c344307d20bc062
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Jan 4 12:35:12 2012 +0000

    sna: Prevent creation of bo purely for GTT mapping when wedged
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index c9f4add..ff02849 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -853,6 +853,9 @@ sna_pixmap_create_mappable_gpu(PixmapPtr pixmap)
 	struct sna *sna = to_sna_from_pixmap(pixmap);
 	struct sna_pixmap *priv = sna_pixmap(pixmap);;
 
+	if (wedged(sna))
+		return false;
+
 	assert(priv->gpu_bo == NULL);
 	priv->gpu_bo =
 		kgem_create_2d(&sna->kgem,

commit a7c35fa4c3155d10ad75ac33aefb03dafa010aba
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Jan 4 12:33:09 2012 +0000

    sna: Only allow mappable pixmaps to be mapped
    
    If we did not allocate the pixel data, such as for wedged pixmaps or
    scratch buffers, then we cannot perform the pointer dance nor do we want
    to create the GPU buffer.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 3b3dc92..c9f4add 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -225,11 +225,14 @@ sna_pixmap_alloc_cpu(struct sna *sna,
 done:
 	pixmap->devPrivate.ptr = priv->ptr;
 	pixmap->devKind = priv->stride;
+	assert(priv->stride);
 	return priv->ptr != NULL;
 }
 
 static void sna_pixmap_free_cpu(struct sna *sna, struct sna_pixmap *priv)
 {
+	assert(priv->stride);
+
 	if (priv->cpu_bo) {
 		DBG(("%s: discarding CPU buffer, handle=%d, size=%d\n",
 		     __FUNCTION__, priv->cpu_bo->handle, priv->cpu_bo->size));
@@ -941,7 +944,7 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
 			}
 		}
 
-		if (priv->gpu_bo == NULL &&
+		if (priv->gpu_bo == NULL && priv->stride &&
 		    sna_pixmap_choose_tiling(pixmap) != I915_TILING_NONE &&
 		    region_inplace(sna, pixmap, region, priv) &&


Reply to: