1 /**************************************************************************
5 Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
7 Contact: Boram Park <boram1288.park@samsung.com>
8 Sangjin LEE <lsj119@samsung.com>
10 Permission is hereby granted, free of charge, to any person obtaining a
11 copy of this software and associated documentation files (the
12 "Software"), to deal in the Software without restriction, including
13 without limitation the rights to use, copy, modify, merge, publish,
14 distribute, sub license, and/or sell copies of the Software, and to
15 permit persons to whom the Software is furnished to do so, subject to
16 the following conditions:
18 The above copyright notice and this permission notice (including the
19 next paragraph) shall be included in all copies or substantial portions
22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
25 IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
26 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
27 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
28 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 **************************************************************************/
39 #include <sys/types.h>
40 #include <sys/fcntl.h>
47 #include <sys/socket.h>
48 #include <linux/socket.h>
50 #ifdef HAS_GETPEERUCRED
56 #include <X11/Xatom.h>
57 #include <X11/extensions/XI2proto.h>
58 #include <windowstr.h>
63 #include <compositeext.h>
66 #include "xdbg_module_types.h"
70 static int sum_pix_size = 0;
73 _findRtWindow (pointer value, XID id, pointer cdata)
75 WindowPtr pWin = value;
76 ScreenPtr pScreen = pWin->drawable.pScreen;
78 if (pWin->viewable && pWin->realized)
80 ErrorF ("xid:0x%x geo:(%5d,%5d,%5d,%5d) bpp:%2d viewable:%d realized:%d ",
82 pWin->drawable.x, pWin->drawable.y, pWin->drawable.width, pWin->drawable.height,
83 pWin->drawable.bitsPerPixel,
86 if (pWin->parent->parent)
87 ErrorF ("border_id:0x%x ",(unsigned int)(pWin->parent->parent)->drawable.id);
89 PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
90 PixmapPtr pScrnPixmap = (*pScreen->GetScreenPixmap) (pScreen);
91 if (pPixmap == pScrnPixmap)
93 ErrorF ("flip_draw:1 ");
101 _findRtCompWindow (pointer value, XID id, pointer cdata)
103 WindowPtr pWin = value;
104 WindowPtr pChild = NULL;
105 WindowPtr pGrandChild = NULL;
106 ScreenPtr pScreen = pWin->drawable.pScreen;
107 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
108 SECPtr pSec = SECPTR (pScrn);
109 PropertyPtr pProp = NULL;
112 if (pWin->viewable && pWin->realized)
114 ErrorF ("xid:0x%x geo:(%5d,%5d,%5d,%5d) bpp:%2d viewable:%d realized:%d ",
115 (unsigned int)pWin->drawable.id,
116 pWin->drawable.x, pWin->drawable.y, pWin->drawable.width, pWin->drawable.height,
117 pWin->drawable.bitsPerPixel,
121 /* if pWin->child->child has a dri2 atom, the window is 3D window */
122 for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib)
124 for (pGrandChild = pChild->firstChild; pGrandChild; pGrandChild = pGrandChild->nextSib)
126 rc = dixLookupProperty(&pProp, pGrandChild, pSec->atom_use_dri2, serverClient, DixReadAccess);
129 ErrorF ("dri2_draw:1 ");
141 _findRtPixmap (pointer value, XID id, pointer cdata)
143 PixmapPtr pPix = value;
145 ErrorF ("xid:0x%x geo:(%5d,%5d,%5d,%5d) bpp:%2d size:%8d draw_id:0x%x\n",
147 pPix->drawable.x, pPix->drawable.y, pPix->drawable.width, pPix->drawable.height,
148 pPix->drawable.bitsPerPixel,
149 pPix->devKind*pPix->drawable.height/1024,
150 (unsigned int)pPix->drawable.id);
151 sum_pix_size = sum_pix_size + (pPix->devKind*pPix->drawable.height);
155 xDbgModuleRList (XDbgModule *pMod, char *reply, int *len)
157 SECPtr pSec = SECPTR (scrn);
161 bufsize = currentMaxClients * (100 + 1) + 30;
162 out = tmp = malloc (bufsize);
166 for (i = 1; i < currentMaxClients && (tmp < out+bufsize); i++)
168 ClientPtr pClient = clients[i];
169 ModuleClientInfo *info;
174 info = GetClientInfo (pClient);
179 ErrorF(
\r\r"INDEX PID CMD\n");
180 ErrorF(
\r\r"%6d %6d %10s\n", info->index, info->pid, info->command);
181 ErrorF(
\r\r" >> WINDOWS\n");
182 FindClientResourcesByType (pClient, RT_WINDOW, _findRtWindow, pClient);
183 ErrorF(
\r\r" >> CompositeClientWindow\n");
184 FindClientResourcesByType (pClient, CompositeClientWindowType, _findRtCompWindow, pClient);
185 ErrorF(
\r\r" >> PIXMAPS\n");
187 FindClientResourcesByType (pClient, RT_PIXMAP, _findRtPixmap, pClient);
188 ErrorF(
\r\r" SUM mem: %d\n", sum_pix_size/1024);
193 CREATE_PIXMAP_USAGE_BACKING_PIXMAP
194 CREATE_PIXMAP_USAGE_OVERLAY
195 CREATE_PIXMAP_USAGE_DRI2_FILP_BACK
196 CREATE_PIXMAP_USAGE_FB
197 CREATE_PIXMAP_USAGE_SUB_FB
198 CREATE_PIXMAP_USAGE_DRI2_BACK
200 ErrorF ("==== sum of pixmap memory ====\n");
201 ErrorF ("Normal pixmap = %d\n", pSec->pix_normal/1024);
202 ErrorF ("CREATE_PIXMAP_USAGE_BACKING_PIXMAP = %d\n", pSec->pix_backing_pixmap/1024);
203 ErrorF ("CREATE_PIXMAP_USAGE_OVERLAY = %d\n", pSec->pix_overlay/1024);
204 ErrorF ("CREATE_PIXMAP_USAGE_DRI2_FILP_BACK = %d\n", pSec->pix_dri2_flip_back/1024);
205 ErrorF ("CREATE_PIXMAP_USAGE_FB = %d\n", pSec->pix_fb/1024);
206 ErrorF ("CREATE_PIXMAP_USAGE_SUB_FB = %d\n", pSec->pix_sub_fb/1024);
207 ErrorF ("CREATE_PIXMAP_USAGE_DRI2_BACK = %d\n", pSec->pix_dri2_back/1024);
208 ErrorF ("TOTAL = %d\n",
209 (pSec->pix_normal+pSec->pix_backing_pixmap+pSec->pix_overlay+pSec->pix_dri2_flip_back+pSec->pix_fb+pSec->pix_sub_fb+pSec->pix_dri2_back)/1024);
210 ErrorF ("==============================\n");
217 xDbgModuleRList (XDbgModule *pMod, char *reply, int *len)
219 XDBG_REPLY ("rlist : Not implemented.\n");