mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-02 18:10:17 +01:00
frontend/dri: clean up updating dri_drawable::refcount
Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19741>
This commit is contained in:
parent
7d5b1cd02c
commit
f2c4aba9e1
2 changed files with 7 additions and 17 deletions
|
|
@ -279,21 +279,11 @@ dri_unbind_context(struct dri_context *ctx)
|
|||
|
||||
if (ctx->draw || ctx->read) {
|
||||
assert(ctx->draw);
|
||||
if (ctx->draw->refcount == 0) {
|
||||
/* ERROR!!! */
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
dri_put_drawable(ctx->draw);
|
||||
|
||||
if (ctx->read != ctx->draw) {
|
||||
if (ctx->read->refcount == 0) {
|
||||
/* ERROR!!! */
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if (ctx->read != ctx->draw)
|
||||
dri_put_drawable(ctx->read);
|
||||
}
|
||||
|
||||
ctx->draw = NULL;
|
||||
ctx->read = NULL;
|
||||
|
|
|
|||
|
|
@ -207,13 +207,13 @@ dri_destroy_drawable(struct dri_drawable *drawable)
|
|||
void
|
||||
dri_put_drawable(struct dri_drawable *drawable)
|
||||
{
|
||||
if (drawable) {
|
||||
drawable->refcount--;
|
||||
if (drawable->refcount)
|
||||
return;
|
||||
if (drawable) {
|
||||
int refcount = --drawable->refcount;
|
||||
assert(refcount >= 0);
|
||||
|
||||
dri_destroy_drawable(drawable);
|
||||
}
|
||||
if (!refcount)
|
||||
dri_destroy_drawable(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue