i965: Rely on hardware contexts for query objects on Gen6+.
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 16 May 2013 04:33:01 +0000 (21:33 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 20 May 2013 20:03:18 +0000 (13:03 -0700)
commite32cd5ffbb7231f8d4bb44189492c89c9a4fbfa9
tree4a8fd7a861228148eb20a7b62297ed33cbb929ff
parent72b1e440dde1b8430cc63774efa22b6d360fc51e
i965: Rely on hardware contexts for query objects on Gen6+.

Hardware contexts greatly simplify the query object code.  The pipeline
statistics counters get saved and restored with the context, which means
that we don't need to worry about other workloads polluting them.

This means that we can simply write a single pair of values (one at
BeginQuery and one at EndQuery) rather than a series of pairs.  This
also means we don't need to worry about the BO getting full.  We also
don't need to delay BO allocation and starting snapshot until the first
draw.

The generation split here is a little off: technically, Ironlake can also
support hardware contexts.  However, the kernel currently doesn't, and
even if it were to do so someday, we'd need to wait a while before
bumping the kernel requirement to take advantage of it.

v2: Incorporate Paul's feedback.
- Clarify which functions are Gen4/5-only via assertions and comments.
- Change how driver hook initialization happens.
- Update comments.
- Squash a bug fix from a later commit here where it belongs.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net> [v1]
Acked-by: Paul Berry <stereotype441@gmail.com>
src/mesa/drivers/dri/i965/Makefile.sources
src/mesa/drivers/dri/i965/brw_context.c
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/brw_queryobj.c
src/mesa/drivers/dri/i965/gen6_queryobj.c [new file with mode: 0644]