<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Reviewed-by: Tim Rowley <<a href="mailto:timothy.o.rowley@intel.com" class="">timothy.o.rowley@intel.com</a>>
<div class=""><br class="">
<div>
<blockquote type="cite" class="">
<div class="">On Jun 28, 2017, at 1:42 PM, Bruce Cherniak <<a href="mailto:bruce.cherniak@intel.com" class="">bruce.cherniak@intel.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="">Deferred deletion (via "fence_work") has obsoleted the need to allocate<br class="">
all client vertex buffer scratch space in a single chunk.  Scratch<br class="">
allocations are now valid until the referenced fence is complete.<br class="">
---<br class="">
src/gallium/drivers/swr/swr_state.cpp | 25 ++-----------------------<br class="">
1 file changed, 2 insertions(+), 23 deletions(-)<br class="">
<br class="">
diff --git a/src/gallium/drivers/swr/swr_state.cpp b/src/gallium/drivers/swr/swr_state.cpp<br class="">
index 6dc06ed156..7a8786d96f 100644<br class="">
--- a/src/gallium/drivers/swr/swr_state.cpp<br class="">
+++ b/src/gallium/drivers/swr/swr_state.cpp<br class="">
@@ -1219,32 +1219,12 @@ swr_update_derived(struct pipe_context *pipe,<br class="">
    */<br class="">
   if (ctx->dirty & SWR_NEW_VERTEX ||<br class="">
      (p_draw_info && p_draw_info->index_size)) {<br class="">
-      uint32_t scratch_total;<br class="">
-      uint8_t *scratch = NULL;<br class="">
<br class="">
      /* If being called by swr_draw_vbo, copy draw details */<br class="">
      struct pipe_draw_info info = {0};<br class="">
      if (p_draw_info)<br class="">
         info = *p_draw_info;<br class="">
<br class="">
-      /* We must get all the scratch space in one go */<br class="">
-      scratch_total = 0;<br class="">
-      for (UINT i = 0; i < ctx->num_vertex_buffers; i++) {<br class="">
-         struct pipe_vertex_buffer *vb = &ctx->vertex_buffer[i];<br class="">
-<br class="">
-         if (!vb->is_user_buffer)<br class="">
-            continue;<br class="">
-<br class="">
-         uint32_t elems, base, size;<br class="">
-         swr_user_vbuf_range(&info, ctx->velems, vb, i, &elems, &base, &size);<br class="">
-         scratch_total += AlignUp(size, 4);<br class="">
-      }<br class="">
-<br class="">
-      if (scratch_total) {<br class="">
-         scratch = (uint8_t *)swr_copy_to_scratch_space(<br class="">
-               ctx, &ctx->scratch->vertex_buffer, NULL, scratch_total);<br class="">
-      }<br class="">
-<br class="">
      /* vertex buffers */<br class="">
      SWR_VERTEX_BUFFER_STATE swrVertexBuffers[PIPE_MAX_ATTRIBS];<br class="">
      for (UINT i = 0; i < ctx->num_vertex_buffers; i++) {<br class="">
@@ -1289,9 +1269,8 @@ swr_update_derived(struct pipe_context *pipe,<br class="">
            /* Copy only needed vertices to scratch space */<br class="">
            size = AlignUp(size, 4);<br class="">
            const void *ptr = (const uint8_t *) vb->buffer.user + base;<br class="">
-            memcpy(scratch, ptr, size);<br class="">
-            ptr = scratch;<br class="">
-            scratch += size;<br class="">
+            ptr = (uint8_t *)swr_copy_to_scratch_space(<br class="">
+               ctx, &ctx->scratch->vertex_buffer, ptr, size);<br class="">
            p_data = (const uint8_t *)ptr - base;<br class="">
         }<br class="">
<br class="">
-- <br class="">
2.11.0<br class="">
<br class="">
_______________________________________________<br class="">
mesa-dev mailing list<br class="">
<a href="mailto:mesa-dev@lists.freedesktop.org" class="">mesa-dev@lists.freedesktop.org</a><br class="">
https://lists.freedesktop.org/mailman/listinfo/mesa-dev<br class="">
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>