[Mesa-dev] [PATCH] i965: Sort array elements to increase chances of reusing buffer relocation
Ben Widawsky
ben at bwidawsk.net
Mon Dec 1 21:20:28 PST 2014
On Mon, Dec 01, 2014 at 05:37:27PM -0800, Eric Anholt wrote:
> 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.
In fact, I'd be interested to see numbers with the existing logic was removed.
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list