Lines Matching refs:query

30  * Support for query objects (GL_ARB_occlusion_query, GL_ARB_timer_query,
40 * query is active, and sum up the differences. (We should do so for
132 /** Waits on the query object's BO and totals the results for this query */
135 struct brw_query_object *query)
142 if (query->bo == NULL)
146 if (drm_intel_bo_busy(query->bo)) {
147 perf_debug("Stalling on the GPU waiting for a query object.\n");
151 drm_intel_bo_map(query->bo, false);
152 results = query->bo->virtual;
153 switch (query->Base.Target) {
156 query->Base.Result += 80 * (results[1] - results[0]);
158 query->Base.Result += 1000 * ((results[1] >> 32) - (results[0] >> 32));
179 query->Base.Result = 80 * (results[1] & 0xffffffff);
180 query->Base.Result &= (1ull << 36) - 1;
182 query->Base.Result = 1000 * (results[1] >> 32);
188 /* Map and count the pixels from the current query BO */
189 for (i = query->first_index; i <= query->last_index; i++) {
190 query->Base.Result += results[i * 2 + 1] - results[i * 2];
196 for (i = query->first_index; i <= query->last_index; i++) {
198 query->Base.Result = GL_TRUE;
206 /* We don't actually query the hardware for this value, so query->bo
213 assert(!"Unrecognized query target in brw_queryobj_get_results()");
216 drm_intel_bo_unmap(query->bo);
218 drm_intel_bo_unreference(query->bo);
219 query->bo = NULL;
225 struct brw_query_object *query;
227 query = calloc(1, sizeof(struct brw_query_object));
229 query->Base.Id = id;
230 query->Base.Result = 0;
231 query->Base.Active = false;
232 query->Base.Ready = true;
234 return &query->Base;
240 struct brw_query_object *query = (struct brw_query_object *)q;
242 drm_intel_bo_unreference(query->bo);
243 free(query);
251 struct brw_query_object *query = (struct brw_query_object *)q;
253 switch (query->Base.Target) {
255 drm_intel_bo_unreference(query->bo);
256 query->bo = drm_intel_bo_alloc(intel->bufmgr, "timer query", 4096, 4096);
257 write_timestamp(intel, query->bo, 0);
262 /* Reset our driver's tracking of query state. */
263 drm_intel_bo_unreference(query->bo);
264 query->bo = NULL;
265 query->first_index = -1;
266 query->last_index = -1;
268 brw->query.obj = query;
273 /* We don't actually query the hardware for this value; we keep track of
281 /* We don't actually query the hardware for this value; we keep track of
289 assert(!"Unrecognized query target in brw_begin_query()");
295 * Begin the ARB_occlusion_query query on a query object.
302 struct brw_query_object *query = (struct brw_query_object *)q;
304 switch (query->Base.Target) {
306 drm_intel_bo_unreference(query->bo);
307 query->bo = drm_intel_bo_alloc(intel->bufmgr, "timer query",
312 write_timestamp(intel, query->bo, 1);
318 /* Flush the batchbuffer in case it has writes to our query BO.
319 * Have later queries write to a new query BO so that further rendering
322 if (query->bo) {
326 drm_intel_bo_unreference(brw->query.bo);
327 brw->query.bo = NULL;
330 brw->query.obj = NULL;
336 /* We don't actually query the hardware for this value; we keep track of
338 * the query object.
340 query->Base.Result = brw->sol.primitives_generated;
343 /* And set brw->query.obj to NULL so that this query won't try to wait
346 query->bo = NULL;
350 /* We don't actually query the hardware for this value; we keep track of
352 * the query object.
354 query->Base.Result = brw->sol.primitives_written;
357 /* And set brw->query.obj to NULL so that this query won't try to wait
360 query->bo = NULL;
364 assert(!"Unrecognized query target in brw_end_query()");
371 struct brw_query_object *query = (struct brw_query_object *)q;
373 brw_queryobj_get_results(ctx, query);
374 query->Base.Ready = true;
379 struct brw_query_object *query = (struct brw_query_object *)q;
381 if (query->bo == NULL || !drm_intel_bo_busy(query->bo)) {
382 brw_queryobj_get_results(ctx, query);
383 query->Base.Ready = true;
387 /** Called to set up the query BO and account for its aperture space */
394 if (!brw->query.obj)
397 /* Get a new query BO if we're going to need it. */
398 if (brw->query.bo == NULL ||
399 brw->query.index * 2 + 1 >= 4096 / sizeof(uint64_t)) {
400 drm_intel_bo_unreference(brw->query.bo);
401 brw->query.bo = NULL;
403 brw->query.bo = drm_intel_bo_alloc(intel->bufmgr, "query", 4096, 1);
406 drm_intel_bo_map(brw->query.bo, true);
407 memset((char *)brw->query.bo->virtual, 0, 4096);
408 drm_intel_bo_unmap(brw->query.bo);
410 brw->query.index = 0;
420 struct brw_query_object *query = brw->query.obj;
423 if (!query || brw->query.active)
426 write_depth_count(intel, brw->query.bo, brw->query.index * 2);
428 if (query->bo != brw->query.bo) {
429 if (query->bo != NULL)
430 brw_queryobj_get_results(ctx, query);
431 drm_intel_bo_reference(brw->query.bo);
432 query->bo = brw->query.bo;
433 query->first_index = brw->query.index;
435 query->last_index = brw->query.index;
436 brw->query.active = true;
445 if (!brw->query.active)
448 write_depth_count(intel, brw->query.bo, brw->query.index * 2 + 1);
450 brw->query.active = false;
451 brw->query.index++;