mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-19 23:10:47 +02:00
kmsro: assert that scanout refcount is larger than 0
The dumb buffer backing the renderonly_scanout is only destroyed if the refcount reaches zero. If a driver does not correctly initialize the refcount, the refcount may be negative and the buffer will never be freed. Add an assert to ensure that drivers correctly initialize the refcount. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23743>
This commit is contained in:
parent
279d08a18a
commit
ee62f4629a
1 changed files with 1 additions and 0 deletions
|
|
@ -43,6 +43,7 @@ renderonly_scanout_destroy(struct renderonly_scanout *scanout,
|
|||
{
|
||||
struct drm_mode_destroy_dumb destroy_dumb = {0};
|
||||
|
||||
assert(p_atomic_read(&scanout->refcnt) > 0);
|
||||
if (p_atomic_dec_return(&scanout->refcnt))
|
||||
return;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue