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/Xrandr.h>
56 #include <X11/extensions/randrproto.h>
59 #include "xdbg_types.h"
60 #include "xdbg_evlog_randr.h"
63 _EvlogRequestRandr (xReq *req, char *reply, int *len)
69 case X_RRGetScreenSizeRange:
71 xRRGetScreenSizeRangeReq *stuff = (xRRGetScreenSizeRangeReq *)req;
72 REPLY (": XID(0x%lx)",
78 case X_RRSetScreenSize:
80 xRRSetScreenSizeReq *stuff = (xRRSetScreenSizeReq *)req;
81 REPLY (": XID(0x%lx) size(%dx%d) milliSize(%ldx%ld)",
85 stuff->widthInMillimeters,
86 stuff->heightInMillimeters);
91 case X_RRGetScreenResources:
93 xRRGetScreenResourcesReq *stuff = (xRRGetScreenResourcesReq *)req;
94 REPLY (": XID(0x%lx)",
100 case X_RRGetOutputInfo:
102 xRRGetOutputInfoReq *stuff = (xRRGetOutputInfoReq *)req;
103 REPLY (": XID(0x%lx)",
109 case X_RRListOutputProperties:
111 xRRListOutputPropertiesReq *stuff = (xRRListOutputPropertiesReq *)req;
112 REPLY (": XID(0x%lx)",
118 case X_RRQueryOutputProperty:
120 xRRQueryOutputPropertyReq *stuff = (xRRQueryOutputPropertyReq *)req;
121 REPLY (": XID(0x%lx) Property(0x%lx)",
128 case X_RRConfigureOutputProperty:
130 xRRConfigureOutputPropertyReq *stuff = (xRRConfigureOutputPropertyReq *)req;
131 REPLY (": XID(0x%lx) Property(0x%lx)",
138 case X_RRChangeOutputProperty:
140 xRRChangeOutputPropertyReq *stuff = (xRRChangeOutputPropertyReq *)req;
141 REPLY (": XID(0x%lx) Property(0x%lx) Type(0x%lx) Format(%d) nUnits(%ld)",
151 case X_RRDeleteOutputProperty:
153 xRRDeleteOutputPropertyReq *stuff = (xRRDeleteOutputPropertyReq *)req;
154 REPLY (": XID(0x%lx) Property(0x%lx)",
161 case X_RRGetOutputProperty:
163 xRRGetOutputPropertyReq *stuff = (xRRGetOutputPropertyReq *)req;
164 REPLY (": XID(0x%lx) Property(0x%lx) Type(0x%lx) longOffset(%ld) longLength(%ld)",
174 case X_RRGetCrtcInfo:
176 xRRGetCrtcInfoReq *stuff = (xRRGetCrtcInfoReq *)req;
177 REPLY (": XID(0x%lx)",
183 case X_RRSetCrtcConfig:
185 xRRSetCrtcConfigReq *stuff = (xRRSetCrtcConfigReq *)req;
186 REPLY (": XID(0x%lx) Coordinate(%d,%d) Rotation(%d)",
195 case X_RRGetScreenResourcesCurrent:
197 xRRGetScreenResourcesCurrentReq *stuff = (xRRGetScreenResourcesCurrentReq *)req;
198 REPLY (": XID(0x%lx)",
213 _EvlogEventRandr (xEvent *evt, int first_base, char *reply, int *len)
217 switch ((stuff->u.u.type & 0x7F) - first_base)
219 case RRScreenChangeNotify:
221 xRRScreenChangeNotifyEvent *stuff = (xRRScreenChangeNotifyEvent *) evt;
222 REPLY (": Root(0x%lx) Window(0x%lx) sizeID(%d) subPixel(%d) Pixel(%d,%d) Milli(%d,%d)",
226 stuff->subpixelOrder,
227 stuff->widthInPixels,
228 stuff->heightInPixels,
229 stuff->widthInMillimeters,
230 stuff->heightInMillimeters);
237 switch(stuff->u.u.detail)
239 case RRNotify_CrtcChange:
241 xRRCrtcChangeNotifyEvent *stuff = (xRRCrtcChangeNotifyEvent *) evt;
242 REPLY (": XID(0x%lx) Crtc(0x%lx) Mode(0x%lx) size(%udx%ud) coord(%d,%d)",
254 case RRNotify_OutputChange:
256 xRROutputChangeNotifyEvent *stuff = (xRROutputChangeNotifyEvent *) evt;
257 REPLY (": XID(0x%lx) Output(0x%lx) Crtc(0x%lx) Mode(0x%lx)",
266 case RRNotify_OutputProperty:
268 xRROutputPropertyNotifyEvent *stuff = (xRROutputPropertyNotifyEvent *) evt;
269 REPLY (": XID(0x%lx) Output(0x%lx) Atom(0x%lx)",
277 case RRNotify_ProviderChange:
279 xRRProviderChangeNotifyEvent *stuff = (xRRProviderChangeNotifyEvent *) evt;
280 REPLY (": XID(0x%lx) Provider(0x%lx)",
287 case RRNotify_ProviderProperty:
289 xRRProviderPropertyNotifyEvent *stuff = (xRRProviderPropertyNotifyEvent *) evt;
290 REPLY (": XID(0x%lx) Provider(0x%lx) Atom(0x%lx)",
298 case RRNotify_ResourceChange:
300 xRRResourceChangeNotifyEvent *stuff = (xRRResourceChangeNotifyEvent *) evt;
301 REPLY (": XID(0x%lx)",
321 xDbgEvlogRandrGetBase (void *dpy, ExtensionInfo *extinfo)
324 Display *d = (Display*)dpy;
326 RETURN_IF_FAIL (d != NULL);
327 RETURN_IF_FAIL (extinfo != NULL);
329 if (!XQueryExtension(d, RANDR_NAME, &extinfo->opcode, &extinfo->evt_base, &extinfo->err_base))
331 fprintf (stderr, "[UTILX] no Randr extension. \n");
334 extinfo->req_func = _EvlogRequestRandr;
335 extinfo->evt_func = _EvlogEventRandr;
337 ExtensionEntry *xext = CheckExtension (RANDR_NAME);
338 RETURN_IF_FAIL (xext != NULL);
340 extinfo->opcode = xext->base;
341 extinfo->evt_base = xext->eventBase;
342 extinfo->err_base = xext->errorBase;
343 extinfo->req_func = _EvlogRequestRandr;
344 extinfo->evt_func = _EvlogEventRandr;