xf86-video-intel: 3 commits - src/sna/compiler.h src/sna/gen4_vertex.c src/sna/sna_threads.c src/sna/sna_trapezoids.c src/sna/sna_video_sprite.c

Chris Wilson ickle at kemper.freedesktop.org
Sun Aug 4 05:28:36 PDT 2013


 src/sna/compiler.h         |    2 ++
 src/sna/gen4_vertex.c      |    6 +++---
 src/sna/sna_threads.c      |    7 +++++--
 src/sna/sna_trapezoids.c   |   24 +++++++++++++++---------
 src/sna/sna_video_sprite.c |    2 +-
 5 files changed, 26 insertions(+), 15 deletions(-)

New commits:
commit 2536ad044b259eb3ce3e7b1ccf2c59ab3fe37d06
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Aug 4 12:50:41 2013 +0100

    sna: Tweak threading thresholds
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_threads.c b/src/sna/sna_threads.c
index f77ddbf..21fd94c 100644
--- a/src/sna/sna_threads.c
+++ b/src/sna/sna_threads.c
@@ -208,7 +208,10 @@ int sna_use_threads(int width, int height, int threshold)
 	if (max_threads <= 0)
 		return 1;
 
-	num_threads = height / (128/width + 1) / threshold-1;
+	if (width < 128)
+		height /= 128/width;
+
+	num_threads = height * max_threads / threshold - 1;
 	if (num_threads <= 0)
 		return 1;
 
