mirror of
https://github.com/X11Libre/xserver.git
synced 2026-09-21 20:26:45 +00:00
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>
This commit is contained in:
parent
96864bfa95
commit
e83388cc70
4 changed files with 271 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue