anv: Align "used" attribute to 64 bits.
authorRafael Antognolli <rafael.antognolli@intel.com>
Wed, 24 Jun 2020 18:57:51 +0000 (18:57 +0000)
committerRafael Antognolli <rafael.antognolli@intel.com>
Fri, 26 Jun 2020 05:11:36 +0000 (22:11 -0700)
This is a 64 bits value that might not be aligned on 32 bit plaforms.
Since it's used with atomics, let's make sure it gets properly aligned
to avoid any potential performance loss.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5637>

src/intel/vulkan/anv_private.h

index a6104bdcfa166efecc9652c3c7c8ac48cb8f8c1e..e31e6a6579e601355fd9fc33c0eef5e166abe289 100644 (file)
@@ -1036,8 +1036,11 @@ struct anv_memory_heap {
    VkDeviceSize      size;
    VkMemoryHeapFlags flags;
 
-   /* Driver-internal book-keeping */
-   VkDeviceSize      used;
+   /** Driver-internal book-keeping.
+    *
+    * Align it to 64 bits to make atomic operations faster on 32 bit platforms.
+    */
+   VkDeviceSize      used __attribute__ ((aligned (8)));
 };
 
 struct anv_physical_device {