radeonsi: don't re-upload the sample position constant buffer repeatedly
[mesa.git] / src / gallium / drivers / radeonsi / si_pipe.h
index 9ab79bcaa2ed36917aa6f925bb0e26063dac8542..93082e262d6afd1ea3510d2d6ab4eaa92f9b0e44 100644 (file)
@@ -165,6 +165,8 @@ enum {
        DBG_TEST_VMFAULT_CP,
        DBG_TEST_VMFAULT_SDMA,
        DBG_TEST_VMFAULT_SHADER,
+       DBG_TEST_DMA_PERF,
+       DBG_TEST_GDS,
 };
 
 #define DBG_ALL_SHADERS                (((1 << (DBG_CS + 1)) - 1))
@@ -403,6 +405,9 @@ struct si_screen {
        uint64_t                        debug_flags;
        char                            renderer_string[183];
 
+       unsigned                        pa_sc_raster_config;
+       unsigned                        pa_sc_raster_config_1;
+       unsigned                        se_tile_repeat;
        unsigned                        gs_table_depth;
        unsigned                        tess_offchip_block_dw_size;
        unsigned                        tess_offchip_ring_size;
@@ -803,6 +808,9 @@ struct si_context {
        struct si_scissors              scissors;
        struct si_streamout             streamout;
        struct si_viewports             viewports;
+       unsigned                        num_window_rectangles;
+       bool                            window_rectangles_include;
+       struct pipe_scissor_state       window_rectangles[4];
 
        /* Precomputed states. */
        struct si_pm4_state             *init_config;
@@ -821,6 +829,7 @@ struct si_context {
        /* shader information */
        struct si_vertex_elements       *vertex_elements;
        unsigned                        sprite_coord_enable;
+       unsigned                        cs_max_waves_per_sh;
        bool                            flatshade;
        bool                            do_update_shaders;
 
@@ -850,6 +859,7 @@ struct si_context {
        unsigned                        border_color_count;
        unsigned                        num_vs_blit_sgprs;
        uint32_t                        vs_blit_sh_data[SI_VS_BLIT_SGPRS_POS_TEXCOORD];
+       uint32_t                        cs_user_data[4];
 
        /* Vertex and index buffers. */
        bool                            vertex_buffers_dirty;
@@ -955,11 +965,14 @@ struct si_context {
        /* MSAA sample locations.
         * The first index is the sample index.
         * The second index is the coordinate: X, Y. */
-       float                   sample_locations_1x[1][2];
-       float                   sample_locations_2x[2][2];
-       float                   sample_locations_4x[4][2];
-       float                   sample_locations_8x[8][2];
-       float                   sample_locations_16x[16][2];
+       struct {
+               float                   x1[1][2];
+               float                   x2[2][2];
+               float                   x4[4][2];
+               float                   x8[8][2];
+               float                   x16[16][2];
+       } sample_positions;
+       struct pipe_resource *sample_pos_buffer;
 
        /* Misc stats. */
        unsigned                        num_draw_calls;
@@ -1023,9 +1036,6 @@ struct si_context {
                         unsigned src_level,
                         const struct pipe_box *src_box);
 
-       void (*dma_clear_buffer)(struct si_context *sctx, struct pipe_resource *dst,
-                                uint64_t offset, uint64_t size, unsigned value);
-
        struct si_tracked_regs                  tracked_regs;
 };
 
@@ -1104,6 +1114,12 @@ void si_init_clear_functions(struct si_context *sctx);
                           SI_CPDMA_SKIP_GFX_SYNC | \
                           SI_CPDMA_SKIP_BO_LIST_UPDATE)
 
+enum si_cache_policy {
+       L2_BYPASS,
+       L2_STREAM, /* same as SLC=1 */
+       L2_LRU,    /* same as SLC=0 */
+};
+
 enum si_coherency {
        SI_COHERENCY_NONE, /* no cache flushes needed */
        SI_COHERENCY_SHADER,
@@ -1111,16 +1127,25 @@ enum si_coherency {
 };
 
 void si_cp_dma_wait_for_idle(struct si_context *sctx);
+void si_cp_dma_clear_buffer(struct si_context *sctx, struct pipe_resource *dst,
+                           uint64_t offset, uint64_t size, unsigned value,
+                           enum si_coherency coher,
+                           enum si_cache_policy cache_policy);
 void si_clear_buffer(struct si_context *sctx, struct pipe_resource *dst,
                     uint64_t offset, uint64_t size, unsigned value,
                     enum si_coherency coher);
+void si_cp_dma_copy_buffer(struct si_context *sctx,
+                          struct pipe_resource *dst, struct pipe_resource *src,
+                          uint64_t dst_offset, uint64_t src_offset, unsigned size,
+                          unsigned user_flags, enum si_coherency coher,
+                          enum si_cache_policy cache_policy);
 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,
-                   unsigned user_flags);
+                   uint64_t dst_offset, uint64_t src_offset, unsigned size);
 void cik_prefetch_TC_L2_async(struct si_context *sctx, struct pipe_resource *buf,
                              uint64_t offset, unsigned size);
 void cik_emit_prefetch_L2(struct si_context *sctx, bool vertex_stage_only);
+void si_test_gds(struct si_context *sctx);
 void si_init_cp_dma_functions(struct si_context *sctx);
 
 /* si_debug.c */
@@ -1141,6 +1166,10 @@ bool si_replace_shader(unsigned num, struct ac_shader_binary *binary);
 void si_init_dma_functions(struct si_context *sctx);
 
 /* si_dma_cs.c */
+void si_dma_emit_timestamp(struct si_context *sctx, struct r600_resource *dst,
+                          uint64_t offset);
+void si_sdma_clear_buffer(struct si_context *sctx, struct pipe_resource *dst,
+                         uint64_t offset, uint64_t size, unsigned clear_value);
 void si_need_dma_space(struct si_context *ctx, unsigned num_dw,
                       struct r600_resource *dst, struct r600_resource *src);
 void si_flush_dma_cs(struct si_context *ctx, unsigned flags,
@@ -1149,21 +1178,20 @@ void si_screen_clear_buffer(struct si_screen *sscreen, struct pipe_resource *dst
                            uint64_t offset, uint64_t size, unsigned value);
 
 /* si_fence.c */
-void si_gfx_write_event_eop(struct si_context *ctx,
-                           unsigned event, unsigned event_flags,
-                           unsigned data_sel,
-                           struct r600_resource *buf, uint64_t va,
-                           uint32_t new_fence, unsigned query_type);
-unsigned si_gfx_write_fence_dwords(struct si_screen *screen);
-void si_gfx_wait_fence(struct si_context *ctx,
-                      uint64_t va, uint32_t ref, uint32_t mask);
+void si_cp_release_mem(struct si_context *ctx,
+                      unsigned event, unsigned event_flags,
+                      unsigned dst_sel, unsigned int_sel, unsigned data_sel,
+                      struct r600_resource *buf, uint64_t va,
+                      uint32_t new_fence, unsigned query_type);
+unsigned si_cp_write_fence_dwords(struct si_screen *screen);
+void si_cp_wait_mem(struct si_context *ctx,
+                     uint64_t va, uint32_t ref, uint32_t mask, unsigned flags);
 void si_init_fence_functions(struct si_context *ctx);
 void si_init_screen_fence_functions(struct si_screen *screen);
 struct pipe_fence_handle *si_create_fence(struct pipe_context *ctx,
                                          struct tc_unflushed_batch_token *tc_token);
 
 /* si_get.c */
-const char *si_get_family_name(const struct si_screen *sscreen);
 void si_init_screen_get_functions(struct si_screen *sscreen);
 
 /* si_gfx_cs.c */
@@ -1196,9 +1224,21 @@ void si_init_query_functions(struct si_context *sctx);
 void si_suspend_queries(struct si_context *sctx);
 void si_resume_queries(struct si_context *sctx);
 
+/* si_shaderlib_tgsi.c */
+void *si_get_blitter_vs(struct si_context *sctx, enum blitter_attrib_type type,
+                       unsigned num_layers);
+void *si_create_fixed_func_tcs(struct si_context *sctx);
+void *si_create_dma_compute_shader(struct pipe_context *ctx,
+                                  unsigned num_dwords_per_thread,
+                                  bool dst_stream_cache_policy, bool is_copy);
+void *si_create_query_result_cs(struct si_context *sctx);
+
 /* si_test_dma.c */
 void si_test_dma(struct si_screen *sscreen);
 
+/* si_test_clearbuffer.c */
+void si_test_dma_perf(struct si_screen *sscreen);
+
 /* si_uvd.c */
 struct pipe_video_codec *si_uvd_create_decoder(struct pipe_context *context,
                                               const struct pipe_video_codec *templ);