mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-21 22:20:14 +01:00
vulkan/wsi/wayland: fix an invalid u_vector_init call
u_vector_init requires size to be power-of-two.
Fixes: 151b65b211 ("vulkan/wsi/wayland: generalize modifier handling")
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13186>
This commit is contained in:
parent
d2543658ef
commit
eed0fc4caf
1 changed files with 3 additions and 2 deletions
|
|
@ -455,8 +455,9 @@ wsi_wl_display_init(struct wsi_wayland *wsi_wl,
|
|||
VkResult result = VK_SUCCESS;
|
||||
memset(display, 0, sizeof(*display));
|
||||
|
||||
if (!u_vector_init(&display->formats, sizeof(struct wsi_wl_format),
|
||||
8 * sizeof(struct wsi_wl_format)))
|
||||
const size_t elem_size =
|
||||
util_next_power_of_two(sizeof(struct wsi_wl_format));
|
||||
if (!u_vector_init(&display->formats, elem_size, 8 * elem_size))
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
|
||||
display->wsi_wl = wsi_wl;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue