sna/dri: Hold a reference to the cached DRI2 buffer on the front buffer

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2012-06-26 14:59:37 +01:00
parent a87f2b9325
commit f306cd557e
1 changed files with 8 additions and 3 deletions

View File

@ -229,7 +229,7 @@ sna_dri_create_buffer(DrawablePtr drawable,
}
FreeResourceByType(drawable->id,
dri_drawable_type,
TRUE);
FALSE);
}
bo = sna_pixmap_set_dri(sna, pixmap);
@ -332,8 +332,9 @@ sna_dri_create_buffer(DrawablePtr drawable,
if (pixmap)
pixmap->refcnt++;
if (attachment == DRI2BufferFrontLeft)
(void)AddResource(drawable->id, dri_drawable_type, buffer);
if (attachment == DRI2BufferFrontLeft &&
AddResource(drawable->id, dri_drawable_type, buffer))
private->refcnt++;
return buffer;
@ -843,6 +844,10 @@ static int
sna_dri_drawable_gone(void *data, XID id)
{
DBG(("%s(%ld)\n", __FUNCTION__, (long)id));
_sna_dri_destroy_buffer(to_sna_from_pixmap(get_private(data)->pixmap),
data);
return Success;
}