Chris Wilson <[email protected]> writes: > Currently we signal the availabilty of the query result using an > unordered pipe-control write. As it is unordered, it may be executed > before the write of the query result itself - and so an observer may > read the query result too early. Fix this by requesting that the write > of the availablity flag is ordered after earlier pipe control writes. > > Testcase: piglit/arb_query_buffer_object-qbo/*async* > Signed-off-by: Chris Wilson <[email protected]> > --- > src/mesa/drivers/dri/i965/gen6_queryobj.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/src/mesa/drivers/dri/i965/gen6_queryobj.c > b/src/mesa/drivers/dri/i965/gen6_queryobj.c > index bbd3c44fb0..f6b90f77ea 100644 > --- a/src/mesa/drivers/dri/i965/gen6_queryobj.c > +++ b/src/mesa/drivers/dri/i965/gen6_queryobj.c > @@ -60,8 +60,16 @@ set_query_availability(struct brw_context *brw, struct > brw_query_object *query, > */ > if (brw->ctx.Extensions.ARB_query_buffer_object && > brw_is_query_pipelined(query)) { > - brw_emit_pipe_control_write(brw, > - PIPE_CONTROL_WRITE_IMMEDIATE, > + unsigned flags = PIPE_CONTROL_WRITE_IMMEDIATE; > + > + if (available) > + /* Order available *after* the query results */ > + flags |= PIPE_CONTROL_FLUSH_ENABLE; > + else > + /* Make it unavailable *before* any pipelined reads */ > + flags |= PIPE_CONTROL_CS_STALL;
AFAIUI this may not actually guarantee that the immediate write will have landed in memory by the time the CS reaches a subsequent pipeline read, it only guarantees that the sync operation will have completed by that time, but not necessarily the post-sync operation used here to update the availability flag. I believe we want a separate PIPE_CONTROL command with CS Stall+Pipe Control Flush set, probably somewhere close to the pipelined read of the availability flag. > + > + brw_emit_pipe_control_write(brw, flags, > query->bo, 2 * sizeof(uint64_t), > available, 0); > } > -- > 2.11.0 > > _______________________________________________ > mesa-dev mailing list > [email protected] > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
signature.asc
Description: PGP signature
_______________________________________________ mesa-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-dev
