Lines Matching refs:q
59 nvc0_query_allocate(struct nvc0_context *nvc0, struct nvc0_query *q, int size) in nvc0_query_allocate() argument
64 if (q->bo) { in nvc0_query_allocate()
65 nouveau_bo_ref(NULL, &q->bo); in nvc0_query_allocate()
66 if (q->mm) { in nvc0_query_allocate()
67 if (q->state == NVC0_QUERY_STATE_READY) in nvc0_query_allocate()
68 nouveau_mm_free(q->mm); in nvc0_query_allocate()
71 nouveau_mm_free_work, q->mm); in nvc0_query_allocate()
75 q->mm = nouveau_mm_allocate(screen->base.mm_GART, size, &q->bo, &q->base); in nvc0_query_allocate()
76 if (!q->bo) in nvc0_query_allocate()
78 q->offset = q->base; in nvc0_query_allocate()
80 ret = nouveau_bo_map(q->bo, 0, screen->base.client); in nvc0_query_allocate()
82 nvc0_query_allocate(nvc0, q, 0); in nvc0_query_allocate()
85 q->data = (uint32_t *)((uint8_t *)q->bo->map + q->base); in nvc0_query_allocate()
101 struct nvc0_query *q; in nvc0_query_create() local
104 q = CALLOC_STRUCT(nvc0_query); in nvc0_query_create()
105 if (!q) in nvc0_query_create()
111 q->rotate = 32; in nvc0_query_create()
115 q->is64bit = TRUE; in nvc0_query_create()
120 q->is64bit = TRUE; in nvc0_query_create()
135 FREE(q); in nvc0_query_create()
138 if (!nvc0_query_allocate(nvc0, q, space)) { in nvc0_query_create()
139 FREE(q); in nvc0_query_create()
143 q->type = type; in nvc0_query_create()
145 if (q->rotate) { in nvc0_query_create()
147 q->offset -= q->rotate; in nvc0_query_create()
148 q->data -= q->rotate / sizeof(*q->data); in nvc0_query_create()
150 if (!q->is64bit) in nvc0_query_create()
151 q->data[0] = 0; /* initialize sequence */ in nvc0_query_create()
153 return (struct pipe_query *)q; in nvc0_query_create()
157 nvc0_query_get(struct nouveau_pushbuf *push, struct nvc0_query *q, in nvc0_query_get() argument
160 offset += q->offset; in nvc0_query_get()
163 PUSH_REFN (push, q->bo, NOUVEAU_BO_GART | NOUVEAU_BO_WR); in nvc0_query_get()
165 PUSH_DATAh(push, q->bo->offset + offset); in nvc0_query_get()
166 PUSH_DATA (push, q->bo->offset + offset); in nvc0_query_get()
167 PUSH_DATA (push, q->sequence); in nvc0_query_get()
172 nvc0_query_rotate(struct nvc0_context *nvc0, struct nvc0_query *q) in nvc0_query_rotate() argument
174 q->offset += q->rotate; in nvc0_query_rotate()
175 q->data += q->rotate / sizeof(*q->data); in nvc0_query_rotate()
176 if (q->offset - q->base == NVC0_QUERY_ALLOC_SPACE) in nvc0_query_rotate()
177 nvc0_query_allocate(nvc0, q, NVC0_QUERY_ALLOC_SPACE); in nvc0_query_rotate()
185 struct nvc0_query *q = nvc0_query(pq); in nvc0_query_begin() local
191 if (q->rotate) { in nvc0_query_begin()
192 nvc0_query_rotate(nvc0, q); in nvc0_query_begin()
197 q->data[0] = q->sequence; /* initialize sequence */ in nvc0_query_begin()
198 q->data[1] = 1; /* initial render condition = TRUE */ in nvc0_query_begin()
199 q->data[4] = q->sequence + 1; /* for comparison COND_MODE */ in nvc0_query_begin()
200 q->data[5] = 0; in nvc0_query_begin()
202 q->sequence++; in nvc0_query_begin()
204 switch (q->type) { in nvc0_query_begin()
207 q->nesting = nvc0->screen->num_occlusion_queries_active++; in nvc0_query_begin()
208 if (q->nesting) { in nvc0_query_begin()
209 nvc0_query_get(push, q, 0x10, 0x0100f002); in nvc0_query_begin()
218 nvc0_query_get(push, q, 0x10, 0x06805002 | (q->index << 5)); in nvc0_query_begin()
221 nvc0_query_get(push, q, 0x10, 0x05805002 | (q->index << 5)); in nvc0_query_begin()
224 nvc0_query_get(push, q, 0x20, 0x05805002 | (q->index << 5)); in nvc0_query_begin()
225 nvc0_query_get(push, q, 0x30, 0x06805002 | (q->index << 5)); in nvc0_query_begin()
228 nvc0_query_get(push, q, 0x10, 0x03005002 | (q->index << 5)); in nvc0_query_begin()
232 nvc0_query_get(push, q, 0x10, 0x00005002); in nvc0_query_begin()
235 nvc0_query_get(push, q, 0xc0 + 0x00, 0x00801002); /* VFETCH, VERTICES */ in nvc0_query_begin()
236 nvc0_query_get(push, q, 0xc0 + 0x10, 0x01801002); /* VFETCH, PRIMS */ in nvc0_query_begin()
237 nvc0_query_get(push, q, 0xc0 + 0x20, 0x02802002); /* VP, LAUNCHES */ in nvc0_query_begin()
238 nvc0_query_get(push, q, 0xc0 + 0x30, 0x03806002); /* GP, LAUNCHES */ in nvc0_query_begin()
239 nvc0_query_get(push, q, 0xc0 + 0x40, 0x04806002); /* GP, PRIMS_OUT */ in nvc0_query_begin()
240 nvc0_query_get(push, q, 0xc0 + 0x50, 0x07804002); /* RAST, PRIMS_IN */ in nvc0_query_begin()
241 nvc0_query_get(push, q, 0xc0 + 0x60, 0x08804002); /* RAST, PRIMS_OUT */ in nvc0_query_begin()
242 nvc0_query_get(push, q, 0xc0 + 0x70, 0x0980a002); /* ROP, PIXELS */ in nvc0_query_begin()
243 nvc0_query_get(push, q, 0xc0 + 0x80, 0x0d808002); /* TCP, LAUNCHES */ in nvc0_query_begin()
244 nvc0_query_get(push, q, 0xc0 + 0x90, 0x0e809002); /* TEP, LAUNCHES */ in nvc0_query_begin()
249 q->state = NVC0_QUERY_STATE_ACTIVE; in nvc0_query_begin()
257 struct nvc0_query *q = nvc0_query(pq); in nvc0_query_end() local
259 if (q->state != NVC0_QUERY_STATE_ACTIVE) { in nvc0_query_end()
261 if (q->rotate) in nvc0_query_end()
262 nvc0_query_rotate(nvc0, q); in nvc0_query_end()
263 q->sequence++; in nvc0_query_end()
265 q->state = NVC0_QUERY_STATE_ENDED; in nvc0_query_end()
267 switch (q->type) { in nvc0_query_end()
270 nvc0_query_get(push, q, 0, 0x0100f002); in nvc0_query_end()
277 nvc0_query_get(push, q, 0, 0x06805002 | (q->index << 5)); in nvc0_query_end()
280 nvc0_query_get(push, q, 0, 0x05805002 | (q->index << 5)); in nvc0_query_end()
283 nvc0_query_get(push, q, 0x00, 0x05805002 | (q->index << 5)); in nvc0_query_end()
284 nvc0_query_get(push, q, 0x10, 0x06805002 | (q->index << 5)); in nvc0_query_end()
289 nvc0_query_get(push, q, 0x00, 0x03005002 | (q->index << 5)); in nvc0_query_end()
290 nvc0_query_get(push, q, 0x20, 0x00005002); in nvc0_query_end()
295 nvc0_query_get(push, q, 0, 0x00005002); in nvc0_query_end()
298 nvc0_query_get(push, q, 0, 0x1000f010); in nvc0_query_end()
301 nvc0_query_get(push, q, 0x00, 0x00801002); /* VFETCH, VERTICES */ in nvc0_query_end()
302 nvc0_query_get(push, q, 0x10, 0x01801002); /* VFETCH, PRIMS */ in nvc0_query_end()
303 nvc0_query_get(push, q, 0x20, 0x02802002); /* VP, LAUNCHES */ in nvc0_query_end()
304 nvc0_query_get(push, q, 0x30, 0x03806002); /* GP, LAUNCHES */ in nvc0_query_end()
305 nvc0_query_get(push, q, 0x40, 0x04806002); /* GP, PRIMS_OUT */ in nvc0_query_end()
306 nvc0_query_get(push, q, 0x50, 0x07804002); /* RAST, PRIMS_IN */ in nvc0_query_end()
307 nvc0_query_get(push, q, 0x60, 0x08804002); /* RAST, PRIMS_OUT */ in nvc0_query_end()
308 nvc0_query_get(push, q, 0x70, 0x0980a002); /* ROP, PIXELS */ in nvc0_query_end()
309 nvc0_query_get(push, q, 0x80, 0x0d808002); /* TCP, LAUNCHES */ in nvc0_query_end()
310 nvc0_query_get(push, q, 0x90, 0x0e809002); /* TEP, LAUNCHES */ in nvc0_query_end()
314 nvc0_query_get(push, q, 0x00, 0x0d005002 | (q->index << 5)); in nvc0_query_end()
323 nvc0_query_update(struct nouveau_client *cli, struct nvc0_query *q) in nvc0_query_update() argument
325 if (q->is64bit) { in nvc0_query_update()
326 if (!nouveau_bo_map(q->bo, NOUVEAU_BO_RD | NOUVEAU_BO_NOBLOCK, cli)) in nvc0_query_update()
327 q->state = NVC0_QUERY_STATE_READY; in nvc0_query_update()
329 if (q->data[0] == q->sequence) in nvc0_query_update()
330 q->state = NVC0_QUERY_STATE_READY; in nvc0_query_update()
339 struct nvc0_query *q = nvc0_query(pq); in nvc0_query_result() local
343 uint64_t *data64 = (uint64_t *)q->data; in nvc0_query_result()
346 if (q->state != NVC0_QUERY_STATE_READY) in nvc0_query_result()
347 nvc0_query_update(nvc0->screen->base.client, q); in nvc0_query_result()
349 if (q->state != NVC0_QUERY_STATE_READY) { in nvc0_query_result()
351 if (q->state != NVC0_QUERY_STATE_FLUSHED) { in nvc0_query_result()
352 q->state = NVC0_QUERY_STATE_FLUSHED; in nvc0_query_result()
358 if (nouveau_bo_wait(q->bo, NOUVEAU_BO_RD, nvc0->screen->base.client)) in nvc0_query_result()
361 q->state = NVC0_QUERY_STATE_READY; in nvc0_query_result()
363 switch (q->type) { in nvc0_query_result()
368 res64[0] = q->data[1] - q->data[5]; in nvc0_query_result()
371 res8[0] = q->data[1] != q->data[5]; in nvc0_query_result()
399 res32[0] = q->data[1]; in nvc0_query_result()
411 struct nvc0_query *q = nvc0_query(pq); in nvc0_query_fifo_wait() local
412 unsigned offset = q->offset; in nvc0_query_fifo_wait()
414 if (q->type == PIPE_QUERY_SO_OVERFLOW_PREDICATE) offset += 0x20; in nvc0_query_fifo_wait()
417 PUSH_REFN (push, q->bo, NOUVEAU_BO_GART | NOUVEAU_BO_RD); in nvc0_query_fifo_wait()
419 PUSH_DATAh(push, q->bo->offset + offset); in nvc0_query_fifo_wait()
420 PUSH_DATA (push, q->bo->offset + offset); in nvc0_query_fifo_wait()
421 PUSH_DATA (push, q->sequence); in nvc0_query_fifo_wait()
432 struct nvc0_query *q; in nvc0_render_condition() local
444 q = nvc0_query(pq); in nvc0_render_condition()
447 switch (q->type) { in nvc0_render_condition()
456 if (unlikely(q->nesting)) in nvc0_render_condition()
475 PUSH_REFN (push, q->bo, NOUVEAU_BO_GART | NOUVEAU_BO_RD); in nvc0_render_condition()
477 PUSH_DATAh(push, q->bo->offset + q->offset); in nvc0_render_condition()
478 PUSH_DATA (push, q->bo->offset + q->offset); in nvc0_render_condition()
486 struct nvc0_query *q = nvc0_query(pq); in nvc0_query_pushbuf_submit() local
491 nouveau_pushbuf_data(push, q->bo, q->offset + result_offset, 4 | in nvc0_query_pushbuf_submit()