<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Jul 11, 2017 at 7:09 PM, Jason Ekstrand <span dir="ltr"><<a href="mailto:jason@jlekstrand.net" target="_blank">jason@jlekstrand.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This fixes 32-bit builds of the driver.<br></blockquote><div><br></div><div>I just updated the commit message to be more descriptive:<br><br>    This fixes 32-bit builds of the driver.  Commit 08413a81b93dc537fb0c3<br>    changed things so that we now put struct anv_states in the u_vector for<br>    binding tables.  On 64-bit builds, sizeof(struct anv_state) is a power<br>    of two but it isn't on 32-bit builds.<br><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
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>
 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>
<span class="gmail-HOEnZb"><font color="#888888"><br>
--<br>
2.5.0.400.gff86faf<br>
<br>
</font></span></blockquote></div><br></div></div>