summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorRami Ylimäki <rami.ylimaki@vincit.fi>2010-10-27 16:59:06 +0300
committerErkki Seppälä <erkki.seppala@vincit.fi>2012-04-18 12:31:24 +0300
commite83388cc70e21e7f377ed2e417d04469e23eb706 (patch)
treedfbd34d2f494110e91ae6700a37417e336691577 /render
parent96864bfa951ea8bf4ab697753fc62c6a97598bc0 (diff)
render: Report pixmap usage of pictures 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 'render')
-rw-r--r--render/picture.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/render/picture.c b/render/picture.c
index 2fd13fc37..24b6ba0b6 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -591,6 +591,27 @@ PictureParseCmapPolicy(const char *name)
return PictureCmapPolicyInvalid;
}
+/** @see GetDefaultBytes */
+static void
+GetPictureBytes(pointer value, XID id, ResourceSizePtr size)
+{
+ PicturePtr picture = value;
+
+ /* Currently only pixmap bytes are reported to clients. */
+ size->resourceSize = 0;
+
+ /* Calculate pixmap reference sizes. */
+ size->pixmapRefSize = 0;
+ if (picture->pDrawable && (picture->pDrawable->type == DRAWABLE_PIXMAP))
+ {
+ SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(RT_PIXMAP);
+ ResourceSizeRec pixmapSize = { 0, 0 };
+ PixmapPtr pixmap = (PixmapPtr)picture->pDrawable;
+ pixmapSizeFunc(pixmap, pixmap->drawable.id, &pixmapSize);
+ size->pixmapRefSize += pixmapSize.pixmapRefSize;
+ }
+}
+
Bool
PictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
{
@@ -602,6 +623,7 @@ PictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
PictureType = CreateNewResourceType(FreePicture, "PICTURE");
if (!PictureType)
return FALSE;
+ SetResourceTypeSizeFunc(PictureType, GetPictureBytes);
PictFormatType = CreateNewResourceType(FreePictFormat, "PICTFORMAT");
if (!PictFormatType)
return FALSE;