kwinglutils: restore alignment logic for Mali GPU
Hi! Feel free to close if not an issue, me and @devinlin found an issue with Mali GPU (Wayland KWin for PinePhone): homescreen is glitched completely, and it looks like a regression after SSE-related logic refactoring.
More details: teams/plasma-mobile/issues#172 (closed)
I have no experience with this software layer unfortunately, my wild guess is that Mali GPU usage is broken if we are skipping alignment to 8 bytes (16 bytes with the proposed code).
Would be happy to get feedback how to improve it, it's critical for Plasma Mobile.
What I've also found from random ARM Mali GPU manual, OpenGL ES Application Optimization Guide (https://documentation-service.arm.com/static/5ea82dba9931941038df2098):
The OpenGL ES standard requires data to be copied from the application to the driver. If you align your data to eight bytes it is more cacheable. This makes copies faster and reduces memory bandwidth usage.
You must also align data before the Mali GPU can use it. If you enforce alignment in code the Mali GPU driver does not have to align the data during the copy. This improves performance because there is no overhead aligning the data when the copy occurs.
Note
- Ensure you align data when you import data from header files. This might require a compiler-specific command.
- Aligned data is more cacheable on GPUs and application processors so it is a good idea to always align data to 8 bytes if possible.