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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user