xf86-video-intel: 8 commits - src/sna/blt.c src/sna/brw src/sna/kgem.c src/sna/sna_accel.c

Chris Wilson ickle at kemper.freedesktop.org
Mon Jun 24 03:51:31 PDT 2013


 src/sna/blt.c              |    6 ++
 src/sna/brw/brw_eu.h       |    2 
 src/sna/brw/brw_eu_debug.c |   95 ---------------------------------------------
 src/sna/kgem.c             |   18 ++++++--
 src/sna/sna_accel.c        |   95 +++++++++++++++++++++++++++++++++++++++++----
 5 files changed, 107 insertions(+), 109 deletions(-)

New commits:
commit 72e8ab2b8f7aabee3bd891f08c64f5b2587da8e1
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Jun 24 11:46:38 2013 +0100

    sna: Remove unused brw_eu_debug.c
    
    Reported-by: Maarten Lankhorst <maarten.lankhorst at canonical.com>
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/brw/brw_eu.h b/src/sna/brw/brw_eu.h
index 24ab599..0124ac2 100644
--- a/src/sna/brw/brw_eu.h
+++ b/src/sna/brw/brw_eu.h
@@ -2239,8 +2239,6 @@ void brw_CMP(struct brw_compile *p,
 	     struct brw_reg src0,
 	     struct brw_reg src1);
 
-void brw_print_reg(struct brw_reg reg);
-
 static inline void brw_math_invert(struct brw_compile *p,
 				   struct brw_reg dst,
 				   struct brw_reg src)
