radeonsi: add TC L2 prefetch for shaders and VBO descriptors
[mesa.git] / src / gallium / drivers / radeonsi / si_pipe.h
index 8fc5fcc370f35896c3c72e95c1283694441c98f4..c0a4636cc636bb56a4297588b9256c8f47d5969d 100644 (file)
@@ -96,6 +96,7 @@ struct si_screen {
        struct si_shader_part           *vs_prologs;
        struct si_shader_part           *vs_epilogs;
        struct si_shader_part           *tcs_epilogs;
+       struct si_shader_part           *gs_prologs;
        struct si_shader_part           *ps_prologs;
        struct si_shader_part           *ps_epilogs;
 
@@ -136,7 +137,12 @@ struct si_sampler_view {
        bool is_stencil_sampler;
 };
 
+#define SI_SAMPLER_STATE_MAGIC 0x34f1c35a
+
 struct si_sampler_state {
+#ifdef DEBUG
+       unsigned                        magic;
+#endif
        uint32_t                        val[4];
 };
 
@@ -166,6 +172,7 @@ struct si_framebuffer {
        unsigned                        nr_samples;
        unsigned                        log_samples;
        unsigned                        compressed_cb_mask;
+       unsigned                        colorbuf_enabled_4bit;
        unsigned                        spi_shader_col_format;
        unsigned                        spi_shader_col_format_alpha;
        unsigned                        spi_shader_col_format_blend;
@@ -319,7 +326,7 @@ struct si_context {
        unsigned                last_sc_line_stipple;
        int                     last_vtx_reuse_depth;
        int                     current_rast_prim; /* primitive type after TES, GS */
-       unsigned                last_gsvs_itemsize;
+       bool                    gs_tri_strip_adj_fix;
 
        /* Scratch buffer */
        struct r600_resource    *scratch_buffer;
@@ -334,6 +341,7 @@ struct si_context {
        struct si_shader_selector *last_tcs;
        int                     last_num_tcs_input_cp;
        int                     last_tes_sh_base;
+       unsigned                last_num_patches;
 
        /* Debug state. */
        bool                    is_debug;
@@ -364,9 +372,17 @@ void si_resource_copy_region(struct pipe_context *ctx,
                             const struct pipe_box *src_box);
 
 /* si_cp_dma.c */
+#define SI_CPDMA_SKIP_CHECK_CS_SPACE   (1 << 0) /* don't call need_cs_space */
+#define SI_CPDMA_SKIP_SYNC_AFTER       (1 << 1) /* don't wait for DMA after the copy */
+#define SI_CPDMA_SKIP_SYNC_BEFORE      (1 << 2) /* don't wait for DMA before the copy (RAW hazards) */
+#define SI_CPDMA_SKIP_GFX_SYNC         (1 << 3) /* don't flush caches and don't wait for PS/CS */
+
 void si_copy_buffer(struct si_context *sctx,
                    struct pipe_resource *dst, struct pipe_resource *src,
-                   uint64_t dst_offset, uint64_t src_offset, unsigned size);
+                   uint64_t dst_offset, uint64_t src_offset, unsigned size,
+                   unsigned user_flags);
+void cik_prefetch_TC_L2_async(struct si_context *sctx, struct pipe_resource *buf,
+                             uint64_t offset, unsigned size);
 void si_init_cp_dma_functions(struct si_context *sctx);
 
 /* si_debug.c */
@@ -401,15 +417,6 @@ struct pipe_video_buffer *si_video_buffer_create(struct pipe_context *pipe,
  * common helpers
  */
 
-static inline struct r600_resource *
-si_resource_create_custom(struct pipe_screen *screen,
-                         unsigned usage, unsigned size)
-{
-       assert(size);
-       return r600_resource(pipe_buffer_create(screen,
-               PIPE_BIND_CUSTOM, usage, size));
-}
-
 static inline void
 si_invalidate_draw_sh_constants(struct si_context *sctx)
 {
@@ -459,7 +466,7 @@ static inline struct tgsi_shader_info *si_get_vs_info(struct si_context *sctx)
 static inline struct si_shader* si_get_vs_state(struct si_context *sctx)
 {
        if (sctx->gs_shader.current)
-               return sctx->gs_shader.current->gs_copy_shader;
+               return sctx->gs_shader.cso->gs_copy_shader;
        else if (sctx->tes_shader.current)
                return sctx->tes_shader.current;
        else
@@ -469,9 +476,9 @@ static inline struct si_shader* si_get_vs_state(struct si_context *sctx)
 static inline bool si_vs_exports_prim_id(struct si_shader *shader)
 {
        if (shader->selector->type == PIPE_SHADER_VERTEX)
-               return shader->key.vs.epilog.export_prim_id;
+               return shader->key.part.vs.epilog.export_prim_id;
        else if (shader->selector->type == PIPE_SHADER_TESS_EVAL)
-               return shader->key.tes.epilog.export_prim_id;
+               return shader->key.part.tes.epilog.export_prim_id;
        else
                return false;
 }