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

xserver-xorg-video-intel: Changes to 'upstream-unstable'



 AUTHORS                                                 |    2 
 Makefile.am                                             |    2 
 NEWS                                                    |  420 
 README                                                  |    9 
 configure.ac                                            |  764 +
 man/intel.man                                           |   69 
 src/Makefile.am                                         |   18 
 src/backlight.c                                         |  494 +
 src/backlight.h                                         |   56 
 src/compat-api.h                                        |   33 
 src/fd.c                                                |   69 
 src/fd.h                                                |   33 
 src/i915_pciids.h                                       |   55 
 src/intel_device.c                                      |  504 -
 src/intel_driver.h                                      |   19 
 src/intel_list.h                                        |    5 
 src/intel_module.c                                      |  151 
 src/intel_options.c                                     |    7 
 src/intel_options.h                                     |    6 
 src/legacy/Makefile.am                                  |    2 
 src/legacy/i810/Makefile.am                             |    3 
 src/legacy/i810/i810_accel.c                            |    1 
 src/legacy/i810/i810_common.h                           |    4 
 src/legacy/i810/i810_cursor.c                           |    5 
 src/legacy/i810/i810_dga.c                              |    1 
 src/legacy/i810/i810_dri.c                              |    1 
 src/legacy/i810/i810_driver.c                           |    3 
 src/legacy/i810/i810_hwmc.c                             |    1 
 src/legacy/i810/i810_memory.c                           |    3 
 src/legacy/i810/i810_ring.h                             |    2 
 src/legacy/i810/i810_video.c                            |    1 
 src/legacy/i810/i810_wmark.c                            |    1 
 src/legacy/i810/i810_xaa.c                              |    1 
 src/legacy/i810/xvmc/Makefile.am                        |    4 
 src/render_program/Makefile.am                          |   23 
 src/render_program/exa_wm_src_affine.g8b                |    4 
 src/render_program/exa_wm_src_sample_argb.g8b           |    3 
 src/render_program/exa_wm_src_sample_planar.g8b         |    5 
 src/render_program/exa_wm_write.g8b                     |   17 
 src/render_program/exa_wm_yuv_rgb.g8b                   |   12 
 src/sna/Makefile.am                                     |   45 
 src/sna/blt.c                                           |  184 
 src/sna/brw/Makefile.am                                 |    3 
 src/sna/brw/brw_eu_util.c                               |  126 
 src/sna/brw/brw_wm.c                                    |   16 
 src/sna/fb/fb.h                                         |    5 
 src/sna/fb/fbbitmap.c                                   |    4 
 src/sna/fb/fbclip.c                                     |    2 
 src/sna/fb/fbgc.c                                       |    1 
 src/sna/fb/fbline.c                                     |   14 
 src/sna/fb/fblinebits.h                                 |   23 
 src/sna/fb/fbpict.h                                     |    1 
 src/sna/fb/fbpoint.c                                    |    4 
 src/sna/fb/fbpointbits.h                                |   23 
 src/sna/fb/fbpush.c                                     |    2 
 src/sna/fb/fbseg.c                                      |    1 
 src/sna/gen2_render.c                                   |  236 
 src/sna/gen3_render.c                                   |  322 
 src/sna/gen4_common.c                                   |   64 
 src/sna/gen4_common.h                                   |   49 
 src/sna/gen4_render.c                                   |  400 
 src/sna/gen4_render.h                                   |    2 
 src/sna/gen4_vertex.c                                   |  237 
 src/sna/gen4_vertex.h                                   |    1 
 src/sna/gen5_render.c                                   |  310 
 src/sna/gen6_common.c                                   |   71 
 src/sna/gen6_common.h                                   |  205 
 src/sna/gen6_render.c                                   |  515 -
 src/sna/gen7_render.c                                   |  623 -
 src/sna/gen8_eu.c                                       | 1379 ++
 src/sna/gen8_eu.h                                       |   19 
 src/sna/gen8_render.c                                   | 4008 ++++++++
 src/sna/gen8_render.h                                   | 1132 ++
 src/sna/gen8_vertex.c                                   |  296 
 src/sna/gen8_vertex.h                                   |   14 
 src/sna/kgem.c                                          | 2408 +++-
 src/sna/kgem.h                                          |  253 
 src/sna/kgem_debug.c                                    |  195 
 src/sna/kgem_debug_gen2.c                               |    1 
 src/sna/sna.h                                           |  432 
 src/sna/sna_accel.c                                     | 7727 ++++++++++------
 src/sna/sna_acpi.c                                      |  223 
 src/sna/sna_blt.c                                       | 1971 +++-
 src/sna/sna_composite.c                                 |  526 -
 src/sna/sna_cpu.c                                       |    4 
 src/sna/sna_cpuid.h                                     |    4 
 src/sna/sna_damage.c                                    |  595 -
 src/sna/sna_damage.h                                    |   48 
 src/sna/sna_display.c                                   | 5138 +++++++---
 src/sna/sna_display_fake.c                              |  258 
 src/sna/sna_dri.c                                       | 2362 ----
 src/sna/sna_dri2.c                                      | 3263 ++++++
 src/sna/sna_dri3.c                                      |  379 
 src/sna/sna_driver.c                                    |  658 -
 src/sna/sna_glyphs.c                                    |  896 +
 src/sna/sna_gradient.c                                  |    9 
 src/sna/sna_io.c                                        | 1404 +-
 src/sna/sna_present.c                                   |  473 
 src/sna/sna_reg.h                                       |   33 
 src/sna/sna_render.c                                    |  437 
 src/sna/sna_render.h                                    |  118 
 src/sna/sna_render_inline.h                             |   99 
 src/sna/sna_stream.c                                    |    4 
 src/sna/sna_threads.c                                   |  168 
 src/sna/sna_tiling.c                                    |  460 
 src/sna/sna_transform.c                                 |   57 
 src/sna/sna_trapezoids.c                                | 7639 ---------------
 src/sna/sna_trapezoids.h                                |  342 
 src/sna/sna_trapezoids_boxes.c                          | 1476 +++
 src/sna/sna_trapezoids_imprecise.c                      | 3946 ++++++++
 src/sna/sna_trapezoids_mono.c                           | 1427 ++
 src/sna/sna_trapezoids_precise.c                        | 3321 ++++++
 src/sna/sna_vertex.c                                    |    4 
 src/sna/sna_video.c                                     |   92 
 src/sna/sna_video.h                                     |   24 
 src/sna/sna_video_hwmc.c                                |   12 
 src/sna/sna_video_overlay.c                             |   36 
 src/sna/sna_video_sprite.c                              |  327 
 src/sna/sna_video_textured.c                            |   27 
 src/uxa/Makefile.am                                     |   27 
 src/uxa/i830_3d.c                                       |    1 
 src/uxa/i830_reg.h                                      |   12 
 src/uxa/i830_render.c                                   |    1 
 src/uxa/i915_3d.c                                       |    1 
 src/uxa/i915_render.c                                   |    1 
 src/uxa/i915_video.c                                    |    6 
 src/uxa/i965_3d.c                                       |    1 
 src/uxa/i965_render.c                                   |   12 
 src/uxa/i965_video.c                                    |    1 
 src/uxa/intel.h                                         |  102 
 src/uxa/intel_batchbuffer.c                             |   17 
 src/uxa/intel_batchbuffer.h                             |    8 
 src/uxa/intel_display.c                                 |  725 -
 src/uxa/intel_dri.c                                     |  254 
 src/uxa/intel_dri3.c                                    |  140 
 src/uxa/intel_driver.c                                  |  189 
 src/uxa/intel_glamor.c                                  |   27 
 src/uxa/intel_glamor.h                                  |    4 
 src/uxa/intel_memory.c                                  |  108 
 src/uxa/intel_present.c                                 |  401 
 src/uxa/intel_sync.c                                    |  111 
 src/uxa/intel_uxa.c                                     |  216 
 src/uxa/intel_video.c                                   |   20 
 src/uxa/uxa-accel.c                                     |    5 
 src/uxa/uxa-glyphs.c                                    |    4 
 src/uxa/uxa-priv.h                                      |   17 
 src/uxa/uxa-render.c                                    |    5 
 src/uxa/uxa-unaccel.c                                   |    4 
 src/uxa/uxa.c                                           |    2 
 test/.gitignore                                         |   10 
 test/Makefile.am                                        |   39 
 test/basic-copyarea-size.c                              |   20 
 test/basic-copyarea.c                                   |   62 
 test/basic-fillrect.c                                   |   58 
 test/basic-lines.c                                      |   14 
 test/basic-putimage.c                                   |   58 
 test/basic-rectangle.c                                  |   86 
 test/basic-stippledrect.c                               |  239 
 test/basic-stress.c                                     |   60 
 test/basic-string.c                                     |   24 
 test/basic-tiledrect.c                                  |  418 
 test/dri2-test.c                                        |  261 
 test/dri3-test.c                                        | 1100 ++
 test/dri3.c                                             |  133 
 test/dri3.h                                             |   50 
 test/lowlevel-blt-bench.c                               |  373 
 test/mixed-stress.c                                     |   72 
 test/present-test.c                                     |  726 +
 test/render-composite-solid-mask.c                      |  118 
 test/render-composite-solid.c                           |   54 
 test/render-copy-alphaless.c                            |   58 
 test/render-copyarea-mask.c                             |  163 
 test/render-copyarea-size.c                             |   18 
 test/render-copyarea.c                                  |   62 
 test/render-fill-copy.c                                 |   54 
 test/render-fill.c                                      |   54 
 test/render-trapezoid-image.c                           |   98 
 test/render-trapezoid.c                                 |   80 
 test/shm-test.c                                         |  174 
 test/test.h                                             |   29 
 test/test_display.c                                     |   38 
 test/test_image.c                                       |  152 
 test/test_render.c                                      |    2 
 test/virtual.conf                                       |   36 
 tools/.gitignore                                        |    3 
 tools/Makefile.am                                       |   65 
 tools/backlight_helper.c                                |   44 
 tools/intel-virtual-output.man                          |   27 
 tools/org.x.xf86-video-intel.backlight-helper.policy.in |   19 
 tools/virtual.c                                         | 3462 +++++++
 xvmc/Makefile.am                                        |    6 
 xvmc/i915_xvmc.c                                        |    2 
 xvmc/i965_xvmc.c                                        |    2 
 xvmc/intel_batchbuffer.c                                |   60 
 xvmc/intel_batchbuffer.h                                |    4 
 xvmc/intel_xvmc.c                                       |   79 
 xvmc/intel_xvmc_private.h                               |   39 
 xvmc/xvmc_vld.c                                         |    4 
 198 files changed, 53330 insertions(+), 20327 deletions(-)

