From 1b9927bc48fcddeb4802a3a204ce916ea58e8cc0 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 Reviewed-by: Adam Jackson Part-of: (cherry picked from commit bc15c95c7afe56cc0408aa2ba02a5a21f766547b) --- .pick_status.json | 2 +- src/gallium/frontends/dri/drisw.c | 2 ++ src/gallium/frontends/dri/kopper.c | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index 5d6888c20e9..2c6ec582566 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -414,7 +414,7 @@ "description": "frontends/dri: always init opencl_func_mutex in InitScreen hooks", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/gallium/frontends/dri/drisw.c b/src/gallium/frontends/dri/drisw.c index 318d9d550c7..52e2a75ed39 100644 --- a/src/gallium/frontends/dri/drisw.c +++ b/src/gallium/frontends/dri/drisw.c @@ -582,6 +582,8 @@ drisw_init_screen(struct dri_screen *screen, bool implicit) 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 435114c7e7f..17cf43d002a 100644 --- a/src/gallium/frontends/dri/kopper.c +++ b/src/gallium/frontends/dri/kopper.c @@ -116,6 +116,8 @@ kopper_init_screen(struct dri_screen *screen, bool implicit) 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"