2 * Copyright © 2006 Keith Packard
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that copyright
7 * notice and this permission notice appear in supporting documentation, and
8 * that the name of the copyright holders not be used in advertising or
9 * publicity pertaining to distribution of the software without specific,
10 * written prior permission. The copyright holders make no representations
11 * about the suitability of this software for any purpose. It is provided "as
12 * is" without express or implied warranty.
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
26 SProcRRQueryVersion(ClientPtr client
)
28 REQUEST(xRRQueryVersionReq
);
30 swaps(&stuff
->length
);
31 swapl(&stuff
->majorVersion
);
32 swapl(&stuff
->minorVersion
);
33 return (*ProcRandrVector
[stuff
->randrReqType
]) (client
);
37 SProcRRGetScreenInfo(ClientPtr client
)
39 REQUEST(xRRGetScreenInfoReq
);
41 swaps(&stuff
->length
);
42 swapl(&stuff
->window
);
43 return (*ProcRandrVector
[stuff
->randrReqType
]) (client
);
47 SProcRRSetScreenConfig(ClientPtr client
)
49 REQUEST(xRRSetScreenConfigReq
);
51 if (RRClientKnowsRates(client
)) {
52 REQUEST_SIZE_MATCH(xRRSetScreenConfigReq
);
56 REQUEST_SIZE_MATCH(xRR1_0SetScreenConfigReq
);
59 swaps(&stuff
->length
);
60 swapl(&stuff
->drawable
);
61 swapl(&stuff
->timestamp
);
62 swaps(&stuff
->sizeID
);
63 swaps(&stuff
->rotation
);
64 return (*ProcRandrVector
[stuff
->randrReqType
]) (client
);
68 SProcRRSelectInput(ClientPtr client
)
70 REQUEST(xRRSelectInputReq
);
72 swaps(&stuff
->length
);
73 swapl(&stuff
->window
);
74 swaps(&stuff
->enable
);
75 return (*ProcRandrVector
[stuff
->randrReqType
]) (client
);
79 SProcRRGetScreenSizeRange(ClientPtr client
)
81 REQUEST(xRRGetScreenSizeRangeReq
);
83 REQUEST_SIZE_MATCH(xRRGetScreenSizeRangeReq
);
84 swaps(&stuff
->length
);
85 swapl(&stuff
->window
);
86 return (*ProcRandrVector
[stuff
->randrReqType
]) (client
);
90 SProcRRSetScreenSize(ClientPtr client
)
92 REQUEST(xRRSetScreenSizeReq
);
94 REQUEST_SIZE_MATCH(xRRSetScreenSizeReq
);
95 swaps(&stuff
->length
);
96 swapl(&stuff
->window
);
98 swaps(&stuff
->height
);
99 swapl(&stuff
->widthInMillimeters
);
100 swapl(&stuff
->heightInMillimeters
);
101 return (*ProcRandrVector
[stuff
->randrReqType
]) (client
);
105 SProcRRGetScreenResources(ClientPtr client
)
107 REQUEST(xRRGetScreenResourcesReq
);
109 REQUEST_SIZE_MATCH(xRRGetScreenResourcesReq
);
110 swaps(&stuff
->length
);
111 swapl(&stuff
->window
);
112 return (*ProcRandrVector
[stuff
->randrReqType
]) (client
);
116 SProcRRGetOutputInfo(ClientPtr client
)
118 REQUEST(xRRGetOutputInfoReq
);
120 REQUEST_SIZE_MATCH(xRRGetOutputInfoReq
);
121 swaps(&stuff
->length
);
122 swapl(&stuff
->output
);
123 swapl(&stuff
->configTimestamp
);
124 return (*ProcRandrVector
[stuff
->randrReqType
]) (client
);
128 SProcRRListOutputProperties(ClientPtr client
)
130 REQUEST(xRRListOutputPropertiesReq
);
132 REQUEST_SIZE_MATCH(xRRListOutputPropertiesReq
);
133 swaps(&stuff
->length
);
134 swapl(&stuff
->output
);
135 return (*ProcRandrVector
[stuff
->randrReqType
]) (client
);
139 SProcRRQueryOutputProperty(ClientPtr client
)
141 REQUEST(xRRQueryOutputPropertyReq
);
143 REQUEST_SIZE_MATCH(xRRQueryOutputPropertyReq
);
144 swaps(&stuff
->length
);
145 swapl(&stuff
->output
);
146 swapl(&stuff
->property
);
147 return (*ProcRandrVector
[stuff
->randrReqType
]) (client
);
151 SProcRRConfigureOutputProperty(ClientPtr client
)
153 REQUEST(xRRConfigureOutputPropertyReq
);
155 swaps(&stuff
->length
);
156 swapl(&stuff
->output
);
157 swapl(&stuff
->property
);
159 return (*ProcRandrVector
[stuff
->randrReqType
]) (client
);
163 SProcRRChangeOutputProperty(ClientPtr client
)
165 REQUEST(xRRChangeOutputPropertyReq
);
167 REQUEST_AT_LEAST_SIZE(xRRChangeOutputPropertyReq
);
168 swaps(&stuff
->length
);
169 swapl(&stuff
->output
);
170 swapl(&stuff
->property
);
172 swapl(&stuff
->nUnits
);
173 switch (stuff
->format
) {
183 client
->errorValue
= stuff
->format
;
186 return (*ProcRandrVector
[stuff
->randrReqType
]) (client
);
190 SProcRRDeleteOutputProperty(ClientPtr client
)
192 REQUEST(xRRDeleteOutputPropertyReq
);
194 REQUEST_SIZE_MATCH(xRRDeleteOutputPropertyReq
);
195 swaps(&stuff
->length
);
196 swapl(&stuff
->output
);
197 swapl(&stuff
->property
);
198 return (*ProcRandrVector
[stuff
->randrReqType
]) (client
);
202 SProcRRGetOutputProperty(ClientPtr client
)
204 REQUEST(xRRGetOutputPropertyReq
);
206 REQUEST_SIZE_MATCH(xRRGetOutputPropertyReq
);
207 swaps(&stuff
->length
);
208 swapl(&stuff
->output
);
209 swapl(&stuff
->property
);
211 swapl(&stuff
->longOffset
);
212 swapl(&stuff
->longLength
);
213 return (*ProcRandrVector
[stuff
->randrReqType
]) (client
);
217 SProcRRCreateMode(ClientPtr client
)
219 xRRModeInfo
*modeinfo
;
221 REQUEST(xRRCreateModeReq
);
223 REQUEST_AT_LEAST_SIZE(xRRCreateModeReq
);
224 swaps(&stuff
->length
);
225 swapl(&stuff
->window
);
227 modeinfo
= &stuff
->modeInfo
;
228 swapl(&modeinfo
->id
);
229 swaps(&modeinfo
->width
);
230 swaps(&modeinfo
->height
);
231 swapl(&modeinfo
->dotClock
);
232 swaps(&modeinfo
->hSyncStart
);
233 swaps(&modeinfo
->hSyncEnd
);
234 swaps(&modeinfo
->hTotal
);
235 swaps(&modeinfo
->vSyncStart
);
236 swaps(&modeinfo
->vSyncEnd
);
237 swaps(&modeinfo
->vTotal
);
238 swaps(&modeinfo
->nameLength
);
239 swapl(&modeinfo
->modeFlags
);
240 return (*ProcRandrVector
[stuff
->randrReqType
]) (client
);
244 SProcRRDestroyMode(ClientPtr client
)
246 REQUEST(xRRDestroyModeReq
);
248 REQUEST_SIZE_MATCH(xRRDestroyModeReq
);
249 swaps(&stuff
->length
);
251 return (*ProcRandrVector
[stuff
->randrReqType
]) (client
);
255 SProcRRAddOutputMode(ClientPtr client
)
257 REQUEST(xRRAddOutputModeReq
);
259 REQUEST_SIZE_MATCH(xRRAddOutputModeReq
);
260 swaps(&stuff
->length
);
261 swapl(&stuff
->output
);
263 return (*ProcRandrVector
[stuff
->randrReqType
]) (client
);
267 SProcRRDeleteOutputMode(ClientPtr client
)
269 REQUEST(xRRDeleteOutputModeReq
);
271 REQUEST_SIZE_MATCH(xRRDeleteOutputModeReq
);
272 swaps(&stuff
->length
);
273 swapl(&stuff
->output
);
275 return (*ProcRandrVector
[stuff
->randrReqType
]) (client
);
279 SProcRRGetCrtcInfo(ClientPtr client
)
281 REQUEST(xRRGetCrtcInfoReq
);
283 REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq
);
284 swaps(&stuff
->length
);
286 swapl(&stuff
->configTimestamp
);
287 return (*ProcRandrVector
[stuff
->randrReqType
]) (client
);
291 SProcRRSetCrtcConfig(ClientPtr client
)
293 REQUEST(xRRSetCrtcConfigReq
);
295 REQUEST_AT_LEAST_SIZE(xRRSetCrtcConfigReq
);
296 swaps(&stuff
->length
);
298 swapl(&stuff
->timestamp
);
299 swapl(&stuff
->configTimestamp
);
303 swaps(&stuff
->rotation
);
305 return (*ProcRandrVector
[stuff
->randrReqType
]) (client
);
309 SProcRRGetCrtcGammaSize(ClientPtr client
)
311 REQUEST(xRRGetCrtcGammaSizeReq
);
313 REQUEST_SIZE_MATCH(xRRGetCrtcGammaSizeReq
);
314 swaps(&stuff
->length
);
316 return (*ProcRandrVector
[stuff
->randrReqType
]) (client
);
320 SProcRRGetCrtcGamma(ClientPtr client
)
322 REQUEST(xRRGetCrtcGammaReq
);
324 REQUEST_SIZE_MATCH(xRRGetCrtcGammaReq
);
325 swaps(&stuff
->length
);
327 return (*ProcRandrVector
[stuff
->randrReqType
]) (client
);
331 SProcRRSetCrtcGamma(ClientPtr client
)
333 REQUEST(xRRSetCrtcGammaReq
);
335 REQUEST_AT_LEAST_SIZE(xRRSetCrtcGammaReq
);
336 swaps(&stuff
->length
);
340 return (*ProcRandrVector
[stuff
->randrReqType
]) (client
);
344 SProcRRSetCrtcTransform(ClientPtr client
)
350 REQUEST(xRRSetCrtcTransformReq
);
352 REQUEST_AT_LEAST_SIZE(xRRSetCrtcTransformReq
);
353 swaps(&stuff
->length
);
355 SwapLongs((CARD32
*) &stuff
->transform
,
356 bytes_to_int32(sizeof(xRenderTransform
)));
357 swaps(&stuff
->nbytesFilter
);
358 filter
= (char *) (stuff
+ 1);
359 params
= (CARD32
*) (filter
+ pad_to_int32(stuff
->nbytesFilter
));
360 nparams
= ((CARD32
*) stuff
+ client
->req_len
) - params
;
364 SwapLongs(params
, nparams
);
365 return (*ProcRandrVector
[stuff
->randrReqType
]) (client
);
369 SProcRRGetCrtcTransform(ClientPtr client
)
371 REQUEST(xRRGetCrtcTransformReq
);
373 REQUEST_SIZE_MATCH(xRRGetCrtcTransformReq
);
374 swaps(&stuff
->length
);
376 return (*ProcRandrVector
[stuff
->randrReqType
]) (client
);
380 SProcRRGetPanning(ClientPtr client
)
382 REQUEST(xRRGetPanningReq
);
384 REQUEST_SIZE_MATCH(xRRGetPanningReq
);
385 swaps(&stuff
->length
);
387 return (*ProcRandrVector
[stuff
->randrReqType
]) (client
);
391 SProcRRSetPanning(ClientPtr client
)
393 REQUEST(xRRSetPanningReq
);
395 REQUEST_SIZE_MATCH(xRRSetPanningReq
);
396 swaps(&stuff
->length
);
398 swapl(&stuff
->timestamp
);
401 swaps(&stuff
->width
);
402 swaps(&stuff
->height
);
403 swaps(&stuff
->track_left
);
404 swaps(&stuff
->track_top
);
405 swaps(&stuff
->track_width
);
406 swaps(&stuff
->track_height
);
407 swaps(&stuff
->border_left
);
408 swaps(&stuff
->border_top
);
409 swaps(&stuff
->border_right
);
410 swaps(&stuff
->border_bottom
);
411 return (*ProcRandrVector
[stuff
->randrReqType
]) (client
);
415 SProcRRSetOutputPrimary(ClientPtr client
)
417 REQUEST(xRRSetOutputPrimaryReq
);
419 REQUEST_SIZE_MATCH(xRRSetOutputPrimaryReq
);
420 swaps(&stuff
->length
);
421 swapl(&stuff
->window
);
422 swapl(&stuff
->output
);
423 return ProcRandrVector
[stuff
->randrReqType
] (client
);
427 SProcRRGetOutputPrimary(ClientPtr client
)
429 REQUEST(xRRGetOutputPrimaryReq
);
431 REQUEST_SIZE_MATCH(xRRGetOutputPrimaryReq
);
432 swaps(&stuff
->length
);
433 swapl(&stuff
->window
);
434 return ProcRandrVector
[stuff
->randrReqType
] (client
);
437 int (*SProcRandrVector
[RRNumberRequests
]) (ClientPtr
) = {
438 SProcRRQueryVersion
, /* 0 */
439 /* we skip 1 to make old clients fail pretty immediately */
440 NULL
, /* 1 SProcRandrOldGetScreenInfo */
441 /* V1.0 apps share the same set screen config request id */
442 SProcRRSetScreenConfig
, /* 2 */
443 NULL
, /* 3 SProcRandrOldScreenChangeSelectInput */
444 /* 3 used to be ScreenChangeSelectInput; deprecated */
445 SProcRRSelectInput
, /* 4 */
446 SProcRRGetScreenInfo
, /* 5 */
448 SProcRRGetScreenSizeRange
, /* 6 */
449 SProcRRSetScreenSize
, /* 7 */
450 SProcRRGetScreenResources
, /* 8 */
451 SProcRRGetOutputInfo
, /* 9 */
452 SProcRRListOutputProperties
, /* 10 */
453 SProcRRQueryOutputProperty
, /* 11 */
454 SProcRRConfigureOutputProperty
, /* 12 */
455 SProcRRChangeOutputProperty
, /* 13 */
456 SProcRRDeleteOutputProperty
, /* 14 */
457 SProcRRGetOutputProperty
, /* 15 */
458 SProcRRCreateMode
, /* 16 */
459 SProcRRDestroyMode
, /* 17 */
460 SProcRRAddOutputMode
, /* 18 */
461 SProcRRDeleteOutputMode
, /* 19 */
462 SProcRRGetCrtcInfo
, /* 20 */
463 SProcRRSetCrtcConfig
, /* 21 */
464 SProcRRGetCrtcGammaSize
, /* 22 */
465 SProcRRGetCrtcGamma
, /* 23 */
466 SProcRRSetCrtcGamma
, /* 24 */
468 SProcRRGetScreenResources
, /* 25 GetScreenResourcesCurrent */
469 SProcRRSetCrtcTransform
, /* 26 */
470 SProcRRGetCrtcTransform
, /* 27 */
471 SProcRRGetPanning
, /* 28 */
472 SProcRRSetPanning
, /* 29 */
473 SProcRRSetOutputPrimary
, /* 30 */
474 SProcRRGetOutputPrimary
, /* 31 */