[Mesa-dev] [PATCH] i965: Fix an off-by-1 error in the draw upload code's size calculation.

Kenneth Graunke kenneth at whitecape.org
Tue Oct 14 17:21:00 PDT 2014


On Tuesday, October 14, 2014 04:42:39 PM Kenneth Graunke wrote:
> According to INTEL_DEBUG=perf, "Borderlands: The Pre-Sequel" was
> stalling on nearly every glBufferSubData call, with very slightly
> overlapping busy ranges.
> 
> It turns out the draw upload code was accidentally including an extra
> stride's worth of data in the vertex buffer size due to a simple
> off-by-one error.  We considered this extra bit of buffer space to be
> busy (in use by the GPU), when it was actually idle.
> 
> The new diagram should make it easier to understand the formula.  It's
> basically what I drew on paper when working through an actual
> glDrawRangeElements call.
> 
> Eliminates all glBufferSubData stalls in "Borderlands: The Pre-Sequel."
> 
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> Cc: mesa-stable at lists.freedesktop.org
> ---
>  src/mesa/drivers/dri/i965/brw_draw_upload.c | 22 +++++++++++++++++++++-
>  1 file changed, 21 insertions(+), 1 deletion(-)
> 
> No Piglit regressions on Haswell.  This might help Dota 2 and Serious Sam 3
> as well, but I haven't checked.

Chris Forbes asked me for actual performance numbers, so here they are:
the initial sequence is roughly 1.6x to 1.8x faster.  (I measured FPS by typing `stat fps` in the developer console and eyeballing the FPS counter it displayed in the corner.  Not the most scientific, but when the change is large enough...it works.)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20141014/0fb69982/attachment.sig>


More information about the mesa-dev mailing list