[Mesa-dev] Time to merge threaded GL dispatch? (aka glthread)

Marek Olšák maraeo at gmail.com
Mon Feb 6 00:11:26 UTC 2017


Back in 2012-2013, then-Intel employees Eric Anholt and Paul Berry
wrote this threaded GL dispatch where GL calls are queued and executed
in a different thread. It was supposed to deal with high CPU overhead
of Mesa, but at the time most games used the compatibility profile and
Steam didn't really exist on Linux, so it didn't help many (if any)

Things are different today. We have Steam and most games use the GL
core profile. We know of several games that have better performance
with glthread, namely Borderlands 2, and some people reported to me
that some other games also benefit. It's about time we put this into
mainline Mesa.

My plan is that we merge it as-is or with minor changes, and then
we'll clean it up and improve it while it's in master. It's disabled
by default, so it shouldn't bother anyone who doesn't want it. There
is a drirc option to turn it on (just use the corresponding env var).
All Gallium drivers support it.

A note on synchronizations. Borderlands 2 has 170 thread syncs per
frame. That means the app thread has to stop and wait 170x per frame.
Despite that, it still has 70% higher performance in some cases. My
theory is that if you have a lot of draw calls, you can have a lot of
syncs, because the sheer amount of draw calls will just make those
syncs irrelevant. 200 syncs per 4k draw calls is like 1 sync per 20
draw calls.

Here it is: https://cgit.freedesktop.org/~mareko/mesa/log/?h=glthread

The plan is to merge everything up to the gallium commit (without the
Intel commits, I'll let Intel decide what to do with them). I can send
the whole series to the list if that's preferable.



More information about the mesa-dev mailing list