Skip to contentSkip to conversation

nv30: avoid doing extra work on clear and hitting unexpected states

PATCH In review Ilia Mirkin 5 participants 9 messages May 24, 2015 7 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 nv30: avoid doing extra work on clear and hitting unexpected states

Clearing can happen at a time when various state objects are incoherent and not ready for a draw. Some of the validation functions don't handle this well, so only flush the framebuffer state. This has the advantage of also not doing extra work.

This works around some crashes that can happen when clearing.

---
 src/gallium/drivers/nouveau/nv30/nv30_clear.c          |  2 +-
 src/gallium/drivers/nouveau/nv30/nv30_context.h        |  2 +-
 src/gallium/drivers/nouveau/nv30/nv30_draw.c           |  4 ++--
 src/gallium/drivers/nouveau/nv30/nv30_state_validate.c | 10 ++++++----
 src/gallium/drivers/nouveau/nv30/nv30_vbo.c            |  2 +-
 5 files changed, 11 insertions(+), 9 deletions(-)
src/gallium/drivers/nouveau/nv30/nv30_clear.c +1 -1
index 1ab8929..83fd1fa 100644
@@ -58,7 +58,7 @@ nv30_clear(struct pipe_context *pipe, unsigned buffers,
    struct pipe_framebuffer_state *fb = &nv30->framebuffer;
    uint32_t colr = 0, zeta = 0, mode = 0;
 
-   if (!nv30_state_validate(nv30, TRUE))
+   if (!nv30_state_validate(nv30, NV30_NEW_FRAMEBUFFER | NV30_NEW_SCISSOR, TRUE))
       return;
 
    if (buffers & PIPE_CLEAR_COLOR && fb->nr_cbufs) {
src/gallium/drivers/nouveau/nv30/nv30_context.h +1 -1
index 7b32aae..592cdbe 100644
@@ -204,7 +204,7 @@ void
 nv30_render_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info);
 
 boolean
-nv30_state_validate(struct nv30_context *nv30, boolean hwtnl);
+nv30_state_validate(struct nv30_context *nv30, uint32_t mask, boolean hwtnl);
 
 void
 nv30_state_release(struct nv30_context *nv30);
src/gallium/drivers/nouveau/nv30/nv30_draw.c +2 -2
index 3575c3d..38c31e9 100644
@@ -129,7 +129,7 @@ nv30_render_draw_elements(struct vbuf_render *render,
                        NOUVEAU_BO_LOW | NOUVEAU_BO_RD, 0, 0);
    }
 
-   if (!nv30_state_validate(nv30, FALSE))
+   if (!nv30_state_validate(nv30, ~0, FALSE))
       return;
 
    BEGIN_NV04(push, NV30_3D(VERTEX_BEGIN_END), 1);
@@ -174,7 +174,7 @@ nv30_render_draw_arrays(struct vbuf_render *render, unsigned start, uint nr)
                        NOUVEAU_BO_LOW | NOUVEAU_BO_RD, 0, 0);
    }
 
-   if (!nv30_state_validate(nv30, FALSE))
+   if (!nv30_state_validate(nv30, ~0, FALSE))
       return;
 
    BEGIN_NV04(push, NV30_3D(VERTEX_BEGIN_END), 1);
src/gallium/drivers/nouveau/nv30/nv30_state_validate.c +6 -4
index 0f9d19d..86ac4f7 100644
@@ -456,7 +456,7 @@ nv30_state_context_switch(struct nv30_context *nv30)
 }
 
 boolean
