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 <dri2/dri2.h>
55 #include <X11/extensions/dri2proto.h>
58 #include "xdbg_types.h"
59 #include "xdbg_evlog_dri2.h"
62 _EvlogRequestDri2 (xReq *req, char *reply, int *len)
68 case X_DRI2CreateDrawable:
70 xDRI2CreateDrawableReq *stuff = (xDRI2CreateDrawableReq *)req;
71 REPLY (": XID(0x%lx)",
77 case X_DRI2DestroyDrawable:
79 xDRI2DestroyDrawableReq *stuff = (xDRI2DestroyDrawableReq *)req;
80 REPLY (": XID(0x%lx)",
86 case X_DRI2GetBuffers:
88 xDRI2GetBuffersReq *stuff = (xDRI2GetBuffersReq *)req;
89 REPLY (": XID(0x%lx) Count(%ld)",
96 case X_DRI2CopyRegion:
98 xDRI2CopyRegionReq *stuff = (xDRI2CopyRegionReq *)req;
99 REPLY (": XID(0x%lx) Region(0x%lx) src(0x%lx) dst(0x%lx)",
108 case X_DRI2GetBuffersWithFormat:
110 xDRI2GetBuffersReq *stuff = (xDRI2GetBuffersReq *)req;
111 REPLY (": XID(0x%lx) count(%ld)",
119 case X_DRI2SwapBuffers:
121 xDRI2SwapBuffersReq *stuff = (xDRI2SwapBuffersReq *)req;
122 REPLY (": XID(0x%lx) msc(0x%lx/0x%lx) divisor(0x%lx/0x%lx) remainder(0x%lx/0x%lx)",
124 stuff->target_msc_hi,
125 stuff->target_msc_lo,
129 stuff->remainder_lo);
134 case X_DRI2SwapInterval:
136 xDRI2SwapIntervalReq *stuff = (xDRI2SwapIntervalReq *)req;
137 REPLY (": XID(0x%lx) Interval(%ld)",
144 case X_DRI2SwapBuffersWithRegion:
146 xDRI2SwapBuffersWithRegionReq *stuff = (xDRI2SwapBuffersWithRegionReq *)req;
147 REPLY (": XID(0x%lx) Region(0x%lx)",
163 _EvlogEventDri2 (xEvent *evt, int first_base, char *reply, int *len)
167 switch ((stuff->u.u.type & 0x7F) - first_base)
169 case DRI2_BufferSwapComplete:
171 xDRI2BufferSwapComplete *stuff = (xDRI2BufferSwapComplete *) evt;
172 REPLY (": XID(0x%lx) ust(0x%lx/0x%lx) msc(0x%lx/0x%lx) sbc(0x%lx/0x%lx)",
184 case DRI2_InvalidateBuffers:
186 xDRI2InvalidateBuffers *stuff = (xDRI2InvalidateBuffers *) evt;
187 REPLY (": XID(0x%lx)",
203 xDbgEvlogDri2GetBase (void *dpy, ExtensionInfo *extinfo)
206 Display *d = (Display*)dpy;
208 RETURN_IF_FAIL (d != NULL);
209 RETURN_IF_FAIL (extinfo != NULL);
211 if (!XQueryExtension(d, DRI2_NAME, &extinfo->opcode, &extinfo->evt_base, &extinfo->err_base))
213 fprintf (stderr, "[UTILX] no DRI2 extension. \n");
216 extinfo->req_func = _EvlogRequestDri2;
217 extinfo->evt_func = _EvlogEventDri2;
219 ExtensionEntry *xext = CheckExtension (DRI2_NAME);
220 RETURN_IF_FAIL (xext != NULL);
222 extinfo->opcode = xext->base;
223 extinfo->evt_base = xext->eventBase;
224 extinfo->err_base = xext->errorBase;
225 extinfo->req_func = _EvlogRequestDri2;
226 extinfo->evt_func = _EvlogEventDri2;