[Mesa-dev] [PATCH 1/7] nvc0: reduce the number of PUSH_SPACE in draw path

Samuel Pitoiset samuel.pitoiset at gmail.com
Tue Oct 25 19:41:10 UTC 2016


This might help CPU-bounds applications but should not have
any real effects for GPU-bounds ones.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c b/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c
index 69ca091..bc4ab9e 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c
@@ -598,8 +598,8 @@ nvc0_draw_arrays(struct nvc0_context *nvc0,
 
    prim = nvc0_prim_gl(mode);
 
+   PUSH_SPACE(push, 6 * instance_count);
    while (instance_count--) {
-      PUSH_SPACE(push, 6);
       BEGIN_NVC0(push, NVC0_3D(VERTEX_BEGIN_GL), 1);
       PUSH_DATA (push, prim);
       BEGIN_NVC0(push, NVC0_3D(VERTEX_BUFFER_FIRST), 2);
@@ -730,10 +730,9 @@ nvc0_draw_elements(struct nvc0_context *nvc0, bool shorten,
    }
 
    if (nvc0->idxbuf.buffer) {
-      PUSH_SPACE(push, 1);
+      PUSH_SPACE(push, 1 + 7 * instance_count);
       IMMED_NVC0(push, NVC0_3D(VERTEX_BEGIN_GL), prim);
       do {
-         PUSH_SPACE(push, 7);
          BEGIN_NVC0(push, NVC0_3D(INDEX_BATCH_FIRST), 2);
          PUSH_DATA (push, start);
          PUSH_DATA (push, count);
@@ -747,8 +746,8 @@ nvc0_draw_elements(struct nvc0_context *nvc0, bool shorten,
    } else {
       const void *data = nvc0->idxbuf.user_buffer;
 
+      PUSH_SPACE(push, 3 * instance_count);
       while (instance_count--) {
-         PUSH_SPACE(push, 2);
          BEGIN_NVC0(push, NVC0_3D(VERTEX_BEGIN_GL), 1);
          PUSH_DATA (push, prim);
          switch (index_size) {
@@ -768,7 +767,6 @@ nvc0_draw_elements(struct nvc0_context *nvc0, bool shorten,
             assert(0);
             return;
          }
-         PUSH_SPACE(push, 1);
          IMMED_NVC0(push, NVC0_3D(VERTEX_END_GL), 0);
 
          prim |= NVC0_3D_VERTEX_BEGIN_GL_INSTANCE_NEXT;
-- 
2.10.1



More information about the mesa-dev mailing list