Module: Mesa
Branch: 10.5
Commit: 71367a1bb4003434e12c229748afc7e89688e67c
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=71367a1bb4003434e12c229748afc7e89688e67c

Author: Ilia Mirkin <[email protected]>
Date:   Fri Apr  3 23:57:43 2015 -0400

nv50: allocate more offset space for occlusion queries

Commit 1a170980a09 started writing to q->data[4]/[5] but kept the
per-query space at 16, which meant that in some cases we would write
past the end of the buffer. Rotate by 32, like nvc0 does. This ensures
that we always have 32 bytes in front of us, and the data writes will go
within the allocated space.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89679
Signed-off-by: Ilia Mirkin <[email protected]>
Tested-by: Nick Tenney <[email protected]>
Reviewed-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Tobias Klausmann <[email protected]>
Cc: "10.4 10.5" <[email protected]>
(cherry picked from commit ba353935a392d2a43422f1d258456336b40b60ea)

---

 src/gallium/drivers/nouveau/nv50/nv50_query.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nv50/nv50_query.c 
b/src/gallium/drivers/nouveau/nv50/nv50_query.c
index e0671ce..c867bca 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_query.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_query.c
@@ -41,7 +41,7 @@ struct nv50_query {
    uint32_t sequence;
    struct nouveau_bo *bo;
    uint32_t base;
-   uint32_t offset; /* base + i * 16 */
+   uint32_t offset; /* base + i * 32 */
    boolean ready;
    boolean flushed;
    boolean is64bit;
@@ -116,8 +116,8 @@ nv50_query_create(struct pipe_context *pipe, unsigned type, 
unsigned index)
    q->type = type;
 
    if (q->type == PIPE_QUERY_OCCLUSION_COUNTER) {
-      q->offset -= 16;
-      q->data -= 16 / sizeof(*q->data); /* we advance before query_begin ! */
+      q->offset -= 32;
+      q->data -= 32 / sizeof(*q->data); /* we advance before query_begin ! */
    }
 
    return (struct pipe_query *)q;
@@ -150,8 +150,8 @@ nv50_query_begin(struct pipe_context *pipe, struct 
pipe_query *pq)
     * initialized it to TRUE.
     */
    if (q->type == PIPE_QUERY_OCCLUSION_COUNTER) {
-      q->offset += 16;
-      q->data += 16 / sizeof(*q->data);
+      q->offset += 32;
+      q->data += 32 / sizeof(*q->data);
       if (q->offset - q->base == NV50_QUERY_ALLOC_SPACE)
          nv50_query_allocate(nv50, q, NV50_QUERY_ALLOC_SPACE);
 

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to