summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/a6xx/fd6_emit.h
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2018-10-07 13:58:30 -0400
committerRob Clark <[email protected]>2018-10-17 12:44:48 -0400
commita398d26fd2cb1ef075a07fa91d2c74613982a66f (patch)
tree3c4802a64be9cafc222342f063272a8b588e2126 /src/gallium/drivers/freedreno/a6xx/fd6_emit.h
parentec717fc629ca4e34a2b934f2b4d02217a4249080 (diff)
freedreno/a6xx: add infrastructure for CP_DRAW_STATE
Add helper to add state-groups to emit, and code to emit CP_DRAW_STATE packet if we have any state-groups. Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/a6xx/fd6_emit.h')
-rw-r--r--src/gallium/drivers/freedreno/a6xx/fd6_emit.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_emit.h b/src/gallium/drivers/freedreno/a6xx/fd6_emit.h
index 4ebb5987423..a2117a1b244 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_emit.h
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_emit.h
@@ -38,6 +38,20 @@
struct fd_ringbuffer;
+/* To collect all the state objects to emit in a single CP_SET_DRAW_STATE
+ * packet, the emit tracks a collection of however many state_group's that
+ * need to be emit'd.
+ */
+enum fd6_state_id {
+ FD6_GROUP_CONST,
+};
+
+struct fd6_state_group {
+ struct fd_ringbuffer *stateobj;
+ enum fd6_state_id group_id;
+ uint8_t enable_mask;
+};
+
/* grouped together emit-state for prog/vertex/state emit: */
struct fd6_emit {
struct pipe_debug_callback *debug;
@@ -63,6 +77,9 @@ struct fd6_emit {
/* TODO: other shader stages.. */
unsigned streamout_mask;
+
+ struct fd6_state_group groups[32];
+ unsigned num_groups;
};
static inline const struct ir3_shader_variant *
@@ -92,6 +109,19 @@ fd6_emit_get_fp(struct fd6_emit *emit)
}
static inline void
+fd6_emit_add_group(struct fd6_emit *emit, struct fd_ringbuffer *stateobj,
+ enum fd6_state_id group_id, unsigned enable_mask)
+{
+ debug_assert(emit->num_groups < ARRAY_SIZE(emit->groups));
+ if (fd_ringbuffer_size(stateobj) == 0)
+ return;
+ struct fd6_state_group *g = &emit->groups[emit->num_groups++];
+ g->stateobj = stateobj;
+ g->group_id = group_id;
+ g->enable_mask = enable_mask;
+}
+
+static inline void
fd6_event_write(struct fd_batch *batch, struct fd_ringbuffer *ring,
enum vgt_event_type evt, bool timestamp)
{