diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2021-07-29 14:13:27 -0700 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2021-08-01 23:58:08 +0000 |
commit | 043c5bf966a276c02c536846f44a1335e082789c (patch) | |
tree | 5dd03971164744aec240ac73455135d60a5ade4f /src/mesa/drivers | |
parent | 80160a67ab1700aabfcc0aa2c58b0fc73fdbd925 (diff) |
intel/compiler: Add id parameter to shader_debug_log callback
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: 42c34e1ac8d ("iris: Enable threaded shader compilation")
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12136>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_screen.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_screen.c b/src/mesa/drivers/dri/i965/brw_screen.c index dad4bc29463..20ca5c21451 100644 --- a/src/mesa/drivers/dri/i965/brw_screen.c +++ b/src/mesa/drivers/dri/i965/brw_screen.c @@ -2472,14 +2472,13 @@ set_max_gl_versions(struct brw_screen *screen) } static void -shader_debug_log_mesa(void *data, const char *fmt, ...) +shader_debug_log_mesa(void *data, unsigned *msg_id, const char *fmt, ...) { struct brw_context *brw = (struct brw_context *)data; va_list args; va_start(args, fmt); - GLuint msg_id = 0; - _mesa_gl_vdebugf(&brw->ctx, &msg_id, + _mesa_gl_vdebugf(&brw->ctx, msg_id, MESA_DEBUG_SOURCE_SHADER_COMPILER, MESA_DEBUG_TYPE_OTHER, MESA_DEBUG_SEVERITY_NOTIFICATION, fmt, args); |