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(void *dpy, EvlogInfo *evinfo, char *reply, int *len)
66 xReq *req = evinfo->req.ptr;
72 xvGrabPortReq *stuff = (xvGrabPortReq *)req;
73 REPLY (": XID(0x%lx)",
81 xvUngrabPortReq *stuff = (xvUngrabPortReq *)req;
82 REPLY (": XID(0x%lx)",
90 xvPutStillReq *stuff = (xvPutStillReq *)req;
91 REPLY (": XID(0x%lx) Drawable(0x%lx) GC(0x%lx) Vid(%d,%d %dx%d) Drw(%d,%d %dx%d)",
109 xvGetStillReq *stuff = (xvGetStillReq *)req;
110 REPLY (": XID(0x%lx) Drawable(0x%lx) GC(0x%lx) Vid(%d,%d %dx%d) Drw(%d,%d %dx%d)",
128 xvPutVideoReq *stuff = (xvPutVideoReq *)req;
129 REPLY (": XID(0x%lx) Drawable(0x%lx) GC(0x%lx) Vid(%d,%d %dx%d) Drw(%d,%d %dx%d)",
147 xvGetVideoReq *stuff = (xvGetVideoReq *)req;
148 REPLY (": XID(0x%lx) Drawable(0x%lx) GC(0x%lx) Vid(%d,%d %dx%d) Drw(%d,%d %dx%d)",
166 xvStopVideoReq *stuff = (xvStopVideoReq *)req;
167 REPLY (": XID(0x%lx) Drawable(0x%lx)",
174 case xv_SelectVideoNotify:
176 xvSelectVideoNotifyReq *stuff = (xvSelectVideoNotifyReq *)req;
177 REPLY (": XID(0x%lx) On/Off(%d)",
184 case xv_SelectPortNotify:
186 xvSelectPortNotifyReq *stuff = (xvSelectPortNotifyReq *)req;
187 REPLY (": XID(0x%lx) On/Off(%d)",
194 case xv_QueryBestSize:
196 xvQueryBestSizeReq *stuff = (xvQueryBestSizeReq *)req;
197 REPLY (": XID(0x%lx) VidSize(%dx%d) DrwSize(%dx%d)",
207 case xv_SetPortAttribute:
209 xvSetPortAttributeReq *stuff = (xvSetPortAttributeReq *)req;
210 REPLY (": XID(0x%lx) value(%ld)",
214 REPLY (" Attribute");
215 reply = xDbgGetAtom(dpy, stuff->attribute, reply, len);
220 case xv_GetPortAttribute:
222 xvGetPortAttributeReq *stuff = (xvGetPortAttributeReq *)req;
223 REPLY (": XID(0x%lx)",
226 REPLY (" Attribute");
227 reply = xDbgGetAtom(dpy, stuff->attribute, reply, len);
234 xvPutImageReq *stuff = (xvPutImageReq *)req;
235 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)",
256 xvShmPutImageReq *stuff = (xvShmPutImageReq *)req;
257 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) sendevent(%d)",
285 _EvlogEventXv (void *dpy, EvlogInfo *evinfo, int first_base, char *reply, int *len)
287 xEvent *evt = evinfo->evt.ptr;
289 switch ((evt->u.u.type & 0x7F) - first_base)
293 XvVideoNotifyEvent *stuff = (XvVideoNotifyEvent *) evt;
294 REPLY (": XID(0x%lx) reason(%ld) portID(0x%lx)",
304 XvPortNotifyEvent *stuff = (XvPortNotifyEvent *) evt;
305 REPLY (": XID(0x%lx) Value(%ld)",
309 REPLY (" Attribute");
310 reply = xDbgGetAtom(dpy, stuff->attribute, reply, len);
323 xDbgEvlogXvGetBase (void *dpy, ExtensionInfo *extinfo)
326 Display *d = (Display*)dpy;
328 RETURN_IF_FAIL (d != NULL);
329 RETURN_IF_FAIL (extinfo != NULL);
331 if (!XQueryExtension(d, XvName, &extinfo->opcode, &extinfo->evt_base, &extinfo->err_base))
333 XDBG_LOG ("no Xv extension. \n");
336 extinfo->req_func = _EvlogRequestXv;
337 extinfo->evt_func = _EvlogEventXv;
339 ExtensionEntry *xext = CheckExtension (XvName);
340 RETURN_IF_FAIL (xext != NULL);
342 extinfo->opcode = xext->base;
343 extinfo->evt_base = xext->eventBase;
344 extinfo->err_base = xext->errorBase;
345 extinfo->req_func = _EvlogRequestXv;
346 extinfo->evt_func = _EvlogEventXv;