<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Jul 11, 2017 at 8:18 PM, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</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 Tuesday, July 11, 2017 7:09:32 PM PDT Jason Ekstrand wrote:<br>
> This fixes 32-bit builds of the driver.<br>
><br>
> Fixes: 08413a81b93dc537fb0c34327ad162<wbr>f07e8c3427<br>
> Cc: Mark Janes <<a href="mailto:mark.a.janes@intel.com">mark.a.janes@intel.com</a>><br>
> Cc: <a href="mailto:mesa-stable@lists.freedesktop.org">mesa-stable@lists.freedesktop.<wbr>org</a><br>
> ---<br>
> src/intel/vulkan/anv_batch_<wbr>chain.c | 15 +++++++++++++--<br>
> 1 file changed, 13 insertions(+), 2 deletions(-)<br>
><br>
> diff --git a/src/intel/vulkan/anv_batch_<wbr>chain.c b/src/intel/vulkan/anv_batch_<wbr>chain.c<br>
> index 47fee739..c895848 100644<br>
> --- a/src/intel/vulkan/anv_batch_<wbr>chain.c<br>
> +++ b/src/intel/vulkan/anv_batch_<wbr>chain.c<br>
> @@ -672,6 +672,15 @@ anv_cmd_buffer_new_binding_<wbr>table_block(struct anv_cmd_buffer *cmd_buffer)<br>
> return VK_SUCCESS;<br>
> }<br>
><br>
> +static inline uint32_t<br>
> +round_up_to_power_of_two(<wbr>uint32_t value)<br>
> +{<br>
> + if (value <= 1)<br>
> + return value;<br>
> +<br>
> + return 1 << (32 - __builtin_clz(value - 1));<br>
> +}<br>
<br>
</span>Would be nice to have this in a src/util header, instead of<br>
src/gallium/auxiliary/util/u_<wbr>math.h's util_next_power_of_two<br>
and src/mesa/main/imports.h's _mesa_next_pow_two_32, and again in anv.<br></blockquote><div><br></div><div>We already pull in u_math.h (Thanks, Eric.) but I didn't find next_power_of_two when I went looking for it. I'll use util_next_power_of_two instead.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
But moving all that around is annoying, and you know CLZ works here,<br>
and it's not that much code, so *shrug*<br>
<br>
Reviewed-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br><div class="HOEnZb"><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 class="HOEnZb"><div class="h5">
> +<br>
> VkResult<br>
> anv_cmd_buffer_init_batch_bo_<wbr>chain(struct anv_cmd_buffer *cmd_buffer)<br>
> {<br>
> @@ -706,9 +715,11 @@ anv_cmd_buffer_init_batch_bo_<wbr>chain(struct anv_cmd_buffer *cmd_buffer)<br>
><br>
> *(struct anv_batch_bo **)u_vector_add(&cmd_buffer-><wbr>seen_bbos) = batch_bo;<br>
><br>
> + /* u_vector requires power-of-two size elements */<br>
> + uint32_t pow2_state_size =<br>
> + round_up_to_power_of_two(<wbr>sizeof(struct anv_state));<br>
> success = u_vector_init(&cmd_buffer->bt_<wbr>block_states,<br>
> - sizeof(struct anv_state),<br>
> - 8 * sizeof(struct anv_state));<br>
> + pow2_state_size, 8 * pow2_state_size);<br>
> if (!success)<br>
> goto fail_seen_bbos;<br>
><br>
><br>
<br>
</div></div></blockquote></div><br></div></div>