-nv30_state_validate(struct nv30_context *nv30, boolean hwtnl)
+nv30_state_validate(struct nv30_context *nv30, uint32_t mask, boolean hwtnl)
 {
    struct nouveau_screen *screen = &nv30->screen->base;
    struct nouveau_pushbuf *push = nv30->base.pushbuf;
@@ -481,14 +481,16 @@ nv30_state_validate(struct nv30_context *nv30, boolean hwtnl)
    else
       validate = swtnl_validate_list;
 
-   if (nv30->dirty) {
+   mask &= nv30->dirty;
+
+   if (mask) {
       while (validate->func) {
-         if (nv30->dirty & validate->mask)
+         if (mask & validate->mask)
             validate->func(nv30);
          validate++;
       }
 
-      nv30->dirty = 0;
+      nv30->dirty &= ~mask;
    }
 
    nouveau_pushbuf_bufctx(push, bctx);
src/gallium/drivers/nouveau/nv30/nv30_vbo.c +1 -1
index 67ab829..d4e384b 100644
@@ -564,7 +564,7 @@ nv30_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
    if (nv30->vbo_user && !(nv30->dirty & (NV30_NEW_VERTEX | NV30_NEW_ARRAYS)))
       nv30_update_user_vbufs(nv30);
 
-   nv30_state_validate(nv30, TRUE);
+   nv30_state_validate(nv30, ~0, TRUE);
    if (nv30->draw_flags) {
       nv30_render_vbo(pipe, info);
       return;
Signature · 6 lines
2.3.6

_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev
#1 lore raw

PATCH 2/2 nv30: fix clip plane uploads and enable changes

nv30_validate_clip depends on the rasterizer state. Also we should upload all the new clip planes on change since next time the plane data won't have changed, but the enables might.

---
 src/gallium/drivers/nouveau/nv30/nv30_state_validate.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
src/gallium/drivers/nouveau/nv30/nv30_state_validate.c +7 -9
index 86ac4f7..a954dcc 100644
@@ -272,15 +272,13 @@ nv30_validate_clip(struct nv30_context *nv30)
    uint32_t clpd_enable = 0;
 
    for (i = 0; i < 6; i++) {
-      if (nv30->rast->pipe.clip_plane_enable & (1 << i)) {
-         if (nv30->dirty & NV30_NEW_CLIP) {
-            BEGIN_NV04(push, NV30_3D(VP_UPLOAD_CONST_ID), 5);
-            PUSH_DATA (push, i);
-            PUSH_DATAp(push, nv30->clip.ucp[i], 4);
-         }
-
-         clpd_enable |= 1 << (1 + 4*i);
+      if (nv30->dirty & NV30_NEW_CLIP) {
+         BEGIN_NV04(push, NV30_3D(VP_UPLOAD_CONST_ID), 5);
+         PUSH_DATA (push, i);
+         PUSH_DATAp(push, nv30->clip.ucp[i], 4);
       }
+      if (nv30->rast->pipe.clip_plane_enable & (1 << i))
+         clpd_enable |= 2 << (4*i);
    }
 
    BEGIN_NV04(push, NV30_3D(VP_CLIP_PLANES_ENABLE), 1);
@@ -389,7 +387,7 @@ static struct state_validate hwtnl_validate_list[] = {
     { nv30_validate_stipple,       NV30_NEW_STIPPLE },
     { nv30_validate_scissor,       NV30_NEW_SCISSOR | NV30_NEW_RASTERIZER },
     { nv30_validate_viewport,      NV30_NEW_VIEWPORT },
-    { nv30_validate_clip,          NV30_NEW_CLIP },
+    { nv30_validate_clip,          NV30_NEW_CLIP | NV30_NEW_RASTERIZER },
     { nv30_fragprog_validate,      NV30_NEW_FRAGPROG | NV30_NEW_FRAGCONST },
     { nv30_vertprog_validate,      NV30_NEW_VERTPROG | NV30_NEW_VERTCONST |
                                    NV30_NEW_FRAGPROG | NV30_NEW_RASTERIZER },
Signature · 6 lines
2.3.6

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

A message that is not in the archive (sent off-list or not yet received): 1432443489-1067-2-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/[email protected]

#3 lore raw

Re: [Mesa-dev] [PATCH 2/2] nv30: fix clip plane uploads and enable changes

Quoted 22 lines · Ilia Mirkin

nv30_validate_clip depends on the rasterizer state. Also we should upload all the new clip planes on change since next time the plane data won't have changed, but the enables might.

---
  src/gallium/drivers/nouveau/nv30/nv30_state_validate.c | 16 +++++++---------
  1 file changed, 7 insertions(+), 9 deletions(-)
src/gallium/drivers/nouveau/nv30/nv30_state_validate.c +0 -5
index 86ac4f7..a954dcc 100644
@@ -272,15 +272,13 @@ nv30_validate_clip(struct nv30_context *nv30)
     uint32_t clpd_enable = 0;
 
     for (i = 0; i < 6; i++) {
-      if (nv30->rast->pipe.clip_plane_enable & (1 << i)) {
-         if (nv30->dirty & NV30_NEW_CLIP) {
-            BEGIN_NV04(push, NV30_3D(VP_UPLOAD_CONST_ID), 5);
-            PUSH_DATA (push, i);
-            PUSH_DATAp(push, nv30->clip.ucp[i], 4);

src/gallium/drivers/nouveau/nv30/nv30_state_validate.c nv30_validate_clip(struct nv30_context *nv30) · line 281

Quoted 10 lines
src/gallium/drivers/nouveau/nv30/nv30_state_validate.c +6 -3
-         }
-
-         clpd_enable |= 1 << (1 + 4*i);
+      if (nv30->dirty & NV30_NEW_CLIP) {
+         BEGIN_NV04(push, NV30_3D(VP_UPLOAD_CONST_ID), 5);
+         PUSH_DATA (push, i);
+         PUSH_DATAp(push, nv30->clip.ucp[i], 4);
        }
+      if (nv30->rast->pipe.clip_plane_enable & (1 << i))
+         clpd_enable |= 2 << (4*i);

Can you explain why did you change this line?

src/gallium/drivers/nouveau/nv30/nv30_state_validate.c static struct state_validate hwtnl_validate_list[] = { · line 393

Quoted 12 lines
src/gallium/drivers/nouveau/nv30/nv30_state_validate.c +1 -1
     }
 
     BEGIN_NV04(push, NV30_3D(VP_CLIP_PLANES_ENABLE), 1);
@@ -389,7 +387,7 @@ static struct state_validate hwtnl_validate_list[] = {
      { nv30_validate_stipple,       NV30_NEW_STIPPLE },
      { nv30_validate_scissor,       NV30_NEW_SCISSOR | NV30_NEW_RASTERIZER },
      { nv30_validate_viewport,      NV30_NEW_VIEWPORT },
-    { nv30_validate_clip,          NV30_NEW_CLIP },
+    { nv30_validate_clip,          NV30_NEW_CLIP | NV30_NEW_RASTERIZER },
      { nv30_fragprog_validate,      NV30_NEW_FRAGPROG | NV30_NEW_FRAGCONST },
      { nv30_vertprog_validate,      NV30_NEW_VERTPROG | NV30_NEW_VERTCONST |
                                     NV30_NEW_FRAGPROG | NV30_NEW_RASTERIZER },

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw

Re: [Mesa-dev] [PATCH 2/2] nv30: fix clip plane uploads and enable changes

Quoted 29 lines · Samuel Pitoiset
Quoted 26 lines · Ilia Mirkin

nv30_validate_clip depends on the rasterizer state. Also we should upload all the new clip planes on change since next time the plane data won't have changed, but the enables might.

---
  src/gallium/drivers/nouveau/nv30/nv30_state_validate.c | 16 
+++++++---------
  1 file changed, 7 insertions(+), 9 deletions(-)
src/gallium/drivers/nouveau/nv30/nv30_state_validate.c +1 -8
index 86ac4f7..a954dcc 100644
@@ -272,15 +272,13 @@ nv30_validate_clip(struct nv30_context *nv30)
     uint32_t clpd_enable = 0;
       for (i = 0; i < 6; i++) {
-      if (nv30->rast->pipe.clip_plane_enable & (1 << i)) {
-         if (nv30->dirty & NV30_NEW_CLIP) {
-            BEGIN_NV04(push, NV30_3D(VP_UPLOAD_CONST_ID), 5);
-            PUSH_DATA (push, i);
-            PUSH_DATAp(push, nv30->clip.ucp[i], 4);
-         }
-
-         clpd_enable |= 1 << (1 + 4*i);
+      if (nv30->dirty & NV30_NEW_CLIP) {
Quoted 8 lines

src/gallium/drivers/nouveau/nv30/nv30_state_validate.c nv30_validate_clip(struct nv30_context *nv30) · line 281

Quoted 6 lines
src/gallium/drivers/nouveau/nv30/nv30_state_validate.c +5 -0
+         BEGIN_NV04(push, NV30_3D(VP_UPLOAD_CONST_ID), 5);
+         PUSH_DATA (push, i);
+         PUSH_DATAp(push, nv30->clip.ucp[i], 4);
        }
+      if (nv30->rast->pipe.clip_plane_enable & (1 << i))
+         clpd_enable |= 2 << (4*i);

Can you explain why did you change this line?

This does bother me as well :)

Quoted 15 lines
Quoted 15 lines
src/gallium/drivers/nouveau/nv30/nv30_state_validate.c +1 -1
     }
       BEGIN_NV04(push, NV30_3D(VP_CLIP_PLANES_ENABLE), 1);
@@ -389,7 +387,7 @@ static struct state_validate 
 hwtnl_validate_list[] = {
      { nv30_validate_stipple,       NV30_NEW_STIPPLE },
      { nv30_validate_scissor,       NV30_NEW_SCISSOR | 
 NV30_NEW_RASTERIZER },
      { nv30_validate_viewport,      NV30_NEW_VIEWPORT },
-    { nv30_validate_clip,          NV30_NEW_CLIP },
+    { nv30_validate_clip,          NV30_NEW_CLIP | 
 NV30_NEW_RASTERIZER },

{ nv30_fragprog_validate, NV30_NEW_FRAGPROG |
NV30_NEW_FRAGCONST },
{ nv30_vertprog_validate, NV30_NEW_VERTPROG |

Quoted 8 lines
Quoted 3 lines

NV30_NEW_VERTCONST |

                                     NV30_NEW_FRAGPROG | 

NV30_NEW_RASTERIZER },

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw

Re: [Mesa-dev] [PATCH 2/2] nv30: fix clip plane uploads and enable changes

Quoted 43 lines · Tobias Klausmann
Quoted 28 lines · Samuel Pitoiset
Quoted 25 lines · Ilia Mirkin

nv30_validate_clip depends on the rasterizer state. Also we should upload all the new clip planes on change since next time the plane data won't have changed, but the enables might.

---
 src/gallium/drivers/nouveau/nv30/nv30_state_validate.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
src/gallium/drivers/nouveau/nv30/nv30_state_validate.c +1 -8
index 86ac4f7..a954dcc 100644
@@ -272,15 +272,13 @@ nv30_validate_clip(struct nv30_context *nv30)
    uint32_t clpd_enable = 0;
      for (i = 0; i < 6; i++) {
-      if (nv30->rast->pipe.clip_plane_enable & (1 << i)) {
-         if (nv30->dirty & NV30_NEW_CLIP) {
-            BEGIN_NV04(push, NV30_3D(VP_UPLOAD_CONST_ID), 5);
-            PUSH_DATA (push, i);
-            PUSH_DATAp(push, nv30->clip.ucp[i], 4);
-         }
-
-         clpd_enable |= 1 << (1 + 4*i);
+      if (nv30->dirty & NV30_NEW_CLIP) {
Quoted 8 lines

src/gallium/drivers/nouveau/nv30/nv30_state_validate.c nv30_validate_clip(struct nv30_context *nv30) · line 281

Quoted 6 lines
src/gallium/drivers/nouveau/nv30/nv30_state_validate.c +5 -0
+         BEGIN_NV04(push, NV30_3D(VP_UPLOAD_CONST_ID), 5);
+         PUSH_DATA (push, i);
+         PUSH_DATAp(push, nv30->clip.ucp[i], 4);
       }
+      if (nv30->rast->pipe.clip_plane_enable & (1 << i))
+         clpd_enable |= 2 << (4*i);

Can you explain why did you change this line?

Quoted 1 line

This does bother me as well :)

It should be the same as before but using one less addition: shifting 1 by 5 or 2 by 4 is similar.

Quoted 20 lines
Quoted 19 lines
Quoted 6 lines
src/gallium/drivers/nouveau/nv30/nv30_state_validate.c +0 -0
    }
      BEGIN_NV04(push, NV30_3D(VP_CLIP_PLANES_ENABLE), 1);

src/gallium/drivers/nouveau/nv30/nv30_state_validate.c static struct state_validate hwtnl_validate_list[] = { · line 393

Quoted 8 lines
src/gallium/drivers/nouveau/nv30/nv30_state_validate.c +1 -1
@@ -389,7 +387,7 @@ static struct state_validate hwtnl_validate_list[] = {
     { nv30_validate_stipple,       NV30_NEW_STIPPLE },
     { nv30_validate_scissor,       NV30_NEW_SCISSOR | NV30_NEW_RASTERIZER },
     { nv30_validate_viewport,      NV30_NEW_VIEWPORT },
-    { nv30_validate_clip,          NV30_NEW_CLIP },
+    { nv30_validate_clip,          NV30_NEW_CLIP | NV30_NEW_RASTERIZER },
     { nv30_fragprog_validate,      NV30_NEW_FRAGPROG | NV30_NEW_FRAGCONST },
     { nv30_vertprog_validate,      NV30_NEW_VERTPROG | NV30_NEW_VERTCONST |
                                    NV30_NEW_FRAGPROG | NV30_NEW_RASTERIZER },

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

Quoted 4 lines

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): ED051C04-3BF9-4299-AF71-AAED9DE8DF9B-GANU6spQydw@public.gmane.org

Reviewed-by
#9 lore raw

Re: [Mesa-dev] [PATCH 2/2] nv30: fix clip plane uploads and enable changes

Quoted 39 lines · Pierre Moreau
Quoted 39 lines · Tobias Klausmann
Quoted 34 lines · Samuel Pitoiset
Quoted 21 lines · Ilia Mirkin

nv30_validate_clip depends on the rasterizer state. Also we should upload all the new clip planes on change since next time the plane data won't have changed, but the enables might.

---
  src/gallium/drivers/nouveau/nv30/nv30_state_validate.c | 16 +++++++---------
  1 file changed, 7 insertions(+), 9 deletions(-)
src/gallium/drivers/nouveau/nv30/nv30_state_validate.c +0 -5
index 86ac4f7..a954dcc 100644
@@ -272,15 +272,13 @@ nv30_validate_clip(struct nv30_context *nv30)
     uint32_t clpd_enable = 0;
       for (i = 0; i < 6; i++) {
-      if (nv30->rast->pipe.clip_plane_enable & (1 << i)) {
-         if (nv30->dirty & NV30_NEW_CLIP) {
-            BEGIN_NV04(push, NV30_3D(VP_UPLOAD_CONST_ID), 5);
-            PUSH_DATA (push, i);
-            PUSH_DATAp(push, nv30->clip.ucp[i], 4);

src/gallium/drivers/nouveau/nv30/nv30_state_validate.c nv30_validate_clip(struct nv30_context *nv30) · line 280

Quoted 10 lines
src/gallium/drivers/nouveau/nv30/nv30_state_validate.c +6 -3
-         }
-
-         clpd_enable |= 1 << (1 + 4*i);
+      if (nv30->dirty & NV30_NEW_CLIP) {
+         BEGIN_NV04(push, NV30_3D(VP_UPLOAD_CONST_ID), 5);
+         PUSH_DATA (push, i);
+         PUSH_DATAp(push, nv30->clip.ucp[i], 4);
        }
+      if (nv30->rast->pipe.clip_plane_enable & (1 << i))
+         clpd_enable |= 2 << (4*i);

Can you explain why did you change this line?

Quoted 2 lines
Quoted 1 line

This does bother me as well :)

It should be the same as before but using one less addition: shifting 1 by 5 or 2 by 4 is similar.

*dang* you are right. maybe we should change those lines along in nv50 and nvc0, save the additional addition :-)

With this sorted out, series is:

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines

src/gallium/drivers/nouveau/nv30/nv30_state_validate.c static struct state_validate hwtnl_validate_list[] = { · line 393

Quoted 13 lines
src/gallium/drivers/nouveau/nv30/nv30_state_validate.c +1 -1
     }
       BEGIN_NV04(push, NV30_3D(VP_CLIP_PLANES_ENABLE), 1);
@@ -389,7 +387,7 @@ static struct state_validate hwtnl_validate_list[] = {
      { nv30_validate_stipple,       NV30_NEW_STIPPLE },
      { nv30_validate_scissor,       NV30_NEW_SCISSOR | NV30_NEW_RASTERIZER },
      { nv30_validate_viewport,      NV30_NEW_VIEWPORT },
-    { nv30_validate_clip,          NV30_NEW_CLIP },
+    { nv30_validate_clip,          NV30_NEW_CLIP | NV30_NEW_RASTERIZER },
      { nv30_fragprog_validate,      NV30_NEW_FRAGPROG | NV30_NEW_FRAGCONST },
      { nv30_vertprog_validate,      NV30_NEW_VERTPROG | NV30_NEW_VERTCONST |
                                     NV30_NEW_FRAGPROG | NV30_NEW_RASTERIZER },

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

Quoted 4 lines
Quoted 4 lines

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): [email protected]

#11 lore raw

Re: [Mesa-dev] [PATCH 2/2] nv30: fix clip plane uploads and enable changes

Quoted 50 lines · Tobias Klausmann
Quoted 47 lines · Pierre Moreau
Quoted 47 lines

On 24 May 2015, at 16:03, Tobias Klausmann
<[email protected]> wrote:

Quoted 39 lines · Samuel Pitoiset
Quoted 24 lines · Ilia Mirkin

nv30_validate_clip depends on the rasterizer state. Also we should upload all the new clip planes on change since next time the plane data won't have changed, but the enables might.

---
  src/gallium/drivers/nouveau/nv30/nv30_state_validate.c | 16
+++++++---------
  1 file changed, 7 insertions(+), 9 deletions(-)
src/gallium/drivers/nouveau/nv30/nv30_state_validate.c +0 -5
index 86ac4f7..a954dcc 100644
@@ -272,15 +272,13 @@ nv30_validate_clip(struct nv30_context *nv30)
     uint32_t clpd_enable = 0;
       for (i = 0; i < 6; i++) {
-      if (nv30->rast->pipe.clip_plane_enable & (1 << i)) {
-         if (nv30->dirty & NV30_NEW_CLIP) {
-            BEGIN_NV04(push, NV30_3D(VP_UPLOAD_CONST_ID), 5);
-            PUSH_DATA (push, i);
-            PUSH_DATAp(push, nv30->clip.ucp[i], 4);

src/gallium/drivers/nouveau/nv30/nv30_state_validate.c nv30_validate_clip(struct nv30_context *nv30) · line 280

Quoted 10 lines
src/gallium/drivers/nouveau/nv30/nv30_state_validate.c +6 -3
-         }
-
-         clpd_enable |= 1 << (1 + 4*i);
+      if (nv30->dirty & NV30_NEW_CLIP) {
+         BEGIN_NV04(push, NV30_3D(VP_UPLOAD_CONST_ID), 5);
+         PUSH_DATA (push, i);
+         PUSH_DATAp(push, nv30->clip.ucp[i], 4);
        }
+      if (nv30->rast->pipe.clip_plane_enable & (1 << i))
+         clpd_enable |= 2 << (4*i);

Can you explain why did you change this line?

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

This does bother me as well :)

It should be the same as before but using one less addition: shifting 1 by 5 or 2 by 4 is similar.

*dang* you are right. maybe we should change those lines along in nv50 and nvc0, save the additional addition :-)

What lines?

Quoted 2 lines

With this sorted out, series is:

Not sure what you mean here... what do you want me to sort out? The 2 back into a +1? I was just looking at the defines like

#define NV30_3D_VP_CLIP_PLANES_ENABLE_PLANE1 0x00000020

and the 2 << 4i seemed more obviously correct. Although they're obviously identical.

Quoted 35 lines
Quoted 29 lines
Quoted 29 lines
Quoted 16 lines
Quoted 16 lines
src/gallium/drivers/nouveau/nv30/nv30_state_validate.c +1 -1
     }
       BEGIN_NV04(push, NV30_3D(VP_CLIP_PLANES_ENABLE), 1);
@@ -389,7 +387,7 @@ static struct state_validate hwtnl_validate_list[]
 = {
      { nv30_validate_stipple,       NV30_NEW_STIPPLE },
      { nv30_validate_scissor,       NV30_NEW_SCISSOR |
 NV30_NEW_RASTERIZER },
      { nv30_validate_viewport,      NV30_NEW_VIEWPORT },
-    { nv30_validate_clip,          NV30_NEW_CLIP },
+    { nv30_validate_clip,          NV30_NEW_CLIP | NV30_NEW_RASTERIZER
 },

{ nv30_fragprog_validate, NV30_NEW_FRAGPROG |
NV30_NEW_FRAGCONST },
{ nv30_vertprog_validate, NV30_NEW_VERTPROG |

Quoted 8 lines
Quoted 3 lines

NV30_NEW_VERTCONST |

                                     NV30_NEW_FRAGPROG |

NV30_NEW_RASTERIZER },

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): CAKb7Uvhkt7OGxbE3hkEkxUMgH7LkmJsa73xp5AxLYc8PN=9e3g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#13 lore raw

Re: [Mesa-dev] [PATCH 2/2] nv30: fix clip plane uploads and enable changes

Quoted 50 lines · Ilia Mirkin
Quoted 48 lines · Tobias Klausmann
Quoted 45 lines · Pierre Moreau
Quoted 42 lines

On 24 May 2015, at 16:03, Tobias Klausmann
<[email protected]> wrote:

Quoted 28 lines · Samuel Pitoiset
Quoted 26 lines · Ilia Mirkin

nv30_validate_clip depends on the rasterizer state. Also we should upload all the new clip planes on change since next time the plane data won't have changed, but the enables might.

---
   src/gallium/drivers/nouveau/nv30/nv30_state_validate.c | 16
+++++++---------
   1 file changed, 7 insertions(+), 9 deletions(-)
src/gallium/drivers/nouveau/nv30/nv30_state_validate.c +0 -8
index 86ac4f7..a954dcc 100644
@@ -272,15 +272,13 @@ nv30_validate_clip(struct nv30_context *nv30)
      uint32_t clpd_enable = 0;
        for (i = 0; i < 6; i++) {
-      if (nv30->rast->pipe.clip_plane_enable & (1 << i)) {
-         if (nv30->dirty & NV30_NEW_CLIP) {
-            BEGIN_NV04(push, NV30_3D(VP_UPLOAD_CONST_ID), 5);
-            PUSH_DATA (push, i);
-            PUSH_DATAp(push, nv30->clip.ucp[i], 4);
-         }
-
-         clpd_enable |= 1 << (1 + 4*i);
Quoted 8 lines

src/gallium/drivers/nouveau/nv30/nv30_state_validate.c nv30_validate_clip(struct nv30_context *nv30) · line 280

Quoted 7 lines
src/gallium/drivers/nouveau/nv30/nv30_state_validate.c +6 -0
+      if (nv30->dirty & NV30_NEW_CLIP) {
+         BEGIN_NV04(push, NV30_3D(VP_UPLOAD_CONST_ID), 5);
+         PUSH_DATA (push, i);
+         PUSH_DATAp(push, nv30->clip.ucp[i], 4);
         }
+      if (nv30->rast->pipe.clip_plane_enable & (1 << i))
+         clpd_enable |= 2 << (4*i);

Can you explain why did you change this line?

Quoted 1 line

This does bother me as well :)

It should be the same as before but using one less addition: shifting 1 by 5 or 2 by 4 is similar.

Quoted 7 lines
Quoted 2 lines

*dang* you are right. maybe we should change those lines along in nv50 and nvc0, save the additional addition :-)

What lines?

Quoted 1 line

With this sorted out, series is:

Not sure what you mean here... what do you want me to sort out? The 2 back into a +1? I was just looking at the defines like

Nah, i meant that it _is_ allright the way you did it and that we should change similar lines for clip in nv50/nvc0 the way you did here

Quoted 35 lines

#define NV30_3D_VP_CLIP_PLANES_ENABLE_PLANE1 0x00000020

and the 2 << 4i seemed more obviously correct. Although they're obviously identical.

Quoted 29 lines
Quoted 25 lines
Quoted 25 lines
Quoted 13 lines
Quoted 13 lines
src/gallium/drivers/nouveau/nv30/nv30_state_validate.c +1 -1
      }
        BEGIN_NV04(push, NV30_3D(VP_CLIP_PLANES_ENABLE), 1);
@@ -389,7 +387,7 @@ static struct state_validate hwtnl_validate_list[]
 = {
       { nv30_validate_stipple,       NV30_NEW_STIPPLE },
       { nv30_validate_scissor,       NV30_NEW_SCISSOR |
 NV30_NEW_RASTERIZER },
       { nv30_validate_viewport,      NV30_NEW_VIEWPORT },
-    { nv30_validate_clip,          NV30_NEW_CLIP },
+    { nv30_validate_clip,          NV30_NEW_CLIP | NV30_NEW_RASTERIZER
 },

{ nv30_fragprog_validate, NV30_NEW_FRAGPROG |
NV30_NEW_FRAGCONST },

Quoted 8 lines
Quoted 4 lines

{ nv30_vertprog_validate, NV30_NEW_VERTPROG |
NV30_NEW_VERTCONST |

                                      NV30_NEW_FRAGPROG |

NV30_NEW_RASTERIZER },

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): [email protected]

#15 lore raw

Re: [Mesa-dev] [PATCH 2/2] nv30: fix clip plane uploads and enable changes

Quoted 70 lines · Tobias Klausmann
Quoted 67 lines · Ilia Mirkin
Quoted 53 lines · Tobias Klausmann
Quoted 50 lines · Pierre Moreau
Quoted 49 lines

On 24 May 2015, at 16:03, Tobias Klausmann
<[email protected]> wrote:

Quoted 32 lines · Samuel Pitoiset
Quoted 29 lines · Ilia Mirkin

nv30_validate_clip depends on the rasterizer state. Also we should upload all the new clip planes on change since next time the plane data
won't have changed, but the enables might.

---
   src/gallium/drivers/nouveau/nv30/nv30_state_validate.c | 16
+++++++---------
   1 file changed, 7 insertions(+), 9 deletions(-)
src/gallium/drivers/nouveau/nv30/nv30_state_validate.c +1 -8
index 86ac4f7..a954dcc 100644
@@ -272,15 +272,13 @@ nv30_validate_clip(struct nv30_context *nv30)
      uint32_t clpd_enable = 0;
        for (i = 0; i < 6; i++) {
-      if (nv30->rast->pipe.clip_plane_enable & (1 << i)) {
-         if (nv30->dirty & NV30_NEW_CLIP) {
-            BEGIN_NV04(push, NV30_3D(VP_UPLOAD_CONST_ID), 5);
-            PUSH_DATA (push, i);
-            PUSH_DATAp(push, nv30->clip.ucp[i], 4);
-         }
-
-         clpd_enable |= 1 << (1 + 4*i);
+      if (nv30->dirty & NV30_NEW_CLIP) {
Quoted 8 lines

src/gallium/drivers/nouveau/nv30/nv30_state_validate.c nv30_validate_clip(struct nv30_context *nv30) · line 280

Quoted 6 lines
src/gallium/drivers/nouveau/nv30/nv30_state_validate.c +5 -0
+         BEGIN_NV04(push, NV30_3D(VP_UPLOAD_CONST_ID), 5);
+         PUSH_DATA (push, i);
+         PUSH_DATAp(push, nv30->clip.ucp[i], 4);
         }
+      if (nv30->rast->pipe.clip_plane_enable & (1 << i))
+         clpd_enable |= 2 << (4*i);

Can you explain why did you change this line?

This does bother me as well :)

Quoted 8 lines
Quoted 3 lines

It should be the same as before but using one less addition: shifting 1 by
5 or 2 by 4 is similar.

*dang* you are right. maybe we should change those lines along in nv50 and
nvc0, save the additional addition :-)

What lines?

Quoted 9 lines
Quoted 4 lines
Quoted 1 line

With this sorted out, series is:

Not sure what you mean here... what do you want me to sort out? The 2 back into a +1? I was just looking at the defines like

Nah, i meant that it _is_ allright the way you did it and that we should change similar lines for clip in nv50/nvc0 the way you did here

Ah OK. I'll push this out shortly. I'm not sure what lines in nv50/nvc0 you're referring to...

nvc0:

   if (nvc0->state.clip_enable != clip_enable) {
      nvc0->state.clip_enable = clip_enable;
      IMMED_NVC0(push, NVC0_3D(CLIP_DISTANCE_ENABLE), clip_enable);
   }

nv50:

   clip_enable = nv50->rast->pipe.clip_plane_enable;

BEGIN_NV04(push, NV50_3D(CLIP_DISTANCE_ENABLE), 1); PUSH_DATA (push, clip_enable);
_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau