From: Nicolai Hähnle <nicolai.haeh...@amd.com>

---
 src/gallium/drivers/radeonsi/si_pipe.c       |  4 +--
 src/gallium/drivers/radeonsi/si_state.c      |  2 --
 src/gallium/drivers/radeonsi/si_state.h      | 10 +------
 src/gallium/drivers/radeonsi/si_state_draw.c | 28 +++++++++++++-------
 4 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_pipe.c 
b/src/gallium/drivers/radeonsi/si_pipe.c
index 7943af4d86e..fd8ff5fa202 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -494,44 +494,44 @@ static struct pipe_context *si_create_context(struct 
pipe_screen *screen,
                ws->buffer_map(sctx->border_color_buffer->buf,
                               NULL, PIPE_TRANSFER_WRITE);
        if (!sctx->border_color_map)
                goto fail;
 
        si_init_all_descriptors(sctx);
        si_init_fence_functions(sctx);
        si_init_state_functions(sctx);
        si_init_shader_functions(sctx);
        si_init_viewport_functions(sctx);
-       si_init_ia_multi_vgt_param_table(sctx);
 
        if (sctx->chip_class >= CIK)
                cik_init_sdma_functions(sctx);
        else
                si_init_dma_functions(sctx);
 
        if (sscreen->debug_flags & DBG(FORCE_DMA))
                sctx->b.resource_copy_region = sctx->dma_copy;
 
        bool dst_stream_policy = SI_COMPUTE_DST_CACHE_POLICY != L2_LRU;
        sctx->cs_clear_buffer = si_create_dma_compute_shader(&sctx->b,
                                             SI_COMPUTE_CLEAR_DW_PER_THREAD,
                                             dst_stream_policy, false);
        sctx->cs_copy_buffer = si_create_dma_compute_shader(&sctx->b,
                                             SI_COMPUTE_COPY_DW_PER_THREAD,
                                             dst_stream_policy, true);
 
        sctx->blitter = util_blitter_create(&sctx->b);
        if (sctx->blitter == NULL)
                goto fail;
-       sctx->blitter->draw_rectangle = si_draw_rectangle;
        sctx->blitter->skip_viewport_restore = true;
 
+       si_init_draw_functions(sctx);
+
        sctx->sample_mask = 0xffff;
 
        if (sctx->chip_class >= GFX9) {
                sctx->wait_mem_scratch = r600_resource(
                        pipe_buffer_create(screen, 0, PIPE_USAGE_DEFAULT, 4));
                if (!sctx->wait_mem_scratch)
                        goto fail;
 
                /* Initialize the memory. */
                struct radeon_cmdbuf *cs = sctx->gfx_cs;
diff --git a/src/gallium/drivers/radeonsi/si_state.c 
b/src/gallium/drivers/radeonsi/si_state.c
index 0960f379c4f..86d7b3a16f9 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -4818,22 +4818,20 @@ void si_init_state_functions(struct si_context *sctx)
        sctx->b.delete_vertex_elements_state = si_delete_vertex_element;
        sctx->b.set_vertex_buffers = si_set_vertex_buffers;
 
        sctx->b.texture_barrier = si_texture_barrier;
        sctx->b.memory_barrier = si_memory_barrier;
        sctx->b.set_min_samples = si_set_min_samples;
        sctx->b.set_tess_state = si_set_tess_state;
 
        sctx->b.set_active_query_state = si_set_active_query_state;
 
-       sctx->b.draw_vbo = si_draw_vbo;
-
        si_init_config(sctx);
 }
 
 void si_init_screen_state_functions(struct si_screen *sscreen)
 {
        sscreen->b.is_format_supported = si_is_format_supported;
 }
 
 static void si_set_grbm_gfx_index(struct si_context *sctx,
                                  struct si_pm4_state *pm4,  unsigned value)
diff --git a/src/gallium/drivers/radeonsi/si_state.h 
b/src/gallium/drivers/radeonsi/si_state.h
index 83589e6918c..bb186f530f0 100644
--- a/src/gallium/drivers/radeonsi/si_state.h
+++ b/src/gallium/drivers/radeonsi/si_state.h
@@ -534,31 +534,23 @@ bool si_init_shader_cache(struct si_screen *sscreen);
 void si_destroy_shader_cache(struct si_screen *sscreen);
 void si_schedule_initial_compile(struct si_context *sctx, unsigned processor,
                                 struct util_queue_fence *ready_fence,
                                 struct si_compiler_ctx_state 
*compiler_ctx_state,
                                 void *job, util_queue_execute_func execute);
 void si_get_active_slot_masks(const struct tgsi_shader_info *info,
                              uint32_t *const_and_shader_buffers,
                              uint64_t *samplers_and_images);
 
 /* si_state_draw.c */
-void si_init_ia_multi_vgt_param_table(struct si_context *sctx);
 void si_emit_cache_flush(struct si_context *sctx);
-void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *dinfo);
-void si_draw_rectangle(struct blitter_context *blitter,
-                      void *vertex_elements_cso,
-                      blitter_get_vs_func get_vs,
-                      int x1, int y1, int x2, int y2,
-                      float depth, unsigned num_instances,
-                      enum blitter_attrib_type type,
-                      const union blitter_attrib *attrib);
 void si_trace_emit(struct si_context *sctx);
