Lines Matching refs:qbuf
37 struct gfx10_sh_query_buffer *qbuf = in emit_shader_query() local
39 qbuf->head += sizeof(struct gfx10_sh_query_buffer_mem); in emit_shader_query()
47 struct gfx10_sh_query_buffer *qbuf = first; in gfx10_release_query_buffers() local
49 first = list_entry(qbuf->list.next, struct gfx10_sh_query_buffer, list); in gfx10_release_query_buffers()
53 qbuf->refcount--; in gfx10_release_query_buffers()
54 if (qbuf->refcount) in gfx10_release_query_buffers()
57 if (qbuf->list.next == &sctx->shader_query_buffers) in gfx10_release_query_buffers()
59 if (qbuf->list.prev == &sctx->shader_query_buffers) in gfx10_release_query_buffers()
62 list_del(&qbuf->list); in gfx10_release_query_buffers()
63 si_resource_reference(&qbuf->buf, NULL); in gfx10_release_query_buffers()
64 FREE(qbuf); in gfx10_release_query_buffers()
73 struct gfx10_sh_query_buffer *qbuf = NULL; in gfx10_alloc_query_buffer() local
76 qbuf = list_last_entry(&sctx->shader_query_buffers, struct gfx10_sh_query_buffer, list); in gfx10_alloc_query_buffer()
77 if (qbuf->head + sizeof(struct gfx10_sh_query_buffer_mem) <= qbuf->buf->b.b.width0) in gfx10_alloc_query_buffer()
80 qbuf = list_first_entry(&sctx->shader_query_buffers, struct gfx10_sh_query_buffer, list); in gfx10_alloc_query_buffer()
81 if (!qbuf->refcount && in gfx10_alloc_query_buffer()
82 !si_cs_is_buffer_referenced(sctx, qbuf->buf->buf, RADEON_USAGE_READWRITE) && in gfx10_alloc_query_buffer()
83 sctx->ws->buffer_wait(sctx->ws, qbuf->buf->buf, 0, RADEON_USAGE_READWRITE)) { in gfx10_alloc_query_buffer()
85 list_del(&qbuf->list); in gfx10_alloc_query_buffer()
87 qbuf = NULL; in gfx10_alloc_query_buffer()
91 if (!qbuf) { in gfx10_alloc_query_buffer()
92 qbuf = CALLOC_STRUCT(gfx10_sh_query_buffer); in gfx10_alloc_query_buffer()
93 if (unlikely(!qbuf)) in gfx10_alloc_query_buffer()
99 qbuf->buf = si_resource(pipe_buffer_create(&screen->b, 0, PIPE_USAGE_STAGING, buf_size)); in gfx10_alloc_query_buffer()
100 if (unlikely(!qbuf->buf)) { in gfx10_alloc_query_buffer()
101 FREE(qbuf); in gfx10_alloc_query_buffer()
111 uint64_t *results = sctx->ws->buffer_map(sctx->ws, qbuf->buf->buf, NULL, in gfx10_alloc_query_buffer()
115 for (unsigned i = 0, e = qbuf->buf->b.b.width0 / sizeof(struct gfx10_sh_query_buffer_mem); i < e; in gfx10_alloc_query_buffer()
122 list_addtail(&qbuf->list, &sctx->shader_query_buffers); in gfx10_alloc_query_buffer()
123 qbuf->head = 0; in gfx10_alloc_query_buffer()
124 qbuf->refcount = sctx->num_active_shader_queries; in gfx10_alloc_query_buffer()
128 sbuf.buffer = &qbuf->buf->b.b; in gfx10_alloc_query_buffer()
129 sbuf.buffer_offset = qbuf->head; in gfx10_alloc_query_buffer()
244 for (struct gfx10_sh_query_buffer *qbuf = query->last;; in gfx10_sh_query_get_result() local
245 qbuf = list_entry(qbuf->list.prev, struct gfx10_sh_query_buffer, list)) { in gfx10_sh_query_get_result()
250 map = sctx->ws->buffer_map(sctx->ws, qbuf->buf->buf, NULL, usage); in gfx10_sh_query_get_result()
252 map = si_buffer_map(sctx, qbuf->buf, usage); in gfx10_sh_query_get_result()
258 unsigned results_end = qbuf->head; in gfx10_sh_query_get_result()
259 if (qbuf == query->first) in gfx10_sh_query_get_result()
261 if (qbuf == query->last) in gfx10_sh_query_get_result()
271 if (qbuf == query->first) in gfx10_sh_query_get_result()
366 struct gfx10_sh_query_buffer *qbuf = query->first; in gfx10_sh_query_get_result_resource() local
368 unsigned begin = qbuf == query->first ? query->first_begin : 0; in gfx10_sh_query_get_result_resource()
369 unsigned end = qbuf == query->last ? query->last_end : qbuf->buf->b.b.width0; in gfx10_sh_query_get_result_resource()
373 ssbo[0].buffer = &qbuf->buf->b.b; in gfx10_sh_query_get_result_resource()
379 if (qbuf != query->first) in gfx10_sh_query_get_result_resource()
381 if (qbuf != query->last) in gfx10_sh_query_get_result_resource()
384 if (qbuf == query->last) { in gfx10_sh_query_get_result_resource()
399 va = qbuf->buf->gpu_address; in gfx10_sh_query_get_result_resource()
412 if (qbuf == query->last) in gfx10_sh_query_get_result_resource()
414 qbuf = list_entry(qbuf->list.next, struct gfx10_sh_query_buffer, list); in gfx10_sh_query_get_result_resource()
455 struct gfx10_sh_query_buffer *qbuf = in gfx10_destroy_query() local
457 list_del(&qbuf->list); in gfx10_destroy_query()
459 assert(!qbuf->refcount); in gfx10_destroy_query()
460 si_resource_reference(&qbuf->buf, NULL); in gfx10_destroy_query()
461 FREE(qbuf); in gfx10_destroy_query()