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

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



 NEWS                        |   15 ++
 configure.ac                |    2 
 man/intel.man               |  123 +++++++---------
 src/intel_driver.c          |    2 
 src/intel_module.c          |   38 ++++-
 src/sna/blt.c               |    5 
 src/sna/fb/fbbitmap.c       |    4 
 src/sna/gen2_render.c       |   17 +-
 src/sna/gen3_render.c       |   83 ++++++-----
 src/sna/gen4_render.c       |   25 +--
 src/sna/gen5_render.c       |   33 ++--
 src/sna/gen6_render.c       |   42 +++--
 src/sna/gen7_render.c       |   43 +++--
 src/sna/kgem.c              |  107 ++++++++++++--
 src/sna/kgem.h              |   22 +-
 src/sna/sna.h               |    7 
 src/sna/sna_accel.c         |  247 ++++++++++++++++++++++-----------
 src/sna/sna_blt.c           |  329 ++++++++++++++++++++++++++++++++++++--------
 src/sna/sna_composite.c     |    7 
 src/sna/sna_damage.c        |   46 ++++--
 src/sna/sna_driver.c        |    2 
 src/sna/sna_render.c        |  104 ++++---------
 src/sna/sna_render.h        |    3 
 src/sna/sna_render_inline.h |   26 ---
 src/sna/sna_trapezoids.c    |   92 ++++++++++--
 25 files changed, 977 insertions(+), 447 deletions(-)

New commits:
commit b5c77a6aaf520e331e82409b2592911cb1bb3100
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sun Aug 26 12:48:18 2012 +0100

    2.20.5 release
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/NEWS b/NEWS
index 1ad769e..54f2caa 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,18 @@
+Release 2.20.5 (2012-08-26)
+===========================
+Another silly bug found, another small bugfix release. The goal was for
+the driver to bind to all Intel devices supported by the kernel.
+Unfortunately we were too successful and started claiming Pouslbo,
+Medfield and Cedarview devices which are still encumbered by propietary
+IP and not supported by this driver.
+
+Bugs fixed since 2.20.4:
+
+ * Only bind to Intel devices using the i915 kernel module
+
+ * Regression in the bitmap-to-region code, e.g. icewm window buttons
+   https://bugs.freedesktop.org/show_bug.cgi?id=53699
+
 Release 2.20.4 (2012-08-18)
 ===========================
 Continuing the small bugfix releases, the only real feature is initial
diff --git a/configure.ac b/configure.ac
index a9c6336..114e721 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-video-intel],
-        [2.20.4],
+        [2.20.5],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-video-intel])
 AC_CONFIG_SRCDIR([Makefile.am])