diff --git a/src/sna/brw/brw_eu_debug.c b/src/sna/brw/brw_eu_debug.c
deleted file mode 100644
index 99453af..0000000
--- a/src/sna/brw/brw_eu_debug.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- Copyright (C) Intel Corp.  2006.  All Rights Reserved.
- Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to
- develop this 3D driver.
- 
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
- 
- The above copyright notice and this permission notice (including the
- next paragraph) shall be included in all copies or substantial
- portions of the Software.
- 
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- 
- **********************************************************************/
- /*
-  * Authors:
-  *   Keith Whitwell <keith at tungstengraphics.com>
-  */
-    
-
-#include "main/mtypes.h"
-#include "main/imports.h"
-#include "brw_eu.h"
-
-void brw_print_reg( struct brw_reg hwreg )
-{
-   static const char *file[] = {
-      "arf",
-      "grf",
-      "msg",
-      "imm"
-   };
-
-   static const char *type[] = {
-      "ud",
-      "d",
-      "uw",
-      "w",
-      "ub",
-      "vf",
-      "hf",
-      "f"
-   };
-
-   printf("%s%s", 
-	  hwreg.abs ? "abs/" : "",
-	  hwreg.negate ? "-" : "");
-     
-   if (hwreg.file == BRW_GENERAL_REGISTER_FILE &&
-       hwreg.nr % 2 == 0 &&
-       hwreg.subnr == 0 &&
-       hwreg.vstride == BRW_VERTICAL_STRIDE_8 &&
-       hwreg.width == BRW_WIDTH_8 &&
-       hwreg.hstride == BRW_HORIZONTAL_STRIDE_1 &&
-       hwreg.type == BRW_REGISTER_TYPE_F) {
-      /* vector register */
-      printf("vec%d", hwreg.nr);
-   }
-   else if (hwreg.file == BRW_GENERAL_REGISTER_FILE &&
-	    hwreg.vstride == BRW_VERTICAL_STRIDE_0 &&
-	    hwreg.width == BRW_WIDTH_1 &&
-	    hwreg.hstride == BRW_HORIZONTAL_STRIDE_0 &&
-	    hwreg.type == BRW_REGISTER_TYPE_F) {      
-      /* "scalar" register */
-      printf("scl%d.%d", hwreg.nr, hwreg.subnr / 4);
-   }
-   else if (hwreg.file == BRW_IMMEDIATE_VALUE) {
-      printf("imm %f", hwreg.dw1.f);
-   }
-   else {
-      printf("%s%d.%d<%d;%d,%d>:%s", 
-		   file[hwreg.file],
-		   hwreg.nr,
-		   hwreg.subnr / type_sz(hwreg.type),
-		   hwreg.vstride ? (1<<(hwreg.vstride-1)) : 0,
-		   1<<hwreg.width,
-		   hwreg.hstride ? (1<<(hwreg.hstride-1)) : 0,		
-		   type[hwreg.type]);
-   }
-}
-
-
-
commit 6ca4ae441c61b1f425453cc443bb1d4d10d25aaa
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Jun 23 23:41:57 2013 +0100

    sna: Check for a request to create an inactive scanout
    
    The combination is just about valid and used along some odd paths, so
    replace the assertion with a regular checks.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 76f393d..8e056d3 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -3665,8 +3665,7 @@ struct kgem_bo *kgem_create_2d(struct kgem *kgem,
 	size /= PAGE_SIZE;
 	bucket = cache_bucket(size);
 
-	if (flags & CREATE_SCANOUT) {
-		assert((flags & CREATE_INACTIVE) == 0);
+	if ((flags & (CREATE_SCANOUT | CREATE_INACTIVE)) == CREATE_SCANOUT) {
 		list_for_each_entry_reverse(bo, &kgem->scanout, list) {
 			assert(bo->scanout);
 			assert(bo->delta);
commit b459ab9eeba4c865f15f0b3e28af318948b4adbd
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Jun 23 23:00:55 2013 +0100

    sna: Move the reset bo to the right list
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index b32ceee..76f393d 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -2519,9 +2519,18 @@ void kgem_reset(struct kgem *kgem)
 			} else
 				__kgem_bo_clear_busy(bo);
 
-			if (!bo->refcnt && !bo->reusable) {
-				assert(!bo->snoop);
-				DBG(("%s: discarding handle=%d\n",
+			if (bo->refcnt || bo->rq)
+				continue;
+
+			if (bo->snoop) {
+				kgem_bo_move_to_snoop(kgem, bo);
+			} else if (bo->scanout) {
+				kgem_bo_move_to_scanout(kgem, bo);
+			} else if ((bo = kgem_bo_replace_io(bo))->reusable &&
+				   kgem_bo_set_purgeable(kgem, bo)) {
+				kgem_bo_move_to_inactive(kgem, bo);
+			} else {
+				DBG(("%s: closing %d\n",
 				     __FUNCTION__, bo->handle));
 				kgem_bo_free(kgem, bo);
 			}
commit 77ddadf0ec6b867a0638660bf06c82ad31577795
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Jun 23 22:01:12 2013 +0100

    sna: Clear 'clear' hint upon uploading into tiled
    
    Fixes regression from
    commit 53c113c3cc2f8527debc185f0819139ca8637637 [2.21.10]
    Author: Chris Wilson <chris at chris-wilson.co.uk>
    Date:   Fri Jun 21 19:27:24 2013 +0100
    
        sna: Allow PutImage to write inplace using manual tiling
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66059
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 0994c33..43d6a67 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -4000,6 +4000,8 @@ try_upload_tiled_x(PixmapPtr pixmap, RegionRec *region,
 	} while (--n);
 	__kgem_bo_unmap__cpu(&sna->kgem, priv->gpu_bo, dst);
 
+	priv->clear = false;
+	priv->cpu = false;
 	return true;
 }
 
commit d3de043d2de4aa11a85c56faf1658ec4c4699da2
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Jun 23 21:30:56 2013 +0100

    sna: Discard proxy upload buffers before overwritting for PutImage
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index ba97b33..0994c33 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -3942,7 +3942,13 @@ try_upload_tiled_x(PixmapPtr pixmap, RegionRec *region,
 
 	DBG(("%s: bo? %d, can tile? %d\n", __FUNCTION__,
 	     priv->gpu_bo != NULL,
-	     priv->gpu_bo ? can_upload_tiled(&sna->kgem, priv->gpu_bo) : 0));
+	     priv->gpu_bo ? can_upload_tiled_x(&sna->kgem, priv->gpu_bo) : 0));
+
+	if (priv->gpu_bo && priv->gpu_bo->proxy) {
+		DBG(("%s: discarding cached upload proxy\n", __FUNCTION__));
+		kgem_bo_destroy(&sna->kgem, priv->gpu_bo);
+		priv->gpu_bo = NULL;
+	}
 
 	if (priv->gpu_bo == NULL &&
 	    !create_upload_tiled_x(&sna->kgem, pixmap, priv))
commit d68d24dc3727dcc281bc9b45bc605874f3a3c4f2
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Jun 23 19:08:32 2013 +0100

    sna: Discard overwritten incomplete operations before migrating
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index f95d526..ba97b33 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1821,6 +1821,13 @@ _sna_pixmap_move_to_cpu(PixmapPtr pixmap, unsigned int flags)
 
 	assert(priv->gpu_damage == NULL || priv->gpu_bo);
 
+	if ((flags & MOVE_READ) == 0) {
+		if (priv->gpu_bo)
+			kgem_bo_undo(&sna->kgem, priv->gpu_bo);
+		if (priv->cpu_bo)
+			kgem_bo_undo(&sna->kgem, priv->cpu_bo);
+	}
+
 	if (USE_INPLACE && (flags & MOVE_READ) == 0 && !priv->cow) {
 		assert(flags & MOVE_WRITE);
 		DBG(("%s: no readbck, discarding gpu damage [%d], pending clear[%d]\n",
@@ -3482,6 +3489,13 @@ sna_pixmap_move_to_gpu(PixmapPtr pixmap, unsigned flags)
 
 	assert(priv->gpu_damage == NULL || priv->gpu_bo);
 
+	if ((flags & MOVE_READ) == 0) {
+		if (priv->gpu_bo)
+			kgem_bo_undo(&sna->kgem, priv->gpu_bo);
+		if (priv->cpu_bo)
+			kgem_bo_undo(&sna->kgem, priv->cpu_bo);
+	}
+
 	if (priv->cow && (flags & MOVE_WRITE || priv->cpu_damage)) {
 		if (!sna_pixmap_undo_cow(sna, priv, flags & MOVE_READ))
 			return false;
@@ -3947,6 +3961,14 @@ try_upload_tiled_x(PixmapPtr pixmap, RegionRec *region,
 	n = RegionNumRects(region);
 
 	DBG(("%s: upload(%d, %d, %d, %d) x %d\n", __FUNCTION__, x, y, w, h, n));
+
+	if (n == 1 &&
+	    w >= pixmap->drawable.width &&
+	    h >= pixmap->drawable.height) {
+		DBG(("%s: discarding operations to GPU bo\n", __FUNCTION__));
+		kgem_bo_undo(&sna->kgem, priv->gpu_bo);
+	}
+
 	if (!DAMAGE_IS_ALL(priv->gpu_damage)) {
 		sna_damage_add(&priv->gpu_damage, region);
 		sna_damage_reduce_all(&priv->gpu_damage,
commit 60dbd5a5b6cd56b7a33eac3afebe2d94ac8579c7
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Jun 23 18:51:38 2013 +0100

    sna: Document swizzling for DBG
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/blt.c b/src/sna/blt.c
index 4dbd9e8..b27c683 100644
--- a/src/sna/blt.c
+++ b/src/sna/blt.c
@@ -487,16 +487,22 @@ void choose_memcpy_to_tiled_x(struct kgem *kgem, int swizzling)
 {
 	switch (swizzling) {
 	default:
+		DBG(("%s: unknown swizzling, %d\n", __FUNCTION__, swizzling));
+		break;
 	case I915_BIT_6_SWIZZLE_NONE:
+		DBG(("%s: no swizzling\n", __FUNCTION__));
 		kgem->memcpy_to_tiled_x = memcpy_to_tiled_x__swizzle_0;
 		break;
 	case I915_BIT_6_SWIZZLE_9:
+		DBG(("%s: 6^9 swizzling\n", __FUNCTION__));
 		kgem->memcpy_to_tiled_x = memcpy_to_tiled_x__swizzle_9;
 		break;
 	case I915_BIT_6_SWIZZLE_9_10:
+		DBG(("%s: 6^9^10 swizzling\n", __FUNCTION__));
 		kgem->memcpy_to_tiled_x = memcpy_to_tiled_x__swizzle_9_10;
 		break;
 	case I915_BIT_6_SWIZZLE_9_11:
+		DBG(("%s: 6^9^11 swizzling\n", __FUNCTION__));
 		kgem->memcpy_to_tiled_x = memcpy_to_tiled_x__swizzle_9_11;
 		break;
 	}
commit fd375da5caf34f93a4e87670bb0c70fec5b4c55c
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Jun 23 17:06:11 2013 +0100

    sna: Allow tiled uploads to accumulate damage
    
    And for the upload to create the bo as required.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index c8d4088..f95d526 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -3868,9 +3868,6 @@ static inline void box32_add_rect(Box32Rec *box, const xRectangle *r)
 
 static bool can_upload_tiled_x(struct kgem *kgem, struct kgem_bo *bo)
 {
-	if (!kgem->memcpy_to_tiled_x)
-		return false;
-
 	if (bo->tiling != I915_TILING_X)
 		return false;
 
@@ -3881,6 +3878,39 @@ static bool can_upload_tiled_x(struct kgem *kgem, struct kgem_bo *bo)
 }
 
 static bool
+create_upload_tiled_x(struct kgem *kgem,
+		      PixmapPtr pixmap,
+		      struct sna_pixmap *priv)
+{
+	unsigned create, tiling;
+
+	if (priv->shm)
+		return false;
+
+	if ((priv->create & KGEM_CAN_CREATE_GPU) == 0)
+		return false;
+
+	tiling = sna_pixmap_choose_tiling(pixmap, I915_TILING_X);
+	if (!(tiling == I915_TILING_X || tiling == -I915_TILING_X))
+		return false;
+
+	assert(priv->gpu_bo == NULL);
+	assert(priv->gpu_damage == NULL);
+
+	create = CREATE_CPU_MAP | CREATE_INACTIVE | CREATE_EXACT;
+	if (pixmap->usage_hint == SNA_CREATE_FB)
+		create |= CREATE_SCANOUT;
+
+	priv->gpu_bo =
+		kgem_create_2d(kgem,
+			       pixmap->drawable.width,
+			       pixmap->drawable.height,
+			       pixmap->drawable.bitsPerPixel,
+			       tiling, create);
+	return priv->gpu_bo != NULL;
+}
+
+static bool
 try_upload_tiled_x(PixmapPtr pixmap, RegionRec *region,
 		   int x, int y, int w, int  h, char *bits, int stride)
 {
@@ -3890,12 +3920,21 @@ try_upload_tiled_x(PixmapPtr pixmap, RegionRec *region,
 	uint8_t *dst;
 	int n;
 
+	if (!sna->kgem.memcpy_to_tiled_x)
+		return false;
+
+	if (wedged(sna))
+		return false;
+
 	DBG(("%s: bo? %d, can tile? %d\n", __FUNCTION__,
 	     priv->gpu_bo != NULL,
 	     priv->gpu_bo ? can_upload_tiled(&sna->kgem, priv->gpu_bo) : 0));
 
-	if (!DAMAGE_IS_ALL(priv->gpu_damage) ||
-	    !can_upload_tiled_x(&sna->kgem, priv->gpu_bo))
+	if (priv->gpu_bo == NULL &&
+	    !create_upload_tiled_x(&sna->kgem, pixmap, priv))
+		return false;
+
+	if (!can_upload_tiled_x(&sna->kgem, priv->gpu_bo))
 		return false;
 
 	assert(priv->gpu_bo->tiling == I915_TILING_X);
@@ -3908,6 +3947,18 @@ try_upload_tiled_x(PixmapPtr pixmap, RegionRec *region,
 	n = RegionNumRects(region);
 
 	DBG(("%s: upload(%d, %d, %d, %d) x %d\n", __FUNCTION__, x, y, w, h, n));
+	if (!DAMAGE_IS_ALL(priv->gpu_damage)) {
+		sna_damage_add(&priv->gpu_damage, region);
+		sna_damage_reduce_all(&priv->gpu_damage,
+				      pixmap->drawable.width,
+				      pixmap->drawable.height);
+		if (DAMAGE_IS_ALL(priv->gpu_damage)) {
+			list_del(&priv->flush_list);
+			sna_pixmap_free_cpu(sna, priv);
+		}
+	}
+	if (priv->cpu_damage)
+		sna_damage_subtract(&priv->cpu_damage, region);
 
 	kgem_bo_sync__cpu(&sna->kgem, priv->gpu_bo);
 	do {
@@ -6111,7 +6162,7 @@ damage_clipped:
 
 		DBG(("%s: clip %ld x [(%d, %d), (%d, %d)] x %d [(%d, %d)...]\n",
 		     __FUNCTION__,
-		     RegionNumRects(&clip),
+		     (long)RegionNumRects(&clip),
 		     clip.extents.x1, clip.extents.y1, clip.extents.x2, clip.extents.y2,
 		     n, pt->x, pt->y));
 


More information about the xorg-commit mailing list