Mesa (master): lima: Fix lima_screen_query_dmabuf_modifiers()

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Aug 4 14:10:30 UTC 2020


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

Author: Roman Stratiienko <r.stratiienko at gmail.com>
Date:   Sun Jul 26 06:37:57 2020 +0300

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 <r.stratiienko at gmail.com>
Reviewed-by: Icenowy Zheng <icenowy at aosc.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6076>

---

 src/gallium/drivers/lima/lima_screen.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

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;
    }
 }
 



More information about the mesa-commit mailing list