summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nv30/nv30_query.c
diff options
context:
space:
mode:
authorPatrice Mandin <[email protected]>2008-04-11 23:39:29 +0200
committerPatrice Mandin <[email protected]>2008-04-11 23:39:29 +0200
commit186277ee928a7c9ad8a31776f93e502613ad94fd (patch)
treef67f7b44cd1b3058157ce9e746f800abd4cce060 /src/gallium/drivers/nv30/nv30_query.c
parent4c498c1b0c38a3ba93649fa4435937d15689bae1 (diff)
nv30: Move some structures and functions from context to screen
Diffstat (limited to 'src/gallium/drivers/nv30/nv30_query.c')
-rw-r--r--src/gallium/drivers/nv30/nv30_query.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/gallium/drivers/nv30/nv30_query.c b/src/gallium/drivers/nv30/nv30_query.c
index 0c2d941562c..d40d75f2640 100644
--- a/src/gallium/drivers/nv30/nv30_query.c
+++ b/src/gallium/drivers/nv30/nv30_query.c
@@ -1,5 +1,4 @@
#include "pipe/p_context.h"
-#include "pipe/p_util.h"
#include "nv30_context.h"
@@ -10,7 +9,7 @@ struct nv30_query {
uint64_t result;
};
-static inline struct nv30_query *
+static INLINE struct nv30_query *
nv30_query(struct pipe_query *pipe)
{
return (struct nv30_query *)pipe;
@@ -46,9 +45,18 @@ nv30_query_begin(struct pipe_context *pipe, struct pipe_query *pq)
assert(q->type == PIPE_QUERY_OCCLUSION_COUNTER);
- if (nv30->nvws->res_alloc(nv30->query_heap, 1, NULL, &q->object))
+ /* 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.
+ */
+ if (q->object) {
+ uint64 tmp;
+ pipe->get_query_result(pipe, pq, 1, &tmp);
+ }
+
+ if (nv30->nvws->res_alloc(nv30->screen->query_heap, 1, NULL, &q->object))
assert(0);
- nv30->nvws->notifier_reset(nv30->query, q->object->start);
+ nv30->nvws->notifier_reset(nv30->screen->query, q->object->start);
BEGIN_RING(rankine, NV34TCL_QUERY_RESET, 1);
OUT_RING (1);
@@ -83,16 +91,17 @@ nv30_query_result(struct pipe_context *pipe, struct pipe_query *pq,
if (!q->ready) {
unsigned status;
- status = nvws->notifier_status(nv30->query, q->object->start);
+ status = nvws->notifier_status(nv30->screen->query,
+ q->object->start);
if (status != NV_NOTIFY_STATE_STATUS_COMPLETED) {
if (wait == FALSE)
return FALSE;
- nvws->notifier_wait(nv30->query, q->object->start,
+ nvws->notifier_wait(nv30->screen->query, q->object->start,
NV_NOTIFY_STATE_STATUS_COMPLETED,
0);
}
- q->result = nvws->notifier_retval(nv30->query,
+ q->result = nvws->notifier_retval(nv30->screen->query,
q->object->start);
q->ready = TRUE;
nvws->res_free(&q->object);