Skip to content

intel/compiler: Add id parameter to shader_debug_log and shader_perf_log callbacks

Ian Romanick requested to merge idr/mesa:review/shader_debug_log into main

There are two problems with the current architecture.

In OpenGL, the id is supposed to be a unique identifier for a particular log source. This is done so that applications can (theoretically) filter particular log messages. The debug callback infrastructure in Mesa assigns a uniqe value when a value of 0 is passed in. This causes the id to get set once to a unique value for each message.

By passing a stack variable that is initialized to 0 on every call, every time the same message is logged, it will have a different id. This isn't great, but it's also not catastrophic.

When threaded shader compiles are used, the id pointer is saved and dereferenced at a possibly much later time on a possibly different thread. This causes one thread to access the stack from a different thread... and that stack frame might not be valid any more. :(

This fixes shader-db crashes of various kinds on Iris with threaded shader compiles enabled.

Fixes: 42c34e1a ("iris: Enable threaded shader compilation")

Merge request reports