commit 454cc8453af1852758c3396dbe303c13c5c1be27
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Aug 24 08:48:12 2012 +0100

    sna: Submit the partial batch before throttling
    
    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 9bc8c48..fd9728c 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -13691,8 +13691,10 @@ static void sna_accel_throttle(struct sna *sna)
 {
 	DBG(("%s (time=%ld)\n", __FUNCTION__, (long)TIME));
 
-	if (sna->kgem.need_throttle)
+	if (sna->kgem.need_throttle) {
+		kgem_submit(&sna->kgem);
 		kgem_throttle(&sna->kgem);
+	}
 
 	if (!sna->kgem.need_retire)
 		sna_accel_disarm_timer(sna, THROTTLE_TIMER);

commit 0e1e83ed4952f620e9422e58f955a5aea406e300
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Aug 24 00:59:31 2012 +0100

    sna: Allow the batch to be flushed if the GPU is idle upon a context switch
    
    Submit early, submit often in order to keep the GPU busy. As always we
    trade off CPU overhead versus concurrency.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/gen2_render.c b/src/sna/gen2_render.c
index 9e51cb7..d2f6fe7 100644
--- a/src/sna/gen2_render.c
+++ b/src/sna/gen2_render.c
@@ -3124,8 +3124,16 @@ gen2_render_context_switch(struct kgem *kgem,
 {
 	struct sna *sna = container_of(kgem, struct sna, kgem);
 
+	if (!kgem->mode)
+		return;
+
 	/* Reload BLT registers following a lost context */
 	sna->blt_state.fill_bo = 0;
+
+	if (kgem_is_idle(kgem)) {
+		DBG(("%s: GPU idle, flushing\n", __FUNCTION__));
+		_kgem_submit(kgem);
+	}
 }
 
 bool gen2_render_init(struct sna *sna)
diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c
index 2894c58..aaf7e49 100644
--- a/src/sna/gen5_render.c
+++ b/src/sna/gen5_render.c
@@ -3509,6 +3509,9 @@ static void
 gen5_render_context_switch(struct kgem *kgem,
 			   int new_mode)
 {
+	if (!kgem->mode)
+		return;
+
 	/* Ironlake has a limitation that a 3D or Media command can't
 	 * be the first command after a BLT, unless it's
 	 * non-pipelined.
@@ -3522,6 +3525,11 @@ gen5_render_context_switch(struct kgem *kgem,
 		     __FUNCTION__));
 		sna->render_state.gen5.drawrect_limit = -1;
 	}
+
+	if (kgem_is_idle(kgem)) {
+		DBG(("%s: GPU idle, flushing\n", __FUNCTION__));
+		_kgem_submit(kgem);
+	}
 }
 
 static void
diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c
index 84e7902..bfbcfd8 100644
--- a/src/sna/gen6_render.c
+++ b/src/sna/gen6_render.c
@@ -2366,9 +2366,18 @@ static bool prefer_blt_ring(struct sna *sna)
 	return sna->kgem.ring != KGEM_RENDER;
 }
 
-static bool can_switch_rings(struct sna *sna)
+static bool can_switch_to_blt(struct sna *sna)
 {
-	return sna->kgem.mode == KGEM_NONE && sna->kgem.has_semaphores && !NO_RING_SWITCH;
+	if (sna->kgem.ring == KGEM_BLT)
+		return true;
+
+	if (NO_RING_SWITCH)
+		return false;
+
+	if (!sna->kgem.has_semaphores)
+		return false;
+
+	return sna->kgem.mode == KGEM_NONE || kgem_is_idle(&sna->kgem);
 }
 
 static inline bool untiled_tlb_miss(struct kgem_bo *bo)
@@ -2397,7 +2406,7 @@ try_blt(struct sna *sna,
 		return true;
 	}
 
-	if (can_switch_rings(sna) && sna_picture_is_solid(src, NULL))
+	if (can_switch_to_blt(sna) && sna_picture_is_solid(src, NULL))
 		return true;
 
 	return false;
@@ -3328,7 +3337,7 @@ fallback_blt:
 		if (too_large(extents.x2-extents.x1, extents.y2-extents.y1))
 			goto fallback_blt;
 
-		if ((flags & COPY_LAST || can_switch_rings(sna)) &&
+		if ((flags & COPY_LAST || can_switch_to_blt(sna)) &&
 		    sna_blt_compare_depth(&src->drawable, &dst->drawable) &&
 		    sna_blt_copy_boxes(sna, alu,
 				       src_bo, src_dx, src_dy,
@@ -3646,7 +3655,7 @@ static inline bool prefer_blt_fill(struct sna *sna,
 	if (PREFER_RENDER)
 		return PREFER_RENDER < 0;
 
-	return (can_switch_rings(sna) ||
+	return (can_switch_to_blt(sna) ||
 		prefer_blt_ring(sna) ||
 		untiled_tlb_miss(bo));
 }
diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index 99296fb..08ba6a0 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -2455,9 +2455,18 @@ gen7_composite_set_target(struct sna *sna, struct sna_composite_op *op, PictureP
 	return true;
 }
 
-inline static bool can_switch_rings(struct sna *sna)
+inline static bool can_switch_to_blt(struct sna *sna)
 {
-	return sna->kgem.mode == KGEM_NONE && sna->kgem.has_semaphores && !NO_RING_SWITCH;
+	if (sna->kgem.ring == KGEM_BLT)
+		return true;
+
+	if (NO_RING_SWITCH)
+		return false;
+
+	if (!sna->kgem.has_semaphores)
+		return false;
+
+	return sna->kgem.mode == KGEM_NONE || kgem_is_idle(&sna->kgem);
 }
 
 static inline bool untiled_tlb_miss(struct kgem_bo *bo)
@@ -2472,7 +2481,7 @@ static bool prefer_blt_bo(struct sna *sna, struct kgem_bo *bo)
 
 inline static bool prefer_blt_ring(struct sna *sna)
 {
-	return sna->kgem.ring != KGEM_RENDER || can_switch_rings(sna);
+	return sna->kgem.ring != KGEM_RENDER || can_switch_to_blt(sna);
 }
 
 static bool
@@ -2491,7 +2500,7 @@ try_blt(struct sna *sna,
 		return true;
 	}
 
-	if (can_switch_rings(sna)) {
+	if (can_switch_to_blt(sna)) {
 		if (sna_picture_is_solid(src, NULL))
 			return true;
 
@@ -3416,7 +3425,7 @@ fallback_blt:
 		if (too_large(extents.x2-extents.x1, extents.y2-extents.y1))
 			goto fallback_blt;
 
-		if ((flags & COPY_LAST || can_switch_rings(sna)) &&
+		if ((flags & COPY_LAST || can_switch_to_blt(sna)) &&
 		    sna_blt_compare_depth(&src->drawable, &dst->drawable) &&
 		    sna_blt_copy_boxes(sna, alu,
 				       src_bo, src_dx, src_dy,
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 1cf7957..825caa7 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -1158,8 +1158,6 @@ void _kgem_add_bo(struct kgem *kgem, struct kgem_bo *bo)
 
 static uint32_t kgem_end_batch(struct kgem *kgem)
 {
-	kgem->context_switch(kgem, KGEM_NONE);
-
 	kgem->batch[kgem->nbatch++] = MI_BATCH_BUFFER_END;
 	if (kgem->nbatch & 1)
 		kgem->batch[kgem->nbatch++] = MI_NOOP;
@@ -1758,6 +1756,21 @@ bool kgem_retire(struct kgem *kgem)
 	return retired;
 }
 
+bool __kgem_is_idle(struct kgem *kgem)
+{
+	struct kgem_request *rq;
+
+	assert(!list_is_empty(&kgem->requests));
+
+	rq = list_last_entry(&kgem->requests, struct kgem_request, list);
+	if (kgem_busy(kgem, rq->bo->handle))
+		return false;
+
+	kgem_retire__requests(kgem);
+	assert(list_is_empty(&kgem->requests));
+	return true;
+}
+
 static void kgem_commit(struct kgem *kgem)
 {
 	struct kgem_request *rq = kgem->next_request;
diff --git a/src/sna/kgem.h b/src/sna/kgem.h
index 583bafc..d085a2f 100644
--- a/src/sna/kgem.h
+++ b/src/sna/kgem.h
@@ -258,15 +258,13 @@ void kgem_bo_set_binding(struct kgem_bo *bo, uint32_t format, uint16_t offset);
 
 void kgem_bo_retire(struct kgem *kgem, struct kgem_bo *bo);
 bool kgem_retire(struct kgem *kgem);
+bool __kgem_is_idle(struct kgem *kgem);
 static inline bool kgem_is_idle(struct kgem *kgem)
 {
 	if (list_is_empty(&kgem->requests))
 		return true;
 
-	if (!kgem_retire(kgem))
-		return false;
-
-	return list_is_empty(&kgem->requests);
+	return __kgem_is_idle(kgem);
 }
 struct kgem_bo *kgem_get_last_request(struct kgem *kgem);
 
diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c
index 8373890..0d4d706 100644
--- a/src/sna/sna_render.c
+++ b/src/sna/sna_render.c
@@ -246,6 +246,14 @@ static void
 no_render_context_switch(struct kgem *kgem,
 			 int new_mode)
 {
+	if (!kgem->mode)
+		return;
+
+	if (kgem_is_idle(kgem)) {
+		DBG(("%s: GPU idle, flushing\n", __FUNCTION__));
+		_kgem_submit(kgem);
+	}
+
 	(void)kgem;
 	(void)new_mode;
 }

commit 5059db0697c5516f1538f7062937664baf7b1c2e
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Aug 24 00:21:07 2012 +0100

    sna: Correct a pair of DBG messages
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c
index 257dbc8..84e7902 100644
--- a/src/sna/gen6_render.c
+++ b/src/sna/gen6_render.c
@@ -1235,7 +1235,7 @@ gen6_bind_bo(struct sna *sna,
 	if (offset) {
 		DBG(("[%x]  bo(handle=%d), format=%d, reuse %s binding\n",
 		     offset, bo->handle, format,
-		     domains & 0xffff ? "render" : "sampler"));
+		     is_dst ? "render" : "sampler"));
 		if (is_dst)
 			kgem_bo_mark_dirty(bo);
 		return offset * sizeof(uint32_t);
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index dfb1491..9bc8c48 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -13427,7 +13427,7 @@ sna_accel_flush_callback(CallbackListPtr *list,
 	 * and doesn't appear to mitigate the performance loss.
 	 */
 	DBG(("%s: flush?=%d, dirty?=%d\n", __FUNCTION__,
-	     sna->kgem.flush, list_is_empty(&sna->flush_pixmap)));
+	     sna->kgem.flush, !list_is_empty(&sna->flush_pixmaps)));
 
 	/* flush any pending damage from shadow copies to tfp clients */
 	while (!list_is_empty(&sna->flush_pixmaps)) {

commit c5b46e411a2c738c5ae55bffb9b3d460249f5c24
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Aug 23 17:36:10 2012 +0100

    sna: Tidy up users of __kgem_bo_is_busy()
    
    A lot of callsites had not been converted to the common function.
    
    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 2a976cf..dfb1491 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1231,11 +1231,8 @@ _sna_pixmap_move_to_cpu(PixmapPtr pixmap, unsigned int flags)
 			assert(!priv->shm);
 			DBG(("%s: write inplace\n", __FUNCTION__));
 			if (priv->gpu_bo) {
-				if (kgem_bo_is_busy(priv->gpu_bo) &&
-				    priv->gpu_bo->exec == NULL)
-					kgem_retire(&sna->kgem);
-
-				if (kgem_bo_is_busy(priv->gpu_bo)) {
+				if (__kgem_bo_is_busy(&sna->kgem,
+						      priv->gpu_bo)) {
 					if (priv->pinned)
 						goto skip_inplace_map;
 
@@ -1277,21 +1274,17 @@ _sna_pixmap_move_to_cpu(PixmapPtr pixmap, unsigned int flags)
 
 skip_inplace_map:
 		sna_damage_destroy(&priv->gpu_damage);
-		if (priv->cpu_bo && !priv->cpu_bo->flush && kgem_bo_is_busy(priv->cpu_bo)) {
+		if (priv->cpu_bo && !priv->cpu_bo->flush &&
+		    __kgem_bo_is_busy(&sna->kgem, priv->cpu_bo)) {
+			DBG(("%s: discarding busy CPU bo\n", __FUNCTION__));
 			assert(!priv->shm);
-			if (priv->cpu_bo->exec == NULL)
-				kgem_retire(&sna->kgem);
+			assert(priv->gpu_bo == NULL || priv->gpu_damage == NULL);
 
-			if (kgem_bo_is_busy(priv->cpu_bo)) {
-				DBG(("%s: discarding busy CPU bo\n", __FUNCTION__));
-				assert(priv->gpu_bo == NULL || priv->gpu_damage == NULL);
-
-				sna_damage_destroy(&priv->cpu_damage);
-				priv->undamaged = false;
+			sna_damage_destroy(&priv->cpu_damage);
+			priv->undamaged = false;
 
-				sna_pixmap_free_gpu(sna, priv);
-				sna_pixmap_free_cpu(sna, priv);
-			}
+			sna_pixmap_free_gpu(sna, priv);
+			sna_pixmap_free_cpu(sna, priv);
 		}
 	}
 
@@ -1495,11 +1488,6 @@ pixmap_contains_damage(PixmapPtr pixmap, struct sna_damage *damage)
 }
 #endif
 
-static bool sync_will_stall(struct kgem_bo *bo)
-{
-	return kgem_bo_is_busy(bo);
-}
-
 static inline bool region_inplace(struct sna *sna,
 				  PixmapPtr pixmap,
 				  RegionPtr region,
@@ -1629,11 +1617,7 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
 		if (priv->stride && priv->gpu_bo &&
 		    region_inplace(sna, pixmap, region, priv, true)) {
 			assert(priv->gpu_bo->proxy == NULL);
-			if (sync_will_stall(priv->gpu_bo) &&
-			    priv->gpu_bo->exec == NULL)
-				kgem_retire(&sna->kgem);
-
-			if (!kgem_bo_is_busy(priv->gpu_bo)) {
+			if (!__kgem_bo_is_busy(&sna->kgem, priv->gpu_bo)) {
 				pixmap->devPrivate.ptr =
 					kgem_bo_map(&sna->kgem, priv->gpu_bo);
 				if (pixmap->devPrivate.ptr == NULL) {
@@ -1666,9 +1650,7 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
 		}
 
 		if (priv->cpu_bo && !priv->cpu_bo->flush) {
-			if (sync_will_stall(priv->cpu_bo) && priv->cpu_bo->exec == NULL)
-				kgem_retire(&sna->kgem);
-			if (sync_will_stall(priv->cpu_bo)) {
+			if (__kgem_bo_is_busy(&sna->kgem, priv->cpu_bo)) {
 				sna_damage_subtract(&priv->cpu_damage, region);
 				if (!sna_pixmap_move_to_gpu(pixmap, MOVE_WRITE)) {
 					if (dx | dy)
@@ -3325,9 +3307,7 @@ sna_put_zpixmap_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region,
 		 * However, we can queue some writes to the GPU bo to avoid
 		 * the wait. Or we can try to replace the CPU bo.
 		 */
-		if (sync_will_stall(priv->cpu_bo) && priv->cpu_bo->exec == NULL)
-			kgem_retire(&sna->kgem);
-		if (sync_will_stall(priv->cpu_bo)) {
+		if (__kgem_bo_is_busy(&sna->kgem, priv->cpu_bo)) {
 			if (priv->cpu_bo->flush) {
 				if (sna_put_image_upload_blt(drawable, gc, region,
 							     x, y, w, h, bits, stride)) {

commit 82e91327d57e03d2117638165f298a50b946fcaa
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Aug 23 15:59:00 2012 +0100

    sna: Use a temporary userptr mapping for a large upload into a busy target
    
    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 0499a1d..2a976cf 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -4333,6 +4333,41 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
 			return;
 		}
 
+		if (src_priv == NULL &&
+		    sna->kgem.has_userptr &&
+		    __kgem_bo_is_busy(&sna->kgem, bo) &&
+		    box_inplace(src_pixmap, &region->extents)) {
+			struct kgem_bo *src_bo;
+			bool ok = false;
+
+			DBG(("%s: upload through a temporary map\n",
+			     __FUNCTION__));
+
+			src_bo = kgem_create_map(&sna->kgem,
+						 src_pixmap->devPrivate.ptr,
+						 src_pixmap->devKind * src_pixmap->drawable.height,
+						 true);
+			if (src_bo) {
+				src_bo->flush = true;
+				src_bo->pitch = src_pixmap->devKind;
+				src_bo->reusable = false;
+
+				ok = sna->render.copy_boxes(sna, alu,
+							    src_pixmap, src_bo, src_dx, src_dy,
+							    dst_pixmap, bo, 0, 0,
+							    box, n, COPY_LAST);
+
+				kgem_bo_sync__cpu(&sna->kgem, src_bo);
+				kgem_bo_destroy(&sna->kgem, src_bo);
+			}
+
+			if (ok) {
+				if (damage)
+					sna_damage_add(damage, region);
+				return;
+			}
+		}
+
 		if (alu != GXcopy) {
 			PixmapPtr tmp;
 			int i;

commit b286ffa6beccb8fe341c464a4fb9f2af98541263
Author: Eric S. Raymond <esr@thyrsus.com>
Date:   Thu Aug 23 12:42:18 2012 -0400

    Fix seriously malformed list syntax on intel(4).
    
    Signed-off-by: Eric S. Raymond <esr@thyrsus.com>

diff --git a/man/intel.man b/man/intel.man
index d231fd0..5498f87 100644
--- a/man/intel.man
+++ b/man/intel.man
@@ -257,80 +257,73 @@ VGA output port (typically exposed via an HD15 connector).
 .SS "LVDS"
 Low Voltage Differential Signalling output (typically a laptop LCD panel).  Available properties:
 
-.PP
-.B BACKLIGHT
-- current backlight level (adjustable)
-.TP 2
-By adjusting the BACKLIGHT property, the brightness on the LVDS output can be adjusted.  In some cases, this property may be unavailable (for example if your platform uses an external microcontroller to control the backlight).
-
-.PP
-.B scaling mode
-- control LCD panel scaling mode
-.TP 2
-When the currently selected display mode differs from the native panel resolution, various scaling options are available. These include
+.TP
+\fBBACKLIGHT\fB - current backlight level (adjustable)
+By adjusting the BACKLIGHT property, the brightness on the LVDS output
+can be adjusted.  In some cases, this property may be unavailable (for
+example if your platform uses an external microcontroller to control
+the backlight).
+.TP
+\fBscaling mode\fP - control LCD panel scaling mode
+When the currently selected display mode differs from the native panel
+resolution, various scaling options are available. These include
 .RS
-.PP
+.TP
 .B Center
-.TP 4
-Simply center the image on-screen without scaling. This is the only scaling mode that guarantees a one-to-one correspondence between native and displayed pixels, but some portions of the panel may be unused (so-called "letterboxing").
-.PP
+Simply center the image on-screen without scaling. This is the only
+scaling mode that guarantees a one-to-one correspondence between
+native and displayed pixels, but some portions of the panel may be
+unused (so-called "letterboxing").
+.TP
 .B Full aspect
-.TP 4
-Scale the image as much as possible while preserving aspect ratio. Pixels may not be displayed one-to-one (there may be some blurriness). Some portions of the panel may be unused if the aspect ratio of the selected mode does not match that of the panel.
-.PP
+Scale the image as much as possible while preserving aspect
+ratio. Pixels may not be displayed one-to-one (there may be some
+blurriness). Some portions of the panel may be unused if the aspect
+ratio of the selected mode does not match that of the panel.
+.TP
 .B Full
-.TP 4
-Scale the image to the panel size without regard to aspect ratio. This is the only mode which guarantees that every pixel of the panel will be used. But the displayed image may be distorted by stretching either horizontally or vertically, and pixels may not be displayed one-to-one (there may be some blurriness).
+Scale the image to the panel size without regard to aspect ratio. This
+is the only mode which guarantees that every pixel of the panel will
+be used. But the displayed image may be distorted by stretching either
+horizontally or vertically, and pixels may not be displayed one-to-one
+(there may be some blurriness).
 .RE
 
 The precise names of these options may differ depending on the kernel
-video driver, (but the functionality should be similar). See the output of
+video driver, (but the functionality should be similar). See the
+output of
 .B xrandr \-\-prop
 for a list of currently available scaling modes.
 .SS "TV"
 Integrated TV output.  Available properties include:
-
-.PP
-.B BOTTOM, RIGHT, TOP, LEFT
-- margins
-.TP 2
-Adjusting these properties allows you to control the placement of your TV output buffer on the screen. The options with the same name can also be set in xorg.conf with integer value.
-
-.PP
-.B BRIGHTNESS
-- TV brightness, range 0-255
-.TP 2
+.TP
+\fBBOTTOM, RIGHT, TOP, LEFT\fP - margins
+Adjusting these properties allows you to control the placement of your
+TV output buffer on the screen. The options with the same name can
+also be set in xorg.conf with integer value.
+.TP
+\fBBRIGHTNESS\fP - TV brightness, range 0-255
 Adjust TV brightness, default value is 128.
-
-.PP
-.B CONTRAST
-- TV contrast, range 0-255
-.TP 2
+.TP
+\fBCONTRAST\fP - TV contrast, range 0-255
 Adjust TV contrast, default value is 1.0 in chipset specific format.
-
-.PP
-.B SATURATION
-- TV saturation, range 0-255
-.TP 2
+.TP
+\fBSATURATION\fP - TV saturation, range 0-255
 Adjust TV saturation, default value is 1.0 in chipset specific format.
-
-.PP
-.B HUE
-- TV hue, range 0-255
-.TP 2
+.TP
+\fBHUE\fP - TV hue, range 0-255
 Adjust TV hue, default value is 0.
-
-.PP
-.B TV_FORMAT
-- output standard
-.TP 2
-This property allows you to control the output standard used on your TV output port.  You can select between NTSC-M, NTSC-443, NTSC-J, PAL-M, PAL-N, and PAL.
-
-.PP
-.B TV_Connector
-- connector type
-.TP 2
-This config option should be added to xorg.conf TV monitor's section, it allows you to force the TV output connector type, which bypass load detect and TV will always be taken as connected. You can select between S-Video, Composite and Component.
+.TP
+\fBTV_FORMAT\fP - output standard
+This property allows you to control the output standard used on your
+TV output port.  You can select between NTSC-M, NTSC-443, NTSC-J,
+PAL-M, PAL-N, and PAL.
+.TP
+\fBTV_Connector\fP - connector type
+This config option should be added to xorg.conf TV monitor's section,
+it allows you to force the TV output connector type, which bypass load
+detect and TV will always be taken as connected. You can select
+between S-Video, Composite and Component.
 
 .SS "TMDS-1"
 First DVI SDVO output
@@ -340,15 +333,15 @@ Second DVI SDVO output
 
 .SS "TMDS-1", "TMDS-2", "HDMI-1", "HDMI-2"
 DVI/HDMI outputs. Avaliable common properties include:
-.PP
-.B BROADCAST_RGB
-- method used to set RGB color range(full range 0-255, not full range 16-235)
-.TP 2
-Adjusting this propertie allows you to set RGB color range on each channel in order to match HDTV requirment(default 0 for full range). Setting 1 means RGB color range is 16-235, 0 means RGB color range is 0-255 on each channel.
+.TP
+\fBBROADCAST_RGB\fP - method used to set RGB color range
+Adjusting this property allows you to set RGB color range on each
+channel in order to match HDTV requirment(default 0 for full
+range). Setting 1 means RGB color range is 16-235, 0 means RGB color
+range is 0-255 on each channel.  (Full range is 0-255, not 16-235)
 
 .PP
 SDVO and DVO TV outputs are not supported by the driver at this time.
-
 .PP
 See __xconfigfile__(__filemansuffix__) for information on associating Monitor
 sections with these outputs for configuration.  Associating Monitor sections

commit fc6b7f564df88ca773ae245b1b4e278b47dffd59
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Aug 23 15:13:14 2012 +0100

    sna: Flush the batch if it contains any DRI pixmaps
    
    This fixes a regression from
    
    commit 02963f489b177d0085006753e91e240545933387
    Author: Chris Wilson <chris@chris-wilson.co.uk>
    Date:   Sun Aug 19 15:45:35 2012 +0100
    
        sna: Only submit the batch if flushing a DRI client bo
    
    which made the presumption that we called sna_add_flush_pixmap() for
    every DRI pixmap that we used. However, that is only called for the
    dirty pixmaps, any native exported pixmap only marks the batch as
    requiring a flush. So in those cases we always need to submit the batch
    if it contains an exported DRI pixmap.
    
    Reported-by: chr.ohm@gmx.net
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=53967
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 077f3e1..1cf7957 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -2057,6 +2057,7 @@ void kgem_reset(struct kgem *kgem)
 	kgem->nbatch = 0;
 	kgem->surface = kgem->batch_size;
 	kgem->mode = KGEM_NONE;
+	kgem->flush = 0;
 
 	kgem->next_request = __kgem_request_alloc();
 
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 72d2d02..0499a1d 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1031,8 +1031,6 @@ void sna_add_flush_pixmap(struct sna *sna,
 		DBG(("%s: flush bo idle, flushing\n", __FUNCTION__));
 		kgem_submit(&sna->kgem);
 	}
-
-	sna->kgem.flush = true;
 }
 
 static void __sna_free_pixmap(struct sna *sna,
@@ -13413,9 +13411,8 @@ sna_accel_flush_callback(CallbackListPtr *list,
 	 * by checking for outgoing damage events or sync replies. Tricky,
 	 * and doesn't appear to mitigate the performance loss.
 	 */
-	DBG(("%s: flush?=%d\n", __FUNCTION__, sna->kgem.flush));
-	if (!sna->kgem.flush)
-		return;
+	DBG(("%s: flush?=%d, dirty?=%d\n", __FUNCTION__,
+	     sna->kgem.flush, list_is_empty(&sna->flush_pixmap)));
 
 	/* flush any pending damage from shadow copies to tfp clients */
 	while (!list_is_empty(&sna->flush_pixmaps)) {
@@ -13435,14 +13432,14 @@ sna_accel_flush_callback(CallbackListPtr *list,
 		} else {
 			DBG(("%s: flushing DRI pixmap=%ld\n", __FUNCTION__,
 			     priv->pixmap->drawable.serialNumber));
-			if (sna_pixmap_move_to_gpu(priv->pixmap,
-						     MOVE_READ | __MOVE_FORCE))
-				kgem_bo_submit(&sna->kgem, priv->gpu_bo);
+			ret = sna_pixmap_move_to_gpu(priv->pixmap,
+						     MOVE_READ | __MOVE_FORCE);
 		}
 		(void)ret;
 	}
 
-	sna->kgem.flush = false;
+	if (sna->kgem.flush)
+		kgem_submit(&sna->kgem);
 }
 
 static struct sna_pixmap *sna_accel_scanout(struct sna *sna)

commit fd38f45ec5421802b426867a050c978a2feec937
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Aug 23 12:11:48 2012 +0100

    sna: Mark the CPU damage as needing flushing for DRI buffers
    
    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 9bab91c..72d2d02 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1022,6 +1022,7 @@ void sna_add_flush_pixmap(struct sna *sna,
 {
 	DBG(("%s: marking pixmap=%ld for flushing\n",
 	     __FUNCTION__, priv->pixmap->drawable.serialNumber));
+	assert(bo);
 	list_move(&priv->list, &sna->flush_pixmaps);
 
 	if (bo->exec == NULL && sna->kgem.need_retire)
@@ -2631,6 +2632,10 @@ use_cpu_bo:
 		if ((flags & FORCE_GPU) == 0 && !kgem_bo_is_busy(priv->cpu_bo))
 			return NULL;
 	}
+	if (priv->flush) {
+		assert(!priv->shm);
+		sna_add_flush_pixmap(sna, priv, priv->gpu_bo);
+	}
 
 	DBG(("%s: using CPU bo with damage? %d\n",
 	     __FUNCTION__, *damage != NULL));

commit ac6cb667546a82b865c959a1be32f52b2da7bf7d
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Aug 22 12:00:49 2012 +0100

    sna: Flush before adding any SHM pixmap into the batch
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna.h b/src/sna/sna.h
index 157830b..d655da0 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -458,7 +458,9 @@ sna_drawable_move_to_gpu(DrawablePtr drawable, unsigned flags)
 	return sna_pixmap_move_to_gpu(get_drawable_pixmap(drawable), flags) != NULL;
 }
 
-void sna_add_flush_pixmap(struct sna *sna, struct sna_pixmap *priv);
+void sna_add_flush_pixmap(struct sna *sna,
+			  struct sna_pixmap *priv,
+			  struct kgem_bo *bo);
 
 struct kgem_bo *sna_pixmap_change_tiling(PixmapPtr pixmap, uint32_t tiling);
 
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index bba24e5..9bab91c 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1016,16 +1016,18 @@ fallback:
 	return create_pixmap(sna, screen, width, height, depth, usage);
 }
 
-void sna_add_flush_pixmap(struct sna *sna, struct sna_pixmap *priv)
+void sna_add_flush_pixmap(struct sna *sna,
+			  struct sna_pixmap *priv,
+			  struct kgem_bo *bo)
 {
 	DBG(("%s: marking pixmap=%ld for flushing\n",
 	     __FUNCTION__, priv->pixmap->drawable.serialNumber));
 	list_move(&priv->list, &sna->flush_pixmaps);
 
-	if (sna->kgem.need_retire)
+	if (bo->exec == NULL && sna->kgem.need_retire)
 		kgem_retire(&sna->kgem);
-	if (!sna->kgem.need_retire || !sna->kgem.flush) {
-		DBG(("%s: GPU idle, flushing\n", __FUNCTION__));
+	if (bo->exec == NULL || !sna->kgem.need_retire) {
+		DBG(("%s: flush bo idle, flushing\n", __FUNCTION__));
 		kgem_submit(&sna->kgem);
 	}
 
@@ -1078,8 +1080,8 @@ static Bool sna_destroy_pixmap(PixmapPtr pixmap)
 		kgem_bo_destroy(&sna->kgem, priv->gpu_bo);
 
 	if (priv->shm && kgem_bo_is_busy(priv->cpu_bo)) {
+		sna_add_flush_pixmap(sna, priv, priv->cpu_bo);
 		kgem_bo_submit(&sna->kgem, priv->cpu_bo); /* XXX ShmDetach */
-		sna_add_flush_pixmap(sna, priv);
 	} else
 		__sna_free_pixmap(sna, pixmap, priv);
 	return TRUE;
@@ -1419,7 +1421,7 @@ skip_inplace_map:
 
 		if (priv->flush) {
 			assert(!priv->shm);
-			sna_add_flush_pixmap(sna, priv);
+			sna_add_flush_pixmap(sna, priv, priv->gpu_bo);
 		}
 	}
 
@@ -2030,7 +2032,7 @@ done:
 		}
 		if (priv->flush) {
 			assert(!priv->shm);
-			sna_add_flush_pixmap(sna, priv);
+			sna_add_flush_pixmap(sna, priv, priv->gpu_bo);
 		}
 	}
 
@@ -2244,7 +2246,7 @@ sna_pixmap_move_area_to_gpu(PixmapPtr pixmap, const BoxRec *box, unsigned int fl
 							    box, n, 0);
 				if (ok && priv->shm) {
 					assert(!priv->flush);
-					sna_add_flush_pixmap(sna, priv);
+					sna_add_flush_pixmap(sna, priv, priv->cpu_bo);
 				}
 			}
 			if (!ok) {
@@ -2288,7 +2290,7 @@ sna_pixmap_move_area_to_gpu(PixmapPtr pixmap, const BoxRec *box, unsigned int fl
 						    box, 1, 0);
 			if (ok && priv->shm) {
 				assert(!priv->flush);
-				sna_add_flush_pixmap(sna, priv);
+				sna_add_flush_pixmap(sna, priv, priv->cpu_bo);
 			}
 		}
 		if (!ok) {
@@ -2323,7 +2325,7 @@ sna_pixmap_move_area_to_gpu(PixmapPtr pixmap, const BoxRec *box, unsigned int fl
 						    box, n, 0);
 			if (ok && priv->shm) {
 				assert(!priv->flush);
-				sna_add_flush_pixmap(sna, priv);
+				sna_add_flush_pixmap(sna, priv, priv->cpu_bo);
 			}
 		}
 		if (!ok) {
@@ -2349,7 +2351,7 @@ sna_pixmap_move_area_to_gpu(PixmapPtr pixmap, const BoxRec *box, unsigned int fl
 
 	if (priv->shm) {
 		assert(!priv->flush);
-		sna_add_flush_pixmap(sna, priv);
+		sna_add_flush_pixmap(sna, priv, priv->cpu_bo);
 	}
 
 done:
@@ -2623,7 +2625,7 @@ use_cpu_bo:
 
 	if (priv->shm) {
 		assert(!priv->flush);
-		sna_add_flush_pixmap(sna, priv);
+		sna_add_flush_pixmap(sna, priv, priv->cpu_bo);
 
 		/* As we may have flushed and retired,, recheck for busy bo */
 		if ((flags & FORCE_GPU) == 0 && !kgem_bo_is_busy(priv->cpu_bo))
@@ -2851,7 +2853,7 @@ sna_pixmap_move_to_gpu(PixmapPtr pixmap, unsigned flags)
 						    box, n, 0);
 			if (ok && priv->shm) {
 				assert(!priv->flush);
-				sna_add_flush_pixmap(sna, priv);
+				sna_add_flush_pixmap(sna, priv, priv->cpu_bo);
 			}
 		}
 		if (!ok) {
@@ -2886,7 +2888,7 @@ sna_pixmap_move_to_gpu(PixmapPtr pixmap, unsigned flags)
 
 	if (priv->shm) {
 		assert(!priv->flush);
-		sna_add_flush_pixmap(sna, priv);
+		sna_add_flush_pixmap(sna, priv, priv->cpu_bo);
 	}
 
 	/* For large bo, try to keep only a single copy around */
@@ -3441,7 +3443,7 @@ sna_put_zpixmap_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region,
 		}
 		if (priv->flush) {
 			assert(!priv->shm);
-			sna_add_flush_pixmap(sna, priv);
+			sna_add_flush_pixmap(sna, priv, priv->gpu_bo);
 		}
 	}
 	priv->cpu = true;
@@ -4320,7 +4322,7 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
 
 			if (src_priv->shm) {
 				assert(!src_priv->flush);
-				sna_add_flush_pixmap(sna, src_priv);
+				sna_add_flush_pixmap(sna, src_priv, src_priv->cpu_bo);
 			}
 
 			if (damage)
diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c
index 13822b8..8373890 100644
--- a/src/sna/sna_render.c
+++ b/src/sna/sna_render.c
@@ -378,7 +378,7 @@ use_cpu_bo(struct sna *sna, PixmapPtr pixmap, const BoxRec *box, bool blt)
 
 	if (priv->shm) {
 		assert(!priv->flush);
-		sna_add_flush_pixmap(sna, priv);
+		sna_add_flush_pixmap(sna, priv, priv->cpu_bo);
 	}
 
 	DBG(("%s for box=(%d, %d), (%d, %d)\n",

commit 785c1046b94fd9ca6f22b2a6d73639408a411cea
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Aug 22 10:56:12 2012 +0100

    sna: Only use the GPU for an active CPU bo unless forced
    
    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 110d9c5..bba24e5 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1339,7 +1339,8 @@ skip_inplace_map:


Reply to: