* [PATCH] nv50: avoid using inline vertex data submit when gl_VertexID is used
@ 2015-08-24 15:51 Ilia Mirkin
[not found] ` <1440431513-29568-1-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Ilia Mirkin @ 2015-08-24 15:51 UTC (permalink / raw)
To: mesa-dev; +Cc: nouveau, 11.0
The hardware only generates vertexid when vertices come from a VBO. This
fixes:
vertexid-drawelements
vertexid-drawarrays
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0" <mesa-stable@lists.freedesktop.org>
---
src/gallium/drivers/nouveau/nv50/nv50_program.c | 1 +
src/gallium/drivers/nouveau/nv50/nv50_program.h | 1 +
src/gallium/drivers/nouveau/nv50/nv50_state_validate.c | 3 ++-
src/gallium/drivers/nouveau/nv50/nv50_vbo.c | 8 ++++++++
4 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_program.c b/src/gallium/drivers/nouveau/nv50/nv50_program.c
index 02dc367..eff4477 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_program.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_program.c
@@ -66,6 +66,7 @@ nv50_vertprog_assign_slots(struct nv50_ir_prog_info *info)
case TGSI_SEMANTIC_VERTEXID:
prog->vp.attrs[2] |= NV50_3D_VP_GP_BUILTIN_ATTR_EN_VERTEX_ID;
prog->vp.attrs[2] |= NV50_3D_VP_GP_BUILTIN_ATTR_EN_VERTEX_ID_DRAW_ARRAYS_ADD_START;
+ prog->vp.vertexid = 1;
continue;
default:
break;
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_program.h b/src/gallium/drivers/nouveau/nv50/nv50_program.h
index 5d3ff56..f4e8e94 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_program.h
+++ b/src/gallium/drivers/nouveau/nv50/nv50_program.h
@@ -76,6 +76,7 @@ struct nv50_program {
ubyte psiz; /* output slot of point size */
ubyte bfc[2]; /* indices into varying for FFC (FP) or BFC (VP) */
ubyte edgeflag;
+ ubyte vertexid;
ubyte clpd[2]; /* output slot of clip distance[i]'s 1st component */
ubyte clpd_nr;
} vp;
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c b/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
index b304a17..66dcf43 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
@@ -503,7 +503,8 @@ static struct state_validate {
{ nv50_validate_samplers, NV50_NEW_SAMPLERS },
{ nv50_stream_output_validate, NV50_NEW_STRMOUT |
NV50_NEW_VERTPROG | NV50_NEW_GMTYPROG },
- { nv50_vertex_arrays_validate, NV50_NEW_VERTEX | NV50_NEW_ARRAYS },
+ { nv50_vertex_arrays_validate, NV50_NEW_VERTEX | NV50_NEW_ARRAYS |
+ NV50_NEW_VERTPROG },
{ nv50_validate_min_samples, NV50_NEW_MIN_SAMPLES },
};
#define validate_list_len (sizeof(validate_list) / sizeof(validate_list[0]))
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_vbo.c b/src/gallium/drivers/nouveau/nv50/nv50_vbo.c
index 600b973..fb4305f 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_vbo.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_vbo.c
@@ -301,6 +301,14 @@ nv50_vertex_arrays_validate(struct nv50_context *nv50)
unsigned i;
const unsigned n = MAX2(vertex->num_elements, nv50->state.num_vtxelts);
+ /* A vertexid is not generated for inline data uploads. Have to use a
+ * VBO. This check must come after the vertprog has been validated,
+ * otherwise vertexid may be unset.
+ */
+ assert(nv50->vertprog->translated);
+ if (nv50->vertprog->vp.vertexid)
+ nv50->vbo_push_hint = 0;
+
if (unlikely(vertex->need_conversion))
nv50->vbo_fifo = ~0;
else
--
2.4.6
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] nv50: avoid using inline vertex data submit when gl_VertexID is used
[not found] ` <1440431513-29568-1-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
@ 2015-08-24 15:57 ` Tobias Klausmann
2015-08-24 16:19 ` [Nouveau] " Ilia Mirkin
2015-08-24 20:07 ` [Mesa-dev] " Samuel Pitoiset
1 sibling, 1 reply; 6+ messages in thread
From: Tobias Klausmann @ 2015-08-24 15:57 UTC (permalink / raw)
To: Ilia Mirkin
Cc: mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
On 24.08.2015 17:51, Ilia Mirkin wrote:
> The hardware only generates vertexid when vertices come from a VBO. This
> fixes:
>
> vertexid-drawelements
> vertexid-drawarrays
>
> Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
> Cc: "11.0" <mesa-stable@lists.freedesktop.org>
> ---
> src/gallium/drivers/nouveau/nv50/nv50_program.c | 1 +
> src/gallium/drivers/nouveau/nv50/nv50_program.h | 1 +
> src/gallium/drivers/nouveau/nv50/nv50_state_validate.c | 3 ++-
> src/gallium/drivers/nouveau/nv50/nv50_vbo.c | 8 ++++++++
> 4 files changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_program.c b/src/gallium/drivers/nouveau/nv50/nv50_program.c
> index 02dc367..eff4477 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_program.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_program.c
> @@ -66,6 +66,7 @@ nv50_vertprog_assign_slots(struct nv50_ir_prog_info *info)
> case TGSI_SEMANTIC_VERTEXID:
> prog->vp.attrs[2] |= NV50_3D_VP_GP_BUILTIN_ATTR_EN_VERTEX_ID;
> prog->vp.attrs[2] |= NV50_3D_VP_GP_BUILTIN_ATTR_EN_VERTEX_ID_DRAW_ARRAYS_ADD_START;
> + prog->vp.vertexid = 1;
> continue;
> default:
> break;
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_program.h b/src/gallium/drivers/nouveau/nv50/nv50_program.h
> index 5d3ff56..f4e8e94 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_program.h
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_program.h
> @@ -76,6 +76,7 @@ struct nv50_program {
> ubyte psiz; /* output slot of point size */
> ubyte bfc[2]; /* indices into varying for FFC (FP) or BFC (VP) */
> ubyte edgeflag;
> + ubyte vertexid;
> ubyte clpd[2]; /* output slot of clip distance[i]'s 1st component */
> ubyte clpd_nr;
> } vp;
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c b/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
> index b304a17..66dcf43 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
> @@ -503,7 +503,8 @@ static struct state_validate {
> { nv50_validate_samplers, NV50_NEW_SAMPLERS },
> { nv50_stream_output_validate, NV50_NEW_STRMOUT |
> NV50_NEW_VERTPROG | NV50_NEW_GMTYPROG },
> - { nv50_vertex_arrays_validate, NV50_NEW_VERTEX | NV50_NEW_ARRAYS },
> + { nv50_vertex_arrays_validate, NV50_NEW_VERTEX | NV50_NEW_ARRAYS |
> + NV50_NEW_VERTPROG },
> { nv50_validate_min_samples, NV50_NEW_MIN_SAMPLES },
> };
> #define validate_list_len (sizeof(validate_list) / sizeof(validate_list[0]))
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_vbo.c b/src/gallium/drivers/nouveau/nv50/nv50_vbo.c
> index 600b973..fb4305f 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_vbo.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_vbo.c
> @@ -301,6 +301,14 @@ nv50_vertex_arrays_validate(struct nv50_context *nv50)
> unsigned i;
> const unsigned n = MAX2(vertex->num_elements, nv50->state.num_vtxelts);
>
> + /* A vertexid is not generated for inline data uploads. Have to use a
> + * VBO. This check must come after the vertprog has been validated,
> + * otherwise vertexid may be unset.
> + */
> + assert(nv50->vertprog->translated);
> + if (nv50->vertprog->vp.vertexid)
> + nv50->vbo_push_hint = 0;
> +
> if (unlikely(vertex->need_conversion))
> nv50->vbo_fifo = ~0;
> else
LGTM!
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Nouveau] [PATCH] nv50: avoid using inline vertex data submit when gl_VertexID is used
2015-08-24 15:57 ` Tobias Klausmann
@ 2015-08-24 16:19 ` Ilia Mirkin
0 siblings, 0 replies; 6+ messages in thread
From: Ilia Mirkin @ 2015-08-24 16:19 UTC (permalink / raw)
To: Tobias Klausmann
Cc: mesa-dev@lists.freedesktop.org, nouveau@lists.freedesktop.org
On Mon, Aug 24, 2015 at 11:57 AM, Tobias Klausmann
<tobias.johannes.klausmann@mni.thm.de> wrote:
>
>
> On 24.08.2015 17:51, Ilia Mirkin wrote:
>>
>> The hardware only generates vertexid when vertices come from a VBO. This
>> fixes:
>>
>> vertexid-drawelements
>> vertexid-drawarrays
>>
>> Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
>> Cc: "11.0" <mesa-stable@lists.freedesktop.org>
>> ---
>> src/gallium/drivers/nouveau/nv50/nv50_program.c | 1 +
>> src/gallium/drivers/nouveau/nv50/nv50_program.h | 1 +
>> src/gallium/drivers/nouveau/nv50/nv50_state_validate.c | 3 ++-
>> src/gallium/drivers/nouveau/nv50/nv50_vbo.c | 8 ++++++++
>> 4 files changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_program.c
>> b/src/gallium/drivers/nouveau/nv50/nv50_program.c
>> index 02dc367..eff4477 100644
>> --- a/src/gallium/drivers/nouveau/nv50/nv50_program.c
>> +++ b/src/gallium/drivers/nouveau/nv50/nv50_program.c
>> @@ -66,6 +66,7 @@ nv50_vertprog_assign_slots(struct nv50_ir_prog_info
>> *info)
>> case TGSI_SEMANTIC_VERTEXID:
>> prog->vp.attrs[2] |= NV50_3D_VP_GP_BUILTIN_ATTR_EN_VERTEX_ID;
>> prog->vp.attrs[2] |=
>> NV50_3D_VP_GP_BUILTIN_ATTR_EN_VERTEX_ID_DRAW_ARRAYS_ADD_START;
>> + prog->vp.vertexid = 1;
>> continue;
>> default:
>> break;
>> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_program.h
>> b/src/gallium/drivers/nouveau/nv50/nv50_program.h
>> index 5d3ff56..f4e8e94 100644
>> --- a/src/gallium/drivers/nouveau/nv50/nv50_program.h
>> +++ b/src/gallium/drivers/nouveau/nv50/nv50_program.h
>> @@ -76,6 +76,7 @@ struct nv50_program {
>> ubyte psiz; /* output slot of point size */
>> ubyte bfc[2]; /* indices into varying for FFC (FP) or BFC
>> (VP) */
>> ubyte edgeflag;
>> + ubyte vertexid;
>> ubyte clpd[2]; /* output slot of clip distance[i]'s 1st
>> component */
>> ubyte clpd_nr;
>> } vp;
>> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
>> b/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
>> index b304a17..66dcf43 100644
>> --- a/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
>> +++ b/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
>> @@ -503,7 +503,8 @@ static struct state_validate {
>> { nv50_validate_samplers, NV50_NEW_SAMPLERS },
>> { nv50_stream_output_validate, NV50_NEW_STRMOUT |
>> NV50_NEW_VERTPROG | NV50_NEW_GMTYPROG
>> },
>> - { nv50_vertex_arrays_validate, NV50_NEW_VERTEX | NV50_NEW_ARRAYS },
>> + { nv50_vertex_arrays_validate, NV50_NEW_VERTEX | NV50_NEW_ARRAYS |
>> + NV50_NEW_VERTPROG },
>> { nv50_validate_min_samples, NV50_NEW_MIN_SAMPLES },
>> };
>> #define validate_list_len (sizeof(validate_list) /
>> sizeof(validate_list[0]))
>> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_vbo.c
>> b/src/gallium/drivers/nouveau/nv50/nv50_vbo.c
>> index 600b973..fb4305f 100644
>> --- a/src/gallium/drivers/nouveau/nv50/nv50_vbo.c
>> +++ b/src/gallium/drivers/nouveau/nv50/nv50_vbo.c
>> @@ -301,6 +301,14 @@ nv50_vertex_arrays_validate(struct nv50_context
>> *nv50)
>> unsigned i;
>> const unsigned n = MAX2(vertex->num_elements,
>> nv50->state.num_vtxelts);
>> + /* A vertexid is not generated for inline data uploads. Have to use
>> a
>> + * VBO. This check must come after the vertprog has been validated,
>> + * otherwise vertexid may be unset.
>> + */
>> + assert(nv50->vertprog->translated);
>> + if (nv50->vertprog->vp.vertexid)
>> + nv50->vbo_push_hint = 0;
>> +
>> if (unlikely(vertex->need_conversion))
>> nv50->vbo_fifo = ~0;
>> else
>
> LGTM!
Thanks. I was a little torn on whether to do it this way (which
penalizes someone switching vertex programs while keeping the vertex
setup the same), as opposed to do it the other way, which would
penalize every program that uses vertexid (by calling
nv50_vertex_arrays_validate twice for those).
Ideally I'd do it in a way that penalized neither, but that's just not
going to happen :)
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Mesa-dev] [PATCH] nv50: avoid using inline vertex data submit when gl_VertexID is used
[not found] ` <55DB7974.5090403-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2015-08-24 20:02 ` Ilia Mirkin
[not found] ` <CAKb7Uvi-29ZZxo57Y1iWxf3A0U98EN4EroGvQ55L4PBqRXPF8w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Ilia Mirkin @ 2015-08-24 20:02 UTC (permalink / raw)
To: Samuel Pitoiset
Cc: mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, 11.0,
nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Edge flag stuff is annoying. Pretty sure only blender uses it. shade
model = flat should get fixed on nv50 before edge flags, since blender
uses that too, and it's produces much worse visual artifacts.
I'm having second thoughts about this patch. I think I'm going to go
back to my previous approach of just calling
nv50_vertex_arrays_validate when vbo_fifo && vertexid. I suspect that
vertexid usage with small draws from client buffers is next to
inexistent, no need to re-emit this stuff so often.
On Mon, Aug 24, 2015 at 4:07 PM, Samuel Pitoiset
<samuel.pitoiset@gmail.com> wrote:
> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
>
> This fix is simpler than I was expected. What about the edge flag stuff now?
> :)
>
>
> On 08/24/2015 05:51 PM, Ilia Mirkin wrote:
>>
>> The hardware only generates vertexid when vertices come from a VBO. This
>> fixes:
>>
>> vertexid-drawelements
>> vertexid-drawarrays
>>
>> Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
>> Cc: "11.0" <mesa-stable@lists.freedesktop.org>
>> ---
>> src/gallium/drivers/nouveau/nv50/nv50_program.c | 1 +
>> src/gallium/drivers/nouveau/nv50/nv50_program.h | 1 +
>> src/gallium/drivers/nouveau/nv50/nv50_state_validate.c | 3 ++-
>> src/gallium/drivers/nouveau/nv50/nv50_vbo.c | 8 ++++++++
>> 4 files changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_program.c
>> b/src/gallium/drivers/nouveau/nv50/nv50_program.c
>> index 02dc367..eff4477 100644
>> --- a/src/gallium/drivers/nouveau/nv50/nv50_program.c
>> +++ b/src/gallium/drivers/nouveau/nv50/nv50_program.c
>> @@ -66,6 +66,7 @@ nv50_vertprog_assign_slots(struct nv50_ir_prog_info
>> *info)
>> case TGSI_SEMANTIC_VERTEXID:
>> prog->vp.attrs[2] |= NV50_3D_VP_GP_BUILTIN_ATTR_EN_VERTEX_ID;
>> prog->vp.attrs[2] |=
>> NV50_3D_VP_GP_BUILTIN_ATTR_EN_VERTEX_ID_DRAW_ARRAYS_ADD_START;
>> + prog->vp.vertexid = 1;
>> continue;
>> default:
>> break;
>> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_program.h
>> b/src/gallium/drivers/nouveau/nv50/nv50_program.h
>> index 5d3ff56..f4e8e94 100644
>> --- a/src/gallium/drivers/nouveau/nv50/nv50_program.h
>> +++ b/src/gallium/drivers/nouveau/nv50/nv50_program.h
>> @@ -76,6 +76,7 @@ struct nv50_program {
>> ubyte psiz; /* output slot of point size */
>> ubyte bfc[2]; /* indices into varying for FFC (FP) or BFC
>> (VP) */
>> ubyte edgeflag;
>> + ubyte vertexid;
>> ubyte clpd[2]; /* output slot of clip distance[i]'s 1st
>> component */
>> ubyte clpd_nr;
>> } vp;
>> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
>> b/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
>> index b304a17..66dcf43 100644
>> --- a/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
>> +++ b/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
>> @@ -503,7 +503,8 @@ static struct state_validate {
>> { nv50_validate_samplers, NV50_NEW_SAMPLERS },
>> { nv50_stream_output_validate, NV50_NEW_STRMOUT |
>> NV50_NEW_VERTPROG | NV50_NEW_GMTYPROG
>> },
>> - { nv50_vertex_arrays_validate, NV50_NEW_VERTEX | NV50_NEW_ARRAYS },
>> + { nv50_vertex_arrays_validate, NV50_NEW_VERTEX | NV50_NEW_ARRAYS |
>> + NV50_NEW_VERTPROG },
>> { nv50_validate_min_samples, NV50_NEW_MIN_SAMPLES },
>> };
>> #define validate_list_len (sizeof(validate_list) /
>> sizeof(validate_list[0]))
>> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_vbo.c
>> b/src/gallium/drivers/nouveau/nv50/nv50_vbo.c
>> index 600b973..fb4305f 100644
>> --- a/src/gallium/drivers/nouveau/nv50/nv50_vbo.c
>> +++ b/src/gallium/drivers/nouveau/nv50/nv50_vbo.c
>> @@ -301,6 +301,14 @@ nv50_vertex_arrays_validate(struct nv50_context
>> *nv50)
>> unsigned i;
>> const unsigned n = MAX2(vertex->num_elements,
>> nv50->state.num_vtxelts);
>> + /* A vertexid is not generated for inline data uploads. Have to use
>> a
>> + * VBO. This check must come after the vertprog has been validated,
>> + * otherwise vertexid may be unset.
>> + */
>> + assert(nv50->vertprog->translated);
>> + if (nv50->vertprog->vp.vertexid)
>> + nv50->vbo_push_hint = 0;
>> +
>> if (unlikely(vertex->need_conversion))
>> nv50->vbo_fifo = ~0;
>> else
>
>
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Mesa-dev] [PATCH] nv50: avoid using inline vertex data submit when gl_VertexID is used
[not found] ` <1440431513-29568-1-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
2015-08-24 15:57 ` Tobias Klausmann
@ 2015-08-24 20:07 ` Samuel Pitoiset
[not found] ` <55DB7974.5090403-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
1 sibling, 1 reply; 6+ messages in thread
From: Samuel Pitoiset @ 2015-08-24 20:07 UTC (permalink / raw)
To: Ilia Mirkin, mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, 11.0
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
This fix is simpler than I was expected. What about the edge flag stuff
now? :)
On 08/24/2015 05:51 PM, Ilia Mirkin wrote:
> The hardware only generates vertexid when vertices come from a VBO. This
> fixes:
>
> vertexid-drawelements
> vertexid-drawarrays
>
> Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
> Cc: "11.0" <mesa-stable@lists.freedesktop.org>
> ---
> src/gallium/drivers/nouveau/nv50/nv50_program.c | 1 +
> src/gallium/drivers/nouveau/nv50/nv50_program.h | 1 +
> src/gallium/drivers/nouveau/nv50/nv50_state_validate.c | 3 ++-
> src/gallium/drivers/nouveau/nv50/nv50_vbo.c | 8 ++++++++
> 4 files changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_program.c b/src/gallium/drivers/nouveau/nv50/nv50_program.c
> index 02dc367..eff4477 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_program.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_program.c
> @@ -66,6 +66,7 @@ nv50_vertprog_assign_slots(struct nv50_ir_prog_info *info)
> case TGSI_SEMANTIC_VERTEXID:
> prog->vp.attrs[2] |= NV50_3D_VP_GP_BUILTIN_ATTR_EN_VERTEX_ID;
> prog->vp.attrs[2] |= NV50_3D_VP_GP_BUILTIN_ATTR_EN_VERTEX_ID_DRAW_ARRAYS_ADD_START;
> + prog->vp.vertexid = 1;
> continue;
> default:
> break;
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_program.h b/src/gallium/drivers/nouveau/nv50/nv50_program.h
> index 5d3ff56..f4e8e94 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_program.h
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_program.h
> @@ -76,6 +76,7 @@ struct nv50_program {
> ubyte psiz; /* output slot of point size */
> ubyte bfc[2]; /* indices into varying for FFC (FP) or BFC (VP) */
> ubyte edgeflag;
> + ubyte vertexid;
> ubyte clpd[2]; /* output slot of clip distance[i]'s 1st component */
> ubyte clpd_nr;
> } vp;
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c b/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
> index b304a17..66dcf43 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
> @@ -503,7 +503,8 @@ static struct state_validate {
> { nv50_validate_samplers, NV50_NEW_SAMPLERS },
> { nv50_stream_output_validate, NV50_NEW_STRMOUT |
> NV50_NEW_VERTPROG | NV50_NEW_GMTYPROG },
> - { nv50_vertex_arrays_validate, NV50_NEW_VERTEX | NV50_NEW_ARRAYS },
> + { nv50_vertex_arrays_validate, NV50_NEW_VERTEX | NV50_NEW_ARRAYS |
> + NV50_NEW_VERTPROG },
> { nv50_validate_min_samples, NV50_NEW_MIN_SAMPLES },
> };
> #define validate_list_len (sizeof(validate_list) / sizeof(validate_list[0]))
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_vbo.c b/src/gallium/drivers/nouveau/nv50/nv50_vbo.c
> index 600b973..fb4305f 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_vbo.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_vbo.c
> @@ -301,6 +301,14 @@ nv50_vertex_arrays_validate(struct nv50_context *nv50)
> unsigned i;
> const unsigned n = MAX2(vertex->num_elements, nv50->state.num_vtxelts);
>
> + /* A vertexid is not generated for inline data uploads. Have to use a
> + * VBO. This check must come after the vertprog has been validated,
> + * otherwise vertexid may be unset.
> + */
> + assert(nv50->vertprog->translated);
> + if (nv50->vertprog->vp.vertexid)
> + nv50->vbo_push_hint = 0;
> +
> if (unlikely(vertex->need_conversion))
> nv50->vbo_fifo = ~0;
> else
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Mesa-dev] [PATCH] nv50: avoid using inline vertex data submit when gl_VertexID is used
[not found] ` <CAKb7Uvi-29ZZxo57Y1iWxf3A0U98EN4EroGvQ55L4PBqRXPF8w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-08-24 20:12 ` Samuel Pitoiset
0 siblings, 0 replies; 6+ messages in thread
From: Samuel Pitoiset @ 2015-08-24 20:12 UTC (permalink / raw)
To: Ilia Mirkin
Cc: mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, 11.0,
nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
On 08/24/2015 10:02 PM, Ilia Mirkin wrote:
> Edge flag stuff is annoying. Pretty sure only blender uses it. shade
> model = flat should get fixed on nv50 before edge flags, since blender
> uses that too, and it's produces much worse visual artifacts.
No rush for this one though.
>
> I'm having second thoughts about this patch. I think I'm going to go
> back to my previous approach of just calling
> nv50_vertex_arrays_validate when vbo_fifo && vertexid. I suspect that
> vertexid usage with small draws from client buffers is next to
> inexistent, no need to re-emit this stuff so often.
Good, I'd be happy to have a look at this second approach.
>
> On Mon, Aug 24, 2015 at 4:07 PM, Samuel Pitoiset
> <samuel.pitoiset@gmail.com> wrote:
>> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
>>
>> This fix is simpler than I was expected. What about the edge flag stuff now?
>> :)
>>
>>
>> On 08/24/2015 05:51 PM, Ilia Mirkin wrote:
>>> The hardware only generates vertexid when vertices come from a VBO. This
>>> fixes:
>>>
>>> vertexid-drawelements
>>> vertexid-drawarrays
>>>
>>> Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
>>> Cc: "11.0" <mesa-stable@lists.freedesktop.org>
>>> ---
>>> src/gallium/drivers/nouveau/nv50/nv50_program.c | 1 +
>>> src/gallium/drivers/nouveau/nv50/nv50_program.h | 1 +
>>> src/gallium/drivers/nouveau/nv50/nv50_state_validate.c | 3 ++-
>>> src/gallium/drivers/nouveau/nv50/nv50_vbo.c | 8 ++++++++
>>> 4 files changed, 12 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_program.c
>>> b/src/gallium/drivers/nouveau/nv50/nv50_program.c
>>> index 02dc367..eff4477 100644
>>> --- a/src/gallium/drivers/nouveau/nv50/nv50_program.c
>>> +++ b/src/gallium/drivers/nouveau/nv50/nv50_program.c
>>> @@ -66,6 +66,7 @@ nv50_vertprog_assign_slots(struct nv50_ir_prog_info
>>> *info)
>>> case TGSI_SEMANTIC_VERTEXID:
>>> prog->vp.attrs[2] |= NV50_3D_VP_GP_BUILTIN_ATTR_EN_VERTEX_ID;
>>> prog->vp.attrs[2] |=
>>> NV50_3D_VP_GP_BUILTIN_ATTR_EN_VERTEX_ID_DRAW_ARRAYS_ADD_START;
>>> + prog->vp.vertexid = 1;
>>> continue;
>>> default:
>>> break;
>>> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_program.h
>>> b/src/gallium/drivers/nouveau/nv50/nv50_program.h
>>> index 5d3ff56..f4e8e94 100644
>>> --- a/src/gallium/drivers/nouveau/nv50/nv50_program.h
>>> +++ b/src/gallium/drivers/nouveau/nv50/nv50_program.h
>>> @@ -76,6 +76,7 @@ struct nv50_program {
>>> ubyte psiz; /* output slot of point size */
>>> ubyte bfc[2]; /* indices into varying for FFC (FP) or BFC
>>> (VP) */
>>> ubyte edgeflag;
>>> + ubyte vertexid;
>>> ubyte clpd[2]; /* output slot of clip distance[i]'s 1st
>>> component */
>>> ubyte clpd_nr;
>>> } vp;
>>> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
>>> b/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
>>> index b304a17..66dcf43 100644
>>> --- a/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
>>> +++ b/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
>>> @@ -503,7 +503,8 @@ static struct state_validate {
>>> { nv50_validate_samplers, NV50_NEW_SAMPLERS },
>>> { nv50_stream_output_validate, NV50_NEW_STRMOUT |
>>> NV50_NEW_VERTPROG | NV50_NEW_GMTYPROG
>>> },
>>> - { nv50_vertex_arrays_validate, NV50_NEW_VERTEX | NV50_NEW_ARRAYS },
>>> + { nv50_vertex_arrays_validate, NV50_NEW_VERTEX | NV50_NEW_ARRAYS |
>>> + NV50_NEW_VERTPROG },
>>> { nv50_validate_min_samples, NV50_NEW_MIN_SAMPLES },
>>> };
>>> #define validate_list_len (sizeof(validate_list) /
>>> sizeof(validate_list[0]))
>>> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_vbo.c
>>> b/src/gallium/drivers/nouveau/nv50/nv50_vbo.c
>>> index 600b973..fb4305f 100644
>>> --- a/src/gallium/drivers/nouveau/nv50/nv50_vbo.c
>>> +++ b/src/gallium/drivers/nouveau/nv50/nv50_vbo.c
>>> @@ -301,6 +301,14 @@ nv50_vertex_arrays_validate(struct nv50_context
>>> *nv50)
>>> unsigned i;
>>> const unsigned n = MAX2(vertex->num_elements,
>>> nv50->state.num_vtxelts);
>>> + /* A vertexid is not generated for inline data uploads. Have to use
>>> a
>>> + * VBO. This check must come after the vertprog has been validated,
>>> + * otherwise vertexid may be unset.
>>> + */
>>> + assert(nv50->vertprog->translated);
>>> + if (nv50->vertprog->vp.vertexid)
>>> + nv50->vbo_push_hint = 0;
>>> +
>>> if (unlikely(vertex->need_conversion))
>>> nv50->vbo_fifo = ~0;
>>> else
>>
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-08-24 20:12 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-24 15:51 [PATCH] nv50: avoid using inline vertex data submit when gl_VertexID is used Ilia Mirkin
[not found] ` <1440431513-29568-1-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
2015-08-24 15:57 ` Tobias Klausmann
2015-08-24 16:19 ` [Nouveau] " Ilia Mirkin
2015-08-24 20:07 ` [Mesa-dev] " Samuel Pitoiset
[not found] ` <55DB7974.5090403-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-08-24 20:02 ` Ilia Mirkin
[not found] ` <CAKb7Uvi-29ZZxo57Y1iWxf3A0U98EN4EroGvQ55L4PBqRXPF8w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-08-24 20:12 ` Samuel Pitoiset
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.