[Intel-gfx] [PATCH] Use drm_intel_bo_disable_reuse API to flag scanout and cursor buffers

Keith Packard keithp at keithp.com
Mon May 11 22:53:08 CEST 2009


Buffers referenced by the kernel for scanout or cursor display should not be
reused by the driver. Use the new drm API to disable reuse of these buffers.

Signed-off-by: Keith Packard <keithp at keithp.com>
---
 src/i830.h        |    1 +
 src/i830_memory.c |    7 ++++++-
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/i830.h b/src/i830.h
index 207d4ec..3cd01a3 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -901,6 +901,7 @@ extern const int I830CopyROP[16];
 #define NEED_NON_STOLEN			0x00000004
 #define NEED_LIFETIME_FIXED		0x00000008
 #define ALLOW_SHARING			0x00000010
+#define DISABLE_REUSE			0x00000020
 
 /* Chipset registers for VIDEO BIOS memory RW access */
 #define _855_DRAM_RW_CONTROL 0x58
diff --git a/src/i830_memory.c b/src/i830_memory.c
index d5827f8..192cbdb 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -798,6 +798,9 @@ i830_allocate_memory_bo(ScrnInfoPtr pScrn, const char *name,
 	}
     }
 
+    if (flags & DISABLE_REUSE)
+	drm_intel_bo_disable_reuse(mem->bo);
+
     /* Insert new allocation into the list */
     mem->prev = NULL;
     mem->next = pI830->bo_list;
@@ -1075,7 +1078,7 @@ i830_allocate_framebuffer(ScrnInfoPtr pScrn)
     i830_memory *front_buffer = NULL;
     enum tile_format tile_format = TILE_NONE;
 
-    flags = ALLOW_SHARING;
+    flags = ALLOW_SHARING|DISABLE_REUSE;
 
     /* We'll allocate the fb such that the root window will fit regardless of
      * rotation.
@@ -1142,6 +1145,8 @@ i830_allocate_cursor_buffers(ScrnInfoPtr pScrn)
 
     flags = pI830->CursorNeedsPhysical ? NEED_PHYSICAL_ADDR : 0;
 
+    flags |= DISABLE_REUSE;
+
     /* Try to allocate one big blob for our cursor memory.  This works
      * around a limitation in the FreeBSD AGP driver that allows only one
      * physical allocation larger than a page, and could allow us
-- 
1.6.3




More information about the Intel-gfx mailing list