From 227e50495e8d026552244a47fc4e4159cfd64596 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 2 May 2024 08:15:56 -0400 Subject: [PATCH] frontends/dri: always init opencl_func_mutex in InitScreen hooks 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 Part-of: Signed-off-by: Weifeng Liu Signed-off-by: Mike Blumenkrantz --- src/gallium/frontends/dri/drisw.c | 2 ++ src/gallium/frontends/dri/kopper.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/gallium/frontends/dri/drisw.c b/src/gallium/frontends/dri/drisw.c index 777707c04dc..4c9b66cedfb 100644 --- a/src/gallium/frontends/dri/drisw.c +++ b/src/gallium/frontends/dri/drisw.c @@ -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) { diff --git a/src/gallium/frontends/dri/kopper.c b/src/gallium/frontends/dri/kopper.c index 91f2d481a46..fa3221b152e 100644 --- a/src/gallium/frontends/dri/kopper.c +++ b/src/gallium/frontends/dri/kopper.c @@ -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"