[PATCH driver/intel] Allow copy_front() to fail and clean up gracefully if it does

Egbert Eich eich at suse.com
Fri Sep 26 09:05:07 PDT 2014


Hi Chris,

Chris Wilson writes:
 > 
 > Also realised that even this should be fixed up as a last resort by
 > falling back to the shadow CRTC allocation. That band-aid should be
 > working again.
 > 
 > Hopefully
 > 
 > commit 9f7c1a4c4f2a6352263c36e75a984ed4095adbc0
 > Author: Chris Wilson <chris at chris-wilson.co.uk>
 > Date:   Thu Sep 25 16:29:14 2014 +0100
 > 
 >     sna: Check for scanout pitch restrictions on linear GPU bo
 >     
 >     When converting a linear cached CPU bo into an uncached GPU bo, we must
 >     be careful to adhere to the scanout restrictions if they apply for this
 >     transfer or this Pixmap.
 >     
 >     Reported-by: Egbert Eich <eich at suse.com>
 >     Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
 > 
 > catches all the cases where we need to check the alignment on the pitch
 > before changing the cache level. If not, it now explicitly converts the
 > bo before making the framebuffer.

thanks for looking into this! I can confirm that the patch works.

I took a brief look into why the server terminates at server reset
when the the patch which fixes the tiling isn't applied. 
This happens in sna_create_screen_resources() when sna_pixmap_force_to_gpu() 
fails and the entire creatSecreenResources fails.
Since sna_pixmap_force_to_gpu() is allowed to fail at other places
as alternatives will be used I looked who might need this call. 
The only thing I found was sna_copy_fbcon() which will fail in 
assert(priv && priv->gpu_bo). sna_copy_fbcon() is however not vital:
The fix below made this work for me.
This is a simple hack, one could also use a bo to a supported front 
buffer instead of insisiting a GPU bo.

Later on use_shadow() should take care of a the failure of 
sna_pixmap_force_to_gpu() in sna_create_screen_resources(). 

Or can you think of another reason why this is needed so early?

Cheers,
	Egbert.

From: Egbert Eich <eich at freedesktop.org>
Date: Fri, 26 Sep 2014 17:57:55 +0200
Subject: [PATCH driver/intel] In sna_create_screen_resources() don't make
 sna_pixmap_force_to_gpu() mandatory

Signed-off-by: Egbert Eich <eich at freedesktop.org>
---
 src/sna/sna_display.c |  3 ++-
 src/sna/sna_driver.c  | 11 +----------
 2 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 0aa7557..a55bdb9 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -1625,7 +1625,8 @@ void sna_copy_fbcon(struct sna *sna)
 	assert((sna->flags & SNA_IS_HOSTED) == 0);
 
 	priv = sna_pixmap(sna->front);
-	assert(priv && priv->gpu_bo);
+	if (!priv || !priv->gpu_bo)
+	    return;
 
 	/* Scan the connectors for a framebuffer and assume that is the fbcon */
 	VG_CLEAR(fbcon);
diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c
index 7eed214..fe2a6ec 100644
--- a/src/sna/sna_driver.c
+++ b/src/sna/sna_driver.c
@@ -248,16 +248,7 @@ static Bool sna_create_screen_resources(ScreenPtr screen)
 		return FALSE;
 	}
 
-	if (!sna_pixmap_force_to_gpu(new_front, MOVE_READ)) {
-		xf86DrvMsg(screen->myNum, X_ERROR,
-			   "[intel] Failed to allocate video resources for front buffer %dx%d at depth %d\n",
-			   screen->width,
-			   screen->height,
-			   screen->rootDepth);
-		screen->DestroyPixmap(new_front);
-		return FALSE;
-	}
-
+	sna_pixmap_force_to_gpu(new_front, MOVE_READ);
 	screen->SetScreenPixmap(new_front);
 	assert(screen->GetScreenPixmap(screen) == new_front);
 	assert(sna->front == new_front);
-- 
1.8.4.5



More information about the xorg-devel mailing list