nv50: support non-blocking query_result()
authorBen Skeggs <bskeggs@redhat.com>
Wed, 29 Jul 2009 01:19:52 +0000 (11:19 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Wed, 29 Jul 2009 01:19:52 +0000 (11:19 +1000)
src/gallium/drivers/nv50/nv50_query.c

index 940e04365f255498fc278632aac719e3e984faf5..c354e10b0f88855c13d1e44babb0690bb7d0bfd8 100644 (file)
@@ -107,13 +107,13 @@ nv50_query_result(struct pipe_context *pipe, struct pipe_query *pq,
                  boolean wait, uint64_t *result)
 {
        struct nv50_query *q = nv50_query(pq);
-
-       /*XXX: Want to be able to return FALSE here instead of blocking
-        *     until the result is available..
-        */
+       int ret;
 
        if (!q->ready) {
-               nouveau_bo_map(q->bo, NOUVEAU_BO_RD);
+               ret = nouveau_bo_map(q->bo, NOUVEAU_BO_RD |
+                                    wait ? 0 : NOUVEAU_BO_NOWAIT);
+               if (ret)
+                       return false;
                q->result = ((uint32_t *)q->bo->map)[1];
                q->ready = TRUE;
                nouveau_bo_unmap(q->bo);