freedreno/query: add optional enable hook
[mesa.git] / src / gallium / drivers / freedreno / freedreno_context.h
index c2d98345349f2e5df752db40b2fb3a511b55d72d..85ce97c16b79c377c64e3d5b3396364155c28b20 100644 (file)
@@ -40,6 +40,8 @@
 #include "freedreno_gmem.h"
 #include "freedreno_util.h"
 
+#define BORDER_COLOR_UPLOAD_SIZE (2 * PIPE_MAX_SAMPLERS * BORDERCOLOR_SIZE)
+
 struct fd_vertex_stateobj;
 
 struct fd_texture_stateobj {
@@ -82,6 +84,20 @@ struct fd_vertex_stateobj {
        unsigned num_elements;
 };
 
+struct fd_streamout_stateobj {
+       struct pipe_stream_output_target *targets[PIPE_MAX_SO_BUFFERS];
+       unsigned num_targets;
+       /* Track offset from vtxcnt for streamout data.  This counter
+        * is just incremented by # of vertices on each draw until
+        * reset or new streamout buffer bound.
+        *
+        * When we eventually have GS, the CPU won't actually know the
+        * number of vertices per draw, so I think we'll have to do
+        * something more clever.
+        */
+       unsigned offsets[PIPE_MAX_SO_BUFFERS];
+};
+
 /* group together the vertex and vertexbuf state.. for ease of passing
  * around, and because various internal operations (gmem<->mem, etc)
  * need their own vertex state:
@@ -148,6 +164,9 @@ struct fd_context {
         */
        struct fd_hw_sample *sample_cache[MAX_HW_SAMPLE_PROVIDERS];
 
+       /* which sample providers were active in the current batch: */
+       uint32_t active_providers;
+
        /* tracking for current stage, to know when to start/stop
         * any active queries:
         */
@@ -179,7 +198,7 @@ struct fd_context {
        struct fd_program_stateobj solid_prog; // TODO move to screen?
 
        /* shaders used by mem->gmem blits: */
-       struct fd_program_stateobj blit_prog[8]; // TODO move to screen?
+       struct fd_program_stateobj blit_prog[MAX_RENDER_TARGETS]; // TODO move to screen?
        struct fd_program_stateobj blit_z, blit_zs;
 
        /* do we need to mem2gmem before rendering.  We don't, if for example,
@@ -319,6 +338,9 @@ struct fd_context {
                FD_DIRTY_VTXBUF      = (1 << 15),
                FD_DIRTY_INDEXBUF    = (1 << 16),
                FD_DIRTY_SCISSOR     = (1 << 17),
+               FD_DIRTY_STREAMOUT   = (1 << 18),
+               FD_DIRTY_UCP         = (1 << 19),
+               FD_DIRTY_BLEND_DUAL  = (1 << 20),
        } dirty;
 
        struct pipe_blend_state *blend;
@@ -339,6 +361,12 @@ struct fd_context {
        struct pipe_viewport_state viewport;
        struct fd_constbuf_stateobj constbuf[PIPE_SHADER_TYPES];
        struct pipe_index_buffer indexbuf;
+       struct fd_streamout_stateobj streamout;
+       struct pipe_clip_state ucp;
+
+       struct pipe_query *cond_query;
+       bool cond_cond; /* inverted rendering condition */
+       uint cond_mode;
 
        /* GMEM/tile handling fxns: */
        void (*emit_tile_init)(struct fd_context *ctx);
@@ -351,9 +379,20 @@ struct fd_context {
        void (*emit_sysmem_prep)(struct fd_context *ctx);
 
        /* draw: */
-       void (*draw_vbo)(struct fd_context *pctx, const struct pipe_draw_info *info);
+       void (*draw_vbo)(struct fd_context *ctx, const struct pipe_draw_info *info);
        void (*clear)(struct fd_context *ctx, unsigned buffers,
                        const union pipe_color_union *color, double depth, unsigned stencil);
+
+       /* constant emit:  (note currently not used/needed for a2xx) */
+       void (*emit_const)(struct fd_ringbuffer *ring, enum shader_t type,
+                       uint32_t regid, uint32_t offset, uint32_t sizedwords,
+                       const uint32_t *dwords, struct pipe_resource *prsc);
+       void (*emit_const_bo)(struct fd_ringbuffer *ring, enum shader_t type, boolean write,
+                       uint32_t regid, uint32_t num, struct fd_bo **bos, uint32_t *offsets);
+
+       /* indirect-branch emit: */
+       void (*emit_ib)(struct fd_ringbuffer *ring, struct fd_ringmarker *start,
+                       struct fd_ringmarker *end);
 };
 
 static inline struct fd_context *