mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 17:48:10 +02: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) {
|
if (ctx->draw || ctx->read) {
|
||||||
assert(ctx->draw);
|
assert(ctx->draw);
|
||||||
if (ctx->draw->refcount == 0) {
|
|
||||||
/* ERROR!!! */
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
dri_put_drawable(ctx->draw);
|
dri_put_drawable(ctx->draw);
|
||||||
|
|
||||||
if (ctx->read != ctx->draw) {
|
if (ctx->read != ctx->draw)
|
||||||
if (ctx->read->refcount == 0) {
|
|
||||||
/* ERROR!!! */
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
dri_put_drawable(ctx->read);
|
dri_put_drawable(ctx->read);
|
||||||
}
|
|
||||||
|
|
||||||
ctx->draw = NULL;
|
ctx->draw = NULL;
|
||||||
ctx->read = NULL;
|
ctx->read = NULL;
|
||||||
|
|
|
||||||
|
|
@ -207,13 +207,13 @@ dri_destroy_drawable(struct dri_drawable *drawable)
|
||||||
void
|
void
|
||||||
dri_put_drawable(struct dri_drawable *drawable)
|
dri_put_drawable(struct dri_drawable *drawable)
|
||||||
{
|
{
|
||||||
if (drawable) {
|
if (drawable) {
|
||||||
drawable->refcount--;
|
int refcount = --drawable->refcount;
|
||||||
if (drawable->refcount)
|
assert(refcount >= 0);
|
||||||
return;
|
|
||||||
|
|
||||||
dri_destroy_drawable(drawable);
|
if (!refcount)
|
||||||
}
|
dri_destroy_drawable(drawable);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue