Skip to content

Commit

Permalink
frontends/dri: always init opencl_func_mutex in InitScreen hooks
Browse files Browse the repository at this point in the history
this otherwise leads to a mismatch where some types of screen may have
the mutex initialized while others don't, in which case dri_release_screen()
will attempt to destroy an uninitialized mutex

cc: mesa-stable

Tracked-On: OAM-122605
Reviewed-by: Adam Jackson <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29021>
Signed-off-by: Weifeng Liu <[email protected]>
Signed-off-by: Mike Blumenkrantz <[email protected]>
  • Loading branch information
zmike authored and sysopenci committed Jul 25, 2024
1 parent b1e8d3d commit b95a14b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/gallium/frontends/dri/drisw.c
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,8 @@ drisw_init_screen(struct dri_screen *screen)
struct pipe_screen *pscreen = NULL;
const struct drisw_loader_funcs *lf = &drisw_lf;

(void) mtx_init(&screen->opencl_func_mutex, mtx_plain);

screen->swrast_no_present = debug_get_option_swrast_no_present();

if (loader->base.version >= 4) {
Expand Down
2 changes: 2 additions & 0 deletions src/gallium/frontends/dri/kopper.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ kopper_init_screen(struct dri_screen *screen)
const __DRIconfig **configs;
struct pipe_screen *pscreen = NULL;

(void) mtx_init(&screen->opencl_func_mutex, mtx_plain);

if (!screen->kopper_loader) {
fprintf(stderr, "mesa: Kopper interface not found!\n"
" Ensure the versions of %s built with this version of Zink are\n"
Expand Down

0 comments on commit b95a14b

Please sign in to comment.