Lines Matching refs:query
60 struct r600_query_sw *query = (struct r600_query_sw *)rquery; in r600_query_sw_destroy() local
62 rscreen->b.fence_reference(&rscreen->b, &query->fence, NULL); in r600_query_sw_destroy()
63 FREE(query); in r600_query_sw_destroy()
95 struct r600_query_sw *query = (struct r600_query_sw *)rquery; in r600_query_sw_begin() local
98 switch(query->b.type) { in r600_query_sw_begin()
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()
167 query->begin_result = 0; in r600_query_sw_begin()
175 enum radeon_value_id ws_id = winsys_id_from_type(query->b.type); in r600_query_sw_begin()
176 query->begin_result = rctx->ws->query_value(rctx->ws, ws_id); in r600_query_sw_begin()
180 ws_id = winsys_id_from_type(query->b.type); 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()
186 ws_id = winsys_id_from_type(query->b.type); in r600_query_sw_begin()
187 query->begin_result = rctx->ws->query_value(rctx->ws, ws_id); in r600_query_sw_begin()
188 query->begin_time = os_time_get_nano(); in r600_query_sw_begin()
191 query->begin_result = in r600_query_sw_begin()
193 query->begin_time = os_time_get_nano(); in r600_query_sw_begin()
216 query->begin_result = r600_begin_counter(rctx->screen, in r600_query_sw_begin()
217 query->b.type); 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()
226 query->begin_result = in r600_query_sw_begin()
245 struct r600_query_sw *query = (struct r600_query_sw *)rquery; in r600_query_sw_end() local
248 switch(query->b.type) { in r600_query_sw_end()
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()
325 enum radeon_value_id ws_id = winsys_id_from_type(query->b.type); in r600_query_sw_end()
326 query->end_result = rctx->ws->query_value(rctx->ws, ws_id); in r600_query_sw_end()
330 ws_id = winsys_id_from_type(query->b.type); 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()
336 ws_id = winsys_id_from_type(query->b.type); in r600_query_sw_end()
337 query->end_result = rctx->ws->query_value(rctx->ws, ws_id); in r600_query_sw_end()
338 query->end_time = os_time_get_nano(); in r600_query_sw_end()
341 query->end_result = in r600_query_sw_end()
343 query->end_time = os_time_get_nano(); in r600_query_sw_end()
366 query->end_result = r600_end_counter(rctx->screen, in r600_query_sw_end()
367 query->b.type, in r600_query_sw_end()
368 query->begin_result); in r600_query_sw_end()
369 query->begin_result = 0; 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()
378 query->end_result = in r600_query_sw_end()
399 struct r600_query_sw *query = (struct r600_query_sw *)rquery; in r600_query_sw_get_result() local
401 switch (query->b.type) { in r600_query_sw_get_result()
412 result->b = screen->fence_finish(screen, ctx, query->fence, in r600_query_sw_get_result()
418 result->u64 = (query->end_result - query->begin_result) / in r600_query_sw_get_result()
419 (query->end_time - query->begin_time); in r600_query_sw_get_result()
423 result->u64 = (query->end_result - query->begin_result) * 100 / in r600_query_sw_get_result()
424 (query->end_time - query->begin_time); in r600_query_sw_get_result()
443 result->u64 = query->end_result - query->begin_result; in r600_query_sw_get_result()
445 switch (query->b.type) { in r600_query_sw_get_result()
470 struct r600_query_sw *query; in r600_query_sw_create() local
472 query = CALLOC_STRUCT(r600_query_sw); in r600_query_sw_create()
473 if (!query) in r600_query_sw_create()
476 query->b.type = query_type; in r600_query_sw_create()
477 query->b.ops = &sw_query_ops; in r600_query_sw_create()
479 return (struct pipe_query *)query; in r600_query_sw_create()
485 struct r600_query_hw *query = (struct r600_query_hw *)rquery; in r600_query_hw_destroy() local
486 struct r600_query_buffer *prev = query->buffer.previous; in r600_query_hw_destroy()
496 r600_resource_reference(&query->buffer.buf, NULL); in r600_query_hw_destroy()
501 struct r600_query_hw *query) in r600_new_query_buffer() argument
503 unsigned buf_size = MAX2(query->result_size, in r600_new_query_buffer()
516 if (!query->ops->prepare_buffer(rscreen, query, buf)) { in r600_new_query_buffer()
525 struct r600_query_hw *query, in r600_query_hw_prepare_buffer() argument
537 if (query->b.type == PIPE_QUERY_OCCLUSION_COUNTER || in r600_query_hw_prepare_buffer()
538 query->b.type == PIPE_QUERY_OCCLUSION_PREDICATE || in r600_query_hw_prepare_buffer()
539 query->b.type == PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE) { in r600_query_hw_prepare_buffer()
546 num_results = buffer->b.b.width0 / query->result_size; in r600_query_hw_prepare_buffer()
578 struct r600_query_hw *query,
582 struct r600_query_hw *query,
600 struct r600_query_hw *query) in r600_query_hw_init() argument
602 query->buffer.buf = r600_new_query_buffer(rscreen, query); in r600_query_hw_init()
603 if (!query->buffer.buf) in r600_query_hw_init()
613 struct r600_query_hw *query = CALLOC_STRUCT(r600_query_hw); in r600_query_hw_create() local
614 if (!query) in r600_query_hw_create()
617 query->b.type = query_type; in r600_query_hw_create()
618 query->b.ops = &query_hw_ops; in r600_query_hw_create()
619 query->ops = &query_hw_default_hw_ops; in r600_query_hw_create()
625 query->result_size = 16 * rscreen->info.max_render_backends; in r600_query_hw_create()
626 query->result_size += 16; /* for the fence + alignment */ in r600_query_hw_create()
627 query->num_cs_dw_begin = 6; in r600_query_hw_create()
628 query->num_cs_dw_end = 6 + r600_gfx_write_fence_dwords(rscreen); in r600_query_hw_create()
631 query->result_size = 24; in r600_query_hw_create()
632 query->num_cs_dw_begin = 8; in r600_query_hw_create()
633 query->num_cs_dw_end = 8 + r600_gfx_write_fence_dwords(rscreen); in r600_query_hw_create()
636 query->result_size = 16; in r600_query_hw_create()
637 query->num_cs_dw_end = 8 + r600_gfx_write_fence_dwords(rscreen); in r600_query_hw_create()
638 query->flags = R600_QUERY_HW_FLAG_NO_START; in r600_query_hw_create()
645 query->result_size = 32; in r600_query_hw_create()
646 query->num_cs_dw_begin = 6; in r600_query_hw_create()
647 query->num_cs_dw_end = 6; in r600_query_hw_create()
648 query->stream = index; in r600_query_hw_create()
652 query->result_size = 32 * R600_MAX_STREAMS; in r600_query_hw_create()
653 query->num_cs_dw_begin = 6 * R600_MAX_STREAMS; in r600_query_hw_create()
654 query->num_cs_dw_end = 6 * R600_MAX_STREAMS; in r600_query_hw_create()
658 query->result_size = (rscreen->gfx_level >= EVERGREEN ? 11 : 8) * 16; in r600_query_hw_create()
659 query->result_size += 8; /* for the fence + alignment */ in r600_query_hw_create()
660 query->num_cs_dw_begin = 6; in r600_query_hw_create()
661 query->num_cs_dw_end = 6 + r600_gfx_write_fence_dwords(rscreen); in r600_query_hw_create()
665 FREE(query); in r600_query_hw_create()
669 if (!r600_query_hw_init(rscreen, query)) { in r600_query_hw_create()
670 FREE(query); in r600_query_hw_create()
674 return (struct pipe_query *)query; in r600_query_hw_create()
727 struct r600_query_hw *query, in r600_query_hw_do_emit_start() argument
733 switch (query->b.type) { in r600_query_hw_do_emit_start()
746 emit_sample_streamout(cs, va, query->stream); in r600_query_hw_do_emit_start()
758 NULL, va, 0, query->b.type); in r600_query_hw_do_emit_start()
769 r600_emit_reloc(ctx, &ctx->gfx, query->buffer.buf, RADEON_USAGE_WRITE | in r600_query_hw_do_emit_start()
774 struct r600_query_hw *query) in r600_query_hw_emit_start() argument
778 if (!query->buffer.buf) in r600_query_hw_emit_start()
781 r600_update_occlusion_query_state(ctx, query->b.type, 1); in r600_query_hw_emit_start()
782 r600_update_prims_generated_query_state(ctx, query->b.type, 1); in r600_query_hw_emit_start()
784 ctx->need_gfx_cs_space(&ctx->b, query->num_cs_dw_begin + query->num_cs_dw_end, in r600_query_hw_emit_start()
788 if (query->buffer.results_end + query->result_size > query->buffer.buf->b.b.width0) { in r600_query_hw_emit_start()
790 *qbuf = query->buffer; in r600_query_hw_emit_start()
791 query->buffer.results_end = 0; in r600_query_hw_emit_start()
792 query->buffer.previous = qbuf; in r600_query_hw_emit_start()
793 query->buffer.buf = r600_new_query_buffer(ctx->screen, query); in r600_query_hw_emit_start()
794 if (!query->buffer.buf) in r600_query_hw_emit_start()
799 va = query->buffer.buf->gpu_address + query->buffer.results_end; in r600_query_hw_emit_start()
801 query->ops->emit_start(ctx, query, query->buffer.buf, va); in r600_query_hw_emit_start()
803 ctx->num_cs_dw_queries_suspend += query->num_cs_dw_end; in r600_query_hw_emit_start()
807 struct r600_query_hw *query, in r600_query_hw_do_emit_stop() argument
814 switch (query->b.type) { in r600_query_hw_do_emit_stop()
831 emit_sample_streamout(cs, va, query->stream); in r600_query_hw_do_emit_stop()
844 0, query->b.type); in r600_query_hw_do_emit_stop()
848 unsigned sample_size = (query->result_size - 8) / 2; in r600_query_hw_do_emit_stop()
862 r600_emit_reloc(ctx, &ctx->gfx, query->buffer.buf, RADEON_USAGE_WRITE | in r600_query_hw_do_emit_stop()
868 query->buffer.buf, fence_va, 0x80000000, in r600_query_hw_do_emit_stop()
869 query->b.type); in r600_query_hw_do_emit_stop()
873 struct r600_query_hw *query) in r600_query_hw_emit_stop() argument
877 if (!query->buffer.buf) in r600_query_hw_emit_stop()
881 if (query->flags & R600_QUERY_HW_FLAG_NO_START) { in r600_query_hw_emit_stop()
882 ctx->need_gfx_cs_space(&ctx->b, query->num_cs_dw_end, false); in r600_query_hw_emit_stop()
886 va = query->buffer.buf->gpu_address + query->buffer.results_end; in r600_query_hw_emit_stop()
888 query->ops->emit_stop(ctx, query, query->buffer.buf, va); in r600_query_hw_emit_stop()
890 query->buffer.results_end += query->result_size; in r600_query_hw_emit_stop()
892 if (!(query->flags & R600_QUERY_HW_FLAG_NO_START)) in r600_query_hw_emit_stop()
893 ctx->num_cs_dw_queries_suspend -= query->num_cs_dw_end; in r600_query_hw_emit_stop()
895 r600_update_occlusion_query_state(ctx, query->b.type, -1); in r600_query_hw_emit_stop()
896 r600_update_prims_generated_query_state(ctx, query->b.type, -1); in r600_query_hw_emit_stop()
915 struct r600_query_hw *query = (struct r600_query_hw *)ctx->render_cond; in r600_emit_query_predication() local
920 if (!query) in r600_emit_query_predication()
927 switch (query->b.type) { in r600_emit_query_predication()
952 for (qbuf = &query->buffer; qbuf; qbuf = qbuf->previous) { in r600_emit_query_predication()
959 if (query->b.type == PIPE_QUERY_SO_OVERFLOW_ANY_PREDICATE) { in r600_emit_query_predication()
971 results_base += query->result_size; in r600_emit_query_predication()
989 static void r600_destroy_query(struct pipe_context *ctx, struct pipe_query *query) in r600_destroy_query() argument
992 struct r600_query *rquery = (struct r600_query *)query; in r600_destroy_query()
998 struct pipe_query *query) in r600_begin_query() argument
1001 struct r600_query *rquery = (struct r600_query *)query; in r600_begin_query()
1007 struct r600_query_hw *query) in r600_query_hw_reset_buffers() argument
1009 struct r600_query_buffer *prev = query->buffer.previous; in r600_query_hw_reset_buffers()
1019 query->buffer.results_end = 0; in r600_query_hw_reset_buffers()
1020 query->buffer.previous = NULL; in r600_query_hw_reset_buffers()
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(rctx->ws, query->buffer.buf->buf, 0, RADEON_USAGE_READWRITE)) { in r600_query_hw_reset_buffers()
1025 r600_resource_reference(&query->buffer.buf, NULL); 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()
1029 r600_resource_reference(&query->buffer.buf, NULL); in r600_query_hw_reset_buffers()
1036 struct r600_query_hw *query = (struct r600_query_hw *)rquery; in r600_query_hw_begin() local
1038 if (query->flags & R600_QUERY_HW_FLAG_NO_START) { in r600_query_hw_begin()
1043 if (!(query->flags & R600_QUERY_HW_FLAG_BEGIN_RESUMES)) in r600_query_hw_begin()
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()
1047 if (!query->buffer.buf) in r600_query_hw_begin()
1050 list_addtail(&query->list, &rctx->active_queries); in r600_query_hw_begin()
1054 static bool r600_end_query(struct pipe_context *ctx, struct pipe_query *query) in r600_end_query() argument
1057 struct r600_query *rquery = (struct r600_query *)query; in r600_end_query()
1065 struct r600_query_hw *query = (struct r600_query_hw *)rquery; in r600_query_hw_end() local
1067 if (query->flags & R600_QUERY_HW_FLAG_NO_START) in r600_query_hw_end()
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()
1072 if (!(query->flags & R600_QUERY_HW_FLAG_NO_START)) in r600_query_hw_end()
1073 list_delinit(&query->list); in r600_query_hw_end()
1075 if (!query->buffer.buf) in r600_query_hw_end()
1172 struct r600_query_hw *query, in r600_query_hw_add_result() argument
1178 switch (query->b.type) { in r600_query_hw_add_result()
1299 struct pipe_query *query, bool wait, in r600_get_query_result() argument
1303 struct r600_query *rquery = (struct r600_query *)query; in r600_get_query_result()
1309 struct pipe_query *query, in r600_get_query_result_resource() argument
1317 struct r600_query *rquery = (struct r600_query *)query; in r600_get_query_result_resource()
1323 static void r600_query_hw_clear_result(struct r600_query_hw *query, in r600_query_hw_clear_result() argument
1326 util_query_clear_result(result, query->b.type); in r600_query_hw_clear_result()
1334 struct r600_query_hw *query = (struct r600_query_hw *)rquery; in r600_query_hw_get_result() local
1337 query->ops->clear_result(query, result); in r600_query_hw_get_result()
1339 for (qbuf = &query->buffer; qbuf; qbuf = qbuf->previous) { in r600_query_hw_get_result()
1354 query->ops->add_result(rscreen, query, map + results_base, in r600_query_hw_get_result()
1356 results_base += query->result_size; in r600_query_hw_get_result()
1608 struct r600_query_hw *query = (struct r600_query_hw *)rquery; in r600_query_hw_get_result_resource() local
1636 if (query->buffer.previous) { in r600_query_hw_get_result_resource()
1645 r600_get_hw_query_params(rctx, query, index >= 0 ? index : 0, ¶ms); in r600_query_hw_get_result_resource()
1648 consts.result_stride = query->result_size; in r600_query_hw_get_result_resource()
1673 if (query->b.type == PIPE_QUERY_OCCLUSION_PREDICATE || in r600_query_hw_get_result_resource()
1674 query->b.type == PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE) in r600_query_hw_get_result_resource()
1676 else if (query->b.type == PIPE_QUERY_SO_OVERFLOW_PREDICATE || in r600_query_hw_get_result_resource()
1677 query->b.type == PIPE_QUERY_SO_OVERFLOW_ANY_PREDICATE) in r600_query_hw_get_result_resource()
1679 else if (query->b.type == PIPE_QUERY_TIMESTAMP || in r600_query_hw_get_result_resource()
1680 query->b.type == PIPE_QUERY_TIME_ELAPSED) in r600_query_hw_get_result_resource()
1697 for (qbuf = &query->buffer; qbuf; qbuf = qbuf_prev) { in r600_query_hw_get_result_resource()
1698 if (query->b.type != PIPE_QUERY_TIMESTAMP) { in r600_query_hw_get_result_resource()
1700 consts.result_count = qbuf->results_end / query->result_size; in r600_query_hw_get_result_resource()
1702 if (qbuf != &query->buffer) in r600_query_hw_get_result_resource()
1711 params.start_offset += qbuf->results_end - query->result_size; in r600_query_hw_get_result_resource()
1731 if ((flags & PIPE_QUERY_WAIT) && qbuf == &query->buffer) { in r600_query_hw_get_result_resource()
1738 va = qbuf->buf->gpu_address + qbuf->results_end - query->result_size; in r600_query_hw_get_result_resource()
1753 struct pipe_query *query, in r600_render_condition() argument
1758 struct r600_query_hw *rquery = (struct r600_query_hw *)query; in r600_render_condition()
1764 if (query) { in r600_render_condition()
1772 rctx->render_cond = query; in r600_render_condition()
1776 rctx->set_atom_dirty(rctx, atom, query != NULL); in r600_render_condition()
1781 struct r600_query_hw *query; in r600_suspend_queries() local
1783 LIST_FOR_EACH_ENTRY(query, &ctx->active_queries, list) { in r600_suspend_queries()
1784 r600_query_hw_emit_stop(ctx, query); in r600_suspend_queries()
1792 struct r600_query_hw *query; in r600_queries_num_cs_dw_for_resuming() local
1795 LIST_FOR_EACH_ENTRY(query, query_list, list) { in r600_queries_num_cs_dw_for_resuming()
1797 num_dw += query->num_cs_dw_begin + query->num_cs_dw_end; in r600_queries_num_cs_dw_for_resuming()
1804 num_dw += query->num_cs_dw_end; in r600_queries_num_cs_dw_for_resuming()
1816 struct r600_query_hw *query; in r600_resume_queries() local
1824 LIST_FOR_EACH_ENTRY(query, &ctx->active_queries, list) { in r600_resume_queries()
1825 r600_query_hw_emit_start(ctx, query); in r600_resume_queries()