mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 20:28:04 +02:00
ac/surface: fix an addrlib race condition on gfx9
Addrlib calls GetMetaEquation, which generates and saves address equations in a global table that is not thread safe. Fixes:df2cbdd2e3- amd/addrlib: expose DCC address equations to drivers Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6361 Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16091> (cherry picked from commitc4ca059dee)
This commit is contained in:
parent
1fddd2dbeb
commit
acc3752a10
2 changed files with 19 additions and 1 deletions
|
|
@ -553,7 +553,7 @@
|
|||
"description": "ac/surface: fix an addrlib race condition on gfx9",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "df2cbdd2e321d198e973be21eea25e9b296cceff"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@
|
|||
|
||||
struct ac_addrlib {
|
||||
ADDR_HANDLE handle;
|
||||
simple_mtx_t lock;
|
||||
};
|
||||
|
||||
bool ac_modifier_has_dcc(uint64_t modifier)
|
||||
|
|
@ -503,11 +504,13 @@ struct ac_addrlib *ac_addrlib_create(const struct radeon_info *info,
|
|||
}
|
||||
|
||||
addrlib->handle = addrCreateOutput.hLib;
|
||||
simple_mtx_init(&addrlib->lock, mtx_plain);
|
||||
return addrlib;
|
||||
}
|
||||
|
||||
void ac_addrlib_destroy(struct ac_addrlib *addrlib)
|
||||
{
|
||||
simple_mtx_destroy(&addrlib->lock);
|
||||
AddrDestroy(addrlib->handle);
|
||||
free(addrlib);
|
||||
}
|
||||
|
|
@ -1829,7 +1832,12 @@ static int gfx9_compute_miptree(struct ac_addrlib *addrlib, const struct radeon_
|
|||
din.dataSurfaceSize = out.surfSize;
|
||||
din.firstMipIdInTail = out.firstMipIdInTail;
|
||||
|
||||
if (info->chip_class == GFX9)
|
||||
simple_mtx_lock(&addrlib->lock);
|
||||
ret = Addr2ComputeDccInfo(addrlib->handle, &din, &dout);
|
||||
if (info->chip_class == GFX9)
|
||||
simple_mtx_unlock(&addrlib->lock);
|
||||
|
||||
if (ret != ADDR_OK)
|
||||
return ret;
|
||||
|
||||
|
|
@ -1910,7 +1918,12 @@ static int gfx9_compute_miptree(struct ac_addrlib *addrlib, const struct radeon_
|
|||
assert(surf->tile_swizzle == 0);
|
||||
assert(surf->u.gfx9.color.dcc.pipe_aligned || surf->u.gfx9.color.dcc.rb_aligned);
|
||||
|
||||
if (info->chip_class == GFX9)
|
||||
simple_mtx_lock(&addrlib->lock);
|
||||
ret = Addr2ComputeDccInfo(addrlib->handle, &din, &dout);
|
||||
if (info->chip_class == GFX9)
|
||||
simple_mtx_unlock(&addrlib->lock);
|
||||
|
||||
if (ret != ADDR_OK)
|
||||
return ret;
|
||||
|
||||
|
|
@ -2010,7 +2023,12 @@ static int gfx9_compute_miptree(struct ac_addrlib *addrlib, const struct radeon_
|
|||
else
|
||||
cin.swizzleMode = in->swizzleMode;
|
||||
|
||||
if (info->chip_class == GFX9)
|
||||
simple_mtx_lock(&addrlib->lock);
|
||||
ret = Addr2ComputeCmaskInfo(addrlib->handle, &cin, &cout);
|
||||
if (info->chip_class == GFX9)
|
||||
simple_mtx_unlock(&addrlib->lock);
|
||||
|
||||
if (ret != ADDR_OK)
|
||||
return ret;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue