aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2020-06-08 14:08:45 -0400
committerMarge Bot <[email protected]>2020-06-12 14:45:50 +0000
commitc31af6fbca036ee45875884518ae772acfd6e63f (patch)
treeb58e6b73c4da0122b1cf3407e1f4a36d74a893ea
parentdf24209473a71e84b94f9163e11cf95e26591ec9 (diff)
panfrost: Emit xfb records
Signed-off-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5423>
-rw-r--r--src/gallium/drivers/panfrost/pan_cmdstream.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index aad66bc9fe0..6480733a2b5 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -1884,6 +1884,51 @@ pan_emit_vary_special(unsigned present, enum pan_special_varying buf,
return pan_emit_vary(present, buf, quirks, pan_varying_formats[buf], 0);
}
+static enum mali_format
+pan_xfb_format(enum mali_format format, unsigned nr)
+{
+ if (MALI_EXTRACT_BITS(format) == MALI_CHANNEL_FLOAT)
+ return MALI_R32F | MALI_NR_CHANNELS(nr);
+ else
+ return MALI_EXTRACT_TYPE(format) | MALI_NR_CHANNELS(nr) | MALI_CHANNEL_32;
+}
+
+/* Transform feedback records. Note struct pipe_stream_output is (if packed as
+ * a bitfield) 32-bit, smaller than a 64-bit pointer, so may as well pass by
+ * value. */
+
+static struct mali_attr_meta
+pan_emit_vary_xfb(unsigned present,
+ unsigned max_xfb,
+ unsigned *streamout_offsets,
+ unsigned quirks,
+ enum mali_format format,
+ struct pipe_stream_output o)
+{
+ /* Otherwise construct a record for it */
+ struct mali_attr_meta meta = {
+ /* XFB buffers come after everything else */
+ .index = pan_xfb_base(present) + o.output_buffer,
+
+ /* As usual unknown bit */
+ .unknown1 = quirks & IS_BIFROST ? 0x0 : 0x2,
+
+ /* Override swizzle with number of channels */
+ .swizzle = quirks & HAS_SWIZZLES ?
+ panfrost_get_default_swizzle(o.num_components) :
+ panfrost_bifrost_swizzle(o.num_components),
+
+ /* Override number of channels and precision to highp */
+ .format = pan_xfb_format(format, o.num_components),
+
+ /* Apply given offsets together */
+ .src_offset = (o.dst_offset * 4) /* dwords */
+ + streamout_offsets[o.output_buffer]
+ };
+
+ return meta;
+}
+
void
panfrost_emit_varying_descriptor(struct panfrost_batch *batch,
unsigned vertex_count,