2 * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * on the rights to use, copy, modify, merge, publish, distribute, sub
8 * license, and/or sell copies of the Software, and to permit persons to whom
9 * the Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21 * USE OR OTHER DEALINGS IN THE SOFTWARE.
23 #include "r600_pipe.h"
25 #include "util/u_memory.h"
27 static bool r600_is_timer_query(unsigned type
)
29 return type
== PIPE_QUERY_TIME_ELAPSED
||
30 type
== PIPE_QUERY_TIMESTAMP
||
31 type
== PIPE_QUERY_TIMESTAMP_DISJOINT
;
34 static bool r600_query_needs_begin(unsigned type
)
36 return type
!= PIPE_QUERY_GPU_FINISHED
&&
37 type
!= PIPE_QUERY_TIMESTAMP
;
40 static struct r600_resource
*r600_new_query_buffer(struct r600_context
*ctx
, unsigned type
)
42 unsigned j
, i
, num_results
, buf_size
= 4096;
44 /* Queries are normally read by the CPU after
45 * being written by the gpu, hence staging is probably a good
48 struct r600_resource
*buf
= (struct r600_resource
*)
49 pipe_buffer_create(&ctx
->screen
->screen
, PIPE_BIND_CUSTOM
,
50 PIPE_USAGE_STAGING
, buf_size
);
53 case PIPE_QUERY_OCCLUSION_COUNTER
:
54 case PIPE_QUERY_OCCLUSION_PREDICATE
:
55 results
= ctx
->ws
->buffer_map(buf
->cs_buf
, ctx
->cs
, PIPE_TRANSFER_WRITE
);
56 memset(results
, 0, buf_size
);
58 /* Set top bits for unused backends. */
59 num_results
= buf_size
/ (16 * ctx
->max_db
);
60 for (j
= 0; j
< num_results
; j
++) {
61 for (i
= 0; i
< ctx
->max_db
; i
++) {
62 if (!(ctx
->backend_mask
& (1<<i
))) {
63 results
[(i
* 4)+1] = 0x80000000;
64 results
[(i
* 4)+3] = 0x80000000;
67 results
+= 4 * ctx
->max_db
;
69 ctx
->ws
->buffer_unmap(buf
->cs_buf
);
71 case PIPE_QUERY_TIME_ELAPSED
:
72 case PIPE_QUERY_TIMESTAMP
:
74 case PIPE_QUERY_PRIMITIVES_EMITTED
:
75 case PIPE_QUERY_PRIMITIVES_GENERATED
:
76 case PIPE_QUERY_SO_STATISTICS
:
77 case PIPE_QUERY_SO_OVERFLOW_PREDICATE
:
78 results
= ctx
->ws
->buffer_map(buf
->cs_buf
, ctx
->cs
, PIPE_TRANSFER_WRITE
);
79 memset(results
, 0, buf_size
);
80 ctx
->ws
->buffer_unmap(buf
->cs_buf
);
88 static void r600_update_occlusion_query_state(struct r600_context
*rctx
,
89 unsigned type
, int diff
)
91 if (type
== PIPE_QUERY_OCCLUSION_COUNTER
||
92 type
== PIPE_QUERY_OCCLUSION_PREDICATE
) {
95 rctx
->num_occlusion_queries
+= diff
;
96 assert(rctx
->num_occlusion_queries
>= 0);
98 enable
= rctx
->num_occlusion_queries
!= 0;
100 if (rctx
->db_misc_state
.occlusion_query_enabled
!= enable
) {
101 rctx
->db_misc_state
.occlusion_query_enabled
= enable
;
102 rctx
->db_misc_state
.atom
.dirty
= true;
107 static void r600_emit_query_begin(struct r600_context
*ctx
, struct r600_query
*query
)
109 struct radeon_winsys_cs
*cs
= ctx
->cs
;
112 r600_update_occlusion_query_state(ctx
, query
->type
, 1);
113 r600_need_cs_space(ctx
, query
->num_cs_dw
* 2, TRUE
);
115 /* Get a new query buffer if needed. */
116 if (query
->buffer
.results_end
+ query
->result_size
> query
->buffer
.buf
->b
.b
.width0
) {
117 struct r600_query_buffer
*qbuf
= MALLOC_STRUCT(r600_query_buffer
);
118 *qbuf
= query
->buffer
;
119 query
->buffer
.buf
= r600_new_query_buffer(ctx
, query
->type
);
120 query
->buffer
.results_end
= 0;
121 query
->buffer
.previous
= qbuf
;
124 /* emit begin query */
125 va
= r600_resource_va(&ctx
->screen
->screen
, (void*)query
->buffer
.buf
);
126 va
+= query
->buffer
.results_end
;
128 switch (query
->type
) {
129 case PIPE_QUERY_OCCLUSION_COUNTER
:
130 case PIPE_QUERY_OCCLUSION_PREDICATE
:
131 cs
->buf
[cs
->cdw
++] = PKT3(PKT3_EVENT_WRITE
, 2, 0);
132 cs
->buf
[cs
->cdw
++] = EVENT_TYPE(EVENT_TYPE_ZPASS_DONE
) | EVENT_INDEX(1);
133 cs
->buf
[cs
->cdw
++] = va
;
134 cs
->buf
[cs
->cdw
++] = (va
>> 32UL) & 0xFF;
136 case PIPE_QUERY_PRIMITIVES_EMITTED
:
137 case PIPE_QUERY_PRIMITIVES_GENERATED
:
138 case PIPE_QUERY_SO_STATISTICS
:
139 case PIPE_QUERY_SO_OVERFLOW_PREDICATE
:
140 cs
->buf
[cs
->cdw
++] = PKT3(PKT3_EVENT_WRITE
, 2, 0);
141 cs
->buf
[cs
->cdw
++] = EVENT_TYPE(EVENT_TYPE_SAMPLE_STREAMOUTSTATS
) | EVENT_INDEX(3);
142 cs
->buf
[cs
->cdw
++] = va
;
143 cs
->buf
[cs
->cdw
++] = (va
>> 32UL) & 0xFF;
145 case PIPE_QUERY_TIME_ELAPSED
:
146 cs
->buf
[cs
->cdw
++] = PKT3(PKT3_EVENT_WRITE_EOP
, 4, 0);
147 cs
->buf
[cs
->cdw
++] = EVENT_TYPE(EVENT_TYPE_CACHE_FLUSH_AND_INV_TS_EVENT
) | EVENT_INDEX(5);
148 cs
->buf
[cs
->cdw
++] = va
;
149 cs
->buf
[cs
->cdw
++] = (3 << 29) | ((va
>> 32UL) & 0xFF);
150 cs
->buf
[cs
->cdw
++] = 0;
151 cs
->buf
[cs
->cdw
++] = 0;
156 cs
->buf
[cs
->cdw
++] = PKT3(PKT3_NOP
, 0, 0);
157 cs
->buf
[cs
->cdw
++] = r600_context_bo_reloc(ctx
, query
->buffer
.buf
, RADEON_USAGE_WRITE
);
159 if (r600_is_timer_query(query
->type
)) {
160 ctx
->num_cs_dw_timer_queries_suspend
+= query
->num_cs_dw
;
162 ctx
->num_cs_dw_nontimer_queries_suspend
+= query
->num_cs_dw
;
166 static void r600_emit_query_end(struct r600_context
*ctx
, struct r600_query
*query
)
168 struct radeon_winsys_cs
*cs
= ctx
->cs
;
171 /* The queries which need begin already called this in begin_query. */
172 if (!r600_query_needs_begin(query
->type
)) {
173 r600_need_cs_space(ctx
, query
->num_cs_dw
, FALSE
);
176 va
= r600_resource_va(&ctx
->screen
->screen
, (void*)query
->buffer
.buf
);
178 switch (query
->type
) {
179 case PIPE_QUERY_OCCLUSION_COUNTER
:
180 case PIPE_QUERY_OCCLUSION_PREDICATE
:
181 va
+= query
->buffer
.results_end
+ 8;
182 cs
->buf
[cs
->cdw
++] = PKT3(PKT3_EVENT_WRITE
, 2, 0);
183 cs
->buf
[cs
->cdw
++] = EVENT_TYPE(EVENT_TYPE_ZPASS_DONE
) | EVENT_INDEX(1);
184 cs
->buf
[cs
->cdw
++] = va
;
185 cs
->buf
[cs
->cdw
++] = (va
>> 32UL) & 0xFF;
187 case PIPE_QUERY_PRIMITIVES_EMITTED
:
188 case PIPE_QUERY_PRIMITIVES_GENERATED
:
189 case PIPE_QUERY_SO_STATISTICS
:
190 case PIPE_QUERY_SO_OVERFLOW_PREDICATE
:
191 cs
->buf
[cs
->cdw
++] = PKT3(PKT3_EVENT_WRITE
, 2, 0);
192 cs
->buf
[cs
->cdw
++] = EVENT_TYPE(EVENT_TYPE_SAMPLE_STREAMOUTSTATS
) | EVENT_INDEX(3);
193 cs
->buf
[cs
->cdw
++] = query
->buffer
.results_end
+ query
->result_size
/2;
194 cs
->buf
[cs
->cdw
++] = 0;
196 case PIPE_QUERY_TIME_ELAPSED
:
197 va
+= query
->buffer
.results_end
+ query
->result_size
/2;
199 case PIPE_QUERY_TIMESTAMP
:
200 cs
->buf
[cs
->cdw
++] = PKT3(PKT3_EVENT_WRITE_EOP
, 4, 0);
201 cs
->buf
[cs
->cdw
++] = EVENT_TYPE(EVENT_TYPE_CACHE_FLUSH_AND_INV_TS_EVENT
) | EVENT_INDEX(5);
202 cs
->buf
[cs
->cdw
++] = va
;
203 cs
->buf
[cs
->cdw
++] = (3 << 29) | ((va
>> 32UL) & 0xFF);
204 cs
->buf
[cs
->cdw
++] = 0;
205 cs
->buf
[cs
->cdw
++] = 0;
210 cs
->buf
[cs
->cdw
++] = PKT3(PKT3_NOP
, 0, 0);
211 cs
->buf
[cs
->cdw
++] = r600_context_bo_reloc(ctx
, query
->buffer
.buf
, RADEON_USAGE_WRITE
);
213 query
->buffer
.results_end
+= query
->result_size
;
215 if (r600_query_needs_begin(query
->type
)) {
216 if (r600_is_timer_query(query
->type
)) {
217 ctx
->num_cs_dw_timer_queries_suspend
-= query
->num_cs_dw
;
219 ctx
->num_cs_dw_nontimer_queries_suspend
-= query
->num_cs_dw
;
223 r600_update_occlusion_query_state(ctx
, query
->type
, -1);
226 static void r600_emit_query_predication(struct r600_context
*ctx
, struct r600_query
*query
,
227 int operation
, bool flag_wait
)
229 struct radeon_winsys_cs
*cs
= ctx
->cs
;
231 if (operation
== PREDICATION_OP_CLEAR
) {
232 r600_need_cs_space(ctx
, 3, FALSE
);
234 cs
->buf
[cs
->cdw
++] = PKT3(PKT3_SET_PREDICATION
, 1, 0);
235 cs
->buf
[cs
->cdw
++] = 0;
236 cs
->buf
[cs
->cdw
++] = PRED_OP(PREDICATION_OP_CLEAR
);
238 struct r600_query_buffer
*qbuf
;
242 /* Find how many results there are. */
244 for (qbuf
= &query
->buffer
; qbuf
; qbuf
= qbuf
->previous
) {
245 count
+= qbuf
->results_end
/ query
->result_size
;
248 r600_need_cs_space(ctx
, 5 * count
, TRUE
);
250 op
= PRED_OP(operation
) | PREDICATION_DRAW_VISIBLE
|
251 (flag_wait
? PREDICATION_HINT_WAIT
: PREDICATION_HINT_NOWAIT_DRAW
);
253 /* emit predicate packets for all data blocks */
254 for (qbuf
= &query
->buffer
; qbuf
; qbuf
= qbuf
->previous
) {
255 unsigned results_base
= 0;
256 uint64_t va
= r600_resource_va(&ctx
->screen
->screen
, &qbuf
->buf
->b
.b
);
258 while (results_base
< qbuf
->results_end
) {
259 cs
->buf
[cs
->cdw
++] = PKT3(PKT3_SET_PREDICATION
, 1, 0);
260 cs
->buf
[cs
->cdw
++] = (va
+ results_base
) & 0xFFFFFFFFUL
;
261 cs
->buf
[cs
->cdw
++] = op
| (((va
+ results_base
) >> 32UL) & 0xFF);
262 cs
->buf
[cs
->cdw
++] = PKT3(PKT3_NOP
, 0, 0);
263 cs
->buf
[cs
->cdw
++] = r600_context_bo_reloc(ctx
, qbuf
->buf
, RADEON_USAGE_READ
);
264 results_base
+= query
->result_size
;
266 /* set CONTINUE bit for all packets except the first */
267 op
|= PREDICATION_CONTINUE
;
273 static struct pipe_query
*r600_create_query(struct pipe_context
*ctx
, unsigned query_type
)
275 struct r600_context
*rctx
= (struct r600_context
*)ctx
;
277 struct r600_query
*query
;
279 query
= CALLOC_STRUCT(r600_query
);
283 query
->type
= query_type
;
285 switch (query_type
) {
286 case PIPE_QUERY_OCCLUSION_COUNTER
:
287 case PIPE_QUERY_OCCLUSION_PREDICATE
:
288 query
->result_size
= 16 * rctx
->max_db
;
289 query
->num_cs_dw
= 6;
291 case PIPE_QUERY_TIME_ELAPSED
:
292 query
->result_size
= 16;
293 query
->num_cs_dw
= 8;
295 case PIPE_QUERY_TIMESTAMP
:
296 query
->result_size
= 8;
297 query
->num_cs_dw
= 8;
299 case PIPE_QUERY_PRIMITIVES_EMITTED
:
300 case PIPE_QUERY_PRIMITIVES_GENERATED
:
301 case PIPE_QUERY_SO_STATISTICS
:
302 case PIPE_QUERY_SO_OVERFLOW_PREDICATE
:
303 /* NumPrimitivesWritten, PrimitiveStorageNeeded. */
304 query
->result_size
= 32;
305 query
->num_cs_dw
= 6;
313 query
->buffer
.buf
= r600_new_query_buffer(rctx
, query_type
);
314 if (!query
->buffer
.buf
) {
318 return (struct pipe_query
*)query
;
321 static void r600_destroy_query(struct pipe_context
*ctx
, struct pipe_query
*query
)
323 struct r600_query
*rquery
= (struct r600_query
*)query
;
324 struct r600_query_buffer
*prev
= rquery
->buffer
.previous
;
326 /* Release all query buffers. */
328 struct r600_query_buffer
*qbuf
= prev
;
329 prev
= prev
->previous
;
330 pipe_resource_reference((struct pipe_resource
**)&qbuf
->buf
, NULL
);
334 pipe_resource_reference((struct pipe_resource
**)&rquery
->buffer
.buf
, NULL
);
338 static void r600_begin_query(struct pipe_context
*ctx
, struct pipe_query
*query
)
340 struct r600_context
*rctx
= (struct r600_context
*)ctx
;
341 struct r600_query
*rquery
= (struct r600_query
*)query
;
342 struct r600_query_buffer
*prev
= rquery
->buffer
.previous
;
344 if (!r600_query_needs_begin(rquery
->type
)) {
349 /* Discard the old query buffers. */
351 struct r600_query_buffer
*qbuf
= prev
;
352 prev
= prev
->previous
;
353 pipe_resource_reference((struct pipe_resource
**)&qbuf
->buf
, NULL
);
357 /* Obtain a new buffer if the current one can't be mapped without a stall. */
358 if (rctx
->ws
->cs_is_buffer_referenced(rctx
->cs
, rquery
->buffer
.buf
->cs_buf
, RADEON_USAGE_READWRITE
) ||
359 rctx
->ws
->buffer_is_busy(rquery
->buffer
.buf
->buf
, RADEON_USAGE_READWRITE
)) {
360 pipe_resource_reference((struct pipe_resource
**)&rquery
->buffer
.buf
, NULL
);
361 rquery
->buffer
.buf
= r600_new_query_buffer(rctx
, rquery
->type
);
364 rquery
->buffer
.results_end
= 0;
365 rquery
->buffer
.previous
= NULL
;
367 r600_emit_query_begin(rctx
, rquery
);
369 if (r600_is_timer_query(rquery
->type
)) {
370 LIST_ADDTAIL(&rquery
->list
, &rctx
->active_timer_queries
);
372 LIST_ADDTAIL(&rquery
->list
, &rctx
->active_nontimer_queries
);
376 static void r600_end_query(struct pipe_context
*ctx
, struct pipe_query
*query
)
378 struct r600_context
*rctx
= (struct r600_context
*)ctx
;
379 struct r600_query
*rquery
= (struct r600_query
*)query
;
381 r600_emit_query_end(rctx
, rquery
);
383 if (r600_query_needs_begin(rquery
->type
)) {
384 LIST_DELINIT(&rquery
->list
);
388 static unsigned r600_query_read_result(char *map
, unsigned start_index
, unsigned end_index
,
389 bool test_status_bit
)
391 uint32_t *current_result
= (uint32_t*)map
;
394 start
= (uint64_t)current_result
[start_index
] |
395 (uint64_t)current_result
[start_index
+1] << 32;
396 end
= (uint64_t)current_result
[end_index
] |
397 (uint64_t)current_result
[end_index
+1] << 32;
399 if (!test_status_bit
||
400 ((start
& 0x8000000000000000UL
) && (end
& 0x8000000000000000UL
))) {
406 static boolean
r600_get_query_buffer_result(struct r600_context
*ctx
,
407 struct r600_query
*query
,
408 struct r600_query_buffer
*qbuf
,
410 union pipe_query_result
*result
)
412 unsigned results_base
= 0;
415 map
= ctx
->ws
->buffer_map(qbuf
->buf
->cs_buf
, ctx
->cs
,
417 (wait
? 0 : PIPE_TRANSFER_DONTBLOCK
));
421 /* count all results across all data blocks */
422 switch (query
->type
) {
423 case PIPE_QUERY_OCCLUSION_COUNTER
:
424 while (results_base
!= qbuf
->results_end
) {
426 r600_query_read_result(map
+ results_base
, 0, 2, true);
430 case PIPE_QUERY_OCCLUSION_PREDICATE
:
431 while (results_base
!= qbuf
->results_end
) {
432 result
->b
= result
->b
||
433 r600_query_read_result(map
+ results_base
, 0, 2, true) != 0;
437 case PIPE_QUERY_TIME_ELAPSED
:
438 while (results_base
!= qbuf
->results_end
) {
440 r600_query_read_result(map
+ results_base
, 0, 2, false);
441 results_base
+= query
->result_size
;
444 case PIPE_QUERY_TIMESTAMP
:
446 uint32_t *current_result
= (uint32_t*)map
;
447 result
->u64
= (uint64_t)current_result
[0] |
448 (uint64_t)current_result
[1] << 32;
451 case PIPE_QUERY_PRIMITIVES_EMITTED
:
452 /* SAMPLE_STREAMOUTSTATS stores this structure:
454 * u64 NumPrimitivesWritten;
455 * u64 PrimitiveStorageNeeded;
457 * We only need NumPrimitivesWritten here. */
458 while (results_base
!= qbuf
->results_end
) {
460 r600_query_read_result(map
+ results_base
, 2, 6, true);
461 results_base
+= query
->result_size
;
464 case PIPE_QUERY_PRIMITIVES_GENERATED
:
465 /* Here we read PrimitiveStorageNeeded. */
466 while (results_base
!= qbuf
->results_end
) {
468 r600_query_read_result(map
+ results_base
, 0, 4, true);
469 results_base
+= query
->result_size
;
472 case PIPE_QUERY_SO_STATISTICS
:
473 while (results_base
!= qbuf
->results_end
) {
474 result
->so_statistics
.num_primitives_written
+=
475 r600_query_read_result(map
+ results_base
, 2, 6, true);
476 result
->so_statistics
.primitives_storage_needed
+=
477 r600_query_read_result(map
+ results_base
, 0, 4, true);
478 results_base
+= query
->result_size
;
481 case PIPE_QUERY_SO_OVERFLOW_PREDICATE
:
482 while (results_base
!= qbuf
->results_end
) {
483 result
->b
= result
->b
||
484 r600_query_read_result(map
+ results_base
, 2, 6, true) !=
485 r600_query_read_result(map
+ results_base
, 0, 4, true);
486 results_base
+= query
->result_size
;
493 ctx
->ws
->buffer_unmap(qbuf
->buf
->cs_buf
);
497 static boolean
r600_get_query_result(struct pipe_context
*ctx
,
498 struct pipe_query
*query
,
499 boolean wait
, union pipe_query_result
*result
)
501 struct r600_context
*rctx
= (struct r600_context
*)ctx
;
502 struct r600_query
*rquery
= (struct r600_query
*)query
;
503 struct r600_query_buffer
*qbuf
;
505 util_query_clear_result(result
, rquery
->type
);
507 for (qbuf
= &rquery
->buffer
; qbuf
; qbuf
= qbuf
->previous
) {
508 if (!r600_get_query_buffer_result(rctx
, rquery
, qbuf
, wait
, result
)) {
513 /* Convert the time to expected units. */
514 if (rquery
->type
== PIPE_QUERY_TIME_ELAPSED
||
515 rquery
->type
== PIPE_QUERY_TIMESTAMP
) {
516 result
->u64
= (1000000 * result
->u64
) / rctx
->screen
->info
.r600_clock_crystal_freq
;
521 static void r600_render_condition(struct pipe_context
*ctx
,
522 struct pipe_query
*query
,
525 struct r600_context
*rctx
= (struct r600_context
*)ctx
;
526 struct r600_query
*rquery
= (struct r600_query
*)query
;
527 bool wait_flag
= false;
529 rctx
->current_render_cond
= query
;
530 rctx
->current_render_cond_mode
= mode
;
533 if (rctx
->predicate_drawing
) {
534 rctx
->predicate_drawing
= false;
535 r600_emit_query_predication(rctx
, NULL
, PREDICATION_OP_CLEAR
, false);
540 if (mode
== PIPE_RENDER_COND_WAIT
||
541 mode
== PIPE_RENDER_COND_BY_REGION_WAIT
) {
545 rctx
->predicate_drawing
= true;
547 switch (rquery
->type
) {
548 case PIPE_QUERY_OCCLUSION_COUNTER
:
549 case PIPE_QUERY_OCCLUSION_PREDICATE
:
550 r600_emit_query_predication(rctx
, rquery
, PREDICATION_OP_ZPASS
, wait_flag
);
552 case PIPE_QUERY_PRIMITIVES_EMITTED
:
553 case PIPE_QUERY_PRIMITIVES_GENERATED
:
554 case PIPE_QUERY_SO_STATISTICS
:
555 case PIPE_QUERY_SO_OVERFLOW_PREDICATE
:
556 r600_emit_query_predication(rctx
, rquery
, PREDICATION_OP_PRIMCOUNT
, wait_flag
);
563 void r600_suspend_nontimer_queries(struct r600_context
*ctx
)
565 struct r600_query
*query
;
567 LIST_FOR_EACH_ENTRY(query
, &ctx
->active_nontimer_queries
, list
) {
568 r600_emit_query_end(ctx
, query
);
570 assert(ctx
->num_cs_dw_nontimer_queries_suspend
== 0);
573 void r600_resume_nontimer_queries(struct r600_context
*ctx
)
575 struct r600_query
*query
;
577 assert(ctx
->num_cs_dw_nontimer_queries_suspend
== 0);
579 LIST_FOR_EACH_ENTRY(query
, &ctx
->active_nontimer_queries
, list
) {
580 r600_emit_query_begin(ctx
, query
);
584 void r600_suspend_timer_queries(struct r600_context
*ctx
)
586 struct r600_query
*query
;
588 LIST_FOR_EACH_ENTRY(query
, &ctx
->active_timer_queries
, list
) {
589 r600_emit_query_end(ctx
, query
);
592 assert(ctx
->num_cs_dw_timer_queries_suspend
== 0);
595 void r600_resume_timer_queries(struct r600_context
*ctx
)
597 struct r600_query
*query
;
599 assert(ctx
->num_cs_dw_timer_queries_suspend
== 0);
601 LIST_FOR_EACH_ENTRY(query
, &ctx
->active_timer_queries
, list
) {
602 r600_emit_query_begin(ctx
, query
);
606 void r600_init_query_functions(struct r600_context
*rctx
)
608 rctx
->context
.create_query
= r600_create_query
;
609 rctx
->context
.destroy_query
= r600_destroy_query
;
610 rctx
->context
.begin_query
= r600_begin_query
;
611 rctx
->context
.end_query
= r600_end_query
;
612 rctx
->context
.get_query_result
= r600_get_query_result
;
614 if (rctx
->screen
->info
.r600_num_backends
> 0)
615 rctx
->context
.render_condition
= r600_render_condition
;