[Mesa-dev] Gallium optimization: add the user pointer into pipe_vertex_buffer and pipe_index_buffer

Marek Olšák maraeo at gmail.com
Thu Apr 12 11:08:49 PDT 2012


Hi,

In parallel with my other work, I have been looking for ways to
decrease our draw-call overhead and tried adding the user buffer
pointer into pipe_vertex_buffer and pipe_index_buffer, which led to a
removal of a lot of code from st_draw.c. With that change, I have
tested r300g with torcs and ipers and got surprising results.

Pros:
- 9% performance increase in torcs (open source game)
- 6% performance increase in ipers (from Mesa demos)
- Besides that, a little over 110 lines of code was removed from st_draw.c.

Cons:
- The user buffer contents are fully mutable between draw calls,
however drivers should be ready for that now.

I know this was brought up long ago and it was NAK'd, but you know,
it's really hard to resist this framerate-increasing "cleanup". I
guess many people would agree.

Here's the proof-of-concept implementation (2 commits):
http://cgit.freedesktop.org/~mareko/mesa/commit/?h=gallium-user-ptr-in-states&id=21cf1414df5e24942fe4f0fdab008c9b3bc63802
http://cgit.freedesktop.org/~mareko/mesa/commit/?h=gallium-user-ptr-in-states&id=a582f05b56b89e8c2e1345b6c2b6eb9663919eba

Here are the exact benchmark results:

Torcs before:
libGL: FPS = 22.3
libGL: FPS = 21.6
libGL: FPS = 20.5
libGL: FPS = 20.4

Torcs after:
libGL: FPS = 24.4
libGL: FPS = 23.7
libGL: FPS = 22.2
libGL: FPS = 22.0

Ipers before:
Frame rate: 30.212976
Frame rate: 30.183079
Frame rate: 30.183079
Frame rate: 30.257936

Ipers after:
Frame rate: 31.761785
Frame rate: 32.000000
Frame rate: 32.082922
Frame rate: 32.146389

Comments welcome.

Thanks,
Marek


More information about the mesa-dev mailing list