New commits:
commit 8fa22964f69d3ec8700f177dd7cb3cbc396a9f35
Author: Matthieu Herrb <matthieu@herrb.eu>
Date:   Fri Jul 4 18:26:09 2014 +0200

    backlight: Fix security issues in handling of the interface path name.
    
    - don't allow '/' in the interface name to avoid escaping the /sys
      hierarchy
    - check snprintf() return value for overflow.
    
    Problems reported by  Adam Sampson. Thanks.
    
    Signed-off-by: Matthieu Herrb <matthieu@herrb.eu>
    Reviewed-by: Reviewed-by: Hans de Goede <hdegoede@redhat.com>

diff --git a/tools/backlight_helper.c b/tools/backlight_helper.c
index 11abebc..24958ec 100644
--- a/tools/backlight_helper.c
+++ b/tools/backlight_helper.c
@@ -17,7 +17,15 @@ int main(int argc, char *argv[])
 		return 1;
 	}
 
-	snprintf(buf, sizeof(buf), "/sys/class/backlight/%s/brightness", argv[1]);
+	if (strchr(argv[1], '/') != NULL) {
+		fprintf(stderr, "Invalid interface name\n");
+		return 1;
+	}
+	if (snprintf(buf, sizeof(buf), "/sys/class/backlight/%s/brightness",
+		argv[1]) >= sizeof(buf)) {
+		fprintf(stderr, "Interface name is too long\n");
+		return 1;
+	}
 	fd = open(buf, O_RDWR);
 	if (fd < 0 || fstat(fd, &st) || major(st.st_dev)) {
 		fprintf(stderr, "Cannot access backlight interface '%s'\n", argv[1]);

commit 6a64a3ae55ad5f743d2b7a4852b6ca7b54d2a142
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jul 4 13:04:02 2014 +0100

    sna: Discard operations to either CPU or GPU bo when overwriting with RenderRectangles
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna_composite.c b/src/sna/sna_composite.c
index bc50109..e65bce0 100644
--- a/src/sna/sna_composite.c
+++ b/src/sna/sna_composite.c
@@ -1021,7 +1021,7 @@ sna_composite_rectangles(CARD8		 op,
 		goto fallback;
 	}
 	if (hint & REPLACES)
-		kgem_bo_undo(&sna->kgem, bo);
+		kgem_bo_pair_undo(&sna->kgem, priv->gpu_bo, priv->cpu_bo);
 
 	if (op <= PictOpSrc) {
 		b = pixman_region_rectangles(&region, &num_boxes);

commit 2c8ab77fcd71b7f96ad7bc379e5c68b3b45a5069
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jul 4 12:43:55 2014 +0100

    sna: Tweak number of threads for short areas
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna_threads.c b/src/sna/sna_threads.c
index 83b180f..f9c6b1e 100644
--- a/src/sna/sna_threads.c
+++ b/src/sna/sna_threads.c
@@ -259,8 +259,8 @@ int sna_use_threads(int width, int height, int threshold)
 	if (max_threads <= 0)
 		return 1;
 
-	if (height <= max_threads)
-		return height;
+	if (height <= 1)
+		return 1;
 
 	if (width < 128)
 		height /= 128/width;
@@ -271,6 +271,9 @@ int sna_use_threads(int width, int height, int threshold)
 
 	if (num_threads > max_threads)
 		num_threads = max_threads;
+	if (num_threads > height)
+		num_threads = height;
+
 	return num_threads;
 }
 

commit d3ccb3f3b2a3cb4c8b51d58d185dd10b85e025eb
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jul 4 12:39:01 2014 +0100

    sna: Convert a clear tile into a solid fill
    
    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 0b16bd0..b6d4195 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -12601,6 +12601,26 @@ out_gc:
 	return ret;
 }
 
