From: Roman Stratiienko Date: Sun, 26 Jul 2020 03:37:57 +0000 (+0300) Subject: lima: Fix lima_screen_query_dmabuf_modifiers() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9a9b35a3bb40d736f3a89d27da10f8a7354bc1ed;p=mesa.git lima: Fix lima_screen_query_dmabuf_modifiers() Incorrect implementation has been found during code surfing. v3d implementation used for reference. Signed-off-by: Roman Stratiienko Reviewed-by: Icenowy Zheng Part-of: --- diff --git a/src/gallium/drivers/lima/lima_screen.c b/src/gallium/drivers/lima/lima_screen.c index 1a6ff22dc44..9118212cc60 100644 --- a/src/gallium/drivers/lima/lima_screen.c +++ b/src/gallium/drivers/lima/lima_screen.c @@ -440,15 +440,18 @@ lima_screen_query_dmabuf_modifiers(struct pipe_screen *pscreen, DRM_FORMAT_MOD_LINEAR, }; + int num_modifiers = ARRAY_SIZE(available_modifiers); + if (!modifiers) { - *count = ARRAY_SIZE(available_modifiers); + *count = num_modifiers; return; } + *count = MIN2(max, num_modifiers); for (int i = 0; i < *count; i++) { modifiers[i] = available_modifiers[i]; if (external_only) - external_only = false; + external_only[i] = false; } }