summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nvfx/nvfx_query.c
diff options
context:
space:
mode:
authorLuca Barbieri <[email protected]>2010-09-05 08:27:12 +0200
committerLuca Barbieri <[email protected]>2010-09-05 17:52:26 +0200
commit49b493ddd0bd6718fe02258a070121f5f4aa10d8 (patch)
tree780bd80fa2edad5d803d6a2ac7f543fc1bb579d8 /src/gallium/drivers/nvfx/nvfx_query.c
parent14d58052354cdd72fadabaeb1ae1be2d45d2a5ca (diff)
nvfx: pause occlusion queries during blitter usage
Thanks for Dave Airlie and Jerome Glisse for their code which made me realize I need this too.
Diffstat (limited to 'src/gallium/drivers/nvfx/nvfx_query.c')
-rw-r--r--src/gallium/drivers/nvfx/nvfx_query.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/gallium/drivers/nvfx/nvfx_query.c b/src/gallium/drivers/nvfx/nvfx_query.c
index 1dab20c41a0..eeeb8976610 100644
--- a/src/gallium/drivers/nvfx/nvfx_query.c
+++ b/src/gallium/drivers/nvfx/nvfx_query.c
@@ -49,9 +49,10 @@ nvfx_query_begin(struct pipe_context *pipe, struct pipe_query *pq)
struct nvfx_query *q = nvfx_query(pq);
struct nvfx_screen *screen = nvfx->screen;
struct nouveau_channel *chan = screen->base.channel;
- struct nouveau_grobj *eng3d = screen->eng3d;
uint64_t tmp;
+ assert(!nvfx->query);
+
/* Happens when end_query() is called, then another begin_query()
* without querying the result in-between. For now we'll wait for
* the existing query to notify completion, but it could be better.
@@ -71,27 +72,35 @@ nvfx_query_begin(struct pipe_context *pipe, struct pipe_query *pq)
nouveau_notifier_reset(nvfx->screen->query, q->object->start);
- BEGIN_RING(chan, eng3d, NV34TCL_QUERY_RESET, 1);
- OUT_RING (chan, 1);
- BEGIN_RING(chan, eng3d, NV34TCL_QUERY_UNK17CC, 1);
- OUT_RING (chan, 1);
+ WAIT_RING(chan, 4);
+ OUT_RING(chan, RING_3D(NV34TCL_QUERY_RESET, 1));
+ OUT_RING(chan, 1);
+ OUT_RING(chan, RING_3D(NV34TCL_QUERY_ENABLE, 1));
+ OUT_RING(chan, 1);
q->ready = FALSE;
+
+ nvfx->query = pq;
}
static void
nvfx_query_end(struct pipe_context *pipe, struct pipe_query *pq)
{
struct nvfx_context *nvfx = nvfx_context(pipe);
- struct nvfx_screen *screen = nvfx->screen;
- struct nouveau_channel *chan = screen->base.channel;
- struct nouveau_grobj *eng3d = screen->eng3d;
+ struct nouveau_channel *chan = nvfx->screen->base.channel;
struct nvfx_query *q = nvfx_query(pq);
- BEGIN_RING(chan, eng3d, NV34TCL_QUERY_GET, 1);
+ assert(nvfx->query == pq);
+
+ WAIT_RING(chan, 4);
+ OUT_RING(chan, RING_3D(NV34TCL_QUERY_GET, 1));
OUT_RING (chan, (0x01 << NV34TCL_QUERY_GET_UNK24_SHIFT) |
((q->object->start * 32) << NV34TCL_QUERY_GET_OFFSET_SHIFT));
+ OUT_RING(chan, RING_3D(NV34TCL_QUERY_ENABLE, 1));
+ OUT_RING(chan, 0);
FIRE_RING(chan);
+
+ nvfx->query = 0;
}
static boolean