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()
560 static void r600_query_hw_get_result_resource(struct r600_common_context *rctx,
675 static void r600_update_occlusion_query_state(struct r600_common_context *rctx, in r600_update_occlusion_query_state() argument
680 bool old_enable = rctx->num_occlusion_queries != 0; in r600_update_occlusion_query_state()
682 rctx->num_perfect_occlusion_queries != 0; in r600_update_occlusion_query_state()
685 rctx->num_occlusion_queries += diff; in r600_update_occlusion_query_state()
686 assert(rctx->num_occlusion_queries >= 0); in r600_update_occlusion_query_state()
689 rctx->num_perfect_occlusion_queries += diff; in r600_update_occlusion_query_state()
690 assert(rctx->num_perfect_occlusion_queries >= 0); in r600_update_occlusion_query_state()
693 enable = rctx->num_occlusion_queries != 0; in r600_update_occlusion_query_state()
694 perfect_enable = rctx->num_perfect_occlusion_queries != 0; in r600_update_occlusion_query_state()
697 struct r600_context *ctx = (struct r600_context*)rctx; in r600_update_occlusion_query_state()
985 struct r600_common_context *rctx = (struct r600_common_context *)ctx; in r600_destroy_query() local
988 rquery->ops->destroy(rctx->screen, rquery); in r600_destroy_query()
994 struct r600_common_context *rctx = (struct r600_common_context *)ctx; in r600_begin_query() local
997 return rquery->ops->begin(rctx, rquery); in r600_begin_query()
1000 void r600_query_hw_reset_buffers(struct r600_common_context *rctx, in r600_query_hw_reset_buffers() argument
1017 if (r600_rings_is_buffer_referenced(rctx, query->buffer.buf->buf, RADEON_USAGE_READWRITE) || in r600_query_hw_reset_buffers()
1018 !rctx->ws->buffer_wait(query->buffer.buf->buf, 0, RADEON_USAGE_READWRITE)) { in r600_query_hw_reset_buffers()
1020 query->buffer.buf = r600_new_query_buffer(rctx->screen, query); in r600_query_hw_reset_buffers()
1022 if (!query->ops->prepare_buffer(rctx->screen, query, query->buffer.buf)) in r600_query_hw_reset_buffers()
1027 bool r600_query_hw_begin(struct r600_common_context *rctx, in r600_query_hw_begin() argument
1038 r600_query_hw_reset_buffers(rctx, query); in r600_query_hw_begin()
1040 r600_query_hw_emit_start(rctx, query); in r600_query_hw_begin()
1044 LIST_ADDTAIL(&query->list, &rctx->active_queries); in r600_query_hw_begin()
1050 struct r600_common_context *rctx = (struct r600_common_context *)ctx; in r600_end_query() local
1053 return rquery->ops->end(rctx, rquery); in r600_end_query()
1056 bool r600_query_hw_end(struct r600_common_context *rctx, in r600_query_hw_end() argument
1062 r600_query_hw_reset_buffers(rctx, query); in r600_query_hw_end()
1064 r600_query_hw_emit_stop(rctx, query); in r600_query_hw_end()
1075 static void r600_get_hw_query_params(struct r600_common_context *rctx, in r600_get_hw_query_params() argument
1079 unsigned max_rbs = rctx->screen->info.num_render_backends; in r600_get_hw_query_params()
1293 struct r600_common_context *rctx = (struct r600_common_context *)ctx; in r600_get_query_result() local
1296 return rquery->ops->get_result(rctx, rquery, wait, result); in r600_get_query_result()
1307 struct r600_common_context *rctx = (struct r600_common_context *)ctx; in r600_get_query_result_resource() local
1310 rquery->ops->get_result_resource(rctx, rquery, wait, result_type, index, in r600_get_query_result_resource()
1320 bool r600_query_hw_get_result(struct r600_common_context *rctx, in r600_query_hw_get_result() argument
1324 struct r600_common_screen *rscreen = rctx->screen; in r600_query_hw_get_result()
1337 map = rctx->ws->buffer_map(qbuf->buf->buf, NULL, usage); in r600_query_hw_get_result()
1339 map = r600_buffer_map_sync_with_rings(rctx, qbuf->buf, usage); in r600_query_hw_get_result()
1391 static void r600_create_query_result_shader(struct r600_common_context *rctx) in r600_create_query_result_shader() argument
1562 rctx->screen->info.clock_crystal_freq); in r600_create_query_result_shader()
1572 rctx->query_result_shader = rctx->b.create_compute_state(&rctx->b, &state); in r600_create_query_result_shader()
1575 static void r600_restore_qbo_state(struct r600_common_context *rctx, in r600_restore_qbo_state() argument
1578 rctx->b.bind_compute_state(&rctx->b, st->saved_compute); in r600_restore_qbo_state()
1580 rctx->b.set_constant_buffer(&rctx->b, PIPE_SHADER_COMPUTE, 0, &st->saved_const0); in r600_restore_qbo_state()
1583 rctx->b.set_shader_buffers(&rctx->b, PIPE_SHADER_COMPUTE, 0, 3, st->saved_ssbo); in r600_restore_qbo_state()
1588 static void r600_query_hw_get_result_resource(struct r600_common_context *rctx, in r600_query_hw_get_result_resource() argument
1616 if (!rctx->query_result_shader) { in r600_query_hw_get_result_resource()
1617 r600_create_query_result_shader(rctx); in r600_query_hw_get_result_resource()
1618 if (!rctx->query_result_shader) in r600_query_hw_get_result_resource()
1623 u_suballocator_alloc(rctx->allocator_zeroed_memory, 16, 16, in r600_query_hw_get_result_resource()
1629 rctx->save_qbo_state(&rctx->b, &saved_state); in r600_query_hw_get_result_resource()
1631 r600_get_hw_query_params(rctx, query, index >= 0 ? index : 0, &params); in r600_query_hw_get_result_resource()
1647 rctx->b.bind_compute_state(&rctx->b, rctx->query_result_shader); in r600_query_hw_get_result_resource()
1680 rctx->flags |= rctx->screen->barrier_flags.cp_to_L2; in r600_query_hw_get_result_resource()
1699 rctx->b.set_constant_buffer(&rctx->b, PIPE_SHADER_COMPUTE, 0, &constant_buffer); in r600_query_hw_get_result_resource()
1712 rctx->b.set_shader_buffers(&rctx->b, PIPE_SHADER_COMPUTE, 0, 3, ssbo); in r600_query_hw_get_result_resource()
1724 r600_gfx_wait_fence(rctx, va, 0x80000000, 0x80000000); in r600_query_hw_get_result_resource()
1727 rctx->b.launch_grid(&rctx->b, &grid); in r600_query_hw_get_result_resource()
1728 rctx->flags |= rctx->screen->barrier_flags.compute_to_L2; in r600_query_hw_get_result_resource()
1731 r600_restore_qbo_state(rctx, &saved_state); in r600_query_hw_get_result_resource()
1740 struct r600_common_context *rctx = (struct r600_common_context *)ctx; in r600_render_condition() local
1743 struct r600_atom *atom = &rctx->render_cond_atom; in r600_render_condition()
1755 rctx->render_cond = query; in r600_render_condition()
1756 rctx->render_cond_invert = condition; in r600_render_condition()
1757 rctx->render_cond_mode = mode; in r600_render_condition()
1759 rctx->set_atom_dirty(rctx, atom, query != NULL); in r600_render_condition()
2095 void r600_query_init(struct r600_common_context *rctx) in r600_query_init() argument
2097 rctx->b.create_query = r600_create_query; in r600_query_init()
2098 rctx->b.create_batch_query = r600_create_batch_query; in r600_query_init()
2099 rctx->b.destroy_query = r600_destroy_query; in r600_query_init()
2100 rctx->b.begin_query = r600_begin_query; in r600_query_init()
2101 rctx->b.end_query = r600_end_query; in r600_query_init()
2102 rctx->b.get_query_result = r600_get_query_result; in r600_query_init()
2103 rctx->b.get_query_result_resource = r600_get_query_result_resource; in r600_query_init()
2104 rctx->render_cond_atom.emit = r600_emit_query_predication; in r600_query_init()
2106 if (((struct r600_common_screen*)rctx->b.screen)->info.num_render_backends > 0) in r600_query_init()
2107 rctx->b.render_condition = r600_render_condition; in r600_query_init()
2109 LIST_INITHEAD(&rctx->active_queries); in r600_query_init()