commit 0efdc8b13e7631e83e6b2a520408f6268871965d
Author: Keith Packard <[EMAIL PROTECTED]>
Date:   Thu Dec 6 14:11:34 2007 -0800

    Use previous buffer offsets to compute proposed relocations
    
    This takes advantage of the DRM_BO_HINT_PRESUMED_OFFSET change and allows
    the kernel to avoid mapping and re-writing buffers when relocations occur.

diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c 
b/src/mesa/drivers/dri/intel/intel_batchbuffer.c
index b51086a..84475a2 100644
--- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c
@@ -243,7 +243,12 @@ intel_batchbuffer_emit_reloc(struct intel_batchbuffer 
*batch,
                              GLuint flags, GLuint delta)
 {
    dri_emit_reloc(batch->buf, flags, delta, batch->ptr - batch->map, buffer);
-   batch->ptr += 4;
+   /*
+    * Using the old buffer offset, write in what the right data would be, in 
case
+    * the buffer doesn't move and we can short-circuit the relocation 
processing
+    * in the kernel
+    */
+   intel_batchbuffer_emit_dword (batch, buffer->offset + delta);
 
    return GL_TRUE;
 }
diff --git a/src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c 
b/src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c
index 3e0d818..ab52efc 100644
--- a/src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c
+++ b/src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c
@@ -193,6 +193,10 @@ intel_setup_validate_list(dri_bufmgr_ttm *bufmgr_ttm, 
GLuint *count_p)
        req->op = drm_bo_validate;
        req->bo_req.flags = node->flags;
        req->bo_req.hint = 0;
+#ifdef DRM_BO_HINT_PRESUMED_OFFSET
+       req->bo_req.hint |= DRM_BO_HINT_PRESUMED_OFFSET;
+       req->bo_req.presumed_offset = ((dri_bo *) node->priv)->offset;
+#endif
        req->bo_req.mask = node->mask;
        req->bo_req.fence_class = 0; /* Backwards compat. */
        arg->reloc_handle = 0;
@@ -839,10 +843,28 @@ dri_ttm_process_reloc(dri_bo *batch_buf, GLuint *count)
 }
 
 static void
+intel_update_buffer_offsets (dri_bufmgr_ttm *bufmgr_ttm)
+{
+    struct intel_bo_list *list = &bufmgr_ttm->list;
+    struct intel_bo_node *node;
+    drmMMListHead *l;
+    struct drm_i915_op_arg *arg;
+    struct drm_bo_arg_rep *rep;
+    
+    for (l = list->list.next; l != &list->list; l = l->next) {
+        node = DRMLISTENTRY(struct intel_bo_node, l, head);
+       arg = &node->bo_arg;
+       rep = &arg->d.rep;
+       ((dri_bo *) node->priv)->offset = rep->bo_info.offset;
+    }
+}
+
+static void
 dri_ttm_post_submit(dri_bo *batch_buf, dri_fence **last_fence)
 {
     dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)batch_buf->bufmgr;
 
+    intel_update_buffer_offsets (bufmgr_ttm);
     intel_free_validate_list(bufmgr_ttm);
     intel_free_reloc_list(bufmgr_ttm);
 


-- 
[EMAIL PROTECTED]

Attachment: signature.asc
Description: This is a digitally signed message part

-------------------------------------------------------------------------
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to