uint64_t result;
};
-static INLINE struct nv30_query *
+static inline struct nv30_query *
nv30_query(struct pipe_query *pipe)
{
return (struct nv30_query *)pipe;
}
static struct pipe_query *
-nv30_query_create(struct pipe_context *pipe, unsigned type)
+nv30_query_create(struct pipe_context *pipe, unsigned type, unsigned index)
{
struct nv30_query *q = CALLOC_STRUCT(nv30_query);
if (!q)
q->report = 1;
break;
case PIPE_QUERY_OCCLUSION_COUNTER:
+ case PIPE_QUERY_OCCLUSION_PREDICATE:
+ case PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE:
q->enable = NV30_3D_QUERY_ENABLE;
q->report = 1;
break;
FREE(pq);
}
-static void
+static bool
nv30_query_begin(struct pipe_context *pipe, struct pipe_query *pq)
{
struct nv30_context *nv30 = nv30_context(pipe);
}
break;
case PIPE_QUERY_TIMESTAMP:
- return;
+ return true;
default:
BEGIN_NV04(push, NV30_3D(QUERY_RESET), 1);
PUSH_DATA (push, q->report);
BEGIN_NV04(push, SUBC_3D(q->enable), 1);
PUSH_DATA (push, 1);
}
+ return true;
}
-static void
+static bool
nv30_query_end(struct pipe_context *pipe, struct pipe_query *pq)
{
struct nv30_context *nv30 = nv30_context(pipe);
PUSH_DATA (push, 0);
}
PUSH_KICK (push);
+ return true;
}
-static boolean
+static bool
nv30_query_result(struct pipe_context *pipe, struct pipe_query *pq,
- boolean wait, union pipe_query_result *result)
+ bool wait, union pipe_query_result *result)
{
struct nv30_screen *screen = nv30_screen(pipe->screen);
struct nv30_query *q = nv30_query(pq);
volatile uint32_t *ntfy0 = nv30_ntfy(screen, q->qo[0]);
volatile uint32_t *ntfy1 = nv30_ntfy(screen, q->qo[1]);
- uint64_t *res64 = &result->u64;
if (ntfy1) {
while (ntfy1[3] & 0xff000000) {
if (!wait)
- return FALSE;
+ return false;
}
switch (q->type) {
nv30_query_object_del(screen, &q->qo[1]);
}
- *res64 = q->result;
- return TRUE;
+ if (q->type == PIPE_QUERY_OCCLUSION_PREDICATE ||
+ q->type == PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE)
+ result->b = !!q->result;
+ else
+ result->u64 = q->result;
+ return true;
}
static void
nv40_query_render_condition(struct pipe_context *pipe,
struct pipe_query *pq,
- boolean condition, uint mode)
+ bool condition, enum pipe_render_cond_flag mode)
{
struct nv30_context *nv30 = nv30_context(pipe);
struct nv30_query *q = nv30_query(pq);
PUSH_DATA (push, 0x02000000 | q->qo[1]->hw->start);
}
+static void
+nv30_set_active_query_state(struct pipe_context *pipe, bool enable)
+{
+}
+
void
nv30_query_init(struct pipe_context *pipe)
{
pipe->begin_query = nv30_query_begin;
pipe->end_query = nv30_query_end;
pipe->get_query_result = nv30_query_result;
+ pipe->set_active_query_state = nv30_set_active_query_state;
if (eng3d->oclass >= NV40_3D_CLASS)
pipe->render_condition = nv40_query_render_condition;
}