Lines Matching refs:rctx
94 static bool r600_query_sw_begin(struct r600_common_context *rctx, in r600_query_sw_begin() argument
105 query->begin_result = rctx->num_draw_calls; in r600_query_sw_begin()
108 query->begin_result = rctx->num_decompress_calls; in r600_query_sw_begin()
111 query->begin_result = rctx->num_mrt_draw_calls; in r600_query_sw_begin()
114 query->begin_result = rctx->num_prim_restart_calls; in r600_query_sw_begin()
117 query->begin_result = rctx->num_spill_draw_calls; in r600_query_sw_begin()
120 query->begin_result = rctx->num_compute_calls; in r600_query_sw_begin()
123 query->begin_result = rctx->num_spill_compute_calls; in r600_query_sw_begin()
126 query->begin_result = rctx->num_dma_calls; in r600_query_sw_begin()
129 query->begin_result = rctx->num_cp_dma_calls; in r600_query_sw_begin()
132 query->begin_result = rctx->num_vs_flushes; in r600_query_sw_begin()
135 query->begin_result = rctx->num_ps_flushes; in r600_query_sw_begin()
138 query->begin_result = rctx->num_cs_flushes; in r600_query_sw_begin()
141 query->begin_result = rctx->num_cb_cache_flushes; in r600_query_sw_begin()
144 query->begin_result = rctx->num_db_cache_flushes; in r600_query_sw_begin()
147 query->begin_result = rctx->num_L2_invalidates; in r600_query_sw_begin()
150 query->begin_result = rctx->num_L2_writebacks; in r600_query_sw_begin()
153 query->begin_result = rctx->num_resident_handles; in r600_query_sw_begin()
156 query->begin_result = rctx->tc ? rctx->tc->num_offloaded_slots : 0; in r600_query_sw_begin()
159 query->begin_result = rctx->tc ? rctx->tc->num_direct_slots : 0; in r600_query_sw_begin()
162 query->begin_result = rctx->tc ? rctx->tc->num_syncs : 0; in r600_query_sw_begin()
186 query->begin_result = rctx->ws->query_value(rctx->ws, ws_id); in r600_query_sw_begin()
191 query->begin_result = rctx->ws->query_value(rctx->ws, ws_id); in r600_query_sw_begin()
192 query->begin_time = rctx->ws->query_value(rctx->ws, in r600_query_sw_begin()
197 query->begin_result = rctx->ws->query_value(rctx->ws, ws_id); in r600_query_sw_begin()
202 rctx->tc ? util_queue_get_thread_time_nano(&rctx->tc->queue, 0) : 0; in r600_query_sw_begin()
226 query->begin_result = si_begin_counter(rctx->screen, in r600_query_sw_begin()
230 query->begin_result = p_atomic_read(&rctx->screen->num_compilations); in r600_query_sw_begin()
233 query->begin_result = p_atomic_read(&rctx->screen->num_shaders_created); in r600_query_sw_begin()
237 p_atomic_read(&rctx->screen->num_shader_cache_hits); in r600_query_sw_begin()
252 static bool r600_query_sw_end(struct r600_common_context *rctx, in r600_query_sw_end() argument
262 rctx->b.flush(&rctx->b, &query->fence, PIPE_FLUSH_DEFERRED); in r600_query_sw_end()
265 query->end_result = rctx->num_draw_calls; in r600_query_sw_end()
268 query->end_result = rctx->num_decompress_calls; in r600_query_sw_end()
271 query->end_result = rctx->num_mrt_draw_calls; in r600_query_sw_end()
274 query->end_result = rctx->num_prim_restart_calls; in r600_query_sw_end()
277 query->end_result = rctx->num_spill_draw_calls; in r600_query_sw_end()
280 query->end_result = rctx->num_compute_calls; in r600_query_sw_end()
283 query->end_result = rctx->num_spill_compute_calls; in r600_query_sw_end()
286 query->end_result = rctx->num_dma_calls; in r600_query_sw_end()
289 query->end_result = rctx->num_cp_dma_calls; in r600_query_sw_end()
292 query->end_result = rctx->num_vs_flushes; in r600_query_sw_end()
295 query->end_result = rctx->num_ps_flushes; in r600_query_sw_end()
298 query->end_result = rctx->num_cs_flushes; in r600_query_sw_end()
301 query->end_result = rctx->num_cb_cache_flushes; in r600_query_sw_end()
304 query->end_result = rctx->num_db_cache_flushes; in r600_query_sw_end()
307 query->end_result = rctx->num_L2_invalidates; in r600_query_sw_end()
310 query->end_result = rctx->num_L2_writebacks; in r600_query_sw_end()
313 query->end_result = rctx->num_resident_handles; in r600_query_sw_end()
316 query->end_result = rctx->tc ? rctx->tc->num_offloaded_slots : 0; in r600_query_sw_end()
319 query->end_result = rctx->tc ? rctx->tc->num_direct_slots : 0; in r600_query_sw_end()
322 query->end_result = rctx->tc ? rctx->tc->num_syncs : 0; in r600_query_sw_end()
343 query->end_result = rctx->ws->query_value(rctx->ws, ws_id); in r600_query_sw_end()
348 query->end_result = rctx->ws->query_value(rctx->ws, ws_id); in r600_query_sw_end()
349 query->end_time = rctx->ws->query_value(rctx->ws, in r600_query_sw_end()
354 query->end_result = rctx->ws->query_value(rctx->ws, ws_id); in r600_query_sw_end()
359 rctx->tc ? util_queue_get_thread_time_nano(&rctx->tc->queue, 0) : 0; in r600_query_sw_end()
383 query->end_result = si_end_counter(rctx->screen, in r600_query_sw_end()
389 query->end_result = p_atomic_read(&rctx->screen->num_compilations); in r600_query_sw_end()
392 query->end_result = p_atomic_read(&rctx->screen->num_shaders_created); in r600_query_sw_end()
395 query->end_result = rctx->last_tex_ps_draw_ratio; in r600_query_sw_end()
399 p_atomic_read(&rctx->screen->num_shader_cache_hits); in r600_query_sw_end()
414 static bool r600_query_sw_get_result(struct r600_common_context *rctx, in r600_query_sw_get_result() argument
425 (uint64_t)rctx->screen->info.clock_crystal_freq * 1000; in r600_query_sw_get_result()
429 struct pipe_screen *screen = rctx->b.screen; in r600_query_sw_get_result()
430 struct pipe_context *ctx = rquery->b.flushed ? NULL : &rctx->b; in r600_query_sw_get_result()
450 result->u32 = rctx->screen->info.num_good_compute_units; in r600_query_sw_get_result()
453 result->u32 = rctx->screen->info.num_render_backends; in r600_query_sw_get_result()
459 result->u32 = rctx->screen->info.max_se; in r600_query_sw_get_result()
582 static void r600_query_hw_get_result_resource(struct r600_common_context *rctx,
698 static void r600_update_occlusion_query_state(struct r600_common_context *rctx, in r600_update_occlusion_query_state() argument
704 bool old_enable = rctx->num_occlusion_queries != 0; in r600_update_occlusion_query_state()
706 rctx->num_perfect_occlusion_queries != 0; in r600_update_occlusion_query_state()
709 rctx->num_occlusion_queries += diff; in r600_update_occlusion_query_state()
710 assert(rctx->num_occlusion_queries >= 0); in r600_update_occlusion_query_state()
713 rctx->num_perfect_occlusion_queries += diff; in r600_update_occlusion_query_state()
714 assert(rctx->num_perfect_occlusion_queries >= 0); in r600_update_occlusion_query_state()
717 enable = rctx->num_occlusion_queries != 0; in r600_update_occlusion_query_state()
718 perfect_enable = rctx->num_perfect_occlusion_queries != 0; in r600_update_occlusion_query_state()
721 rctx->set_occlusion_query_state(&rctx->b, old_enable, in r600_update_occlusion_query_state()
1041 struct r600_common_context *rctx = (struct r600_common_context *)ctx; in r600_destroy_query() local
1044 rquery->ops->destroy(rctx->screen, rquery); in r600_destroy_query()
1050 struct r600_common_context *rctx = (struct r600_common_context *)ctx; in r600_begin_query() local
1053 return rquery->ops->begin(rctx, rquery); in r600_begin_query()
1056 void si_query_hw_reset_buffers(struct r600_common_context *rctx, in si_query_hw_reset_buffers() argument
1073 if (si_rings_is_buffer_referenced(rctx, query->buffer.buf->buf, RADEON_USAGE_READWRITE) || in si_query_hw_reset_buffers()
1074 !rctx->ws->buffer_wait(query->buffer.buf->buf, 0, RADEON_USAGE_READWRITE)) { in si_query_hw_reset_buffers()
1076 query->buffer.buf = r600_new_query_buffer(rctx->screen, query); in si_query_hw_reset_buffers()
1078 if (!query->ops->prepare_buffer(rctx->screen, query, query->buffer.buf)) in si_query_hw_reset_buffers()
1083 bool si_query_hw_begin(struct r600_common_context *rctx, in si_query_hw_begin() argument
1094 si_query_hw_reset_buffers(rctx, query); in si_query_hw_begin()
1098 r600_query_hw_emit_start(rctx, query); in si_query_hw_begin()
1102 LIST_ADDTAIL(&query->list, &rctx->active_queries); in si_query_hw_begin()
1108 struct r600_common_context *rctx = (struct r600_common_context *)ctx; in r600_end_query() local
1111 return rquery->ops->end(rctx, rquery); in r600_end_query()
1114 bool si_query_hw_end(struct r600_common_context *rctx, in si_query_hw_end() argument
1120 si_query_hw_reset_buffers(rctx, query); in si_query_hw_end()
1122 r600_query_hw_emit_stop(rctx, query); in si_query_hw_end()
1133 static void r600_get_hw_query_params(struct r600_common_context *rctx, in r600_get_hw_query_params() argument
1137 unsigned max_rbs = rctx->screen->info.num_render_backends; in r600_get_hw_query_params()
1334 struct r600_common_context *rctx = (struct r600_common_context *)ctx; in r600_get_query_result() local
1337 return rquery->ops->get_result(rctx, rquery, wait, result); in r600_get_query_result()
1348 struct r600_common_context *rctx = (struct r600_common_context *)ctx; in r600_get_query_result_resource() local
1351 rquery->ops->get_result_resource(rctx, rquery, wait, result_type, index, in r600_get_query_result_resource()
1361 bool si_query_hw_get_result(struct r600_common_context *rctx, in si_query_hw_get_result() argument
1365 struct si_screen *sscreen = rctx->screen; in si_query_hw_get_result()
1378 map = rctx->ws->buffer_map(qbuf->buf->buf, NULL, usage); in si_query_hw_get_result()
1380 map = si_buffer_map_sync_with_rings(rctx, qbuf->buf, usage); in si_query_hw_get_result()
1432 static void r600_create_query_result_shader(struct r600_common_context *rctx) in r600_create_query_result_shader() argument
1603 rctx->screen->info.clock_crystal_freq); in r600_create_query_result_shader()
1613 rctx->query_result_shader = rctx->b.create_compute_state(&rctx->b, &state); in r600_create_query_result_shader()
1616 static void r600_restore_qbo_state(struct r600_common_context *rctx, in r600_restore_qbo_state() argument
1619 rctx->b.bind_compute_state(&rctx->b, st->saved_compute); in r600_restore_qbo_state()
1621 rctx->b.set_constant_buffer(&rctx->b, PIPE_SHADER_COMPUTE, 0, &st->saved_const0); in r600_restore_qbo_state()
1624 rctx->b.set_shader_buffers(&rctx->b, PIPE_SHADER_COMPUTE, 0, 3, st->saved_ssbo); in r600_restore_qbo_state()
1629 static void r600_query_hw_get_result_resource(struct r600_common_context *rctx, in r600_query_hw_get_result_resource() argument
1657 if (!rctx->query_result_shader) { in r600_query_hw_get_result_resource()
1658 r600_create_query_result_shader(rctx); in r600_query_hw_get_result_resource()
1659 if (!rctx->query_result_shader) in r600_query_hw_get_result_resource()
1664 u_suballocator_alloc(rctx->allocator_zeroed_memory, 16, 16, in r600_query_hw_get_result_resource()
1670 rctx->save_qbo_state(&rctx->b, &saved_state); in r600_query_hw_get_result_resource()
1672 r600_get_hw_query_params(rctx, query, index >= 0 ? index : 0, ¶ms); in r600_query_hw_get_result_resource()
1688 rctx->b.bind_compute_state(&rctx->b, rctx->query_result_shader); in r600_query_hw_get_result_resource()
1722 rctx->flags |= rctx->screen->barrier_flags.cp_to_L2; in r600_query_hw_get_result_resource()
1741 rctx->b.set_constant_buffer(&rctx->b, PIPE_SHADER_COMPUTE, 0, &constant_buffer); in r600_query_hw_get_result_resource()
1755 rctx->b.set_shader_buffers(&rctx->b, PIPE_SHADER_COMPUTE, 0, 3, ssbo); in r600_query_hw_get_result_resource()
1767 si_gfx_wait_fence(rctx, va, 0x80000000, 0x80000000); in r600_query_hw_get_result_resource()
1770 rctx->b.launch_grid(&rctx->b, &grid); in r600_query_hw_get_result_resource()
1771 rctx->flags |= SI_CONTEXT_CS_PARTIAL_FLUSH; in r600_query_hw_get_result_resource()
1774 r600_restore_qbo_state(rctx, &saved_state); in r600_query_hw_get_result_resource()
1783 struct r600_common_context *rctx = (struct r600_common_context *)ctx; in r600_render_condition() local
1785 struct r600_atom *atom = &rctx->render_cond_atom; in r600_render_condition()
1794 if (((rctx->chip_class == VI && rctx->screen->info.pfp_fw_feature < 49) || in r600_render_condition()
1795 (rctx->chip_class == GFX9 && rctx->screen->info.pfp_fw_feature < 38)) && in r600_render_condition()
1805 bool old_force_off = rctx->render_cond_force_off; in r600_render_condition()
1806 rctx->render_cond_force_off = true; in r600_render_condition()
1809 rctx->allocator_zeroed_memory, 8, 8, in r600_render_condition()
1816 rctx->render_cond = NULL; in r600_render_condition()
1824 rctx->flags |= rctx->screen->barrier_flags.L2_to_cp | in r600_render_condition()
1827 rctx->render_cond_force_off = old_force_off; in r600_render_condition()
1831 rctx->render_cond = query; in r600_render_condition()
1832 rctx->render_cond_invert = condition; in r600_render_condition()
1833 rctx->render_cond_mode = mode; in r600_render_condition()
1835 rctx->set_atom_dirty(rctx, atom, query != NULL); in r600_render_condition()
2077 void si_init_query_functions(struct r600_common_context *rctx) in si_init_query_functions() argument
2079 rctx->b.create_query = r600_create_query; in si_init_query_functions()
2080 rctx->b.create_batch_query = si_create_batch_query; in si_init_query_functions()
2081 rctx->b.destroy_query = r600_destroy_query; in si_init_query_functions()
2082 rctx->b.begin_query = r600_begin_query; in si_init_query_functions()
2083 rctx->b.end_query = r600_end_query; in si_init_query_functions()
2084 rctx->b.get_query_result = r600_get_query_result; in si_init_query_functions()
2085 rctx->b.get_query_result_resource = r600_get_query_result_resource; in si_init_query_functions()
2086 rctx->render_cond_atom.emit = r600_emit_query_predication; in si_init_query_functions()
2088 if (((struct si_screen*)rctx->b.screen)->info.num_render_backends > 0) in si_init_query_functions()
2089 rctx->b.render_condition = r600_render_condition; in si_init_query_functions()
2091 LIST_INITHEAD(&rctx->active_queries); in si_init_query_functions()