[Mesa-dev] [PATCH 1/7] nvc0: reduce the number of PUSH_SPACE in draw path
Samuel Pitoiset
samuel.pitoiset at gmail.com
Wed Oct 26 08:14:34 UTC 2016
On 10/25/2016 09:49 PM, Ilia Mirkin wrote:
> What if instance_count = 1M? (It can happen.)
We allocate a giant space in the pushbuf in one shot. Well, anyways this
is not the optimization of the year, so I can drop it. :-)
>
> On Tue, Oct 25, 2016 at 3:41 PM, Samuel Pitoiset
> <samuel.pitoiset at gmail.com> wrote:
>> 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
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
--
-Samuel
More information about the mesa-dev
mailing list