Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into pci-rework

This commit is contained in:
Ian Romanick 2006-07-31 12:30:30 -07:00
commit 65dc25d8f8
3 changed files with 64 additions and 12 deletions

View File

@ -19,6 +19,8 @@
#include "swaprep.h" #include "swaprep.h"
#include <X11/extensions/XResproto.h> #include <X11/extensions/XResproto.h>
#include "pixmapstr.h" #include "pixmapstr.h"
#include "windowstr.h"
#include "gcstruct.h"
#include "modinit.h" #include "modinit.h"
static int static int
@ -154,6 +156,7 @@ ProcXResQueryClientResources (ClientPtr client)
swapl (&rep.length, n); swapl (&rep.length, n);
swapl (&rep.num_types, n); swapl (&rep.num_types, n);
} }
WriteToClient (client,sizeof(xXResQueryClientResourcesReply),(char*)&rep); WriteToClient (client,sizeof(xXResQueryClientResourcesReply),(char*)&rep);
if(num_types) { if(num_types) {
@ -185,13 +188,54 @@ ProcXResQueryClientResources (ClientPtr client)
return (client->noClientException); return (client->noClientException);
} }
static unsigned long
ResGetApproxPixmapBytes (PixmapPtr pix)
{
unsigned long nPixels;
int bytesPerPixel;
bytesPerPixel = pix->drawable.bitsPerPixel>>3;
nPixels = pix->drawable.width * pix->drawable.height;
/* Divide by refcnt as pixmap could be shared between clients,
* so total pixmap mem is shared between these.
*/
return ( nPixels * bytesPerPixel ) / pix->refcnt;
}
static void static void
ResFindPixmaps (pointer value, XID id, pointer cdata) ResFindPixmaps (pointer value, XID id, pointer cdata)
{ {
unsigned long *bytes = (unsigned long *)cdata; unsigned long *bytes = (unsigned long *)cdata;
PixmapPtr pix = (PixmapPtr)value; PixmapPtr pix = (PixmapPtr)value;
*bytes += (pix->devKind * pix->drawable.height); *bytes += ResGetApproxPixmapBytes(pix);
}
static void
ResFindWindowPixmaps (pointer value, XID id, pointer cdata)
{
unsigned long *bytes = (unsigned long *)cdata;
WindowPtr pWin = (WindowPtr)value;
if (pWin->backgroundState == BackgroundPixmap)
*bytes += ResGetApproxPixmapBytes(pWin->background.pixmap);
if (pWin->border.pixmap != NULL && !pWin->borderIsPixel)
*bytes += ResGetApproxPixmapBytes(pWin->border.pixmap);
}
static void
ResFindGCPixmaps (pointer value, XID id, pointer cdata)
{
unsigned long *bytes = (unsigned long *)cdata;
GCPtr pGC = (GCPtr)value;
if (pGC->stipple != NULL)
*bytes += ResGetApproxPixmapBytes(pGC->stipple);
if (pGC->tile.pixmap != NULL && !pGC->tileIsPixel)
*bytes += ResGetApproxPixmapBytes(pGC->tile.pixmap);
} }
static int static int
@ -218,6 +262,24 @@ ProcXResQueryClientPixmapBytes (ClientPtr client)
FindClientResourcesByType(clients[clientID], RT_PIXMAP, ResFindPixmaps, FindClientResourcesByType(clients[clientID], RT_PIXMAP, ResFindPixmaps,
(pointer)(&bytes)); (pointer)(&bytes));
/*
* Make sure win background pixmaps also held to account.
*/
FindClientResourcesByType(clients[clientID], RT_WINDOW,
ResFindWindowPixmaps,
(pointer)(&bytes));
/*
* GC Tile & Stipple pixmaps too.
*/
FindClientResourcesByType(clients[clientID], RT_GC,
ResFindGCPixmaps,
(pointer)(&bytes));
#ifdef COMPOSITE
/* FIXME: include composite pixmaps too */
#endif
rep.type = X_Reply; rep.type = X_Reply;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
rep.length = 0; rep.length = 0;

View File

@ -40,7 +40,6 @@ XORG_LIBS = \
libosandcommon.la \ libosandcommon.la \
rac/librac.a \ rac/librac.a \
parser/libxf86config.a \ parser/libxf86config.a \
dummylib/libdummy.a \
dixmods/libdixmods.la \ dixmods/libdixmods.la \
@XORG_LIBS@ @XORG_LIBS@

View File

@ -2,7 +2,7 @@
# libdummy-nonserver.a contains additional routines normally found in the # libdummy-nonserver.a contains additional routines normally found in the
# server for use in building the utilities like scanpci & the config tools # server for use in building the utilities like scanpci & the config tools
noinst_LIBRARIES = libdummy.a libdummy-nonserver.a noinst_LIBRARIES = libdummy-nonserver.a
INCLUDES = $(XORG_INCS) INCLUDES = $(XORG_INCS)
@ -12,15 +12,6 @@ if NEED_STRLCAT
STRL_SRCS = $(top_srcdir)/os/strlcat.c $(top_srcdir)/os/strlcpy.c STRL_SRCS = $(top_srcdir)/os/strlcat.c $(top_srcdir)/os/strlcpy.c
endif endif
libdummy_a_SOURCES = getvalidbios.c getemptypci.c \
pcitestmulti.c xf86allocscripi.c \
xf86addrestolist.c xf86drvmsg.c xf86drvmsgverb.c \
xf86getverb.c \
xf86opt.c xf86screens.c xf86servisinit.c xf86verbose.c \
#xf86errorf.c xf86errorfverb.c xf86msg.c xf86msgverb.c \
#logvwrite.c verrorf.c xf86info.c xalloc.c fatalerror.c \
#$(srcdir)/../os-support/shared/sigiostubs.c
libdummy_nonserver_a_SOURCES = \ libdummy_nonserver_a_SOURCES = \
fatalerror.c \ fatalerror.c \
getvalidbios.c \ getvalidbios.c \