[Mesa-dev] [PATCH] i965: Sort array elements to increase chances of reusing buffer relocation

Eric Anholt eric at anholt.net
Mon Dec 1 17:37:27 PST 2014


Neil Roberts <neil at linux.intel.com> writes:

> When submitting the vertex buffers the i965 driver will try to recognise when
> multiple attributes are using the same buffer so that it can submit a single
> relocation for it and set a different offset in the attribute. Previously
> however if the application happens to have the attributes in a struct with an
> order that doesn't match the order they are listed in the gl_vert_attrib enum
> then the loop would end up processing the attributes with a greater offset
> first and the optimisation wouldn't be used.
>
> To make the optmisation more likely to be used this patch makes it always
> process the elements in increasing order of offset. This is done copying the
> element pointers into a separate array and sorting it with qsort. This only
> affects the order that the elements are processed and doesn't change the order
> that they are submitted to the hardware.

I would expect the sorting to cost more than the potential win you're
looking for.  Performance patches should come with performance data.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20141201/ca0eb3ad/attachment.sig>


More information about the mesa-dev mailing list