1706f2543Smrg/*
2706f2543Smrg * Copyright © 2006 Keith Packard
3706f2543Smrg *
4706f2543Smrg * Permission to use, copy, modify, distribute, and sell this software and its
5706f2543Smrg * documentation for any purpose is hereby granted without fee, provided that
6706f2543Smrg * the above copyright notice appear in all copies and that both that copyright
7706f2543Smrg * notice and this permission notice appear in supporting documentation, and
8706f2543Smrg * that the name of the copyright holders not be used in advertising or
9706f2543Smrg * publicity pertaining to distribution of the software without specific,
10706f2543Smrg * written prior permission.  The copyright holders make no representations
11706f2543Smrg * about the suitability of this software for any purpose.  It is provided "as
12706f2543Smrg * is" without express or implied warranty.
13706f2543Smrg *
14706f2543Smrg * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15706f2543Smrg * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16706f2543Smrg * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17706f2543Smrg * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18706f2543Smrg * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19706f2543Smrg * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
20706f2543Smrg * OF THIS SOFTWARE.
21706f2543Smrg */
22706f2543Smrg
23706f2543Smrg#include "randrstr.h"
24706f2543Smrg
25706f2543Smrgstatic int
26706f2543SmrgSProcRRQueryVersion (ClientPtr client)
27706f2543Smrg{
28706f2543Smrg    register int n;
29706f2543Smrg    REQUEST(xRRQueryVersionReq);
30706f2543Smrg
31706f2543Smrg    REQUEST_SIZE_MATCH(xRRQueryVersionReq);
32706f2543Smrg    swaps(&stuff->length, n);
33706f2543Smrg    swapl(&stuff->majorVersion, n);
34706f2543Smrg    swapl(&stuff->minorVersion, n);
35706f2543Smrg    return (*ProcRandrVector[stuff->randrReqType]) (client);
36706f2543Smrg}
37706f2543Smrg
38706f2543Smrgstatic int
39706f2543SmrgSProcRRGetScreenInfo (ClientPtr client)
40706f2543Smrg{
41706f2543Smrg    register int n;
42706f2543Smrg    REQUEST(xRRGetScreenInfoReq);
43706f2543Smrg
44706f2543Smrg    REQUEST_SIZE_MATCH(xRRGetScreenInfoReq);
45706f2543Smrg    swaps(&stuff->length, n);
46706f2543Smrg    swapl(&stuff->window, n);
47706f2543Smrg    return (*ProcRandrVector[stuff->randrReqType]) (client);
48706f2543Smrg}
49706f2543Smrg
50706f2543Smrgstatic int
51706f2543SmrgSProcRRSetScreenConfig (ClientPtr client)
52706f2543Smrg{
53706f2543Smrg    register int n;
54706f2543Smrg    REQUEST(xRRSetScreenConfigReq);
55706f2543Smrg
56706f2543Smrg    if (RRClientKnowsRates (client))
57706f2543Smrg    {
58706f2543Smrg	REQUEST_SIZE_MATCH (xRRSetScreenConfigReq);
59706f2543Smrg	swaps (&stuff->rate, n);
60706f2543Smrg    }
61706f2543Smrg    else
62706f2543Smrg    {
63706f2543Smrg	REQUEST_SIZE_MATCH (xRR1_0SetScreenConfigReq);
64706f2543Smrg    }
65706f2543Smrg
66706f2543Smrg    swaps(&stuff->length, n);
67706f2543Smrg    swapl(&stuff->drawable, n);
68706f2543Smrg    swapl(&stuff->timestamp, n);
69706f2543Smrg    swaps(&stuff->sizeID, n);
70706f2543Smrg    swaps(&stuff->rotation, n);
71706f2543Smrg    return (*ProcRandrVector[stuff->randrReqType]) (client);
72706f2543Smrg}
73706f2543Smrg
74706f2543Smrgstatic int
75706f2543SmrgSProcRRSelectInput (ClientPtr client)
76706f2543Smrg{
77706f2543Smrg    register int n;
78706f2543Smrg    REQUEST(xRRSelectInputReq);
79706f2543Smrg
80706f2543Smrg    REQUEST_SIZE_MATCH(xRRSelectInputReq);
81706f2543Smrg    swaps(&stuff->length, n);
82706f2543Smrg    swapl(&stuff->window, n);
83706f2543Smrg    swaps(&stuff->enable, n);
84706f2543Smrg    return (*ProcRandrVector[stuff->randrReqType]) (client);
85706f2543Smrg}
86706f2543Smrg
87706f2543Smrgstatic int
88706f2543SmrgSProcRRGetScreenSizeRange (ClientPtr client)
89706f2543Smrg{
90706f2543Smrg    int n;
91706f2543Smrg    REQUEST(xRRGetScreenSizeRangeReq);
92706f2543Smrg
93706f2543Smrg    REQUEST_SIZE_MATCH(xRRGetScreenSizeRangeReq);
94706f2543Smrg    swaps(&stuff->length, n);
95706f2543Smrg    swapl(&stuff->window, n);
96706f2543Smrg    return (*ProcRandrVector[stuff->randrReqType]) (client);
97706f2543Smrg}
98706f2543Smrg
99706f2543Smrgstatic int
100706f2543SmrgSProcRRSetScreenSize (ClientPtr client)
101706f2543Smrg{
102706f2543Smrg    int n;
103706f2543Smrg    REQUEST(xRRSetScreenSizeReq);
104706f2543Smrg
105706f2543Smrg    REQUEST_SIZE_MATCH(xRRSetScreenSizeReq);
106706f2543Smrg    swaps(&stuff->length, n);
107706f2543Smrg    swapl(&stuff->window, n);
108706f2543Smrg    swaps(&stuff->width, n);
109706f2543Smrg    swaps(&stuff->height, n);
110706f2543Smrg    swapl(&stuff->widthInMillimeters, n);
111706f2543Smrg    swapl(&stuff->heightInMillimeters, n);
112706f2543Smrg    return (*ProcRandrVector[stuff->randrReqType]) (client);
113706f2543Smrg}
114706f2543Smrg
115706f2543Smrgstatic int
116706f2543SmrgSProcRRGetScreenResources (ClientPtr client)
117706f2543Smrg{
118706f2543Smrg    int n;
119706f2543Smrg    REQUEST(xRRGetScreenResourcesReq);
120706f2543Smrg
121706f2543Smrg    REQUEST_SIZE_MATCH(xRRGetScreenResourcesReq);
122706f2543Smrg    swaps(&stuff->length, n);
123706f2543Smrg    swapl(&stuff->window, n);
124706f2543Smrg    return (*ProcRandrVector[stuff->randrReqType]) (client);
125706f2543Smrg}
126706f2543Smrg
127706f2543Smrgstatic int
128706f2543SmrgSProcRRGetOutputInfo (ClientPtr client)
129706f2543Smrg{
130706f2543Smrg    int n;
131706f2543Smrg    REQUEST(xRRGetOutputInfoReq);
132706f2543Smrg
133706f2543Smrg    REQUEST_SIZE_MATCH(xRRGetOutputInfoReq);
134706f2543Smrg    swaps(&stuff->length, n);
135706f2543Smrg    swapl(&stuff->output, n);
136706f2543Smrg    swapl(&stuff->configTimestamp, n);
137706f2543Smrg    return (*ProcRandrVector[stuff->randrReqType]) (client);
138706f2543Smrg}
139706f2543Smrg
140706f2543Smrgstatic int
141706f2543SmrgSProcRRListOutputProperties (ClientPtr client)
142706f2543Smrg{
143706f2543Smrg    int n;
144706f2543Smrg    REQUEST(xRRListOutputPropertiesReq);
145706f2543Smrg
146706f2543Smrg    REQUEST_SIZE_MATCH(xRRListOutputPropertiesReq);
147706f2543Smrg    swaps(&stuff->length, n);
148706f2543Smrg    swapl(&stuff->output, n);
149706f2543Smrg    return (*ProcRandrVector[stuff->randrReqType]) (client);
150706f2543Smrg}
151706f2543Smrg
152706f2543Smrgstatic int
153706f2543SmrgSProcRRQueryOutputProperty (ClientPtr client)
154706f2543Smrg{
155706f2543Smrg    int n;
156706f2543Smrg    REQUEST(xRRQueryOutputPropertyReq);
157706f2543Smrg
158706f2543Smrg    REQUEST_SIZE_MATCH(xRRQueryOutputPropertyReq);
159706f2543Smrg    swaps(&stuff->length, n);
160706f2543Smrg    swapl(&stuff->output, n);
161706f2543Smrg    swapl(&stuff->property, n);
162706f2543Smrg    return (*ProcRandrVector[stuff->randrReqType]) (client);
163706f2543Smrg}
164706f2543Smrg
165706f2543Smrgstatic int
166706f2543SmrgSProcRRConfigureOutputProperty (ClientPtr client)
167706f2543Smrg{
168706f2543Smrg    int n;
169706f2543Smrg    REQUEST(xRRConfigureOutputPropertyReq);
170706f2543Smrg
171706f2543Smrg    REQUEST_AT_LEAST_SIZE(xRRConfigureOutputPropertyReq);
172706f2543Smrg    swaps(&stuff->length, n);
173706f2543Smrg    swapl(&stuff->output, n);
174706f2543Smrg    swapl(&stuff->property, n);
175706f2543Smrg    SwapRestL(stuff);
176706f2543Smrg    return (*ProcRandrVector[stuff->randrReqType]) (client);
177706f2543Smrg}
178706f2543Smrg
179706f2543Smrgstatic int
180706f2543SmrgSProcRRChangeOutputProperty (ClientPtr client)
181706f2543Smrg{
182706f2543Smrg    int n;
183706f2543Smrg    REQUEST(xRRChangeOutputPropertyReq);
184706f2543Smrg
185706f2543Smrg    REQUEST_AT_LEAST_SIZE (xRRChangeOutputPropertyReq);
186706f2543Smrg    swaps(&stuff->length, n);
187706f2543Smrg    swapl(&stuff->output, n);
188706f2543Smrg    swapl(&stuff->property, n);
189706f2543Smrg    swapl(&stuff->type, n);
190706f2543Smrg    swapl(&stuff->nUnits, n);
191706f2543Smrg    switch(stuff->format) {
192706f2543Smrg	case 8:
193706f2543Smrg	    break;
194706f2543Smrg	case 16:
195706f2543Smrg	    SwapRestS(stuff);
196706f2543Smrg	    break;
197706f2543Smrg	case 32:
198706f2543Smrg	    SwapRestL(stuff);
199706f2543Smrg	    break;
200706f2543Smrg	default:
201706f2543Smrg	    client->errorValue = stuff->format;
202706f2543Smrg	    return BadValue;
203706f2543Smrg    }
204706f2543Smrg    return (*ProcRandrVector[stuff->randrReqType]) (client);
205706f2543Smrg}
206706f2543Smrg
207706f2543Smrgstatic int
208706f2543SmrgSProcRRDeleteOutputProperty (ClientPtr client)
209706f2543Smrg{
210706f2543Smrg    int n;
211706f2543Smrg    REQUEST(xRRDeleteOutputPropertyReq);
212706f2543Smrg
213706f2543Smrg    REQUEST_SIZE_MATCH(xRRDeleteOutputPropertyReq);
214706f2543Smrg    swaps(&stuff->length, n);
215706f2543Smrg    swapl(&stuff->output, n);
216706f2543Smrg    swapl(&stuff->property, n);
217706f2543Smrg    return (*ProcRandrVector[stuff->randrReqType]) (client);
218706f2543Smrg}
219706f2543Smrg
220706f2543Smrgstatic int
221706f2543SmrgSProcRRGetOutputProperty (ClientPtr client)
222706f2543Smrg{
223706f2543Smrg    int n;
224706f2543Smrg    REQUEST(xRRGetOutputPropertyReq);
225706f2543Smrg
226706f2543Smrg    REQUEST_SIZE_MATCH(xRRGetOutputPropertyReq);
227706f2543Smrg    swaps(&stuff->length, n);
228706f2543Smrg    swapl(&stuff->output, n);
229706f2543Smrg    swapl(&stuff->property, n);
230706f2543Smrg    swapl(&stuff->type, n);
231706f2543Smrg    swapl(&stuff->longOffset, n);
232706f2543Smrg    swapl(&stuff->longLength, n);
233706f2543Smrg    return (*ProcRandrVector[stuff->randrReqType]) (client);
234706f2543Smrg}
235706f2543Smrg
236706f2543Smrgstatic int
237706f2543SmrgSProcRRCreateMode (ClientPtr client)
238706f2543Smrg{
239706f2543Smrg    int n;
240706f2543Smrg    xRRModeInfo *modeinfo;
241706f2543Smrg    REQUEST(xRRCreateModeReq);
242706f2543Smrg
243706f2543Smrg    REQUEST_AT_LEAST_SIZE(xRRCreateModeReq);
244706f2543Smrg    swaps(&stuff->length, n);
245706f2543Smrg    swapl(&stuff->window, n);
246706f2543Smrg
247706f2543Smrg    modeinfo = &stuff->modeInfo;
248706f2543Smrg    swapl(&modeinfo->id, n);
249706f2543Smrg    swaps(&modeinfo->width, n);
250706f2543Smrg    swaps(&modeinfo->height, n);
251706f2543Smrg    swapl(&modeinfo->dotClock, n);
252706f2543Smrg    swaps(&modeinfo->hSyncStart, n);
253706f2543Smrg    swaps(&modeinfo->hSyncEnd, n);
254706f2543Smrg    swaps(&modeinfo->hTotal, n);
255706f2543Smrg    swaps(&modeinfo->vSyncStart, n);
256706f2543Smrg    swaps(&modeinfo->vSyncEnd, n);
257706f2543Smrg    swaps(&modeinfo->vTotal, n);
258706f2543Smrg    swaps(&modeinfo->nameLength, n);
259706f2543Smrg    swapl(&modeinfo->modeFlags, n);
260706f2543Smrg    return (*ProcRandrVector[stuff->randrReqType]) (client);
261706f2543Smrg}
262706f2543Smrg
263706f2543Smrgstatic int
264706f2543SmrgSProcRRDestroyMode (ClientPtr client)
265706f2543Smrg{
266706f2543Smrg    int n;
267706f2543Smrg    REQUEST(xRRDestroyModeReq);
268706f2543Smrg
269706f2543Smrg    REQUEST_SIZE_MATCH(xRRDestroyModeReq);
270706f2543Smrg    swaps(&stuff->length, n);
271706f2543Smrg    swapl(&stuff->mode, n);
272706f2543Smrg    return (*ProcRandrVector[stuff->randrReqType]) (client);
273706f2543Smrg}
274706f2543Smrg
275706f2543Smrgstatic int
276706f2543SmrgSProcRRAddOutputMode (ClientPtr client)
277706f2543Smrg{
278706f2543Smrg    int n;
279706f2543Smrg    REQUEST(xRRAddOutputModeReq);
280706f2543Smrg
281706f2543Smrg    REQUEST_SIZE_MATCH(xRRAddOutputModeReq);
282706f2543Smrg    swaps(&stuff->length, n);
283706f2543Smrg    swapl(&stuff->output, n);
284706f2543Smrg    swapl(&stuff->mode, n);
285706f2543Smrg    return (*ProcRandrVector[stuff->randrReqType]) (client);
286706f2543Smrg}
287706f2543Smrg
288706f2543Smrgstatic int
289706f2543SmrgSProcRRDeleteOutputMode (ClientPtr client)
290706f2543Smrg{
291706f2543Smrg    int n;
292706f2543Smrg    REQUEST(xRRDeleteOutputModeReq);
293706f2543Smrg
294706f2543Smrg    REQUEST_SIZE_MATCH(xRRDeleteOutputModeReq);
295706f2543Smrg    swaps(&stuff->length, n);
296706f2543Smrg    swapl(&stuff->output, n);
297706f2543Smrg    swapl(&stuff->mode, n);
298706f2543Smrg    return (*ProcRandrVector[stuff->randrReqType]) (client);
299706f2543Smrg}
300706f2543Smrg
301706f2543Smrgstatic int
302706f2543SmrgSProcRRGetCrtcInfo (ClientPtr client)
303706f2543Smrg{
304706f2543Smrg    int n;
305706f2543Smrg    REQUEST(xRRGetCrtcInfoReq);
306706f2543Smrg
307706f2543Smrg    REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq);
308706f2543Smrg    swaps(&stuff->length, n);
309706f2543Smrg    swapl(&stuff->crtc, n);
310706f2543Smrg    swapl(&stuff->configTimestamp, n);
311706f2543Smrg    return (*ProcRandrVector[stuff->randrReqType]) (client);
312706f2543Smrg}
313706f2543Smrg
314706f2543Smrgstatic int
315706f2543SmrgSProcRRSetCrtcConfig (ClientPtr client)
316706f2543Smrg{
317706f2543Smrg    int n;
318706f2543Smrg    REQUEST(xRRSetCrtcConfigReq);
319706f2543Smrg
320706f2543Smrg    REQUEST_AT_LEAST_SIZE(xRRSetCrtcConfigReq);
321706f2543Smrg    swaps(&stuff->length, n);
322706f2543Smrg    swapl(&stuff->crtc, n);
323706f2543Smrg    swapl(&stuff->timestamp, n);
324706f2543Smrg    swapl(&stuff->configTimestamp, n);
325706f2543Smrg    swaps(&stuff->x, n);
326706f2543Smrg    swaps(&stuff->y, n);
327706f2543Smrg    swapl(&stuff->mode, n);
328706f2543Smrg    swaps(&stuff->rotation, n);
329706f2543Smrg    SwapRestL(stuff);
330706f2543Smrg    return (*ProcRandrVector[stuff->randrReqType]) (client);
331706f2543Smrg}
332706f2543Smrg
333706f2543Smrgstatic int
334706f2543SmrgSProcRRGetCrtcGammaSize (ClientPtr client)
335706f2543Smrg{
336706f2543Smrg    int n;
337706f2543Smrg    REQUEST(xRRGetCrtcGammaSizeReq);
338706f2543Smrg
339706f2543Smrg    REQUEST_SIZE_MATCH(xRRGetCrtcGammaSizeReq);
340706f2543Smrg    swaps(&stuff->length, n);
341706f2543Smrg    swapl(&stuff->crtc, n);
342706f2543Smrg    return (*ProcRandrVector[stuff->randrReqType]) (client);
343706f2543Smrg}
344706f2543Smrg
345706f2543Smrgstatic int
346706f2543SmrgSProcRRGetCrtcGamma (ClientPtr client)
347706f2543Smrg{
348706f2543Smrg    int n;
349706f2543Smrg    REQUEST(xRRGetCrtcGammaReq);
350706f2543Smrg
351706f2543Smrg    REQUEST_SIZE_MATCH(xRRGetCrtcGammaReq);
352706f2543Smrg    swaps(&stuff->length, n);
353706f2543Smrg    swapl(&stuff->crtc, n);
354706f2543Smrg    return (*ProcRandrVector[stuff->randrReqType]) (client);
355706f2543Smrg}
356706f2543Smrg
357706f2543Smrgstatic int
358706f2543SmrgSProcRRSetCrtcGamma (ClientPtr client)
359706f2543Smrg{
360706f2543Smrg    int n;
361706f2543Smrg    REQUEST(xRRSetCrtcGammaReq);
362706f2543Smrg
363706f2543Smrg    REQUEST_AT_LEAST_SIZE(xRRSetCrtcGammaReq);
364706f2543Smrg    swaps(&stuff->length, n);
365706f2543Smrg    swapl(&stuff->crtc, n);
366706f2543Smrg    swaps(&stuff->size, n);
367706f2543Smrg    SwapRestS(stuff);
368706f2543Smrg    return (*ProcRandrVector[stuff->randrReqType]) (client);
369706f2543Smrg}
370706f2543Smrg
371706f2543Smrgstatic int
372706f2543SmrgSProcRRSetCrtcTransform (ClientPtr client)
373706f2543Smrg{
374706f2543Smrg    int n, nparams;
375706f2543Smrg    char *filter;
376706f2543Smrg    CARD32 *params;
377706f2543Smrg    REQUEST(xRRSetCrtcTransformReq);
378706f2543Smrg
379706f2543Smrg    REQUEST_AT_LEAST_SIZE(xRRSetCrtcTransformReq);
380706f2543Smrg    swaps(&stuff->length, n);
381706f2543Smrg    swapl(&stuff->crtc, n);
382706f2543Smrg    SwapLongs((CARD32 *)&stuff->transform, bytes_to_int32(sizeof(xRenderTransform)));
383706f2543Smrg    swaps(&stuff->nbytesFilter, n);
384706f2543Smrg    filter = (char *)(stuff + 1);
385706f2543Smrg    params = (CARD32 *) (filter + pad_to_int32(stuff->nbytesFilter));
386706f2543Smrg    nparams = ((CARD32 *) stuff + client->req_len) - params;
387706f2543Smrg    if (nparams < 0)
388706f2543Smrg	return BadLength;
389706f2543Smrg
390706f2543Smrg    SwapLongs(params, nparams);
391706f2543Smrg    return (*ProcRandrVector[stuff->randrReqType]) (client);
392706f2543Smrg}
393706f2543Smrg
394706f2543Smrgstatic int
395706f2543SmrgSProcRRGetCrtcTransform (ClientPtr client)
396706f2543Smrg{
397706f2543Smrg    int n;
398706f2543Smrg    REQUEST(xRRGetCrtcTransformReq);
399706f2543Smrg
400706f2543Smrg    REQUEST_SIZE_MATCH(xRRGetCrtcTransformReq);
401706f2543Smrg    swaps(&stuff->length, n);
402706f2543Smrg    swapl(&stuff->crtc, n);
403706f2543Smrg    return (*ProcRandrVector[stuff->randrReqType]) (client);
404706f2543Smrg}
405706f2543Smrg
406706f2543Smrgstatic int
407706f2543SmrgSProcRRGetPanning (ClientPtr client)
408706f2543Smrg{
409706f2543Smrg    int n;
410706f2543Smrg    REQUEST(xRRGetPanningReq);
411706f2543Smrg
412706f2543Smrg    REQUEST_SIZE_MATCH(xRRGetPanningReq);
413706f2543Smrg    swaps(&stuff->length, n);
414706f2543Smrg    swapl(&stuff->crtc, n);
415706f2543Smrg    return (*ProcRandrVector[stuff->randrReqType]) (client);
416706f2543Smrg}
417706f2543Smrg
418706f2543Smrgstatic int
419706f2543SmrgSProcRRSetPanning (ClientPtr client)
420706f2543Smrg{
421706f2543Smrg    int n;
422706f2543Smrg    REQUEST(xRRSetPanningReq);
423706f2543Smrg
424706f2543Smrg    REQUEST_SIZE_MATCH(xRRSetPanningReq);
425706f2543Smrg    swaps(&stuff->length, n);
426706f2543Smrg    swapl(&stuff->crtc, n);
427706f2543Smrg    swapl(&stuff->timestamp, n);
428706f2543Smrg    swaps(&stuff->left, n);
429706f2543Smrg    swaps(&stuff->top, n);
430706f2543Smrg    swaps(&stuff->width, n);
431706f2543Smrg    swaps(&stuff->height, n);
432706f2543Smrg    swaps(&stuff->track_left, n);
433706f2543Smrg    swaps(&stuff->track_top, n);
434706f2543Smrg    swaps(&stuff->track_width, n);
435706f2543Smrg    swaps(&stuff->track_height, n);
436706f2543Smrg    swaps(&stuff->border_left, n);
437706f2543Smrg    swaps(&stuff->border_top, n);
438706f2543Smrg    swaps(&stuff->border_right, n);
439706f2543Smrg    swaps(&stuff->border_bottom, n);
440706f2543Smrg    return (*ProcRandrVector[stuff->randrReqType]) (client);
441706f2543Smrg}
442706f2543Smrg
443706f2543Smrgstatic int
444706f2543SmrgSProcRRSetOutputPrimary (ClientPtr client)
445706f2543Smrg{
446706f2543Smrg    int n;
447706f2543Smrg    REQUEST(xRRSetOutputPrimaryReq);
448706f2543Smrg
449706f2543Smrg    REQUEST_SIZE_MATCH(xRRSetOutputPrimaryReq);
450706f2543Smrg    swaps(&stuff->length, n);
451706f2543Smrg    swapl(&stuff->window, n);
452706f2543Smrg    swapl(&stuff->output, n);
453706f2543Smrg    return ProcRandrVector[stuff->randrReqType](client);
454706f2543Smrg}
455706f2543Smrg
456706f2543Smrgstatic int
457706f2543SmrgSProcRRGetOutputPrimary (ClientPtr client)
458706f2543Smrg{
459706f2543Smrg    int n;
460706f2543Smrg    REQUEST(xRRGetOutputPrimaryReq);
461706f2543Smrg
462706f2543Smrg    REQUEST_SIZE_MATCH(xRRGetOutputPrimaryReq);
463706f2543Smrg    swaps(&stuff->length, n);
464706f2543Smrg    swapl(&stuff->window, n);
465706f2543Smrg    return ProcRandrVector[stuff->randrReqType](client);
466706f2543Smrg}
467706f2543Smrg
468706f2543Smrgint (*SProcRandrVector[RRNumberRequests])(ClientPtr) = {
469706f2543Smrg    SProcRRQueryVersion,	/* 0 */
470706f2543Smrg/* we skip 1 to make old clients fail pretty immediately */
471706f2543Smrg    NULL,			/* 1 SProcRandrOldGetScreenInfo */
472706f2543Smrg/* V1.0 apps share the same set screen config request id */
473706f2543Smrg    SProcRRSetScreenConfig,	/* 2 */
474706f2543Smrg    NULL,			/* 3 SProcRandrOldScreenChangeSelectInput */
475706f2543Smrg/* 3 used to be ScreenChangeSelectInput; deprecated */
476706f2543Smrg    SProcRRSelectInput,		/* 4 */
477706f2543Smrg    SProcRRGetScreenInfo,    	/* 5 */
478706f2543Smrg/* V1.2 additions */
479706f2543Smrg    SProcRRGetScreenSizeRange,	/* 6 */
480706f2543Smrg    SProcRRSetScreenSize,	/* 7 */
481706f2543Smrg    SProcRRGetScreenResources,	/* 8 */
482706f2543Smrg    SProcRRGetOutputInfo,	/* 9 */
483706f2543Smrg    SProcRRListOutputProperties,/* 10 */
484706f2543Smrg    SProcRRQueryOutputProperty,	/* 11 */
485706f2543Smrg    SProcRRConfigureOutputProperty,  /* 12 */
486706f2543Smrg    SProcRRChangeOutputProperty,/* 13 */
487706f2543Smrg    SProcRRDeleteOutputProperty,/* 14 */
488706f2543Smrg    SProcRRGetOutputProperty,	/* 15 */
489706f2543Smrg    SProcRRCreateMode,		/* 16 */
490706f2543Smrg    SProcRRDestroyMode,		/* 17 */
491706f2543Smrg    SProcRRAddOutputMode,	/* 18 */
492706f2543Smrg    SProcRRDeleteOutputMode,	/* 19 */
493706f2543Smrg    SProcRRGetCrtcInfo,		/* 20 */
494706f2543Smrg    SProcRRSetCrtcConfig,	/* 21 */
495706f2543Smrg    SProcRRGetCrtcGammaSize,	/* 22 */
496706f2543Smrg    SProcRRGetCrtcGamma,	/* 23 */
497706f2543Smrg    SProcRRSetCrtcGamma,	/* 24 */
498706f2543Smrg/* V1.3 additions */
499706f2543Smrg    SProcRRGetScreenResources,	/* 25 GetScreenResourcesCurrent */
500706f2543Smrg    SProcRRSetCrtcTransform,	/* 26 */
501706f2543Smrg    SProcRRGetCrtcTransform,	/* 27 */
502706f2543Smrg    SProcRRGetPanning,		/* 28 */
503706f2543Smrg    SProcRRSetPanning,		/* 29 */
504706f2543Smrg    SProcRRSetOutputPrimary,	/* 30 */
505706f2543Smrg    SProcRRGetOutputPrimary,	/* 31 */
506706f2543Smrg};
507706f2543Smrg
508