radeonsi: remove Constant Engine support
[mesa.git] / src / gallium / drivers / radeonsi / si_pipe.c
index f08cfcb5cdf1456072d0bf4cf7743b3c93be28bc..3ceaaac165a9e8e49075da277a825f741afb1a19 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "radeon/radeon_uvd.h"
 #include "util/hash_table.h"
+#include "util/u_log.h"
 #include "util/u_memory.h"
 #include "util/u_suballoc.h"
 #include "util/u_tests.h"
@@ -54,10 +55,6 @@ static void si_destroy_context(struct pipe_context *context)
 
        si_release_all_descriptors(sctx);
 
-       if (sctx->ce_suballocator)
-               u_suballocator_destroy(sctx->ce_suballocator);
-
-       r600_resource_reference(&sctx->ce_ram_saved_buffer, NULL);
        pipe_resource_reference(&sctx->esgs_ring, NULL);
        pipe_resource_reference(&sctx->gsvs_ring, NULL);
        pipe_resource_reference(&sctx->tf_ring, NULL);
@@ -95,12 +92,7 @@ static void si_destroy_context(struct pipe_context *context)
 
        LLVMDisposeTargetMachine(sctx->tm);
 
-       r600_resource_reference(&sctx->trace_buf, NULL);
-       r600_resource_reference(&sctx->last_trace_buf, NULL);
-       radeon_clear_saved_cs(&sctx->last_gfx);
-
-       pb_slabs_deinit(&sctx->bindless_descriptor_slabs);
-       util_dynarray_fini(&sctx->bindless_descriptors);
+       si_saved_cs_reference(&sctx->current_saved_cs, NULL);
 
        _mesa_hash_table_destroy(sctx->tex_handles, NULL);
        _mesa_hash_table_destroy(sctx->img_handles, NULL);
@@ -135,6 +127,9 @@ static void si_emit_string_marker(struct pipe_context *ctx,
        struct si_context *sctx = (struct si_context *)ctx;
 
        dd_parse_apitrace_marker(string, len, &sctx->apitrace_call_number);
+
+       if (sctx->b.log)
+               u_log_printf(sctx->b.log, "\nString marker: %*s\n", len, string);
 }
 
 static LLVMTargetMachineRef
@@ -157,6 +152,16 @@ si_create_llvm_target_machine(struct si_screen *sscreen)
                                       LLVMCodeModelDefault);
 }
 
+static void si_set_log_context(struct pipe_context *ctx,
+                              struct u_log_context *log)
+{
+       struct si_context *sctx = (struct si_context *)ctx;
+       sctx->b.log = log;
+
+       if (log)
+               u_log_add_auto_logger(log, si_auto_log_cs, sctx);
+}
+
 static struct pipe_context *si_create_context(struct pipe_screen *screen,
                                               unsigned flags)
 {
@@ -175,6 +180,7 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen,
        sctx->b.b.priv = NULL;
        sctx->b.b.destroy = si_destroy_context;
        sctx->b.b.emit_string_marker = si_emit_string_marker;
+       sctx->b.b.set_log_context = si_set_log_context;
        sctx->b.set_atom_dirty = (void *)si_set_atom_dirty;
        sctx->screen = sscreen; /* Easy accessing of screen/winsys. */
        sctx->is_debug = (flags & PIPE_CONTEXT_DEBUG) != 0;
@@ -200,33 +206,6 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen,
 
        sctx->b.gfx.cs = ws->cs_create(sctx->b.ctx, RING_GFX,
                                       si_context_gfx_flush, sctx);
-
-       /* SI + AMDGPU + CE = GPU hang */
-       if (!(sscreen->b.debug_flags & DBG_NO_CE) && ws->cs_add_const_ib &&
-           sscreen->b.chip_class != SI &&
-           /* These can't use CE due to a power gating bug in the kernel. */
-           sscreen->b.family != CHIP_CARRIZO &&
-           sscreen->b.family != CHIP_STONEY) {
-               sctx->ce_ib = ws->cs_add_const_ib(sctx->b.gfx.cs);
-               if (!sctx->ce_ib)
-                       goto fail;
-
-               if (ws->cs_add_const_preamble_ib) {
-                       sctx->ce_preamble_ib =
-                                  ws->cs_add_const_preamble_ib(sctx->b.gfx.cs);
-
-                       if (!sctx->ce_preamble_ib)
-                               goto fail;
-               }
-
-               sctx->ce_suballocator =
-                       u_suballocator_create(&sctx->b.b, 1024 * 1024, 0,
-                                             PIPE_USAGE_DEFAULT,
-                                             R600_RESOURCE_FLAG_UNMAPPABLE, false);
-               if (!sctx->ce_suballocator)
-                       goto fail;
-       }
-
        sctx->b.gfx.flush = si_context_gfx_flush;
 
        /* Border colors. */
@@ -346,15 +325,6 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen,
 
        sctx->tm = si_create_llvm_target_machine(sscreen);
 
-       /* Create a slab allocator for all bindless descriptors. */
-       if (!pb_slabs_init(&sctx->bindless_descriptor_slabs, 6, 6, 1, sctx,
-                          si_bindless_descriptor_can_reclaim_slab,
-                          si_bindless_descriptor_slab_alloc,
-                          si_bindless_descriptor_slab_free))
-               goto fail;
-
-       util_dynarray_init(&sctx->bindless_descriptors, NULL);
-
        /* Bindless handles. */
        sctx->tex_handles = _mesa_hash_table_create(NULL, _mesa_hash_pointer,
                                                    _mesa_key_pointer_equal);
@@ -516,6 +486,7 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
        case PIPE_CAP_QUERY_TIME_ELAPSED:
        case PIPE_CAP_NIR_SAMPLERS_AS_DEREF:
        case PIPE_CAP_QUERY_SO_OVERFLOW:
+       case PIPE_CAP_MEMOBJ:
                return 1;
 
        case PIPE_CAP_INT64:
@@ -605,7 +576,6 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
        case PIPE_CAP_UMA:
        case PIPE_CAP_POLYGON_MODE_FILL_RECTANGLE:
        case PIPE_CAP_POST_DEPTH_COVERAGE:
-       case PIPE_CAP_MEMOBJ:
                return 0;
 
        case PIPE_CAP_QUERY_BUFFER_OBJECT:
@@ -1055,6 +1025,10 @@ struct pipe_screen *radeonsi_screen_create(struct radeon_winsys *ws,
        sscreen->tess_offchip_block_dw_size =
                sscreen->b.family == CHIP_HAWAII ? 4096 : 8192;
 
+       /* The mere presense of CLEAR_STATE in the IB causes random GPU hangs
+        * on SI. */
+       sscreen->has_clear_state = sscreen->b.chip_class >= CIK;
+
        sscreen->has_distributed_tess =
                sscreen->b.chip_class >= VI &&
                sscreen->b.info.max_se >= 2;