+void si_init_draw_functions(struct si_context *sctx);
 
 /* si_state_msaa.c */
 void si_init_msaa_functions(struct si_context *sctx);
 void si_emit_sample_locations(struct radeon_cmdbuf *cs, int nr_samples);
 
 /* si_state_streamout.c */
 void si_streamout_buffers_dirty(struct si_context *sctx);
 void si_emit_streamout_end(struct si_context *sctx);
 void si_update_prims_generated_query_state(struct si_context *sctx,
                                           unsigned type, int diff);
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c 
b/src/gallium/drivers/radeonsi/si_state_draw.c
index 612ca910cb9..254f9edeb75 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -448,21 +448,21 @@ si_get_init_multi_vgt_param(struct si_screen *sscreen,
                S_028AA8_PARTIAL_VS_WAVE_ON(partial_vs_wave) |
                S_028AA8_PARTIAL_ES_WAVE_ON(partial_es_wave) |
                S_028AA8_WD_SWITCH_ON_EOP(sscreen->info.chip_class >= CIK ? 
wd_switch_on_eop : 0) |
                /* The following field was moved to VGT_SHADER_STAGES_EN in 
GFX9. */
                S_028AA8_MAX_PRIMGRP_IN_WAVE(sscreen->info.chip_class == VI ?
                                             max_primgroup_in_wave : 0) |
                S_030960_EN_INST_OPT_BASIC(sscreen->info.chip_class >= GFX9) |
                S_030960_EN_INST_OPT_ADV(sscreen->info.chip_class >= GFX9);
 }
 
-void si_init_ia_multi_vgt_param_table(struct si_context *sctx)
+static void si_init_ia_multi_vgt_param_table(struct si_context *sctx)
 {
        for (int prim = 0; prim <= SI_PRIM_RECTANGLE_LIST; prim++)
        for (int uses_instancing = 0; uses_instancing < 2; uses_instancing++)
        for (int multi_instances = 0; multi_instances < 2; multi_instances++)
        for (int primitive_restart = 0; primitive_restart < 2; 
primitive_restart++)
        for (int count_from_so = 0; count_from_so < 2; count_from_so++)
        for (int line_stipple = 0; line_stipple < 2; line_stipple++)
        for (int uses_tess = 0; uses_tess < 2; uses_tess++)
        for (int tess_uses_primid = 0; tess_uses_primid < 2; tess_uses_primid++)
        for (int uses_gs = 0; uses_gs < 2; uses_gs++) {
@@ -1241,21 +1241,21 @@ static void si_emit_all_states(struct si_context *sctx, 
const struct pipe_draw_i
            (context_roll || sctx->context_roll_counter)) {
                sctx->scissors.dirty_mask = (1 << SI_MAX_VIEWPORTS) - 1;
                sctx->atoms.s.scissors.emit(sctx);
        }
 
        /* Emit draw states. */
        si_emit_vs_state(sctx, info);
        si_emit_draw_registers(sctx, info, num_patches);
 }
 
-void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
+static void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info 
*info)
 {
        struct si_context *sctx = (struct si_context *)ctx;
        struct si_state_rasterizer *rs = sctx->queued.named.rasterizer;
        struct pipe_resource *indexbuf = info->index.resource;
        unsigned dirty_tex_counter;
        enum pipe_prim_type rast_prim;
        unsigned index_size = info->index_size;
        unsigned index_offset = info->indirect ? info->start * index_size : 0;
 
        if (likely(!info->indirect)) {
@@ -1521,27 +1521,28 @@ void si_draw_vbo(struct pipe_context *ctx, const struct 
pipe_draw_info *info)
                        sctx->num_mrt_draw_calls++;
                if (info->primitive_restart)
                        sctx->num_prim_restart_calls++;
                if (G_0286E8_WAVESIZE(sctx->spi_tmpring_size))
                        sctx->num_spill_draw_calls++;
        }
        if (index_size && indexbuf != info->index.resource)
                pipe_resource_reference(&indexbuf, NULL);
 }
 
-void si_draw_rectangle(struct blitter_context *blitter,
-                      void *vertex_elements_cso,
-                      blitter_get_vs_func get_vs,
-                      int x1, int y1, int x2, int y2,
-                      float depth, unsigned num_instances,
-                      enum blitter_attrib_type type,
-                      const union blitter_attrib *attrib)
+static void
+si_draw_rectangle(struct blitter_context *blitter,
+                 void *vertex_elements_cso,
+                 blitter_get_vs_func get_vs,
+                 int x1, int y1, int x2, int y2,
+                 float depth, unsigned num_instances,
+                 enum blitter_attrib_type type,
+                 const union blitter_attrib *attrib)
 {
        struct pipe_context *pipe = util_blitter_get_pipe(blitter);
        struct si_context *sctx = (struct si_context*)pipe;
 
        /* Pack position coordinates as signed int16. */
        sctx->vs_blit_sh_data[0] = (uint32_t)(x1 & 0xffff) |
                                   ((uint32_t)(y1 & 0xffff) << 16);
        sctx->vs_blit_sh_data[1] = (uint32_t)(x2 & 0xffff) |
                                   ((uint32_t)(y2 & 0xffff) << 16);
        sctx->vs_blit_sh_data[2] = fui(depth);
@@ -1585,10 +1586,19 @@ void si_trace_emit(struct si_context *sctx)
                    S_370_ENGINE_SEL(V_370_ME));
        radeon_emit(cs, va);
        radeon_emit(cs, va >> 32);
        radeon_emit(cs, trace_id);
        radeon_emit(cs, PKT3(PKT3_NOP, 0, 0));
        radeon_emit(cs, AC_ENCODE_TRACE_POINT(trace_id));
 
        if (sctx->log)
                u_log_flush(sctx->log);
 }
+
+void si_init_draw_functions(struct si_context *sctx)
+{
+       sctx->b.draw_vbo = si_draw_vbo;
+
+       sctx->blitter->draw_rectangle = si_draw_rectangle;
+
+       si_init_ia_multi_vgt_param_table(sctx);
+}
-- 
2.19.1

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to