Lines Matching refs:rctx
92 static bool r600_query_sw_begin(struct r600_common_context *rctx, in r600_query_sw_begin() argument
103 query->begin_result = rctx->num_draw_calls; in r600_query_sw_begin()
106 query->begin_result = rctx->num_decompress_calls; in r600_query_sw_begin()
109 query->begin_result = rctx->num_mrt_draw_calls; in r600_query_sw_begin()
112 query->begin_result = rctx->num_prim_restart_calls; in r600_query_sw_begin()
115 query->begin_result = rctx->num_spill_draw_calls; in r600_query_sw_begin()
118 query->begin_result = rctx->num_compute_calls; in r600_query_sw_begin()
121 query->begin_result = rctx->num_spill_compute_calls; in r600_query_sw_begin()
124 query->begin_result = rctx->num_dma_calls; in r600_query_sw_begin()
127 query->begin_result = rctx->num_cp_dma_calls; in r600_query_sw_begin()
130 query->begin_result = rctx->num_vs_flushes; in r600_query_sw_begin()
133 query->begin_result = rctx->num_ps_flushes; in r600_query_sw_begin()
136 query->begin_result = rctx->num_cs_flushes; in r600_query_sw_begin()
139 query->begin_result = rctx->num_cb_cache_flushes; in r600_query_sw_begin()
142 query->begin_result = rctx->num_db_cache_flushes; in r600_query_sw_begin()
145 query->begin_result = rctx->num_resident_handles; in r600_query_sw_begin()
148 query->begin_result = rctx->tc ? rctx->tc->num_offloaded_slots : 0; in r600_query_sw_begin()
151 query->begin_result = rctx->tc ? rctx->tc->num_direct_slots : 0; in r600_query_sw_begin()
154 query->begin_result = rctx->tc ? rctx->tc->num_syncs : 0; in r600_query_sw_begin()
176 query->begin_result = rctx->ws->query_value(rctx->ws, ws_id); in r600_query_sw_begin()
181 query->begin_result = rctx->ws->query_value(rctx->ws, ws_id); in r600_query_sw_begin()
182 query->begin_time = rctx->ws->query_value(rctx->ws, in r600_query_sw_begin()
187 query->begin_result = rctx->ws->query_value(rctx->ws, ws_id); in r600_query_sw_begin()
192 rctx->tc ? util_queue_get_thread_time_nano(&rctx->tc->queue, 0) : 0; in r600_query_sw_begin()
216 query->begin_result = r600_begin_counter(rctx->screen, in r600_query_sw_begin()
220 query->begin_result = p_atomic_read(&rctx->screen->num_compilations); in r600_query_sw_begin()
223 query->begin_result = p_atomic_read(&rctx->screen->num_shaders_created); in r600_query_sw_begin()
227 p_atomic_read(&rctx->screen->num_shader_cache_hits); in r600_query_sw_begin()
242 static bool r600_query_sw_end(struct r600_common_context *rctx, in r600_query_sw_end() argument
252 rctx->b.flush(&rctx->b, &query->fence, PIPE_FLUSH_DEFERRED); in r600_query_sw_end()
255 query->end_result = rctx->num_draw_calls; in r600_query_sw_end()
258 query->end_result = rctx->num_decompress_calls; in r600_query_sw_end()
261 query->end_result = rctx->num_mrt_draw_calls; in r600_query_sw_end()
264 query->end_result = rctx->num_prim_restart_calls; in r600_query_sw_end()
267 query->end_result = rctx->num_spill_draw_calls; in r600_query_sw_end()
270 query->end_result = rctx->num_compute_calls; in r600_query_sw_end()
273 query->end_result = rctx->num_spill_compute_calls; in r600_query_sw_end()
276 query->end_result = rctx->num_dma_calls; in r600_query_sw_end()
279 query->end_result = rctx->num_cp_dma_calls; in r600_query_sw_end()
282 query->end_result = rctx->num_vs_flushes; in r600_query_sw_end()
285 query->end_result = rctx->num_ps_flushes; in r600_query_sw_end()
288 query->end_result = rctx->num_cs_flushes; in r600_query_sw_end()
291 query->end_result = rctx->num_cb_cache_flushes; in r600_query_sw_end()
294 query->end_result = rctx->num_db_cache_flushes; in r600_query_sw_end()
297 query->end_result = rctx->num_resident_handles; in r600_query_sw_end()
300 query->end_result = rctx->tc ? rctx->tc->num_offloaded_slots : 0; in r600_query_sw_end()
303 query->end_result = rctx->tc ? rctx->tc->num_direct_slots : 0; in r600_query_sw_end()
306 query->end_result = rctx->tc ? rctx->tc->num_syncs : 0; in r600_query_sw_end()
326 query->end_result = rctx->ws->query_value(rctx->ws, ws_id); in r600_query_sw_end()
331 query->end_result = rctx->ws->query_value(rctx->ws, ws_id); in r600_query_sw_end()
332 query->end_time = rctx->ws->query_value(rctx->ws, in r600_query_sw_end()
337 query->end_result = rctx->ws->query_value(rctx->ws, ws_id); in r600_query_sw_end()
342 rctx->tc ? util_queue_get_thread_time_nano(&rctx->tc->queue, 0) : 0; in r600_query_sw_end()
366 query->end_result = r600_end_counter(rctx->screen, in r600_query_sw_end()
372 query->end_result = p_atomic_read(&rctx->screen->num_compilations); in r600_query_sw_end()
375 query->end_result = p_atomic_read(&rctx->screen->num_shaders_created); in r600_query_sw_end()
379 p_atomic_read(&rctx->screen->num_shader_cache_hits); in r600_query_sw_end()
394 static bool r600_query_sw_get_result(struct r600_common_context *rctx, in r600_query_sw_get_result() argument
405 (uint64_t)rctx->screen->info.clock_crystal_freq * 1000; in r600_query_sw_get_result()
409 struct pipe_screen *screen = rctx->b.screen; in r600_query_sw_get_result()
410 struct pipe_context *ctx = rquery->b.flushed ? NULL : &rctx->b; in r600_query_sw_get_result()
430 result->u32 = rctx->screen->info.num_good_compute_units; in r600_query_sw_get_result()
433 result->u32 = rctx->screen->info.num_render_backends; in r600_query_sw_get_result()
439 result->u32 = rctx->screen->info.max_se; in r600_query_sw_get_result()
561 static void r600_query_hw_get_result_resource(struct r600_common_context *rctx,
677 static void r600_update_occlusion_query_state(struct r600_common_context *rctx, in r600_update_occlusion_query_state() argument
683 bool old_enable = rctx->num_occlusion_queries != 0; in r600_update_occlusion_query_state()
685 rctx->num_perfect_occlusion_queries != 0; in r600_update_occlusion_query_state()
688 rctx->num_occlusion_queries += diff; in r600_update_occlusion_query_state()
689 assert(rctx->num_occlusion_queries >= 0); in r600_update_occlusion_query_state()
692 rctx->num_perfect_occlusion_queries += diff; in r600_update_occlusion_query_state()
693 assert(rctx->num_perfect_occlusion_queries >= 0); in r600_update_occlusion_query_state()
696 enable = rctx->num_occlusion_queries != 0; in r600_update_occlusion_query_state()
697 perfect_enable = rctx->num_perfect_occlusion_queries != 0; in r600_update_occlusion_query_state()
700 struct r600_context *ctx = (struct r600_context*)rctx; in r600_update_occlusion_query_state()
991 struct r600_common_context *rctx = (struct r600_common_context *)ctx; in r600_destroy_query() local
994 rquery->ops->destroy(rctx->screen, rquery); in r600_destroy_query()
1000 struct r600_common_context *rctx = (struct r600_common_context *)ctx; in r600_begin_query() local
1003 return rquery->ops->begin(rctx, rquery); in r600_begin_query()
1006 void r600_query_hw_reset_buffers(struct r600_common_context *rctx, in r600_query_hw_reset_buffers() argument
1023 if (r600_rings_is_buffer_referenced(rctx, query->buffer.buf->buf, RADEON_USAGE_READWRITE) || in r600_query_hw_reset_buffers()
1024 !rctx->ws->buffer_wait(query->buffer.buf->buf, 0, RADEON_USAGE_READWRITE)) { in r600_query_hw_reset_buffers()
1026 query->buffer.buf = r600_new_query_buffer(rctx->screen, query); in r600_query_hw_reset_buffers()
1028 if (!query->ops->prepare_buffer(rctx->screen, query, query->buffer.buf)) in r600_query_hw_reset_buffers()
1033 bool r600_query_hw_begin(struct r600_common_context *rctx, in r600_query_hw_begin() argument
1044 r600_query_hw_reset_buffers(rctx, query); in r600_query_hw_begin()
1046 r600_query_hw_emit_start(rctx, query); in r600_query_hw_begin()
1050 list_addtail(&query->list, &rctx->active_queries); in r600_query_hw_begin()
1056 struct r600_common_context *rctx = (struct r600_common_context *)ctx; in r600_end_query() local
1059 return rquery->ops->end(rctx, rquery); in r600_end_query()
1062 bool r600_query_hw_end(struct r600_common_context *rctx, in r600_query_hw_end() argument
1068 r600_query_hw_reset_buffers(rctx, query); in r600_query_hw_end()
1070 r600_query_hw_emit_stop(rctx, query); in r600_query_hw_end()
1081 static void r600_get_hw_query_params(struct r600_common_context *rctx, in r600_get_hw_query_params() argument
1085 unsigned max_rbs = rctx->screen->info.num_render_backends; in r600_get_hw_query_params()
1302 struct r600_common_context *rctx = (struct r600_common_context *)ctx; in r600_get_query_result() local
1305 return rquery->ops->get_result(rctx, rquery, wait, result); in r600_get_query_result()
1316 struct r600_common_context *rctx = (struct r600_common_context *)ctx; in r600_get_query_result_resource() local
1319 rquery->ops->get_result_resource(rctx, rquery, wait, result_type, index, in r600_get_query_result_resource()
1329 bool r600_query_hw_get_result(struct r600_common_context *rctx, in r600_query_hw_get_result() argument
1333 struct r600_common_screen *rscreen = rctx->screen; in r600_query_hw_get_result()
1346 map = rctx->ws->buffer_map(qbuf->buf->buf, NULL, usage); in r600_query_hw_get_result()
1348 map = r600_buffer_map_sync_with_rings(rctx, qbuf->buf, usage); in r600_query_hw_get_result()
1402 static void r600_create_query_result_shader(struct r600_common_context *rctx) in r600_create_query_result_shader() argument
1577 rctx->screen->info.clock_crystal_freq); in r600_create_query_result_shader()
1587 rctx->query_result_shader = rctx->b.create_compute_state(&rctx->b, &state); in r600_create_query_result_shader()
1590 static void r600_restore_qbo_state(struct r600_common_context *rctx, in r600_restore_qbo_state() argument
1593 rctx->b.bind_compute_state(&rctx->b, st->saved_compute); in r600_restore_qbo_state()
1595 rctx->b.set_constant_buffer(&rctx->b, PIPE_SHADER_COMPUTE, 0, &st->saved_const0); in r600_restore_qbo_state()
1598 rctx->b.set_shader_buffers(&rctx->b, PIPE_SHADER_COMPUTE, 0, 3, st->saved_ssbo, ~0); in r600_restore_qbo_state()
1603 static void r600_query_hw_get_result_resource(struct r600_common_context *rctx, in r600_query_hw_get_result_resource() argument
1633 if (!rctx->query_result_shader) { in r600_query_hw_get_result_resource()
1634 r600_create_query_result_shader(rctx); in r600_query_hw_get_result_resource()
1635 if (!rctx->query_result_shader) in r600_query_hw_get_result_resource()
1640 u_suballocator_alloc(rctx->allocator_zeroed_memory, 16, 256, in r600_query_hw_get_result_resource()
1646 rctx->save_qbo_state(&rctx->b, &saved_state); in r600_query_hw_get_result_resource()
1648 r600_get_hw_query_params(rctx, query, index >= 0 ? index : 0, ¶ms); in r600_query_hw_get_result_resource()
1664 rctx->b.bind_compute_state(&rctx->b, rctx->query_result_shader); in r600_query_hw_get_result_resource()
1698 rctx->flags |= rctx->screen->barrier_flags.cp_to_L2; in r600_query_hw_get_result_resource()
1730 rctx->b.set_constant_buffer(&rctx->b, PIPE_SHADER_COMPUTE, 0, &constant_buffer); in r600_query_hw_get_result_resource()
1732 rctx->b.set_shader_buffers(&rctx->b, PIPE_SHADER_COMPUTE, 0, 3, ssbo, ~0); in r600_query_hw_get_result_resource()
1744 r600_gfx_wait_fence(rctx, qbuf->buf, va, 0x80000000, 0x80000000); in r600_query_hw_get_result_resource()
1747 rctx->b.launch_grid(&rctx->b, &grid); in r600_query_hw_get_result_resource()
1748 rctx->flags |= rctx->screen->barrier_flags.compute_to_L2; in r600_query_hw_get_result_resource()
1751 r600_restore_qbo_state(rctx, &saved_state); in r600_query_hw_get_result_resource()
1760 struct r600_common_context *rctx = (struct r600_common_context *)ctx; in r600_render_condition() local
1763 struct r600_atom *atom = &rctx->render_cond_atom; in r600_render_condition()
1775 rctx->render_cond = query; in r600_render_condition()
1776 rctx->render_cond_invert = condition; in r600_render_condition()
1777 rctx->render_cond_mode = mode; in r600_render_condition()
1779 rctx->set_atom_dirty(rctx, atom, query != NULL); in r600_render_condition()
2115 void r600_query_init(struct r600_common_context *rctx) in r600_query_init() argument
2117 rctx->b.create_query = r600_create_query; in r600_query_init()
2118 rctx->b.create_batch_query = r600_create_batch_query; in r600_query_init()
2119 rctx->b.destroy_query = r600_destroy_query; in r600_query_init()
2120 rctx->b.begin_query = r600_begin_query; in r600_query_init()
2121 rctx->b.end_query = r600_end_query; in r600_query_init()
2122 rctx->b.get_query_result = r600_get_query_result; in r600_query_init()
2123 rctx->b.get_query_result_resource = r600_get_query_result_resource; in r600_query_init()
2124 rctx->render_cond_atom.emit = r600_emit_query_predication; in r600_query_init()
2126 if (((struct r600_common_screen*)rctx->b.screen)->info.num_render_backends > 0) in r600_query_init()
2127 rctx->b.render_condition = r600_render_condition; in r600_query_init()
2129 list_inithead(&rctx->active_queries); in r600_query_init()