summaryrefslogtreecommitdiff
path: root/composite
diff options
context:
space:
mode:
authorRami Ylimäki <rami.ylimaki@vincit.fi>2010-10-27 17:25:50 +0300
committerErkki Seppälä <erkki.seppala@vincit.fi>2012-04-18 12:31:27 +0300
commitb8d0d19a6d410776b53a41e7cae90f68d4b22bb7 (patch)
tree182e325f2b569272f7e3479cd73621eec8b77966 /composite
parente83388cc70e21e7f377ed2e417d04469e23eb706 (diff)
composite: Report pixmap usage of client windows to resource extension.
Signed-off-by: Erkki Seppälä <erkki.seppala@vincit.fi> Signed-off-by: Rami Ylimäki <rami.ylimaki@vincit.fi> Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Diffstat (limited to 'composite')
-rw-r--r--composite/compext.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/composite/compext.c b/composite/compext.c
index 940eed1fc..1d4d8bf97 100644
--- a/composite/compext.c
+++ b/composite/compext.c
@@ -497,6 +497,28 @@ SProcCompositeDispatch(ClientPtr client)
return BadRequest;
}
+/** @see GetDefaultBytes */
+static void
+GetCompositeClientWindowBytes(pointer value, XID id, ResourceSizePtr size)
+{
+ WindowPtr window = value;
+
+ /* Currently only pixmap bytes are reported to clients. */
+ size->resourceSize = 0;
+
+ /* Calculate pixmap reference sizes. */
+ size->pixmapRefSize = 0;
+ if (window->redirectDraw != RedirectDrawNone)
+ {
+ SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(RT_PIXMAP);
+ ResourceSizeRec pixmapSize = { 0, 0 };
+ ScreenPtr screen = window->drawable.pScreen;
+ PixmapPtr pixmap = screen->GetWindowPixmap(window);
+ pixmapSizeFunc(pixmap, pixmap->drawable.id, &pixmapSize);
+ size->pixmapRefSize += pixmapSize.pixmapRefSize;
+ }
+}
+
void
CompositeExtensionInit(void)
{
@@ -529,6 +551,9 @@ CompositeExtensionInit(void)
if (!CompositeClientWindowType)
return;
+ SetResourceTypeSizeFunc(CompositeClientWindowType,
+ GetCompositeClientWindowBytes);
+
CompositeClientSubwindowsType = CreateNewResourceType
(FreeCompositeClientSubwindows, "CompositeClientSubwindows");
if (!CompositeClientSubwindowsType)