Home | History | Annotate | Download | only in i965

Lines Matching refs:query

30  * Support for query objects (GL_ARB_occlusion_query, GL_ARB_timer_query,
84 * Wait on the query object's BO and calculate the final result.
88 struct brw_query_object *query)
97 if (query->bo == NULL)
100 /* If the application has requested the query result, but this batch is
104 if (drm_intel_bo_references(brw->batch.bo, query->bo))
108 if (drm_intel_bo_busy(query->bo)) {
109 perf_debug("Stalling on the GPU waiting for a query object.\n");
113 drm_intel_bo_map(query->bo, false);
114 results = query->bo->virtual;
115 switch (query->Base.Target) {
117 /* The query BO contains the starting and ending timestamps.
120 query->Base.Result += 1000 * ((results[1] >> 32) - (results[0] >> 32));
124 /* The query BO contains a single timestamp value in results[0]. */
125 query->Base.Result = 1000 * (results[0] >> 32);
133 * of fragments for the entire query.
135 * Note that query->Base.Result may already be non-zero. We may have
136 * run out of space in the query's BO and allocated a new one. If so,
139 for (i = 0; i < query->last_index; i++) {
140 query->Base.Result += results[i * 2 + 1] - results[i * 2];
149 for (i = 0; i < query->last_index; i++) {
151 query->Base.Result = GL_TRUE;
158 unreachable("Unrecognized query target in brw_queryobj_get_results()");
160 drm_intel_bo_unmap(query->bo);
162 /* Now that we've processed the data stored in the query's buffer object,
165 drm_intel_bo_unreference(query->bo);
166 query->bo = NULL;
172 * Allocates and initializes a new query object.
177 struct brw_query_object *query;
179 query = calloc(1, sizeof(struct brw_query_object));
181 query->Base.Id = id;
182 query->Base.Result = 0;
183 query->Base.Active = false;
184 query->Base.Ready = true;
186 return &query->Base;
195 struct brw_query_object *query = (struct brw_query_object *)q;
197 drm_intel_bo_unreference(query->bo);
198 free(query);
205 * recording data for the query.
211 struct brw_query_object *query = (struct brw_query_object *)q;
215 switch (query->Base.Target) {
228 * may implement a query to determine time elapsed at different stages
236 drm_intel_bo_unreference(query->bo);
237 query->bo = drm_intel_bo_alloc(brw->bufmgr, "timer query", 4096, 4096);
238 brw_write_timestamp(brw, query->bo, 0);
248 * Since we're starting a new query, we need to be sure to throw away
249 * any previous occlusion query results.
251 drm_intel_bo_unreference(query->bo);
252 query->bo = NULL;
253 query->last_index = -1;
255 brw->query.obj = query;
266 unreachable("Unrecognized query target in brw_begin_query()");
273 * Emits GPU commands to record a final query value, ending any data capturing.
282 struct brw_query_object *query = (struct brw_query_object *)q;
286 switch (query->Base.Target) {
289 brw_write_timestamp(brw, query->bo, 1);
296 /* No query->bo means that EndQuery was called after BeginQuery with no
303 * It must always be true that if any query object
305 * same type issued prior to that query must also return
308 if (!query->bo) {
312 assert(query->bo);
316 brw->query.obj = NULL;
323 unreachable("Unrecognized query target in brw_end_query()");
330 * Wait for a query result to become available and return it. This is the
335 struct brw_query_object *query = (struct brw_query_object *)q;
339 brw_queryobj_get_results(ctx, query);
340 query->Base.Ready = true;
346 * Checks whether a query result is ready yet. If not, flushes.
352 struct brw_query_object *query = (struct brw_query_object *)q;
361 * the async query will return true in finite time.
363 if (query->bo && drm_intel_bo_references(brw->batch.bo, query->bo))
366 if (query->bo == NULL || !drm_intel_bo_busy(query->bo)) {
367 brw_queryobj_get_results(ctx, query);
368 query->Base.Ready = true;
373 * Ensure there query's BO has enough space to store a new pair of values.
379 ensure_bo_has_space(struct gl_context *ctx, struct brw_query_object *query)
385 if (!query->bo || query->last_index * 2 + 1 >= 4096 / sizeof(uint64_t)) {
387 if (query->bo != NULL) {
388 /* The old query BO did not have enough space, so we allocated a new
392 brw_queryobj_get_results(ctx, query);
395 query->bo = drm_intel_bo_alloc(brw->bufmgr, "query", 4096, 1);
396 query->last_index = 0;
405 * shared among all applications using the GPU. However, our query value
424 struct brw_query_object *query = brw->query.obj;
430 * initial query value for this batchbuffer.
432 if (!query || brw->query.begin_emitted)
435 ensure_bo_has_space(ctx, query);
437 brw_write_depth_count(brw, query->bo, query->last_index * 2);
439 brw->query.begin_emitted = true;
451 struct brw_query_object *query = brw->query.obj;
456 if (!brw->query.begin_emitted)
459 brw_write_depth_count(brw, query->bo, query->last_index * 2 + 1);
461 brw->query.begin_emitted = false;
462 query->last_index++;
470 * time while the query is active.
476 struct brw_query_object *query = (struct brw_query_object *) q;
480 drm_intel_bo_unreference(query->bo);
481 query->bo = drm_intel_bo_alloc(brw->bufmgr, "timestamp query", 4096, 4096);
482 brw_write_timestamp(brw, query->bo, 0);
484 query->flushed = false;
518 * Is this type of query written by PIPE_CONTROL?
521 brw_is_query_pipelined(struct brw_query_object *query)
523 switch (query->Base.Target) {
547 unreachable("Unrecognized query target in is_query_pipelined()");
551 /* Initialize query object functions used on all generations. */
559 /* Initialize Gen4/5-specific query object functions. */