xf86-video-intel: 2 commits - src/i830_dri.c src/i830.h src/i830_uxa.c src/i915_render.c

Chris Wilson ickle at kemper.freedesktop.org
Sat May 29 02:42:42 PDT 2010


 src/i830.h        |    1 +
 src/i830_dri.c    |   22 +++++++++++-----------
 src/i830_uxa.c    |    1 +
 src/i915_render.c |   10 +++++-----
 4 files changed, 18 insertions(+), 16 deletions(-)

New commits:
commit 44d45d3fa56f121ce89ffe5b28beb48be01a95df
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat May 29 10:39:28 2010 +0100

    dri: Use size from backing pixmap when creating buffers.
    
    This avoid using the garbage values stored in the Screen drawable,
    instead of the true values which are only maintained in its backing
    pixmap. The consequence of using the wrong size was to hand a 1x1
    pixmap to metacity/mutter and have it believe it was a full screen
    drawable; GPU hangs ensued if using page flipping.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/i830_dri.c b/src/i830_dri.c
index 61abd36..f7b9018 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -83,7 +83,7 @@ I830DRI2CreateBuffers(DrawablePtr drawable, unsigned int *attachments,
 	intel_screen_private *intel = intel_get_screen_private(scrn);
 	DRI2BufferPtr buffers;
 	dri_bo *bo;
-	int i;
+	int i, width, height, depth;
 	I830DRI2BufferPrivatePtr privates;
 	PixmapPtr pixmap, pDepthPixmap;
 
@@ -96,6 +96,11 @@ I830DRI2CreateBuffers(DrawablePtr drawable, unsigned int *attachments,
 		return NULL;
 	}
 
+	pixmap = get_drawable_pixmap(drawable);
+	width = pixmap->drawable.width;
+	height = pixmap->drawable.height;
+	depth = pixmap->drawable.depth;
+
 	pDepthPixmap = NULL;
 	for (i = 0; i < count; i++) {
 		if (attachments[i] == DRI2BufferFrontLeft) {
@@ -125,12 +130,7 @@ I830DRI2CreateBuffers(DrawablePtr drawable, unsigned int *attachments,
 			if (!intel->tiling)
 				hint = 0;
 
-			pixmap = screen->CreatePixmap(screen,
-						      drawable->width,
-						      drawable->height,
-						      drawable->depth,
-						      hint);
-
+			pixmap = screen->CreatePixmap(screen, width, height, depth, hint);
 		}
 
 		if (attachments[i] == DRI2BufferDepth)
@@ -196,8 +196,8 @@ I830DRI2CreateBuffer(DrawablePtr drawable, unsigned int attachment,
 		return NULL;
 	}
 
+	pixmap = get_drawable_pixmap(drawable);
 	if (attachment == DRI2BufferFrontLeft) {
-		pixmap = get_drawable_pixmap(drawable);
 		pixmap->refcnt++;
 	} else {
 		unsigned int hint = 0;
@@ -222,10 +222,10 @@ I830DRI2CreateBuffer(DrawablePtr drawable, unsigned int attachment,
 			hint = 0;
 
 		pixmap = screen->CreatePixmap(screen,
-					      drawable->width,
-					      drawable->height,
+					      pixmap->drawable.width,
+					      pixmap->drawable.height,
 					      (format != 0) ? format :
-							      drawable->depth,
+							      pixmap->drawable.depth,
 					      hint);
 
 	}
commit 90c74a43149ec72bef64fb7e64b812294bda69a5
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri May 28 21:49:38 2010 +0100

    i915: Don't re-emit vertex size unless it has changed.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/i830.h b/src/i830.h
index a69f60d..d0628fe 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -367,6 +367,7 @@ typedef struct intel_screen_private {
 			  int dstX, int dstY,
 			  int w, int h);
 	int floats_per_vertex;
+	int last_floats_per_vertex;
 	uint32_t vertex_count;
 	uint32_t vertex_index;
 	uint32_t vertex_used;
diff --git a/src/i830_uxa.c b/src/i830_uxa.c
index b063d0f..208de07 100644
--- a/src/i830_uxa.c
+++ b/src/i830_uxa.c
@@ -1088,6 +1088,7 @@ Bool i830_uxa_init(ScreenPtr screen)
 	intel->prim_offset = 0;
 	intel->vertex_count = 0;
 	intel->floats_per_vertex = 0;
+	intel->last_floats_per_vertex = 0;
 	intel->vertex_bo = NULL;
 
 	/* Solid fill */
diff --git a/src/i915_render.c b/src/i915_render.c
index 3d38397..1c9127b 100644
--- a/src/i915_render.c
+++ b/src/i915_render.c
@@ -1166,10 +1166,8 @@ i915_composite(PixmapPtr dest, int srcX, int srcY, int maskX, int maskY,
 	if (intel->needs_render_state_emit)
 		i915_emit_composite_setup(scrn);
 
-	if (intel_vertex_space(intel) < 3*4*intel->floats_per_vertex)
-		intel->needs_render_vertex_emit = TRUE;
-
-	if (intel->needs_render_vertex_emit) {
+	if (intel->needs_render_vertex_emit ||
+	    intel_vertex_space(intel) < 3*4*intel->floats_per_vertex) {
 		i915_vertex_flush(intel);
 
 		if (intel_vertex_space(intel) < 256) {
@@ -1181,7 +1179,7 @@ i915_composite(PixmapPtr dest, int srcX, int srcY, int maskX, int maskY,
 			OUT_BATCH((intel->floats_per_vertex << S1_VERTEX_WIDTH_SHIFT) |
 				  (intel->floats_per_vertex << S1_VERTEX_PITCH_SHIFT));
 			intel->vertex_index = 0;
-		} else {
+		} else if (intel->floats_per_vertex != intel->last_floats_per_vertex){
 			OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 |
 				  I1_LOAD_S(1) | 0);
 			OUT_BATCH((intel->floats_per_vertex << S1_VERTEX_WIDTH_SHIFT) |
@@ -1192,6 +1190,7 @@ i915_composite(PixmapPtr dest, int srcX, int srcY, int maskX, int maskY,
 			intel->vertex_used = intel->vertex_index * intel->floats_per_vertex;
 		}
 
+		intel->last_floats_per_vertex = intel->floats_per_vertex;
 		intel->needs_render_vertex_emit = FALSE;
 	}
 
@@ -1248,4 +1247,5 @@ i915_batch_flush_notify(ScrnInfoPtr scrn)
 	intel_screen_private *intel = intel_get_screen_private(scrn);
 
 	intel->needs_render_state_emit = TRUE;
+	intel->last_floats_per_vertex = 0;
 }


More information about the xorg-commit mailing list