@@ -251,7 +254,7 @@ void sna_image_composite(pixman_op_t        op,
 {
 	int num_threads;
 
-	num_threads = sna_use_threads(width, height, 16);
+	num_threads = sna_use_threads(width, height, 32);
 	if (num_threads <= 1) {
 		pixman_image_composite(op, src, mask, dst,
 				       src_x, src_y,
diff --git a/src/sna/sna_trapezoids.c b/src/sna/sna_trapezoids.c
index 04c8448..e3b406e 100644
--- a/src/sna/sna_trapezoids.c
+++ b/src/sna/sna_trapezoids.c
@@ -2556,7 +2556,7 @@ trapezoids_fallback(struct sna *sna,
 			if (!scratch)
 				return;
 
-			num_threads = sna_use_threads(width, height, 4);
+			num_threads = sna_use_threads(width, height, 8);
 			if (num_threads == 1) {
 				if (depth < 8) {
 					image = pixman_image_create_bits(format, width, height,
@@ -4280,7 +4280,7 @@ mono_trapezoids_span_converter(struct sna *sna,
 	    !unbounded)
 		num_threads = sna_use_threads(mono.clip.extents.x2 - mono.clip.extents.x1,
 					      mono.clip.extents.y2 - mono.clip.extents.y1,
-					      16);
+					      32);
 	if (num_threads > 1) {
 		struct mono_span_thread threads[num_threads];
 		int y, h;
@@ -5795,7 +5795,7 @@ trapezoid_span_inplace__x8r8g8b8(CARD8 op,
 
 	num_threads = sna_use_threads(4*(region.extents.x2 - region.extents.x1),
 				      region.extents.y2 - region.extents.y1,
-				      8);
+				      16);
 
 	DBG(("%s: %dx%d, format=%x, op=%d, lerp?=%d, num_threads=%d\n",
 	     __FUNCTION__,
@@ -6166,7 +6166,7 @@ trapezoid_span_inplace(struct sna *sna,
 
 	num_threads = sna_use_threads(region.extents.x2 - region.extents.x1,
 				      region.extents.y2 - region.extents.y1,
-				      8);
+				      16);
 	if (num_threads == 1) {
 		struct tor tor;
 
commit 2cdd57c804706bcf558d16d3370c1880ef482af1
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Aug 4 11:43:54 2013 +0100

    sna/trapezoids: Some minor DBG to investigate threaded rendering
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/gen4_vertex.c b/src/sna/gen4_vertex.c
index a82f961..dab11e8 100644
--- a/src/sna/gen4_vertex.c
+++ b/src/sna/gen4_vertex.c
@@ -1906,9 +1906,9 @@ emit_composite_spans_primitive(struct sna *sna,
 
 sse2 fastcall static void
 emit_span_solid(struct sna *sna,
-		 const struct sna_composite_spans_op *op,
-		 const BoxRec *box,
-		 float opacity)
+		const struct sna_composite_spans_op *op,
+		const BoxRec *box,
+		float opacity)
 {
 	float *v;
 	union {
diff --git a/src/sna/sna_trapezoids.c b/src/sna/sna_trapezoids.c
index feb1d40..04c8448 100644
--- a/src/sna/sna_trapezoids.c
+++ b/src/sna/sna_trapezoids.c
@@ -4123,15 +4123,15 @@ choose_span(struct sna_composite_spans_op *tmp,
 		/* XXX An imprecise approximation */
 		if (maskFormat && !operator_is_bounded(tmp->base.op)) {
 			span = tor_blt_span_mono_unbounded;
-			if (REGION_NUM_RECTS(clip) > 1)
+			if (clip->data)
 				span = tor_blt_span_mono_unbounded_clipped;
 		} else {
 			span = tor_blt_span_mono;
-			if (REGION_NUM_RECTS(clip) > 1)
+			if (clip->data)
 				span = tor_blt_span_mono_clipped;
 		}
 	} else {
-		if (REGION_NUM_RECTS(clip) > 1)
+		if (clip->data)
 			span = tor_blt_span_clipped;
 		else if (tmp->base.damage == NULL)
 			span = tor_blt_span__no_damage;
@@ -4485,13 +4485,18 @@ thread_choose_span(struct sna_composite_spans_op *tmp,
 {
 	span_func_t span;
 
-	if (tmp->base.damage)
+	if (tmp->base.damage) {
+		DBG(("%s: damaged -> no thread support\n", __FUNCTION__));
 		return NULL;
+	}
 
 	if (is_mono(dst, maskFormat)) {
+		DBG(("%s: mono rendering -> no thread support\n", __FUNCTION__));
 		return NULL;
 	} else {
-		if (REGION_NUM_RECTS(clip) > 1)
+		assert(tmp->thread_boxes);
+		DBG(("%s: clipped? %d\n", __FUNCTION__, clip->data != NULL));
+		if (clip->data)
 			span = span_thread_clipped_box;
 		else
 			span = span_thread_box;
@@ -4667,6 +4672,7 @@ trapezoid_span_converter(struct sna *sna,
 		num_threads = sna_use_threads(extents.x2-extents.x1,
 					      extents.y2-extents.y1,
 					      16);
+	DBG(("%s: using %d threads\n", __FUNCTION__, num_threads));
 	if (num_threads == 1) {
 		struct tor tor;
 
diff --git a/src/sna/sna_video_sprite.c b/src/sna/sna_video_sprite.c
index 7148253..07e59bd 100644
--- a/src/sna/sna_video_sprite.c
+++ b/src/sna/sna_video_sprite.c
@@ -87,7 +87,7 @@ static int sna_video_sprite_set_attr(ClientPtr client,
 	if (attribute == xvColorKey) {
 		video->color_key_changed = true;
 		video->color_key = value;
-		DBG(("COLORKEY = %d\n", value));
+		DBG(("COLORKEY = %ld\n", (long)value));
 	} else
 		return BadMatch;
 
commit 1f7e20d812ef46fa0cba492e06a8f9f5a326d3c5
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Aug 4 12:26:36 2013 +0100

    sna: Define fast function attribute for old gcc or other compilers
    
    Also written by Mark Kettenis and reported by Sedat Dilek.
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/compiler.h b/src/sna/compiler.h
index 2f5dfc7..28d3351 100644
--- a/src/sna/compiler.h
+++ b/src/sna/compiler.h
@@ -67,6 +67,8 @@
 
 #if HAS_GCC(4, 6) && defined(__OPTIMIZE__)
 #define fast __attribute__((optimize("Ofast")))
+#else
+#define fast
 #endif
 
 #if HAS_GCC(4, 6) && defined(__OPTIMIZE__)


More information about the xorg-commit mailing list