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>
This commit is contained in:
parent
e83388cc70
commit
b8d0d19a6d
14
Xext/xres.c
14
Xext/xres.c
|
@ -28,6 +28,7 @@
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "picturestr.h"
|
#include "picturestr.h"
|
||||||
|
#include "compint.h"
|
||||||
|
|
||||||
/** @brief Holds fragments of responses for ConstructClientIds.
|
/** @brief Holds fragments of responses for ConstructClientIds.
|
||||||
*
|
*
|
||||||
|
@ -342,6 +343,14 @@ ResFindPicturePixmaps(pointer value, XID id, pointer cdata)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ResFindCompositeClientWindowPixmaps (pointer value, XID id, pointer cdata)
|
||||||
|
{
|
||||||
|
#ifdef COMPOSITE
|
||||||
|
ResFindResourcePixmaps(value, id, CompositeClientWindowType, cdata);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ProcXResQueryClientPixmapBytes(ClientPtr client)
|
ProcXResQueryClientPixmapBytes(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
@ -384,7 +393,10 @@ ProcXResQueryClientPixmapBytes(ClientPtr client)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef COMPOSITE
|
#ifdef COMPOSITE
|
||||||
/* FIXME: include composite pixmaps too */
|
/* Composite extension client window pixmaps. */
|
||||||
|
FindClientResourcesByType(clients[clientID], CompositeClientWindowType,
|
||||||
|
ResFindCompositeClientWindowPixmaps,
|
||||||
|
(pointer)(&bytes));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rep.type = X_Reply;
|
rep.type = X_Reply;
|
||||||
|
|
|
@ -497,6 +497,28 @@ SProcCompositeDispatch(ClientPtr client)
|
||||||
return BadRequest;
|
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
|
void
|
||||||
CompositeExtensionInit(void)
|
CompositeExtensionInit(void)
|
||||||
{
|
{
|
||||||
|
@ -529,6 +551,9 @@ CompositeExtensionInit(void)
|
||||||
if (!CompositeClientWindowType)
|
if (!CompositeClientWindowType)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
SetResourceTypeSizeFunc(CompositeClientWindowType,
|
||||||
|
GetCompositeClientWindowBytes);
|
||||||
|
|
||||||
CompositeClientSubwindowsType = CreateNewResourceType
|
CompositeClientSubwindowsType = CreateNewResourceType
|
||||||
(FreeCompositeClientSubwindows, "CompositeClientSubwindows");
|
(FreeCompositeClientSubwindows, "CompositeClientSubwindows");
|
||||||
if (!CompositeClientSubwindowsType)
|
if (!CompositeClientSubwindowsType)
|
||||||
|
|
Loading…
Reference in New Issue