xf86-video-intel: Branch 'intel-batchbuffer' - src/intel_bufmgr_ttm.c

Kristian Høgsberg krh at kemper.freedesktop.org
Mon Mar 31 09:14:32 PDT 2008


 src/intel_bufmgr_ttm.c |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

New commits:
commit ad76f6fb5a34c19bbf9d5ca8a3cd8c0b79788b29
Author: Kristian Høgsberg <krh at redhat.com>
Date:   Mon Mar 31 12:08:56 2008 -0400

    Force unmap and mark BOs as shared when we get the underlying handle.
    
    The bufmgr optimizes mapping and unmapping for unshared buffer objects.
    When it's the only user of a buffer object, it delays the actual
    drmBOUnmap call until absolutely necessary, which is when we need to
    submit it.  So when we pass the drm bo handle to the DRI driver, we
    need to force unmap it and mark it shared.

diff --git a/src/intel_bufmgr_ttm.c b/src/intel_bufmgr_ttm.c
index 6d8719d..1926bca 100644
--- a/src/intel_bufmgr_ttm.c
+++ b/src/intel_bufmgr_ttm.c
@@ -554,9 +554,21 @@ dri_ttm_bo_unmap(dri_bo *buf)
 static unsigned int
 dri_ttm_bo_get_handle(dri_bo *buf)
 {
-   dri_bo_ttm *ttm_buf = (dri_bo_ttm *)buf;
+    dri_bufmgr_ttm *bufmgr_ttm;
+    dri_bo_ttm *ttm_buf = (dri_bo_ttm *)buf;
+
+    if (buf == NULL)
+	return 0;
+
+    bufmgr_ttm = (dri_bufmgr_ttm *)buf->bufmgr;
+    if (ttm_buf->delayed_unmap) {
+	drmBOUnmap(bufmgr_ttm->fd, &ttm_buf->drm_bo);
+	ttm_buf->delayed_unmap = GL_FALSE;
+    }
+
+    ttm_buf->shared = GL_TRUE;
 
-   return ttm_buf->drm_bo.handle;
+    return ttm_buf->drm_bo.handle;
 }
 
 /**


More information about the xorg-commit mailing list