[Intel-gfx] [PATCH 3/6] i830_bind_memory: Use dri_bo_pin under GEM. Pin when ACCEL_NONE.

Keith Packard keithp at keithp.com
Thu Jul 9 03:58:48 CEST 2009


On Wed, 2009-07-08 at 18:13 -0700, Eric Anholt wrote:

> Binding pixmaps on behalf of KMS is broken, and the init sequence should
> be fixed if that's required :P

Right, no binding required.

How about this patch instead:

From e25f3c32d41328b0547082978c4c5c69916318ea Mon Sep 17 00:00:00 2001
From: Keith Packard <keithp at keithp.com>
Date: Wed, 8 Jul 2009 13:06:47 -0700
Subject: [PATCH 3/7] i830_bind_memory: Under UMS: Bind GEM bos with dri_bo_pin, else through the GART

We only need to get static offsets for objects when not running KMS,
otherwise the kernel will manage those as needed for us.

Binding objects is done in one of two ways. For GEM buffer objects, we use
dri_bo_pin. For GART allocated memory, we bind that to the GART.
---
 src/i830_memory.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/i830_memory.c b/src/i830_memory.c
index 7326744..d3afd82 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -199,10 +199,11 @@ i830_bind_memory(ScrnInfoPtr pScrn, i830_memory *mem)
 {
     I830Ptr pI830 = I830PTR(pScrn);
 
-    if (mem == NULL || mem->bound)
+    if (mem == NULL || mem->bound || pI830->use_drm_mode)
 	return TRUE;
 
-    if (mem->bo != NULL && !pI830->use_drm_mode) {
+    if (pI830->have_gem && mem->bo != NULL) {
+
 	if (dri_bo_pin(mem->bo, mem->alignment) != 0) {
 	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 		       "Failed to pin %s: %s\n",
@@ -213,9 +214,7 @@ i830_bind_memory(ScrnInfoPtr pScrn, i830_memory *mem)
 	mem->bound = TRUE;
 	mem->offset = mem->bo->offset;
 	mem->end = mem->offset + mem->size;
-    }
-
-    if (!mem->bound) {
+    } else {
 	if (!pI830->gtt_acquired)
 	    return TRUE;
 
@@ -228,8 +227,7 @@ i830_bind_memory(ScrnInfoPtr pScrn, i830_memory *mem)
 	mem->bound = TRUE;
     }
 
-    if (mem->tiling != TILE_NONE && !pI830->use_drm_mode &&
-	!pI830->kernel_exec_fencing) {
+    if (mem->tiling != TILE_NONE && !pI830->kernel_exec_fencing) {
 	mem->fence_nr = i830_set_tiling(pScrn, mem->offset, mem->pitch,
 					mem->allocated_size, mem->tiling);
     }
@@ -1114,7 +1112,7 @@ i830_allocate_framebuffer(ScrnInfoPtr pScrn)
 	return NULL;
     }
 
-    if (!pI830->use_drm_mode && pI830->FbBase && front_buffer->bound)
+    if (pI830->FbBase && front_buffer->bound)
 	memset (pI830->FbBase + front_buffer->offset, 0, size);
 
     i830_set_max_gtt_map_size(pScrn);
-- 
1.6.3.3




-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20090708/885b941e/attachment.sig>


More information about the Intel-gfx mailing list