nv30: fix some s3tc layout issues
[mesa.git] / src / gallium / drivers / nouveau / nv30 / nv30_query.c
index 01b3817c45d4cdc7e948110b4919d5a033aa60d4..f26728868af1aec671695ceb7699c2c9310e18a4 100644 (file)
@@ -98,14 +98,14 @@ 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;
 }
 
 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)
@@ -120,6 +120,8 @@ nv30_query_create(struct pipe_context *pipe, unsigned type)
       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;
@@ -144,7 +146,7 @@ nv30_query_destroy(struct pipe_context *pipe, struct pipe_query *pq)
    FREE(pq);
 }
 
-static void
+static boolean
 nv30_query_begin(struct pipe_context *pipe, struct pipe_query *pq)
 {
    struct nv30_context *nv30 = nv30_context(pipe);
@@ -160,7 +162,7 @@ nv30_query_begin(struct pipe_context *pipe, struct pipe_query *pq)
       }
       break;
    case PIPE_QUERY_TIMESTAMP:
-      return;
+      return true;
    default:
       BEGIN_NV04(push, NV30_3D(QUERY_RESET), 1);
       PUSH_DATA (push, q->report);
@@ -171,9 +173,10 @@ nv30_query_begin(struct pipe_context *pipe, struct pipe_query *pq)
       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);
@@ -192,6 +195,7 @@ nv30_query_end(struct pipe_context *pipe, struct pipe_query *pq)
       PUSH_DATA (push, 0);
    }
    PUSH_KICK (push);
+   return true;
 }
 
 static boolean
@@ -202,12 +206,11 @@ nv30_query_result(struct pipe_context *pipe, struct pipe_query *pq,
    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) {
@@ -226,14 +229,18 @@ nv30_query_result(struct pipe_context *pipe, struct pipe_query *pq,
       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)
+                            boolean condition, enum pipe_render_cond_flag mode)
 {
    struct nv30_context *nv30 = nv30_context(pipe);
    struct nv30_query *q = nv30_query(pq);
@@ -259,6 +266,11 @@ nv40_query_render_condition(struct pipe_context *pipe,
    PUSH_DATA (push, 0x02000000 | q->qo[1]->hw->start);
 }
 
+static void
+nv30_set_active_query_state(struct pipe_context *pipe, boolean enable)
+{
+}
+
 void
 nv30_query_init(struct pipe_context *pipe)
 {
@@ -269,6 +281,7 @@ 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;
 }