xf86-video-intel: 3 commits - src/sna/kgem.c src/sna/sna_accel.c src/sna/sna_driver.c

Chris Wilson ickle at kemper.freedesktop.org
Thu Mar 8 04:24:44 PST 2012


 src/sna/kgem.c       |    2 +-
 src/sna/sna_accel.c  |   22 +++++++++++++++++++---
 src/sna/sna_driver.c |    2 +-
 3 files changed, 21 insertions(+), 5 deletions(-)

New commits:
commit f8d520950edb5cec878999a09d3f7e6f8b15bf5e
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Mar 8 12:13:36 2012 +0000

    sna: Avoid NULL deference in DBG
    
    Only print out the details of the allocated CPU bo, if we actually
    allocate it.
    
    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 a1798a5..08ee537 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -313,10 +313,10 @@ sna_pixmap_alloc_cpu(struct sna *sna,
 						  pixmap->drawable.height,
 						  pixmap->drawable.bitsPerPixel,
 						  from_gpu ? 0 : CREATE_CPU_MAP | CREATE_INACTIVE);
-		DBG(("%s: allocated CPU handle=%d\n", __FUNCTION__,
-		     priv->cpu_bo->handle));
-
 		if (priv->cpu_bo) {
+			DBG(("%s: allocated CPU handle=%d\n", __FUNCTION__,
+			     priv->cpu_bo->handle));
+
 			priv->ptr = kgem_bo_map__cpu(&sna->kgem, priv->cpu_bo);
 			priv->stride = priv->cpu_bo->pitch;
 		}
commit 33af42e6284f104ed3c4cdba4bf3b1c29322ce9c
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Mar 8 12:10:24 2012 +0000

    sna: Force the creation of a backing pixmap for scanout
    
    Ordinarily if the GPU is wedged, we just want to create a shadow buffer.
    Except that we must ensure that we do allow a bo to be created for
    attaching to the scanout.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 2dff2ed..cfa46cf 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -2365,7 +2365,7 @@ unsigned kgem_can_create_2d(struct kgem *kgem,
 	uint32_t pitch, size;
 	unsigned flags = 0;
 
-	if (depth < 8 || kgem->wedged)
+	if (depth < 8)
 		return 0;
 
 	if (width > MAXSHORT || height > MAXSHORT)
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 2769d4b..a1798a5 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -730,6 +730,14 @@ static PixmapPtr sna_create_pixmap(ScreenPtr screen,
 	}
 	assert(width && height);
 
+	if (wedged(sna)) {
+		if (usage == SNA_CREATE_FB) {
+			flags = KGEM_CAN_CREATE_GPU;
+			goto force_create;
+		}
+		goto fallback;
+	}
+
 	flags = kgem_can_create_2d(&sna->kgem, width, height, depth);
 	if (flags == 0) {
 		DBG(("%s: can not use GPU, just creating shadow\n",
@@ -758,6 +766,7 @@ static PixmapPtr sna_create_pixmap(ScreenPtr screen,
 	if (usage == CREATE_PIXMAP_USAGE_GLYPH_PICTURE)
 		goto fallback;
 
+force_create:
 	pad = PixmapBytePad(width, depth);
 	if (pad * height <= 4096) {
 		DBG(("%s: small buffer [%d], attaching to shadow pixmap\n",
commit 6abfa4c5662e5294edc501953dbfa7aabf0b2f57
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Mar 8 11:59:02 2012 +0000

    sna: Mark the pixmap for writing when creating the screen resources
    
    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 419d1c6..2769d4b 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -2051,6 +2051,13 @@ sna_pixmap_force_to_gpu(PixmapPtr pixmap, unsigned flags)
 		struct sna *sna = to_sna_from_pixmap(pixmap);
 		unsigned mode;
 
+		DBG(("%s: forcing creation of  gpu bo (%dx%d@%d, flags=%x)\n",
+		     __FUNCTION__,
+		     pixmap->drawable.width,
+		     pixmap->drawable.height,
+		     pixmap->drawable.bitsPerPixel,
+		     priv->create));
+
 		mode = 0;
 		if (priv->cpu_damage && !priv->cpu_bo)
 			mode |= CREATE_INACTIVE;
diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c
index e53b75f..ddacfd1 100644
--- a/src/sna/sna_driver.c
+++ b/src/sna/sna_driver.c
@@ -198,7 +198,7 @@ static Bool sna_create_screen_resources(ScreenPtr screen)
 		return FALSE;
 	}
 
-	if (!sna_pixmap_force_to_gpu(sna->front, MOVE_READ)) {
+	if (!sna_pixmap_force_to_gpu(sna->front, MOVE_WRITE)) {
 		xf86DrvMsg(screen->myNum, X_ERROR,
 			   "[intel] Failed to allocate video resources for front buffer %dx%d at depth %d\n",
 			   screen->width,


More information about the xorg-commit mailing list