Mesa (master): panfrost: Stop keying on rt format when using native loads

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jul 13 14:04:07 UTC 2020


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

Author: Icecream95 <ixn at keemail.me>
Date:   Tue Jul  7 15:06:08 2020 +1200

panfrost: Stop keying on rt format when using native loads

Native loads are the same for any format, so we can use the same
shader variant for all framebuffer formats with a native load.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5755>

---

 src/gallium/drivers/panfrost/pan_context.c | 13 +++++++++++++
 src/panfrost/util/pan_lower_framebuffer.c  |  3 +++
 2 files changed, 16 insertions(+)

diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index 27e2c35c611..56706a5fe46 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -54,6 +54,7 @@
 #include "pan_cmdstream.h"
 #include "pan_util.h"
 #include "pandecode/decode.h"
+#include "util/pan_lower_framebuffer.h"
 
 struct midgard_tiler_descriptor
 panfrost_emit_midg_tiler(struct panfrost_batch *batch, unsigned vertex_count)
@@ -681,6 +682,12 @@ panfrost_variant_matches(
                         if ((fb->nr_cbufs > i) && fb->cbufs[i])
                                 fmt = fb->cbufs[i]->format;
 
+                        const struct util_format_description *desc =
+                                util_format_description(fmt);
+
+                        if (pan_format_class_load(desc, dev->quirks) == PAN_FORMAT_NATIVE)
+                                fmt = PIPE_FORMAT_NONE;
+
                         if (variant->rt_formats[i] != fmt)
                                 return false;
                 }
@@ -806,6 +813,12 @@ panfrost_bind_shader_state(
                                 if ((fb->nr_cbufs > i) && fb->cbufs[i])
                                         fmt = fb->cbufs[i]->format;
 
+                                const struct util_format_description *desc =
+                                        util_format_description(fmt);
+
+                                if (pan_format_class_load(desc, dev->quirks) == PAN_FORMAT_NATIVE)
+                                        fmt = PIPE_FORMAT_NONE;
+
                                 v->rt_formats[i] = fmt;
                         }
 
diff --git a/src/panfrost/util/pan_lower_framebuffer.c b/src/panfrost/util/pan_lower_framebuffer.c
index 6fdb9695b37..22ad2379a36 100644
--- a/src/panfrost/util/pan_lower_framebuffer.c
+++ b/src/panfrost/util/pan_lower_framebuffer.c
@@ -726,6 +726,9 @@ pan_lower_framebuffer(nir_shader *shader, enum pipe_format *rt_fmts,
                                 else
                                         continue;
 
+                                if (rt_fmts[rt] == PIPE_FORMAT_NONE)
+                                        continue;
+
                                 const struct util_format_description *desc =
                                    util_format_description(rt_fmts[rt]);
 



More information about the mesa-commit mailing list