{
const struct gen_device_info *devinfo = &brw->screen->devinfo;
- return (double)gpu_timestamp * devinfo->timebase_scale;
+ return (1000000000ull * gpu_timestamp) / devinfo->timestamp_frequency;
}
/* As best we know currently, the Gen HW timestamps are 36bits across
void
brw_write_timestamp(struct brw_context *brw, struct brw_bo *query_bo, int idx)
{
- if (brw->gen == 6) {
+ const struct gen_device_info *devinfo = &brw->screen->devinfo;
+
+ if (devinfo->gen == 6) {
/* Emit Sandybridge workaround flush: */
brw_emit_pipe_control_flush(brw,
PIPE_CONTROL_CS_STALL |
uint32_t flags = PIPE_CONTROL_WRITE_TIMESTAMP;
- if (brw->gen == 9 && brw->gt == 4)
+ if (devinfo->gen == 9 && devinfo->gt == 4)
flags |= PIPE_CONTROL_CS_STALL;
brw_emit_pipe_control_write(brw, flags,
- query_bo, idx * sizeof(uint64_t), 0, 0);
+ query_bo, idx * sizeof(uint64_t), 0);
}
/**
void
brw_write_depth_count(struct brw_context *brw, struct brw_bo *query_bo, int idx)
{
+ const struct gen_device_info *devinfo = &brw->screen->devinfo;
uint32_t flags = PIPE_CONTROL_WRITE_DEPTH_COUNT | PIPE_CONTROL_DEPTH_STALL;
- if (brw->gen == 9 && brw->gt == 4)
+ if (devinfo->gen == 9 && devinfo->gt == 4)
flags |= PIPE_CONTROL_CS_STALL;
- if (brw->gen >= 10) {
+ if (devinfo->gen >= 10) {
/* "Driver must program PIPE_CONTROL with only Depth Stall Enable bit set
* prior to programming a PIPE_CONTROL with Write PS Depth Count Post sync
* operation."
}
brw_emit_pipe_control_write(brw, flags,
- query_bo, idx * sizeof(uint64_t),
- 0, 0);
+ query_bo, idx * sizeof(uint64_t), 0);
}
/**
struct brw_query_object *query)
{
struct brw_context *brw = brw_context(ctx);
+ UNUSED const struct gen_device_info *devinfo = &brw->screen->devinfo;
int i;
uint64_t *results;
- assert(brw->gen < 6);
+ assert(devinfo->gen < 6);
if (query->bo == NULL)
return;
{
struct brw_context *brw = brw_context(ctx);
struct brw_query_object *query = (struct brw_query_object *)q;
+ UNUSED const struct gen_device_info *devinfo = &brw->screen->devinfo;
- assert(brw->gen < 6);
+ assert(devinfo->gen < 6);
switch (query->Base.Target) {
case GL_TIME_ELAPSED_EXT:
* the system was doing other work, such as running other applications.
*/
brw_bo_unreference(query->bo);
- query->bo = brw_bo_alloc(brw->bufmgr, "timer query", 4096, 4096);
+ query->bo =
+ brw_bo_alloc(brw->bufmgr, "timer query", 4096, BRW_MEMZONE_OTHER);
brw_write_timestamp(brw, query->bo, 0);
break;
{
struct brw_context *brw = brw_context(ctx);
struct brw_query_object *query = (struct brw_query_object *)q;
+ UNUSED const struct gen_device_info *devinfo = &brw->screen->devinfo;
- assert(brw->gen < 6);
+ assert(devinfo->gen < 6);
switch (query->Base.Target) {
case GL_TIME_ELAPSED_EXT:
static void brw_wait_query(struct gl_context *ctx, struct gl_query_object *q)
{
struct brw_query_object *query = (struct brw_query_object *)q;
+ UNUSED const struct gen_device_info *devinfo =
+ &brw_context(ctx)->screen->devinfo;
- assert(brw_context(ctx)->gen < 6);
+ assert(devinfo->gen < 6);
brw_queryobj_get_results(ctx, query);
query->Base.Ready = true;
{
struct brw_context *brw = brw_context(ctx);
struct brw_query_object *query = (struct brw_query_object *)q;
+ UNUSED const struct gen_device_info *devinfo = &brw->screen->devinfo;
- assert(brw->gen < 6);
+ assert(devinfo->gen < 6);
/* From the GL_ARB_occlusion_query spec:
*
ensure_bo_has_space(struct gl_context *ctx, struct brw_query_object *query)
{
struct brw_context *brw = brw_context(ctx);
+ UNUSED const struct gen_device_info *devinfo = &brw->screen->devinfo;
- assert(brw->gen < 6);
+ assert(devinfo->gen < 6);
if (!query->bo || query->last_index * 2 + 1 >= 4096 / sizeof(uint64_t)) {
brw_queryobj_get_results(ctx, query);
}
- query->bo = brw_bo_alloc(brw->bufmgr, "query", 4096, 1);
+ query->bo = brw_bo_alloc(brw->bufmgr, "query", 4096, BRW_MEMZONE_OTHER);
query->last_index = 0;
}
}
struct gl_context *ctx = &brw->ctx;
struct brw_query_object *query = brw->query.obj;
- if (brw->hw_ctx)
- return;
-
/* Skip if we're not doing any queries, or we've already recorded the
* initial query value for this batchbuffer.
*/
{
struct brw_query_object *query = brw->query.obj;
- if (brw->hw_ctx)
- return;
-
if (!brw->query.begin_emitted)
return;
assert(q->Target == GL_TIMESTAMP);
brw_bo_unreference(query->bo);
- query->bo = brw_bo_alloc(brw->bufmgr, "timestamp query", 4096, 4096);
+ query->bo =
+ brw_bo_alloc(brw->bufmgr, "timestamp query", 4096, BRW_MEMZONE_OTHER);
brw_write_timestamp(brw, query->bo, 0);
query->flushed = false;