mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-22 17:10:32 +01:00
winsys/amdgpu: fix a mutex deadlock when we fail to create pipe_screen
Fixes:2eb067db0f- winsys/amdgpu: add a new winsys for the new kernel driver Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16112> (cherry picked from commit4a982aa542)
This commit is contained in:
parent
3c90596508
commit
6ed6a28fc7
2 changed files with 12 additions and 5 deletions
|
|
@ -468,7 +468,7 @@
|
|||
"description": "winsys/amdgpu: fix a mutex deadlock when we fail to create pipe_screen",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"because_sha": "2eb067db0febcd71b4182153155e3e43f215624c"
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ static void do_winsys_deinit(struct amdgpu_winsys *ws)
|
|||
FREE(ws);
|
||||
}
|
||||
|
||||
static void amdgpu_winsys_destroy(struct radeon_winsys *rws)
|
||||
static void amdgpu_winsys_destroy_locked(struct radeon_winsys *rws, bool locked)
|
||||
{
|
||||
struct amdgpu_screen_winsys *sws = amdgpu_screen_winsys(rws);
|
||||
struct amdgpu_winsys *ws = sws->aws;
|
||||
|
|
@ -167,7 +167,8 @@ static void amdgpu_winsys_destroy(struct radeon_winsys *rws)
|
|||
* amdgpu_winsys_create in another thread doesn't get the winsys
|
||||
* from the table when the counter drops to 0.
|
||||
*/
|
||||
simple_mtx_lock(&dev_tab_mutex);
|
||||
if (!locked)
|
||||
simple_mtx_lock(&dev_tab_mutex);
|
||||
|
||||
destroy = pipe_reference(&ws->reference, NULL);
|
||||
if (destroy && dev_tab) {
|
||||
|
|
@ -178,7 +179,8 @@ static void amdgpu_winsys_destroy(struct radeon_winsys *rws)
|
|||
}
|
||||
}
|
||||
|
||||
simple_mtx_unlock(&dev_tab_mutex);
|
||||
if (!locked)
|
||||
simple_mtx_unlock(&dev_tab_mutex);
|
||||
|
||||
if (destroy)
|
||||
do_winsys_deinit(ws);
|
||||
|
|
@ -187,6 +189,11 @@ static void amdgpu_winsys_destroy(struct radeon_winsys *rws)
|
|||
FREE(rws);
|
||||
}
|
||||
|
||||
static void amdgpu_winsys_destroy(struct radeon_winsys *rws)
|
||||
{
|
||||
amdgpu_winsys_destroy_locked(rws, false);
|
||||
}
|
||||
|
||||
static void amdgpu_winsys_query_info(struct radeon_winsys *rws,
|
||||
struct radeon_info *info,
|
||||
bool enable_smart_access_memory,
|
||||
|
|
@ -556,7 +563,7 @@ amdgpu_winsys_create(int fd, const struct pipe_screen_config *config,
|
|||
* and link all drivers into one binary blob. */
|
||||
ws->base.screen = screen_create(&ws->base, config);
|
||||
if (!ws->base.screen) {
|
||||
amdgpu_winsys_destroy(&ws->base);
|
||||
amdgpu_winsys_destroy_locked(&ws->base, true);
|
||||
simple_mtx_unlock(&dev_tab_mutex);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue