On Thursday, April 21, 2016 10:18:48 PM PDT Jordan Justen wrote: [snip] > diff --git a/src/mesa/drivers/dri/i965/brw_queryobj.c b/src/mesa/drivers/ dri/i965/brw_queryobj.c > index a8e5aba..81ee5ea 100644 > --- a/src/mesa/drivers/dri/i965/brw_queryobj.c > +++ b/src/mesa/drivers/dri/i965/brw_queryobj.c > @@ -462,7 +462,7 @@ brw_emit_query_end(struct brw_context *brw) > * current GPU time. This is unlike GL_TIME_ELAPSED, which measures the > * time while the query is active. > */ > -static void > +void > brw_query_counter(struct gl_context *ctx, struct gl_query_object *q) > { > struct brw_context *brw = brw_context(ctx); > @@ -507,12 +507,42 @@ brw_get_timestamp(struct gl_context *ctx) > return result; > } >
/** * Is this type of query written by PIPE_CONTROL? */ > +bool > +brw_is_query_pipelined(struct brw_query_object *query) > +{ > + switch (query->Base.Target) { > + case GL_TIMESTAMP: > + case GL_TIME_ELAPSED: > + case GL_ANY_SAMPLES_PASSED: > + case GL_ANY_SAMPLES_PASSED_CONSERVATIVE: > + case GL_SAMPLES_PASSED_ARB: > + return true; > + > + case GL_PRIMITIVES_GENERATED: > + case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: > + case GL_VERTICES_SUBMITTED_ARB: > + case GL_PRIMITIVES_SUBMITTED_ARB: > + case GL_VERTEX_SHADER_INVOCATIONS_ARB: > + case GL_GEOMETRY_SHADER_INVOCATIONS: > + case GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB: > + case GL_FRAGMENT_SHADER_INVOCATIONS_ARB: > + case GL_CLIPPING_INPUT_PRIMITIVES_ARB: > + case GL_CLIPPING_OUTPUT_PRIMITIVES_ARB: > + case GL_COMPUTE_SHADER_INVOCATIONS_ARB: > + case GL_TESS_CONTROL_SHADER_PATCHES_ARB: > + case GL_TESS_EVALUATION_SHADER_INVOCATIONS_ARB: > + return false; > + > + default: > + unreachable("Unrecognized query target in is_query_pipelined()"); > + } > +} > + > /* Initialize query object functions used on all generations. */ > void brw_init_common_queryobj_functions(struct dd_function_table *functions) > { > functions->NewQueryObject = brw_new_query_object; > functions->DeleteQuery = brw_delete_query; > - functions->QueryCounter = brw_query_counter; > functions->GetTimestamp = brw_get_timestamp; > } > > @@ -523,4 +553,5 @@ void gen4_init_queryobj_functions(struct dd_function_table *functions) > functions->EndQuery = brw_end_query; > functions->CheckQuery = brw_check_query; > functions->WaitQuery = brw_wait_query; > + functions->QueryCounter = brw_query_counter; > } > diff --git a/src/mesa/drivers/dri/i965/gen6_queryobj.c b/src/mesa/drivers/ dri/i965/gen6_queryobj.c > index 960ccfd..f95c9fc 100644 > --- a/src/mesa/drivers/dri/i965/gen6_queryobj.c > +++ b/src/mesa/drivers/dri/i965/gen6_queryobj.c > @@ -37,8 +37,25 @@ > #include "brw_defines.h" > #include "brw_state.h" > #include "intel_batchbuffer.h" > +#include "intel_buffer_objects.h" > #include "intel_reg.h" > > +static inline void > +set_query_availability(struct brw_context *brw, struct brw_query_object *query, > + bool available) > +{ > + /* For ARB_query_buffer_object we write the query availability for > + * pipelined results > + */ I could use some more comments here. How about: /* For platforms that support ARB_query_buffer_object, we write the * query availability for "pipelined" queries. * * Most counter snapshots are written by the command streamer, by * doing a CS stall and then MI_STORE_REGISTER_MEM. For these * counters, the CS stall guarantees that the results will be * available when subsequent GPU commands run. So we don't need to * do any additional tracking. * * Other counters (occlusion queries and timestamp) are written by * PIPE_CONTROL, without a CS stall. This means that we can't be * sure whether the writes have landed yet or not. Performing a * PIPE_CONTROL with an immediate write will synchronize with * those earlier writes, so we write 1 when the value has landed. */ > + if (brw->ctx.Extensions.ARB_query_buffer_object && > + brw_is_query_pipelined(query)) { > + brw_emit_pipe_control_write(brw, > + PIPE_CONTROL_WRITE_IMMEDIATE, > + query->bo, 2 * sizeof(uint64_t), > + available, 0); > + } > +} > + > static void > write_primitives_generated(struct brw_context *brw, > drm_intel_bo *query_bo, int stream, int idx)
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev