xf86-video-intel: 3 commits - configure.ac src/intel_driver.c src/intel.h src/intel_uxa.c

Chris Wilson ickle at kemper.freedesktop.org
Tue Dec 13 03:37:50 PST 2011


 configure.ac       |    6 +++---
 src/intel.h        |    1 +
 src/intel_driver.c |    4 ++++
 src/intel_uxa.c    |   20 ++++++++++++++++++++
 4 files changed, 28 insertions(+), 3 deletions(-)

New commits:
commit 5d5b2b8ee203ae2274fc7d13ed38d2945facca9e
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Dec 13 11:30:05 2011 +0000

    uxa: Cap the maximum number of VMA cached
    
    Since we can not keep an unlimited number of vma cached due to the hard
    per-process limits on the number of mappings and recreating mappings is
    slow due to excruciatingly slow GTT pagefaults, we need to compromise
    and keep a small MRU cache of inactive mmaps.
    
    This uses the new API in libdrm-2.4.29 to specify the limit upon the VMA
    cache maintained by libdrm.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/configure.ac b/configure.ac
index 4efb65d..da5fd77 100644
--- a/configure.ac
+++ b/configure.ac
@@ -187,7 +187,7 @@ XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
 
 # Obtain compiler/linker options for the driver dependencies
 PKG_CHECK_MODULES(XORG, [xorg-server >= $required_xorg_xserver_version xproto fontsproto pixman-1 >= $required_pixman_version $REQUIRED_MODULES])
-PKG_CHECK_MODULES(DRM, [libdrm >= 2.4.28])
+PKG_CHECK_MODULES(DRM, [libdrm >= 2.4.29])
 PKG_CHECK_MODULES(DRI, [xf86driproto], , DRI=no)
 PKG_CHECK_MODULES(DRI2, [dri2proto >= 2.6],, DRI2=no)
 PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10])
diff --git a/src/intel_driver.c b/src/intel_driver.c
index 066aa5f..9094fd1 100644
--- a/src/intel_driver.c
+++ b/src/intel_driver.c
@@ -413,6 +413,7 @@ static int intel_init_bufmgr(intel_screen_private *intel)
 		return FALSE;
 
 	drm_intel_bufmgr_gem_enable_reuse(intel->bufmgr);
+	drm_intel_bufmgr_gem_set_vma_cache_size(intel->bufmgr, 512);
 	drm_intel_bufmgr_gem_enable_fenced_relocs(intel->bufmgr);
 
 	list_init(&intel->batch_pixmaps);
commit 1128825efb3179a5a5d951fa24db6b769ee41219
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Dec 13 11:20:25 2011 +0000

    uxa: Wakeup 3s after the last rendering to reap the bo-cache
    
    libdrm expires its bo 2s after entry into the cache, but we need to free
    a buffer to trigger the reaper. So schedule a timer event to trigger 3s
    after the last rendering is submitted to free any resident bo during
    long periods of idleness.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/intel.h b/src/intel.h
index 28f049e..5423c20 100644
--- a/src/intel.h
+++ b/src/intel.h
@@ -279,6 +279,7 @@ typedef struct intel_screen_private {
 	struct list flush_pixmaps;
 	struct list in_flight;
 	drm_intel_bo *wa_scratch_bo;
+	OsTimerPtr cache_expire;
 
 	/* For Xvideo */
 	Bool use_overlay;
diff --git a/src/intel_driver.c b/src/intel_driver.c
index 2828ed6..066aa5f 100644
--- a/src/intel_driver.c
+++ b/src/intel_driver.c
@@ -1200,6 +1200,9 @@ static Bool I830CloseScreen(int scrnIndex, ScreenPtr screen)
 
 	intel_glamor_close_screen(screen);
 
+	TimerFree(intel->cache_expire);
+	intel->cache_expire = NULL;
+
 	if (intel->uxa_driver) {
 		uxa_driver_fini(screen);
 		free(intel->uxa_driver);
diff --git a/src/intel_uxa.c b/src/intel_uxa.c
index 5f2959b..e4a5270 100644
--- a/src/intel_uxa.c
+++ b/src/intel_uxa.c
@@ -965,6 +965,23 @@ static Bool intel_uxa_get_image(PixmapPtr pixmap,
 	return ret;
 }
 
+static CARD32 intel_cache_expire(OsTimerPtr timer, CARD32 now, pointer data)
+{
+	intel_screen_private *intel = data;
+
+	/* We just want to create and destroy a bo as this causes libdrm
+	 * to reap its caches. However, since we can't remove that buffer
+	 * from the cache due to its own activity, we want to use something
+	 * that we know we will reuse later. The most frequently reused buffer
+	 * we have is the batchbuffer, and the best way to trigger its
+	 * reallocation is to submit a flush.
+	 */
+	intel_batch_emit_flush(intel->scrn);
+	intel_batch_submit(intel->scrn);
+
+	return 0;
+}
+
 static void intel_flush_rendering(intel_screen_private *intel)
 {
 	if (intel->needs_flush == 0)
@@ -978,6 +995,9 @@ static void intel_flush_rendering(intel_screen_private *intel)
 		intel_batch_submit(intel->scrn);
 	}
 
+	intel->cache_expire = TimerSet(intel->cache_expire, 0, 3000,
+				       intel_cache_expire, intel);
+
 	intel->needs_flush = 0;
 }
 
commit db7c9e8561afcc1ca7ab16b3bf2d5b49938e26d9
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Dec 13 10:05:25 2011 +0000

    configure: Link the extra valgrind debugging to --enable-debug
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/configure.ac b/configure.ac
index 6dbeb28..4efb65d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -260,11 +260,11 @@ if test "x$DEBUG" = xno; then
 fi
 if test "x$DEBUG" != xno; then
 	AC_DEFINE(HAS_EXTRA_DEBUG,1,[Enable additional debugging])
+	PKG_CHECK_MODULES(VALGRIND, [valgrind],
+			  AC_DEFINE([HAVE_VALGRIND], 0, [Use valgind intrinsics to suppress false warings]),)
 fi
 if test "x$DEBUG" = xfull; then
 	AC_DEFINE(HAS_DEBUG_FULL,1,[Enable all debugging])
-	PKG_CHECK_MODULES(VALGRIND, [valgrind],
-			  AC_DEFINE([HAVE_VALGRIND], 0, [Use valgind intrinsics to suppress false warings]),)
         CFLAGS="$CFLAGS -O0 -ggdb3"
 fi
 


More information about the xorg-commit mailing list