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/presentproto.h>
56 #include "xdbg_types.h"
57 #include "xdbg_evlog_present.h"
58 #include "xdbg_evlog.h"
61 _EvlogRequestPresent (EvlogInfo *evinfo, int detail_level, char *reply, int *len)
63 xReq *req = evinfo->req.ptr;
69 xPresentPixmapReq *stuff = (xPresentPixmapReq *)req;
70 REPLY (": window(0x%x) pixmap(0x%x) (s,v,u)(%u,0x%x,0x%x) x,y(%d,%d) crtc(%u) wait(0x%x) idle(0x%x) op(0x%x) (t,d,r)(%u,%u,%u)",
71 (unsigned int)stuff->window,
72 (unsigned int)stuff->pixmap,
73 (unsigned int)stuff->serial,
74 (unsigned int)stuff->valid,
75 (unsigned int)stuff->update,
78 (unsigned int)stuff->target_crtc,
79 (unsigned int)stuff->wait_fence,
80 (unsigned int)stuff->idle_fence,
81 (unsigned int)stuff->options,
82 (unsigned int)stuff->target_msc,
83 (unsigned int)stuff->divisor,
84 (unsigned int)stuff->remainder);
89 case X_PresentNotifyMSC:
91 xPresentNotifyMSCReq *stuff = (xPresentNotifyMSCReq *)req;
92 REPLY (": window(0x%x) serial(%u) target_msc(%lu) divisor(%lu) remainder(%lu)",
93 (unsigned int)stuff->window,
94 (unsigned int)stuff->serial,
95 (unsigned long)stuff->target_msc,
96 (unsigned long)stuff->divisor,
97 (unsigned long)stuff->remainder);
102 case X_PresentSelectInput :
104 xPresentSelectInputReq *stuff = (xPresentSelectInputReq *)req;
105 REPLY (": eid(0x%x) window(0x%x) eventMask (0x%x)",
106 (unsigned int)stuff->eid,
107 (unsigned int)stuff->window,
108 (unsigned int)stuff->eventMask);
113 case X_PresentQueryCapabilities :
115 xPresentQueryCapabilitiesReq *stuff = (xPresentQueryCapabilitiesReq *)req;
116 REPLY (": target(0x%x)",
117 (unsigned int)stuff->target);
131 _EvlogEventPresent (EvlogInfo *evinfo, int first_base, int detail_level, char *reply, int *len)
133 xEvent *evt = evinfo->evt.ptr;
135 switch ((evt->u.u.type & 0x7F) - first_base)
138 case PresentConfigureNotify:
140 xPresentConfigureNotify *stuff = (xPresentConfigureNotify *) evt;
141 REPLY (": window(0x%x)(%ux%u+%d+%d) off x,y (%d,%d) pximap width(%u) height(%u) flags(0x%x)",
142 (unsigned int)stuff->window,
143 (unsigned int)stuff->width,
144 (unsigned int)stuff->height,
149 (unsigned int)stuff->pixmap_width,
150 (unsigned int)stuff->pixmap_height,
151 (unsigned int)stuff->pixmap_flags);
153 evinfo->evt.size = sizeof (xPresentConfigureNotify);
158 case PresentCompleteNotify:
160 xPresentCompleteNotify *stuff = (xPresentCompleteNotify *) evt;
161 REPLY (": window(0x%x) serial(0x%x) kind(%u) mode(%u) ust(%lu)",
162 (unsigned int)stuff->window,
163 (unsigned int)stuff->serial,
164 (unsigned int)stuff->kind,
165 (unsigned int)stuff->mode,
166 (unsigned long)stuff->ust);
168 evinfo->evt.size = sizeof (xPresentCompleteNotify);
173 case PresentIdleNotify:
175 xPresentIdleNotify *stuff = (xPresentIdleNotify *) evt;
176 REPLY (": window(0x%x) serial(0x%x) pixmap(0x%x) idle_fence(0x%x)",
177 (unsigned int)stuff->window,
178 (unsigned int)stuff->serial,
179 (unsigned int)stuff->pixmap,
180 (unsigned int)stuff->idle_fence);
182 evinfo->evt.size = sizeof (xPresentIdleNotify);
187 case PresentRedirectNotify:
190 xPresentRedirectNotify *stuff = (xPresentRedirectNotify *) evt;
191 REPLY (": window(0x%x) pixmap(0x%x) serial(%u) valid(0x%x) update(0x%x) x,y_off(%d,%d) target_crtc(%u) wait_fence(0x%x) idle_fence(0x%x) options(0x%x) target_msc(%u) divisor(%u) remainder(%u)",
192 (unsigned int)stuff->pixmap,
193 (unsigned int)stuff->drawable,
194 (unsigned int)stuff->serial,
195 (unsigned int)stuff->valid_region,
196 (unsigned int)stuff->update_region,
199 (unsigned int)stuff->target_crtc,
200 (unsigned int)stuff->wait_fence,
201 (unsigned int)stuff->idle_fence,
202 (unsigned int)stuff->options,
203 (unsigned int)stuff->target_msc,
204 (unsigned int)stuff->divisor,
205 (unsigned int)stuff->remainder);
207 evinfo->evt.size = sizeof (xPresentRedirectNotify);
221 _EvlogReplyPresent (EvlogInfo *evinfo, int detail_level, char *reply, int *len)
223 xGenericReply *rep = evinfo->rep.ptr;
225 switch (evinfo->rep.reqData)
227 case X_PresentQueryCapabilities:
229 if (evinfo->rep.isStart)
231 xPresentQueryCapabilitiesReply *stuff = (xPresentQueryCapabilitiesReply *)rep;
232 REPLY (": capabilities(0x%x)",
233 (unsigned int)stuff->capabilities);
251 xDbgEvlogPresentGetBase (ExtensionInfo *extinfo)
254 RETURN_IF_FAIL (extinfo != NULL);
256 extinfo->req_func = _EvlogRequestPresent;
257 extinfo->evt_func = _EvlogEventPresent;
258 extinfo->rep_func = _EvlogReplyPresent;
260 ExtensionEntry *xext = CheckExtension (PRESENT_NAME);
261 RETURN_IF_FAIL (xext != NULL);
262 RETURN_IF_FAIL (extinfo != NULL);
264 extinfo->opcode = xext->base;
265 extinfo->evt_base = xext->eventBase;
266 extinfo->err_base = xext->errorBase;
267 extinfo->req_func = _EvlogRequestPresent;
268 extinfo->evt_func = _EvlogEventPresent;
269 extinfo->rep_func = _EvlogReplyPresent;