Skip to content

panfrost: Compile indirect dispatch shader on first use

Alyssa Rosenzweig requested to merge alyssa/mesa:panfrost/first-use into main

For 2D UI workloads and even most 3D workloads, the indirect dispatch shader won't actually be needed, but we currently compile it during eglInitialize() on every v7 application. That hurts app start-up time, especially given that this shader doesn't hit the disk cache. We can instead defer compiling this shader until it's actually needed, when glDispatchComputeIndirect() gets called.

The tradeoff is that the first glDispatchComputeIndirect() call will be (much) slower than successive calls, since we need to build and compile this internal shader. I'm unconvinced that's a problem in practice.

An app would need to call glDispatchComputeIndirect for the first time in the middle of a scene. 2D apps never would call that, OpenCL doesn't have that, and GL compute will have the same costs just moved around. So it's down to a 3D GLES3.1 app that indirectly dispatches compute for the first time time in the middle of a scene. Which, meh? It's not entirely implausible but we have bigger fish to fry, and this fixes a real problem (about 5% of eglInitialize time spent building this shader that won't actually get used).

es2_info starts slightly faster with this change.

Note we only have indirect dispatch implemented on v7 (Mali-G31, G52, and G76), so this doesn't matter for other platforms.

Merge request reports