Mesa (master): nv50,nvc0: fix push hint logic in presence of a start offset

Ilia Mirkin imirkin at kemper.freedesktop.org
Wed Oct 11 12:19:25 UTC 2017


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

Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date:   Tue Oct 10 23:50:06 2017 -0400

nv50,nvc0: fix push hint logic in presence of a start offset

Previously buffer offsets were passed in explicitly as an offset, which
had to be added to the resource address. Now they are passed in via an
increased 'start' parameter. As a result, we were double-adding the
start offset in this kind of situation.

This condition was triggered by piglit's draw-elements test which has a
requisite glMultiDrawElements in combination with a small enough number
of vertices to go through the immediate push path.

Fixes: 330d0607ed6 ("gallium: remove pipe_index_buffer and set_index_buffer")
Reported-by: Karol Herbst <karolherbst at gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Cc: mesa-stable at lists.freedesktop.org

---

 src/gallium/drivers/nouveau/nv50/nv50_push.c          | 3 +--
 src/gallium/drivers/nouveau/nvc0/nvc0_vbo_translate.c | 9 ++++-----
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nv50/nv50_push.c b/src/gallium/drivers/nouveau/nv50/nv50_push.c
index 9ee9a8eed1..bec2d42e03 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_push.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_push.c
@@ -279,8 +279,7 @@ nv50_push_vbo(struct nv50_context *nv50, const struct pipe_draw_info *info)
    if (info->index_size) {
       if (!info->has_user_indices) {
          ctx.idxbuf = nouveau_resource_map_offset(&nv50->base,
-            nv04_resource(info->index.resource), info->start * info->index_size,
-            NOUVEAU_BO_RD);
+            nv04_resource(info->index.resource), 0, NOUVEAU_BO_RD);
       } else {
          ctx.idxbuf = info->index.user;
       }
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_vbo_translate.c b/src/gallium/drivers/nouveau/nvc0/nvc0_vbo_translate.c
index f05618f659..256e20df2e 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_vbo_translate.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_vbo_translate.c
@@ -84,13 +84,12 @@ nvc0_vertex_configure_translate(struct nvc0_context *nvc0, int32_t index_bias)
 
 static inline void
 nvc0_push_map_idxbuf(struct push_context *ctx, struct nvc0_context *nvc0,
-                     const struct pipe_draw_info *info,
-                     unsigned offset)
+                     const struct pipe_draw_info *info)
 {
    if (!info->has_user_indices) {
       struct nv04_resource *buf = nv04_resource(info->index.resource);
-      ctx->idxbuf = nouveau_resource_map_offset(&nvc0->base,
-         buf, offset, NOUVEAU_BO_RD);
+      ctx->idxbuf = nouveau_resource_map_offset(
+            &nvc0->base, buf, 0, NOUVEAU_BO_RD);
    } else {
       ctx->idxbuf = info->index.user;
    }
@@ -509,7 +508,7 @@ nvc0_push_vbo(struct nvc0_context *nvc0, const struct pipe_draw_info *info)
    nvc0->state.prim_restart = info->primitive_restart;
 
    if (info->index_size) {
-      nvc0_push_map_idxbuf(&ctx, nvc0, info, info->start * info->index_size);
+      nvc0_push_map_idxbuf(&ctx, nvc0, info);
       index_size = info->index_size;
    } else {
       if (unlikely(info->count_from_stream_output)) {




More information about the mesa-commit mailing list