Mesa (master): nvc0: fix writing query results into buffer

Ilia Mirkin imirkin at kemper.freedesktop.org
Fri Feb 23 01:48:16 UTC 2018


Module: Mesa
Branch: master
Commit: 33ce3569c5b87523e2ed94c383d2ee245f1beaaf
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=33ce3569c5b87523e2ed94c383d2ee245f1beaaf

Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date:   Wed Feb 21 00:10:24 2018 -0500

nvc0: fix writing query results into buffer

We need to mark the range as valid, and validate the resource using a
helper to ensure that the buffer status is marked properly.

Fixes some CTS pipeline stats query tests, and
KHR-GL45.direct_state_access.queries_functional

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Tested-by: Karol Herbst <kherbst at redhat.com>

---

 src/gallium/drivers/nouveau/nvc0/nvc0_query_hw.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw.c b/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw.c
index 7568eeb94d..83a57fa011 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw.c
@@ -386,6 +386,12 @@ nvc0_hw_get_query_result_resource(struct nvc0_context *nvc0,
       nvc0->base.push_cb(&nvc0->base, buf, offset,
                          result_type >= PIPE_QUERY_TYPE_I64 ? 2 : 1,
                          ready);
+
+      util_range_add(&buf->valid_buffer_range, offset,
+                     offset + (result_type >= PIPE_QUERY_TYPE_I64 ? 8 : 4));
+
+      nvc0_resource_validate(buf, NOUVEAU_BO_WR);
+
       return;
    }
 
@@ -473,10 +479,10 @@ nvc0_hw_get_query_result_resource(struct nvc0_context *nvc0,
    PUSH_DATAh(push, buf->address + offset);
    PUSH_DATA (push, buf->address + offset);
 
-   if (buf->mm) {
-      nouveau_fence_ref(nvc0->screen->base.fence.current, &buf->fence);
-      nouveau_fence_ref(nvc0->screen->base.fence.current, &buf->fence_wr);
-   }
+   util_range_add(&buf->valid_buffer_range, offset,
+                  offset + (result_type >= PIPE_QUERY_TYPE_I64 ? 8 : 4));
+
+   nvc0_resource_validate(buf, NOUVEAU_BO_WR);
 }
 
 static const struct nvc0_query_funcs hw_query_funcs = {




More information about the mesa-commit mailing list