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>
51 #include <X11/Xatom.h>
53 #include <windowstr.h>
54 #include <X11/extensions/Xdamage.h>
55 #include <X11/extensions/damageproto.h>
58 #include "xdbg_types.h"
59 #include "xdbg_evlog_damage.h"
60 #include "xdbg_evlog.h"
63 _EvlogRequestDamage(EvlogInfo *evinfo, int detail_level, char *reply, int *len)
65 xReq *req = evinfo->req.ptr;
71 xDamageCreateReq *stuff = (xDamageCreateReq *)req;
72 REPLY (": XID(0x%x) Drawable(0x%x)",
73 (unsigned int)stuff->damage,
74 (unsigned int)stuff->drawable);
76 if (detail_level >= EVLOG_PRINT_DETAIL)
83 case XDamageReportRawRectangles: level = "DamageReportRawRegion"; break;
84 case XDamageReportDeltaRectangles: level = "DamageReportDeltaRegion"; break;
85 case XDamageReportBoundingBox: level = "DamageReportBoundingBox"; break;
86 case XDamageReportNonEmpty: level = "DamageReportNonEmpty"; break;
87 default: level = dlevel; snprintf (dlevel, 10, "%d", stuff->level); break;
99 xDamageDestroyReq *stuff = (xDamageDestroyReq *)req;
100 REPLY (": XID(0x%x)",
101 (unsigned int)stuff->damage);
114 _EvlogEventDamage (EvlogInfo *evinfo, int first_base, int detail_level, char *reply, int *len)
116 xEvent *evt = evinfo->evt.ptr;
118 switch ((evt->u.u.type & 0x7F) - first_base)
122 xDamageNotifyEvent *stuff = (xDamageNotifyEvent*)evt;
123 REPLY (": XID(0x%x) Damage(0x%x) area(%d,%d %dx%d) geo(%d,%d %dx%d)",
124 (unsigned int)stuff->drawable,
125 (unsigned int)stuff->damage,
132 stuff->geometry.width,
133 stuff->geometry.height);
135 if (detail_level >= EVLOG_PRINT_DETAIL)
138 REPLY ("%67s time(%lums) level(%d) sequence_num(%d)",
140 (unsigned long)stuff->timestamp,
142 stuff->sequenceNumber);
156 _EvlogReplyDamage (EvlogInfo *evinfo, int detail_level, char *reply, int *len)
159 xGenericReply *rep = evinfo->rep.ptr;
161 switch (evinfo->rep.reqData)
172 xDbgEvlogDamageGetBase (ExtensionInfo *extinfo)
175 RETURN_IF_FAIL (extinfo != NULL);
177 extinfo->req_func = _EvlogRequestDamage;
178 extinfo->evt_func = _EvlogEventDamage;
179 extinfo->rep_func = _EvlogReplyDamage;
181 ExtensionEntry *xext = CheckExtension (DAMAGE_NAME);
182 RETURN_IF_FAIL (xext != NULL);
183 RETURN_IF_FAIL (extinfo != NULL);
185 extinfo->opcode = xext->base;
186 extinfo->evt_base = xext->eventBase;
187 extinfo->err_base = xext->errorBase;
188 extinfo->req_func = _EvlogRequestDamage;
189 extinfo->evt_func = _EvlogEventDamage;
190 extinfo->rep_func = _EvlogReplyDamage;