summaryrefslogtreecommitdiff
path: root/glx
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2016-02-02 14:10:49 -0500
committerAdam Jackson <ajax@redhat.com>2016-06-21 11:11:54 -0400
commitce82ae1964b2115a780786676c614546297a79c9 (patch)
tree6c8f5ccdd718d0dad8ac5d5ae46740d8802b015b /glx
parent5d6ad0d3a7611c4dff2d79b6af9eb5c0885656ef (diff)
res: Account for GLXPixmap references too
GLX_EXT_tetxure_from_pixmap operates on a GLXPixmap, which takes a reference on the backing pixmap; that GLXPixmap might be long-lived, so we should account for it in ResQueryClientPixmapBytes. Acked-by: Michel Dänzer <michel.daenzer@amd.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'glx')
-rw-r--r--glx/glxext.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/glx/glxext.c b/glx/glxext.c
index 0de910936..d595a05cb 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -336,6 +336,23 @@ checkScreenVisuals(void)
return False;
}
+static void
+GetGLXDrawableBytes(void *value, XID id, ResourceSizePtr size)
+{
+ __GLXdrawable *draw = value;
+
+ size->resourceSize = 0;
+ size->pixmapRefSize = 0;
+ size->refCnt = 1;
+
+ if (draw->type == GLX_DRAWABLE_PIXMAP) {
+ SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(RT_PIXMAP);
+ ResourceSizeRec pixmapSize = { 0, };
+ pixmapSizeFunc((PixmapPtr)draw->pDraw, draw->pDraw->id, &pixmapSize);
+ size->pixmapRefSize += pixmapSize.pixmapRefSize;
+ }
+}
+
/*
** Initialize the GLX extension.
*/
@@ -365,6 +382,8 @@ GlxExtensionInit(void)
if (!__glXContextRes || !__glXDrawableRes)
return;
+ SetResourceTypeSizeFunc(__glXDrawableRes, GetGLXDrawableBytes);
+
if (!dixRegisterPrivateKey
(&glxClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(__GLXclientState)))
return;