+inline static bool tile_is_solid(GCPtr gc, uint32_t *pixel)
+{
+	PixmapPtr tile = gc->tile.pixmap;
+	struct sna_pixmap *priv;
+
+	if ((tile->drawable.width | tile->drawable.height) == 1) {
+		DBG(("%s: single pixel tile pixmap, converting to solid fill\n", __FUNCTION__));
+		*pixel = get_pixel(tile);
+		return true;
+	}
+
+	priv = sna_pixmap(tile);
+	if (priv == NULL || !priv->clear)
+		return false;
+
+	DBG(("%s: tile is clear, converting to solid fill\n", __FUNCTION__));
+	*pixel = priv->clear_color;
+	return true;
+}
+
 static bool
 sna_poly_fill_rect_tiled_blt(DrawablePtr drawable,
 			     struct kgem_bo *bo,
@@ -12617,6 +12637,7 @@ sna_poly_fill_rect_tiled_blt(DrawablePtr drawable,
 	CARD32 alu = gc->alu;
 	int tile_width, tile_height;
 	int16_t dx, dy;
+	uint32_t pixel;
 
 	DBG(("%s pixmap=%ld, x %d [(%d, %d)x(%d, %d)...], clipped? %d\n",
 	     __FUNCTION__, pixmap->drawable.serialNumber,
@@ -12626,22 +12647,19 @@ sna_poly_fill_rect_tiled_blt(DrawablePtr drawable,
 	assert(tile->drawable.depth == drawable->depth);
 	assert(bo);
 
-	tile_width = tile->drawable.width;
-	tile_height = tile->drawable.height;
-	if ((tile_width | tile_height) == 1) {
-		DBG(("%s: single pixel tile pixmap ,converting to solid fill\n",
-		     __FUNCTION__));
+	if (tile_is_solid(gc, &pixel))
 		return sna_poly_fill_rect_blt(drawable, bo, damage,
-					      gc, get_pixel(tile),
+					      gc, pixel,
 					      n, rect,
 					      extents, clipped);
-	}
 
 	/* XXX [248]x[238] tiling can be reduced to a pattern fill.
 	 * Also we can do the lg2 reduction for BLT and use repeat modes for
 	 * RENDER.
 	 */
 
+	tile_width = tile->drawable.width;
+	tile_height = tile->drawable.height;
 	if ((tile_width | tile_height) == 8) {
 		bool ret;
 

commit 2e0763088f8e159b414cec5c056cc4c91a34766e
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jul 4 12:26:43 2014 +0100

    sna: Fix typo s/num_threads/max_threads/
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna_threads.c b/src/sna/sna_threads.c
index e2bb804..83b180f 100644
--- a/src/sna/sna_threads.c
+++ b/src/sna/sna_threads.c
@@ -259,7 +259,7 @@ int sna_use_threads(int width, int height, int threshold)
 	if (max_threads <= 0)
 		return 1;
 
-	if (height <= num_threads)
+	if (height <= max_threads)
 		return height;
 
 	if (width < 128)

commit 04ddea075e9e07cf3158594130d5ba7d1f50f7f1
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jul 4 12:14:11 2014 +0100

    sna: Do a quirk early check for short areas before threading
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna_threads.c b/src/sna/sna_threads.c
index f263d24..e2bb804 100644
--- a/src/sna/sna_threads.c
+++ b/src/sna/sna_threads.c
@@ -259,6 +259,9 @@ int sna_use_threads(int width, int height, int threshold)
 	if (max_threads <= 0)
 		return 1;
 
+	if (height <= num_threads)
+		return height;
+
 	if (width < 128)
 		height /= 128/width;
 

commit 228a22fe8db044a18556a9fdb989323274817771
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jul 4 12:10:10 2014 +0100

    sna: Disable use of threaded compositor when using threaded renderer
    
    Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna_trapezoids_boxes.c b/src/sna/sna_trapezoids_boxes.c
index 1cfad29..2f7028f 100644
--- a/src/sna/sna_trapezoids_boxes.c
+++ b/src/sna/sna_trapezoids_boxes.c
@@ -682,7 +682,7 @@ pixsolid_opacity(struct pixman_inplace *pi,
 	else
 		*pi->bits = mul_4x8_8(pi->color, opacity);
 	sna_image_composite(pi->op, pi->source, NULL, pi->image,
-			0, 0, 0, 0, pi->dx + x, pi->dy + y, w, h);
+			    0, 0, 0, 0, pi->dx + x, pi->dy + y, w, h);
 }
 
 static void
@@ -936,18 +936,18 @@ pixmask_opacity(struct pixman_inplace *pi,
 		uint8_t opacity)
 {
 	if (opacity == 0xff) {
-		sna_image_composite(pi->op, pi->source, NULL, pi->image,
-				    pi->sx + x, pi->sy + y,
-				    0, 0,
-				    pi->dx + x, pi->dy + y,
-				    w, h);
+		pixman_image_composite(pi->op, pi->source, NULL, pi->image,
+				       pi->sx + x, pi->sy + y,
+				       0, 0,
+				       pi->dx + x, pi->dy + y,
+				       w, h);
 	} else {
 		*pi->bits = opacity;
-		sna_image_composite(pi->op, pi->source, pi->mask, pi->image,
-				    pi->sx + x, pi->sy + y,
-				    0, 0,
-				    pi->dx + x, pi->dy + y,
-				    w, h);
+		pixman_image_composite(pi->op, pi->source, pi->mask, pi->image,
+				       pi->sx + x, pi->sy + y,
+				       0, 0,
+				       pi->dx + x, pi->dy + y,
+				       w, h);
 	}
 }
 

commit 64bcb91f58fba3956f2c66fa37707b9e496da936
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jul 4 11:02:39 2014 +0100

    sna: Utilise existing cached upload for promoting to GPU bo
    
    If we already have a buffer that represents the data on the GPU, we can
    simply use that when we need to promote the pixmap onto 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 9191fe2..0b16bd0 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -4091,24 +4091,19 @@ sna_pixmap_move_to_gpu(PixmapPtr pixmap, unsigned flags)
 		goto active;
 	}
 
-	if (kgem_bo_discard_cache(priv->gpu_bo, flags & (MOVE_WRITE | __MOVE_FORCE))) {
-		DBG(("%s: discarding cached upload buffer\n", __FUNCTION__));
-		assert(DAMAGE_IS_ALL(priv->cpu_damage));
-		assert(priv->gpu_damage == NULL || DAMAGE_IS_ALL(priv->gpu_damage)); /* magical upload buffer */
-		assert(!priv->pinned);
-		assert(!priv->mapped);
-		sna_damage_destroy(&priv->gpu_damage);
-		kgem_bo_destroy(&sna->kgem, priv->gpu_bo);
-		priv->gpu_bo = NULL;
-	}
-
 	if ((flags & MOVE_READ) == 0)
 		sna_damage_destroy(&priv->cpu_damage);
 
 	sna_damage_reduce(&priv->cpu_damage);
 	assert_pixmap_damage(pixmap);
 	DBG(("%s: CPU damage? %d\n", __FUNCTION__, priv->cpu_damage != NULL));
-	if (priv->gpu_bo == NULL) {
+	if (priv->gpu_bo == NULL ||
+	    kgem_bo_discard_cache(priv->gpu_bo, flags & (MOVE_WRITE | __MOVE_FORCE))) {
+		struct kgem_bo *proxy;
+
+		proxy = priv->gpu_bo;
+		priv->gpu_bo = NULL;
+
 		DBG(("%s: creating GPU bo (%dx%d@%d), create=%x\n",
 		     __FUNCTION__,
 		     pixmap->drawable.width,
@@ -4116,9 +4111,9 @@ sna_pixmap_move_to_gpu(PixmapPtr pixmap, unsigned flags)
 		     pixmap->drawable.bitsPerPixel,
 		     priv->create));
 		assert(!priv->mapped);
-		if (flags & __MOVE_FORCE || priv->create & KGEM_CAN_CREATE_GPU) {
-			unsigned create;
+		assert(list_is_empty(&priv->flush_list));
 
+		if (flags & __MOVE_FORCE || priv->create & KGEM_CAN_CREATE_GPU) {
 			assert(pixmap->drawable.width > 0);
 			assert(pixmap->drawable.height > 0);
 			assert(pixmap->drawable.bitsPerPixel >= 8);
@@ -4138,21 +4133,39 @@ sna_pixmap_move_to_gpu(PixmapPtr pixmap, unsigned flags)
 				pixmap->devPrivate.ptr = NULL;
 				sna_damage_all(&priv->gpu_damage, pixmap);
 				sna_damage_destroy(&priv->cpu_damage);
-				goto done;
-			}
-
-			create = 0;
-			if (flags & MOVE_INPLACE_HINT || (priv->cpu_damage && priv->cpu_bo == NULL))
-				create = CREATE_GTT_MAP | CREATE_INACTIVE;
+			} else {
+				unsigned create = 0;
+				if (flags & MOVE_INPLACE_HINT || (priv->cpu_damage && priv->cpu_bo == NULL))
+					create = CREATE_GTT_MAP | CREATE_INACTIVE;
 
-			sna_pixmap_alloc_gpu(sna, pixmap, priv, create);
+				sna_pixmap_alloc_gpu(sna, pixmap, priv, create);
+			}
 		}
+
 		if (priv->gpu_bo == NULL) {
 			DBG(("%s: not creating GPU bo\n", __FUNCTION__));
 			assert(priv->gpu_damage == NULL);
+			priv->gpu_bo = proxy;
+			if (proxy)
+				sna_damage_all(&priv->cpu_damage, pixmap);
 			return NULL;
 		}
 
+		if (proxy) {
+			DBG(("%s: promoting upload proxy handle=%d to GPU\n", __FUNCTION__, proxy->handle));
+
+			if (priv->cpu_damage &&
+			    sna->render.copy_boxes(sna, GXcopy,
+						   &pixmap->drawable, proxy, 0, 0,
+						   &pixmap->drawable, priv->gpu_bo, 0, 0,
+						   region_rects(DAMAGE_REGION(priv->cpu_damage)),
+						   region_num_rects(DAMAGE_REGION(priv->cpu_damage)),
+						   0))
+				sna_damage_destroy(&priv->cpu_damage);
+
+			kgem_bo_destroy(&sna->kgem, proxy);
+		}
+
 		if (flags & MOVE_WRITE && priv->cpu_damage == NULL) {
 			/* Presume that we will only ever write to the GPU
 			 * bo. Readbacks are expensive but fairly constant
diff --git a/src/sna/sna_damage.h b/src/sna/sna_damage.h
index 28f7ee6..a55f859 100644
--- a/src/sna/sna_damage.h
+++ b/src/sna/sna_damage.h
@@ -25,6 +25,7 @@ struct sna_damage {
 #define DAMAGE_IS_ALL(ptr) (((uintptr_t)(ptr))&1)
 #define DAMAGE_MARK_ALL(ptr) ((struct sna_damage *)(((uintptr_t)(ptr))|1))
 #define DAMAGE_PTR(ptr) ((struct sna_damage *)(((uintptr_t)(ptr))&~1))
+#define DAMAGE_REGION(ptr) (&DAMAGE_PTR(ptr)->region)
 
 struct sna_damage *sna_damage_create(void);
 

commit 821ef20b27f84cc26aec266b0f616a7f39ba9e3d
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jul 4 10:43:35 2014 +0100

    sna: Promote tile pixmaps to GPU when reused
    
    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 0475f1e..9191fe2 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -11938,6 +11938,7 @@ static struct kgem_bo *
 sna_pixmap_get_source_bo(PixmapPtr pixmap)
 {
 	struct sna_pixmap *priv = sna_pixmap(pixmap);
+	unsigned flags;
 	BoxRec box;
 
 	box.x1 = box.y1 = 0;
@@ -11968,7 +11969,18 @@ sna_pixmap_get_source_bo(PixmapPtr pixmap)
 			return kgem_bo_reference(priv->cpu_bo);
 	}
 
-	if (!sna_pixmap_move_to_gpu(pixmap, MOVE_READ | MOVE_ASYNC_HINT)) {
+	flags = MOVE_READ | MOVE_ASYNC_HINT;
+	if (priv->gpu_bo && priv->gpu_bo->proxy) {
+		struct kgem_bo *bo = priv->gpu_bo;
+		if (bo->rq == NULL && (bo->snoop || bo->pitch >= 4096))
+			flags |= __MOVE_FORCE;
+	}
+	if (priv->gpu_bo == NULL) {
+		if (++priv->source_count > SOURCE_BIAS)
+			flags |= __MOVE_FORCE;
+	}
+
+	if (!sna_pixmap_move_to_gpu(pixmap, flags)) {
 		struct kgem_bo *upload;
 
 		if (!sna_pixmap_move_to_cpu(pixmap, MOVE_READ))

commit c6407f7380829f822a462100d26bc531aed0fd6f
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jul 4 10:14:54 2014 +0100

    sna/gen8: Disable the unaligned check
    
    Note sure if this is strictly required -- but at the moment it fails for
    1x1R solids, causing us to skip glyphs. The simulator doesn't complain,
    so just skip the check for now.
    
    Reported-by: Ben Widawsky <ben@bwidawsk.net>
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/gen8_render.c b/src/sna/gen8_render.c
index 3cdbfd5..2eb44a9 100644
--- a/src/sna/gen8_render.c
+++ b/src/sna/gen8_render.c
@@ -214,8 +214,10 @@ static inline bool too_large(int width, int height)
 	return width > GEN8_MAX_SIZE || height > GEN8_MAX_SIZE;
 }
 
-static bool unaligned(struct kgem_bo *bo, int bpp)
+static inline bool unaligned(struct kgem_bo *bo, int bpp)
 {
+	/* XXX What exactly do we need to meet H_ALIGN and V_ALIGN? */
+#if 0
 	int x, y;
 
 	if (bo->proxy == NULL)
@@ -241,6 +243,9 @@ static bool unaligned(struct kgem_bo *bo, int bpp)
 	    return true;
 
 	return false;
+#else
+	return false;
+#endif
 }
 
 static uint32_t gen8_get_blend(int op,

commit e64d14d7bc72fe7b150e5427feeb1a163ec600a7
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jul 4 09:55:04 2014 +0100

    sna: Tighten assertions for using upload proxies concurrently with CPU reads
    
    After relaxing some of the rules on when to discard the upload proxies,
    we also need to relax some of the complementary asserts.
    
    Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
    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 c58f177..0475f1e 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -2198,7 +2198,7 @@ skip_inplace_map:
 		}
 	}
 
-	assert(priv->gpu_bo == NULL || priv->gpu_bo->proxy == NULL);
+	assert(priv->gpu_bo == NULL || priv->gpu_bo->proxy == NULL || (flags & MOVE_WRITE) == 0);
 
 	if (operate_inplace(priv, flags) &&
 	    pixmap_inplace(sna, pixmap, priv, flags) &&
@@ -2206,8 +2206,10 @@ skip_inplace_map:
 		void *ptr;
 
 		DBG(("%s: try to operate inplace (GTT)\n", __FUNCTION__));
+		assert(priv->gpu_bo);
 		assert(priv->cow == NULL || (flags & MOVE_WRITE) == 0);
 		assert(!priv->move_to_gpu);
+		assert(priv->gpu_bo->proxy == NULL || (flags & MOVE_WRITE) == 0);
 		assert((flags & MOVE_READ) == 0 || priv->cpu_damage == NULL);
 		/* XXX only sync for writes? */
 		kgem_bo_submit(&sna->kgem, priv->gpu_bo);
@@ -2247,8 +2249,10 @@ skip_inplace_map:
 		void *ptr;
 
 		DBG(("%s: try to operate inplace (CPU)\n", __FUNCTION__));
+		assert(priv->gpu_bo);
 		assert(priv->cow == NULL || (flags & MOVE_WRITE) == 0);
 		assert(priv->move_to_gpu == NULL || (flags & MOVE_WRITE) == 0);
+		assert(priv->gpu_bo->proxy == NULL || (flags & MOVE_WRITE) == 0);
 
 		assert(!priv->mapped);
 		assert(priv->gpu_bo->tiling == I915_TILING_NONE);
@@ -2686,6 +2690,8 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
 		}
 	}
 
+	assert(priv->gpu_bo == NULL || priv->gpu_bo->proxy == NULL || (flags & MOVE_WRITE) == 0);
+
 	if (get_drawable_deltas(drawable, pixmap, &dx, &dy)) {
 		DBG(("%s: delta=(%d, %d)\n", __FUNCTION__, dx, dy));
 		RegionTranslate(region, dx, dy);
@@ -2697,8 +2703,10 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
 		void *ptr;
 
 		DBG(("%s: try to operate inplace\n", __FUNCTION__));
+		assert(priv->gpu_bo);
 		assert(priv->cow == NULL || (flags & MOVE_WRITE) == 0);
 		assert(priv->move_to_gpu == NULL || (flags & MOVE_WRITE) == 0);
+		assert(priv->gpu_bo->proxy == NULL || (flags & MOVE_WRITE) == 0);
 
 		/* XXX only sync for writes? */
 		kgem_bo_submit(&sna->kgem, priv->gpu_bo);
@@ -2776,6 +2784,8 @@ move_to_cpu:
 
 		DBG(("%s: try to operate inplace (CPU), read? %d, write? %d\n",
 		     __FUNCTION__, !!(flags & MOVE_READ), !!(flags & MOVE_WRITE)));
+		assert(priv->gpu_bo);
+		assert(priv->gpu_bo->proxy == NULL || (flags & MOVE_WRITE) == 0);
 		assert(sna_damage_contains_box(&priv->gpu_damage, &region->extents) == PIXMAN_REGION_IN);
 		assert(sna_damage_contains_box(&priv->cpu_damage, &region->extents) == PIXMAN_REGION_OUT);
 

commit 4e12d5ca26bdfafd7b9cd02c36e6d991f068f29b
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jul 4 09:48:53 2014 +0100

    sna: Prevent creating a GPU bo for an inplace read
    
    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 e317e65..c58f177 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -2054,7 +2054,7 @@ static inline bool operate_inplace(struct sna_pixmap *priv, unsigned flags)
 		return false;
 	}
 
-	if (priv->cpu_damage && flags & MOVE_READ) {
+	if ((priv->gpu_damage == NULL || priv->cpu_damage) && flags & MOVE_READ) {
 		DBG(("%s: no, has CPU damage and requires readback\n", __FUNCTION__));
 		return false;
 	}

commit 18ae7722dbdf6ab61560962ed6ca8d39f353b1f9
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Jul 3 18:18:04 2014 +0000

    sna: Wrap xf86DPMSSet
    
    We need to wrap xf86DPMSSet() so that we can reintialize our bookkeeping
    and auxiliary planes after disabling/re-enabling CRTC during DPMS
    operations.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index f472f2c..2f2d52f 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -170,9 +170,10 @@ struct sna_output {
 	uint32_t *prop_ids;
 	uint64_t *prop_values;
 	struct sna_property *props;
-
 };
 
+static void sna_crtc_disable_cursor(struct sna *sna, struct sna_crtc *crtc);
+
 inline static unsigned count_to_mask(int x)
 {
 	return (1 << x) - 1;
@@ -972,6 +973,7 @@ sna_crtc_apply(xf86CrtcPtr crtc)
 	DBG(("%s CRTC:%d [pipe=%d], handle=%d\n", __FUNCTION__, sna_crtc->id, sna_crtc->pipe, sna_crtc->bo->handle));
 
 	assert(sna->mode.num_real_output < ARRAY_SIZE(output_ids));
+	sna_crtc_disable_cursor(sna, sna_crtc);
 
 	if (!rotation_set(sna, &sna_crtc->primary_rotation, sna_crtc->rotation)) {
 		ERR(("%s: set-primary-rotation failed (rotation-id=%d, rotation=%d) on CRTC:%d [pipe=%d], errno=%d\n",
@@ -1430,8 +1432,8 @@ sna_crtc_disable(xf86CrtcPtr crtc)
 
 	sna_crtc->mode_serial++;
 
+	sna_crtc_disable_cursor(sna, sna_crtc);
 	rotation_set(sna, &sna_crtc->primary_rotation, RR_Rotate_0);
-
 	sna_crtc_disable_shadow(sna, sna_crtc);
 
 	if (sna_crtc->bo) {
@@ -4274,6 +4276,29 @@ sna_set_cursor_colors(ScrnInfoPtr scrn, int _bg, int _fg)
 }
 
 static void
+sna_crtc_disable_cursor(struct sna *sna, struct sna_crtc *crtc)
+{
+	struct drm_mode_cursor arg;
+
+	if (!crtc->cursor)
+		return;
+
+	DBG(("%s: CRTC:%d, handle=%d\n", __FUNCTION__, crtc->id, crtc->cursor->handle));
+	assert(crtc->cursor->ref);
+
+	VG_CLEAR(arg);
+	arg.flags = DRM_MODE_CURSOR_BO;
+	arg.crtc_id = crtc->id;
+	arg.width = arg.height = 0;
+	arg.handle = 0;
+
+	(void)drmIoctl(sna->kgem.fd, DRM_IOCTL_MODE_CURSOR, &arg);
+	assert(crtc->cursor->ref > 0);
+	crtc->cursor->ref--;
+	crtc->cursor = NULL;
+}
+
+static void
 sna_hide_cursors(ScrnInfoPtr scrn)
 {
 	xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
@@ -4285,27 +4310,8 @@ sna_hide_cursors(ScrnInfoPtr scrn)
 
 	sigio = sigio_block();
 	for (c = 0; c < sna->mode.num_real_crtc; c++) {
-		xf86CrtcPtr crtc = xf86_config->crtc[c];
-		struct sna_crtc *sna_crtc = to_sna_crtc(crtc);
-		struct drm_mode_cursor arg;
-
-		assert(sna_crtc != NULL);
-		if (!sna_crtc->cursor)
-			continue;
-
-		__DBG(("%s: CRTC:%d, handle=%d\n", __FUNCTION__, sna_crtc->id, sna_crtc->cursor->handle));
-		assert(sna_crtc->cursor->ref);
-
-		VG_CLEAR(arg);
-		arg.flags = DRM_MODE_CURSOR_BO;
-		arg.crtc_id = sna_crtc->id;
-		arg.width = arg.height = 0;
-		arg.handle = 0;
-
-		(void)drmIoctl(sna->kgem.fd, DRM_IOCTL_MODE_CURSOR, &arg);
-		assert(sna_crtc->cursor->ref > 0);
-		sna_crtc->cursor->ref--;
-		sna_crtc->cursor = NULL;
+		assert(to_sna_crtc(xf86_config->crtc[c]));
+		sna_crtc_disable_cursor(sna, to_sna_crtc(xf86_config->crtc[c]));
 	}
 
 	for (prev = &sna->cursor.cursors; (cursor = *prev) != NULL; ) {
diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c
index abcc8ba..4454b32 100644
--- a/src/sna/sna_driver.c
+++ b/src/sna/sna_driver.c
@@ -300,6 +300,16 @@ static Bool sna_save_screen(ScreenPtr screen, int mode)
 	return TRUE;
 }
 
+static void sna_dpms_set(ScrnInfoPtr scrn, int mode, int flags)
+{
+	DBG(("%s(mode=%d, flags=%d)\n", __FUNCTION__, mode));
+	if (!scrn->vtSema)
+		return;
+
+	xf86DPMSSet(scrn, mode, flags);
+	sna_crtc_config_notify(xf86ScrnToScreen(scrn));
+}
+
 static void sna_selftest(void)
 {
 	sna_damage_selftest();
@@ -1107,7 +1117,7 @@ sna_screen_init(SCREEN_INIT_ARGS_DECL)
 				 CMAP_PALETTED_TRUECOLOR))
 		return FALSE;
 
-	xf86DPMSInit(screen, xf86DPMSSet, 0);
+	xf86DPMSInit(screen, sna_dpms_set, 0);
 
 	sna_video_init(sna, screen);
 	sna_dri_init(sna, screen);

commit 57d0cc82d851b95d4e3b1821287dd3ffd1cf6e3b
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Jul 3 09:07:44 2014 +0100

    sna: Clear the cursor reference from the CRTC if the update fails
    
    This should allow it to be restored correctly the next time it gets
    shown.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 5579585..f472f2c 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -4398,9 +4398,9 @@ sna_set_cursor_position(ScrnInfoPtr scrn, int x, int y)
 			if (sna_crtc->cursor != cursor) {
 				arg.flags |= DRM_MODE_CURSOR_BO;
 				arg.handle = cursor->handle;
-				arg.width = arg.height = cursor->size;
 			}
 
+			arg.width = arg.height = cursor->size;
 			arg.flags |= DRM_MODE_CURSOR_MOVE;
 			crtc->cursor_in_range = true;
 		} else {
@@ -4410,6 +4410,7 @@ disable:
 				arg.flags = DRM_MODE_CURSOR_BO;
 				arg.width = arg.height = 0;
 			}
+			cursor = NULL;
 		}
 
 		__DBG(("%s: CRTC:%d (%d, %d), handle=%d, flags=%x (old cursor handle=%d), move? %d, update handle? %d\n",

commit 24c9bac7eb6e17b55044d719bab74d16fd68c450
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Jul 2 21:17:54 2014 +0100

    sna: Limit the size of the tiling object to be smaller than either the originals
    
    When we tile, we do so in order to fit an operation involving two
    objects larger than the aperture. If we then choose an intermediate
    tiling object that is larger than either of those two, the error will
    persist and we will be forced to recuse.
    
    In the worst case, this will provide an upper bound to the recursion.
    
    Reported-by: Bruno Prémont <bonbons@linux-vserver.org>
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna.h b/src/sna/sna.h
index 68a6500..431fe97 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -635,6 +635,7 @@ static inline bool sna_pixmap_is_scanout(struct sna *sna, PixmapPtr pixmap)
 
 static inline int sna_max_tile_copy_size(struct sna *sna, struct kgem_bo *src, struct kgem_bo *dst)
 {
+	int min_object;
 	int max_size;
 
 	max_size = sna->kgem.aperture_high * PAGE_SIZE;
@@ -646,6 +647,13 @@ static inline int sna_max_tile_copy_size(struct sna *sna, struct kgem_bo *src, s
 
 	if (max_size > sna->kgem.max_copy_tile_size)
 		max_size = sna->kgem.max_copy_tile_size;
+
+	min_object = MIN(kgem_bo_size(src), kgem_bo_size(dst)) / 2;
+	if (max_size > min_object)
+		max_size = min_object;
+	if (max_size <= 4096)
+		max_size = 0;
+
 	DBG(("%s: using max tile size of %d\n", __FUNCTION__, max_size));
 	return max_size;
 }

commit 710bb0d37c681f2ffdeaf263b6ee7d9488670bc0
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Jul 2 09:16:07 2014 +0000

    test: Create separate SHM segments for ref/out
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/test/lowlevel-blt-bench.c b/test/lowlevel-blt-bench.c
index 63f6815..99b96c0 100644
--- a/test/lowlevel-blt-bench.c
+++ b/test/lowlevel-blt-bench.c
@@ -218,10 +218,11 @@ static Picture source_radial_generic(struct test_display *t, struct test_target
 	return XRenderCreateRadialGradient(t->dpy, &gradient, stops, colors, 2);
 }
 
-static XShmSegmentInfo shm;
+static XShmSegmentInfo shmref, shmout;
 
 static void setup_shm(struct test *t)


Reply to: