a4xx: add noperspective interpolation support
[mesa.git] / src / gallium / drivers / freedreno / freedreno_context.h
index f724d7b6840e285dd6ee35ee83bbd0be191b776e..620768306abee536a083f521d00e5c57b39ab694 100644 (file)
@@ -131,7 +131,6 @@ enum fd_dirty_3d_state {
        FD_DIRTY_VTXSTATE    = BIT(9),
        FD_DIRTY_VTXBUF      = BIT(10),
        FD_DIRTY_MIN_SAMPLES = BIT(11),
-
        FD_DIRTY_SCISSOR     = BIT(12),
        FD_DIRTY_STREAMOUT   = BIT(13),
        FD_DIRTY_UCP         = BIT(14),
@@ -143,9 +142,16 @@ enum fd_dirty_3d_state {
        FD_DIRTY_PROG        = BIT(16),
        FD_DIRTY_CONST       = BIT(17),
        FD_DIRTY_TEX         = BIT(18),
+       FD_DIRTY_IMAGE       = BIT(19),
+       FD_DIRTY_SSBO        = BIT(20),
 
        /* only used by a2xx.. possibly can be removed.. */
-       FD_DIRTY_TEXSTATE    = BIT(19),
+       FD_DIRTY_TEXSTATE    = BIT(21),
+
+       /* fine grained state changes, for cases where state is not orthogonal
+        * from hw perspective:
+        */
+       FD_DIRTY_RASTERIZER_DISCARD = BIT(24),
 };
 
 /* per shader-stage dirty state: */
@@ -160,6 +166,8 @@ enum fd_dirty_shader_state {
 struct fd_context {
        struct pipe_context base;
 
+       struct list_head node;   /* node in screen->context_list */
+
        /* We currently need to serialize emitting GMEM batches, because of
         * VSC state access in the context.
         *
@@ -270,6 +278,9 @@ struct fd_context {
         */
        bool in_discard_blit : 1;
 
+       /* points to either scissor or disabled_scissor depending on rast state: */
+       struct pipe_scissor_state *current_scissor;
+
        struct pipe_scissor_state scissor;
 
        /* we don't have a disable/enable bit for scissor, so instead we keep
@@ -320,6 +331,9 @@ struct fd_context {
 
        struct pipe_debug_callback debug;
 
+       /* Called on rebind_resource() for any per-gen cleanup required: */
+       void (*rebind_resource)(struct fd_context *ctx, struct fd_resource *rsc);
+
        /* GMEM/tile handling fxns: */
        void (*emit_tile_init)(struct fd_batch *batch);
        void (*emit_tile_prep)(struct fd_batch *batch, const struct fd_tile *tile);
@@ -355,6 +369,14 @@ struct fd_context {
        /* handling for barriers: */
        void (*framebuffer_barrier)(struct fd_context *ctx);
 
+       /* logger: */
+       void (*record_timestamp)(struct fd_ringbuffer *ring, struct fd_bo *bo, unsigned offset);
+       uint64_t (*ts_to_ns)(uint64_t ts);
+
+       struct list_head log_chunks;  /* list of flushed log chunks in fifo order */
+       unsigned frame_nr;            /* frame counter (for fd_log) */
+       FILE *log_out;
+
        /*
         * Common pre-cooked VBO state (used for a3xx and later):
         */
@@ -388,6 +410,7 @@ struct fd_context {
                uint32_t index_start;
                uint32_t instance_start;
                uint32_t restart_index;
+               uint32_t streamout_mask;
        } last;
 };
 
@@ -400,19 +423,19 @@ fd_context(struct pipe_context *pctx)
 static inline void
 fd_context_assert_locked(struct fd_context *ctx)
 {
-       pipe_mutex_assert_locked(ctx->screen->lock);
+       fd_screen_assert_locked(ctx->screen);
 }
 
 static inline void
 fd_context_lock(struct fd_context *ctx)
 {
-       mtx_lock(&ctx->screen->lock);
+       fd_screen_lock(ctx->screen);
 }
 
 static inline void
 fd_context_unlock(struct fd_context *ctx)
 {
-       mtx_unlock(&ctx->screen->lock);
+       fd_screen_unlock(ctx->screen);
 }
 
 /* mark all state dirty: */
@@ -428,6 +451,7 @@ fd_context_all_dirty(struct fd_context *ctx)
 static inline void
 fd_context_all_clean(struct fd_context *ctx)
 {
+       ctx->last.dirty = false;
        ctx->dirty = 0;
        for (unsigned i = 0; i < PIPE_SHADER_TYPES; i++) {
                /* don't mark compute state as clean, since it is not emitted
@@ -444,9 +468,7 @@ fd_context_all_clean(struct fd_context *ctx)
 static inline struct pipe_scissor_state *
 fd_context_get_scissor(struct fd_context *ctx)
 {
-       if (ctx->rasterizer && ctx->rasterizer->scissor)
-               return &ctx->scissor;
-       return &ctx->disabled_scissor;
+       return ctx->current_scissor;
 }
 
 static inline bool
@@ -481,6 +503,8 @@ fd_batch_set_stage(struct fd_batch *batch, enum fd_render_stage stage)
 
 void fd_context_setup_common_vbos(struct fd_context *ctx);
 void fd_context_cleanup_common_vbos(struct fd_context *ctx);
+void fd_emit_string(struct fd_ringbuffer *ring, const char *string, int len);
+void fd_emit_string5(struct fd_ringbuffer *ring, const char *string, int len);
 
 struct pipe_context * fd_context_init(struct fd_context *ctx,
                struct pipe_screen *pscreen, const uint8_t *primtypes,