Module: Mesa
Branch: master
Commit: 717e7539124dc459276385a02847b06ea1989973
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=717e7539124dc459276385a02847b06ea1989973

Author: Kenneth Graunke <[email protected]>
Date:   Fri Sep  8 15:00:14 2017 -0700

i965: Use a WC map and memcpy for the batch instead of pwrite.

We'd like to eliminate the malloc'd shadow copy eventually, but there
are still unresolved performance problems.  In the meantime, let's at
least get rid of pwrite.

On Apollolake, improves Synmark OglBatch6 performance by:
1.53581% +/- 0.269589% (n=108).

Reviewed-by: Matt Turner <[email protected]>
Reviewed-by: Chris Wilson <[email protected]>

---

 src/mesa/drivers/dri/i965/intel_batchbuffer.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c 
b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
index 276fe458a1..9cd491b5ac 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -629,18 +629,16 @@ do_flush_locked(struct brw_context *brw, int in_fence_fd, 
int *out_fence_fd)
    struct intel_batchbuffer *batch = &brw->batch;
    int ret = 0;
 
-   if (devinfo->has_llc) {
-      brw_bo_unmap(batch->bo);
-   } else {
-      ret = brw_bo_subdata(batch->bo, 0, 4 * USED_BATCH(*batch), batch->map);
-      if (ret == 0 && batch->state_batch_offset != batch->bo->size) {
-         ret = brw_bo_subdata(batch->bo,
-                              batch->state_batch_offset,
-                              batch->bo->size - batch->state_batch_offset,
-                              (char *)batch->map + batch->state_batch_offset);
-      }
+   if (batch->cpu_map) {
+      void *bo_map = brw_bo_map(brw, batch->bo, MAP_WRITE);
+      memcpy(bo_map, batch->cpu_map, 4 * USED_BATCH(*batch));
+      memcpy(bo_map + batch->state_batch_offset,
+             (char *) batch->cpu_map + batch->state_batch_offset,
+             batch->bo->size - batch->state_batch_offset);
    }
 
+   brw_bo_unmap(batch->bo);
+
    if (!brw->screen->no_hw) {
       /* The requirement for using I915_EXEC_NO_RELOC are:
        *

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to