Mesa (master): anv: Align "used" attribute to 64 bits.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jun 26 05:23:38 UTC 2020


Module: Mesa
Branch: master
Commit: 66df2ffa36a69265dbb6ab815a93eca6c2a208da
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=66df2ffa36a69265dbb6ab815a93eca6c2a208da

Author: Rafael Antognolli <rafael.antognolli at intel.com>
Date:   Wed Jun 24 18:57:51 2020 +0000

anv: Align "used" attribute to 64 bits.

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 at whitecape.org>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5637>

---

 src/intel/vulkan/anv_private.h | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index a6104bdcfa1..e31e6a6579e 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -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 {



More information about the mesa-commit mailing list