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/dri3proto.h>
56 #include "xdbg_types.h"
57 #include "xdbg_evlog_dri3.h"
58 #include "xdbg_evlog.h"
61 _EvlogRequestDri3 (EvlogInfo *evinfo, int detail_level, char *reply, int *len)
63 xReq *req = evinfo->req.ptr;
67 case X_DRI3PixmapFromBuffer:
69 xDRI3PixmapFromBufferReq *stuff = (xDRI3PixmapFromBufferReq *)req;
70 REPLY (": Pixmap(0x%x) drawable(0x%x) size(%u) width(%u) height(%u) stride(%u) depth(%u) bpp(%u)",
71 (unsigned int)stuff->pixmap,
72 (unsigned int)stuff->drawable,
73 (unsigned int)stuff->size,
74 (unsigned int)stuff->width,
75 (unsigned int)stuff->height,
76 (unsigned int)stuff->stride,
77 (unsigned int)stuff->depth,
78 (unsigned int)stuff->bpp);
83 case X_DRI3BufferFromPixmap:
85 xDRI3BufferFromPixmapReq *stuff = (xDRI3BufferFromPixmapReq *)req;
86 REPLY (": Pixmap(0x%x)",
87 (unsigned int)stuff->pixmap);
92 case X_DRI3FenceFromFD:
94 xDRI3FenceFromFDReq *stuff = (xDRI3FenceFromFDReq *)req;
95 REPLY (": drawable(0x%x) fence(0x%x) initially_triggered(%s)",
96 (unsigned int)stuff->drawable,
97 (unsigned int)stuff->fence,
98 stuff->initially_triggered?"True":"False");
103 case X_DRI3FDFromFence:
105 xDRI3FDFromFenceReq *stuff = (xDRI3FDFromFenceReq *)req;
106 REPLY (": drawable(0x%x) fence(0x%x)",
107 (unsigned int)stuff->drawable,
108 (unsigned int)stuff->fence);
122 _EvlogEventDri3 (EvlogInfo *evinfo, int first_base, int detail_level, char *reply, int *len)
124 xEvent *evt = evinfo->evt.ptr;
126 switch ((evt->u.u.type & 0x7F) - first_base)
137 _EvlogReplyDri3 (EvlogInfo *evinfo, int detail_level, char *reply, int *len)
139 xGenericReply *rep = evinfo->rep.ptr;
141 switch (evinfo->rep.reqData)
143 case X_DRI3BufferFromPixmap:
145 if (evinfo->rep.isStart)
147 xDRI3BufferFromPixmapReply *stuff = (xDRI3BufferFromPixmapReply *)rep;
148 REPLY (": nfd(%u) sequenceNumber(%u) size(%u) width(%u) height(%u) stride(%u) depth(%u) bpp(%u)",
149 (unsigned int)stuff->nfd,
150 (unsigned int)stuff->sequenceNumber,
151 (unsigned int)stuff->size,
152 (unsigned int)stuff->width,
153 (unsigned int)stuff->height,
154 (unsigned int)stuff->stride,
155 (unsigned int)stuff->depth,
156 (unsigned int)stuff->bpp);
166 case X_DRI3FDFromFence:
168 if (evinfo->rep.isStart)
170 xDRI3FDFromFenceReply *stuff = (xDRI3FDFromFenceReply *)rep;
171 REPLY (": nfd(%u) sequenceNumber(%u)",
172 (unsigned int)stuff->nfd,
173 (unsigned int)stuff->sequenceNumber);
191 xDbgEvlogDri3GetBase (ExtensionInfo *extinfo)
194 RETURN_IF_FAIL (extinfo != NULL);
196 extinfo->req_func = _EvlogRequestDri3;
197 extinfo->evt_func = _EvlogEventDri3;
198 extinfo->rep_func = _EvlogReplyDri3;
200 ExtensionEntry *xext = CheckExtension (DRI3_NAME);
201 RETURN_IF_FAIL (xext != NULL);
202 RETURN_IF_FAIL (extinfo != NULL);
204 extinfo->opcode = xext->base;
205 extinfo->evt_base = xext->eventBase;
206 extinfo->err_base = xext->errorBase;
207 extinfo->req_func = _EvlogRequestDri3;
208 extinfo->evt_func = _EvlogEventDri3;
209 extinfo->rep_func = _EvlogReplyDri3;