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>
55 #include <X11/extensions/Xvlib.h>
56 #include <X11/extensions/Xv.h>
57 #include <X11/extensions/Xvproto.h>
59 #include "xdbg_types.h"
60 #include "xdbg_evlog_xv.h"
61 #include "xdbg_evlog.h"
64 _EvlogRequestXv(EvlogInfo *evinfo, int detail_level, char *reply, int *len)
66 xReq *req = evinfo->req.ptr;
72 xvGrabPortReq *stuff = (xvGrabPortReq *)req;
73 REPLY (": XID(0x%lx)",
76 if (detail_level >= EVLOG_PRINT_DETAIL)
78 REPLY (" time(%lums)",
87 xvUngrabPortReq *stuff = (xvUngrabPortReq *)req;
88 REPLY (": XID(0x%lx)",
91 if (detail_level >= EVLOG_PRINT_DETAIL)
93 REPLY (" time(%lums)",
102 xvPutStillReq *stuff = (xvPutStillReq *)req;
103 REPLY (": XID(0x%lx) Drawable(0x%lx) GC(0x%lx) Vid(%d,%d %dx%d) Drw(%d,%d %dx%d)",
121 xvGetStillReq *stuff = (xvGetStillReq *)req;
122 REPLY (": XID(0x%lx) Drawable(0x%lx) GC(0x%lx) Vid(%d,%d %dx%d) Drw(%d,%d %dx%d)",
140 xvPutVideoReq *stuff = (xvPutVideoReq *)req;
141 REPLY (": XID(0x%lx) Drawable(0x%lx) GC(0x%lx) Vid(%d,%d %dx%d) Drw(%d,%d %dx%d)",
159 xvGetVideoReq *stuff = (xvGetVideoReq *)req;
160 REPLY (": XID(0x%lx) Drawable(0x%lx) GC(0x%lx) Vid(%d,%d %dx%d) Drw(%d,%d %dx%d)",
178 xvStopVideoReq *stuff = (xvStopVideoReq *)req;
179 REPLY (": XID(0x%lx) Drawable(0x%lx)",
186 case xv_SelectVideoNotify:
188 xvSelectVideoNotifyReq *stuff = (xvSelectVideoNotifyReq *)req;
189 REPLY (": XID(0x%lx)",
192 if (detail_level >= EVLOG_PRINT_DETAIL)
194 REPLY (" On/Off(%s)",
195 stuff->onoff ? "ON" : "OFF");
201 case xv_SelectPortNotify:
203 xvSelectPortNotifyReq *stuff = (xvSelectPortNotifyReq *)req;
204 REPLY (": XID(0x%lx)",
207 if (detail_level >= EVLOG_PRINT_DETAIL)
209 REPLY (" On/Off(%s)",
210 stuff->onoff ? "ON" : "OFF");
216 case xv_QueryBestSize:
218 xvQueryBestSizeReq *stuff = (xvQueryBestSizeReq *)req;
219 REPLY (": XID(0x%lx) VidSize(%dx%d) DrwSize(%dx%d)",
226 if (detail_level >= EVLOG_PRINT_DETAIL)
228 REPLY (" motion(%d)",
235 case xv_SetPortAttribute:
237 xvSetPortAttributeReq *stuff = (xvSetPortAttributeReq *)req;
238 REPLY (": XID(0x%lx) ",
241 REPLY (" Attribute");
242 reply = xDbgGetAtom(stuff->attribute, evinfo, reply, len);
244 if (detail_level >= EVLOG_PRINT_DETAIL)
246 REPLY (" value(%ld)",
253 case xv_GetPortAttribute:
255 xvGetPortAttributeReq *stuff = (xvGetPortAttributeReq *)req;
256 REPLY (": XID(0x%lx)",
259 REPLY (" Attribute");
260 reply = xDbgGetAtom(stuff->attribute, evinfo, reply, len);
267 xvPutImageReq *stuff = (xvPutImageReq *)req;
268 REPLY (": XID(0x%lx) Drawable(0x%lx) GC(0x%lx) ID(%lx) buf(%dx%d) src(%d,%d %dx%d) drw(%d,%d %dx%d)",
289 xvShmPutImageReq *stuff = (xvShmPutImageReq *)req;
290 REPLY (": XID(0x%lx) Drawable(0x%lx) GC(0x%lx) ID(%lx) buf(%dx%d) src(%d,%d %dx%d) drw(%d,%d %dx%d)",
306 if (detail_level >= EVLOG_PRINT_DETAIL)
309 REPLY ("%67s shmseg(0x%lx) offset(%ld) send_event(%s)",
313 stuff->send_event ? "YES" : "NO");
327 _EvlogEventXv (EvlogInfo *evinfo, int first_base, int detail_level, char *reply, int *len)
329 xEvent *evt = evinfo->evt.ptr;
331 switch ((evt->u.u.type & 0x7F) - first_base)
335 XvVideoNotifyEvent *stuff = (XvVideoNotifyEvent *) evt;
336 REPLY (": XID(0x%lx) portID(0x%lx)",
340 if (detail_level >= EVLOG_PRINT_DETAIL)
342 REPLY (" serial(%lu) reason(%lu) time(%lums)",
353 XvPortNotifyEvent *stuff = (XvPortNotifyEvent *) evt;
354 REPLY (": XID(0x%lx) Value(%ld)",
358 REPLY (" Attribute");
359 reply = xDbgGetAtom(stuff->attribute, evinfo, reply, len);
361 if (detail_level >= EVLOG_PRINT_DETAIL)
363 REPLY (" serial(%lu) value(%ld) time(%lums)",
380 _EvlogReplyXv (EvlogInfo *evinfo, int detail_level, char *reply, int *len)
382 xGenericReply *rep = evinfo->rep.ptr;
384 switch (evinfo->rep.reqData)
386 case xv_QueryBestSize:
388 if (evinfo->rep.isStart)
390 xvQueryBestSizeReply *stuff = (xvQueryBestSizeReply *)rep;
391 REPLY (": actualSize(%dx%d)",
393 stuff->actual_height);
411 xDbgEvlogXvGetBase (ExtensionInfo *extinfo)
414 RETURN_IF_FAIL (extinfo != NULL);
416 extinfo->req_func = _EvlogRequestXv;
417 extinfo->evt_func = _EvlogEventXv;
418 extinfo->rep_func = _EvlogReplyXv;
420 ExtensionEntry *xext = CheckExtension (XvName);
421 RETURN_IF_FAIL (xext != NULL);
422 RETURN_IF_FAIL (extinfo != NULL);
424 extinfo->opcode = xext->base;
425 extinfo->evt_base = xext->eventBase;
426 extinfo->err_base = xext->errorBase;
427 extinfo->req_func = _EvlogRequestXv;
428 extinfo->evt_func = _EvlogEventXv;
429 extinfo->rep_func = _EvlogReplyXv;