Mesa (master): panfrost: Set attribs and attrib_bufs to NULL when attrib_count = 0

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Feb 2 09:33:22 UTC 2021


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

Author: Boris Brezillon <boris.brezillon at collabora.com>
Date:   Sat Jan 30 11:36:38 2021 +0100

panfrost: Set attribs and attrib_bufs to NULL when attrib_count = 0

It's just easier to read pandecode traces when those pointers are set
to NULL for the attribute_count=0 case.

Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Reviewed-by: Italo Nicola <italonicola at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8808>

---

 src/gallium/drivers/panfrost/pan_cmdstream.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index 685aaf99e62..b264521086c 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -1326,6 +1326,11 @@ panfrost_emit_image_attribs(struct panfrost_batch *batch,
         struct panfrost_context *ctx = batch->ctx;
         struct panfrost_shader_state *shader = panfrost_get_shader_state(ctx, type);
 
+        if (!shader->attribute_count) {
+                *buffers = 0;
+                return 0;
+        }
+
         /* Images always need a MALI_ATTRIBUTE_BUFFER_CONTINUATION_3D */
         unsigned attrib_buf_size = MALI_ATTRIBUTE_BUFFER_LENGTH +
                                    MALI_ATTRIBUTE_BUFFER_CONTINUATION_3D_LENGTH;
@@ -1362,6 +1367,11 @@ panfrost_emit_vertex_data(struct panfrost_batch *batch,
         unsigned nr_bufs = (vs->attribute_count * bufs_per_attrib) +
                            (pan_is_bifrost(dev) ? 1 : 0);
 
+        if (!nr_bufs) {
+                *buffers = 0;
+                return 0;
+        }
+
         struct panfrost_ptr S = panfrost_pool_alloc_aligned(&batch->pool,
                         MALI_ATTRIBUTE_BUFFER_LENGTH * nr_bufs,
                         MALI_ATTRIBUTE_BUFFER_LENGTH * 2);



More information about the mesa-commit mailing list