<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, May 3, 2017 at 10:19 AM, Juan A. Suarez Romero <span dir="ltr"><<a href="mailto:jasuarez@igalia.com" target="_blank">jasuarez@igalia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Wed, 2017-04-26 at 07:35 -0700, Jason Ekstrand wrote:<br>
> ---<br>
> src/intel/vulkan/anv_<wbr>allocator.c | 19 ++++++++++++++++---<br>
> 1 file changed, 16 insertions(+), 3 deletions(-)<br>
><br>
> diff --git a/src/intel/vulkan/anv_<wbr>allocator.c b/src/intel/vulkan/anv_<wbr>allocator.c<br>
> index 0e33d1e..7a687b7 100644<br>
> --- a/src/intel/vulkan/anv_<wbr>allocator.c<br>
> +++ b/src/intel/vulkan/anv_<wbr>allocator.c<br>
> @@ -177,11 +177,22 @@ anv_free_list_pop(union anv_free_list *list, void **map, int32_t *offset)<br>
> }<br>
><br>
> static void<br>
> -anv_free_list_push(union anv_free_list *list, void *map, int32_t offset)<br>
> +anv_free_list_push(union anv_free_list *list, void *map, int32_t offset,<br>
> + uint32_t stride, uint32_t count)<br>
<br>
</span>Is stride a good name? Wouldn't it be better to use block_size, or just<br>
size?<br>
<br>
Specially because later we invoke it with block_size/alloc_size.<br></blockquote><div><br></div><div>Sure. I'm happy to rename it.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
In any case, Reviewed-by: Juan A. Suarez Romero <<a href="mailto:jasuarez@igalia.com">jasuarez@igalia.com</a>><br><div><div class="h5"></div></div></blockquote><div><br></div><div>Thanks!<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
<br>
> {<br>
> union anv_free_list current, old, new;<br>
> int32_t *next_ptr = map + offset;<br>
><br>
> + /* If we're returning more than one chunk, we need to build a chain to add<br>
> + * to the list. Fortunately, we can do this without any atomics since we<br>
> + * own everything in the chain right now. `offset` is left pointing to the<br>
> + * head of our chain list while `next_ptr` points to the tail.<br>
> + */<br>
> + for (uint32_t i = 1; i < count; i++) {<br>
> + VG_NOACCESS_WRITE(next_ptr, offset + i * stride);<br>
> + next_ptr = map + offset + i * stride;<br>
> + }<br>
> +<br>
> old = *list;<br>
> do {<br>
> current = old;<br>
> @@ -742,10 +753,12 @@ anv_state_pool_free_no_vg(<wbr>struct anv_state_pool *pool, struct anv_state state)<br>
> if (state.offset < 0) {<br>
> assert(state.alloc_size == pool->block_size);<br>
> anv_free_list_push(&pool-><wbr>back_alloc_free_list,<br>
> - pool->block_pool.map, state.offset);<br>
> + pool->block_pool.map, state.offset,<br>
> + state.alloc_size, 1);<br>
> } else {<br>
> anv_free_list_push(&pool-><wbr>buckets[bucket].free_list,<br>
> - pool->block_pool.map, state.offset);<br>
> + pool->block_pool.map, state.offset,<br>
> + state.alloc_size, 1);<br>
> }<br>
> }<br>
><br>
</div></div>______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</blockquote></div><br></div></div>