1 /*
2  * Copyright © 2006 Keith Packard
3  *
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.
13  *
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
20  * OF THIS SOFTWARE.
21  */
22 
23 #include "randrstr.h"
24 
25 static int _X_COLD
SProcRRQueryVersion(ClientPtr client)26 SProcRRQueryVersion(ClientPtr client)
27 {
28     REQUEST(xRRQueryVersionReq);
29 
30     REQUEST_SIZE_MATCH(xRRQueryVersionReq);
31     swaps(&stuff->length);
32     swapl(&stuff->majorVersion);
33     swapl(&stuff->minorVersion);
34     return (*ProcRandrVector[stuff->randrReqType]) (client);
35 }
36 
37 static int _X_COLD
SProcRRGetScreenInfo(ClientPtr client)38 SProcRRGetScreenInfo(ClientPtr client)
39 {
40     REQUEST(xRRGetScreenInfoReq);
41 
42     REQUEST_SIZE_MATCH(xRRGetScreenInfoReq);
43     swaps(&stuff->length);
44     swapl(&stuff->window);
45     return (*ProcRandrVector[stuff->randrReqType]) (client);
46 }
47 
48 static int _X_COLD
SProcRRSetScreenConfig(ClientPtr client)49 SProcRRSetScreenConfig(ClientPtr client)
50 {
51     REQUEST(xRRSetScreenConfigReq);
52 
53     if (RRClientKnowsRates(client)) {
54         REQUEST_SIZE_MATCH(xRRSetScreenConfigReq);
55         swaps(&stuff->rate);
56     }
57     else {
58         REQUEST_SIZE_MATCH(xRR1_0SetScreenConfigReq);
59     }
60 
61     swaps(&stuff->length);
62     swapl(&stuff->drawable);
63     swapl(&stuff->timestamp);
64     swaps(&stuff->sizeID);
65     swaps(&stuff->rotation);
66     return (*ProcRandrVector[stuff->randrReqType]) (client);
67 }
68 
69 static int _X_COLD
SProcRRSelectInput(ClientPtr client)70 SProcRRSelectInput(ClientPtr client)
71 {
72     REQUEST(xRRSelectInputReq);
73 
74     REQUEST_SIZE_MATCH(xRRSelectInputReq);
75     swaps(&stuff->length);
76     swapl(&stuff->window);
77     swaps(&stuff->enable);
78     return (*ProcRandrVector[stuff->randrReqType]) (client);
79 }
80 
81 static int _X_COLD
SProcRRGetScreenSizeRange(ClientPtr client)82 SProcRRGetScreenSizeRange(ClientPtr client)
83 {
84     REQUEST(xRRGetScreenSizeRangeReq);
85 
86     REQUEST_SIZE_MATCH(xRRGetScreenSizeRangeReq);
87     swaps(&stuff->length);
88     swapl(&stuff->window);
89     return (*ProcRandrVector[stuff->randrReqType]) (client);
90 }
91 
92 static int _X_COLD
SProcRRSetScreenSize(ClientPtr client)93 SProcRRSetScreenSize(ClientPtr client)
94 {
95     REQUEST(xRRSetScreenSizeReq);
96 
97     REQUEST_SIZE_MATCH(xRRSetScreenSizeReq);
98     swaps(&stuff->length);
99     swapl(&stuff->window);
100     swaps(&stuff->width);
101     swaps(&stuff->height);
102     swapl(&stuff->widthInMillimeters);
103     swapl(&stuff->heightInMillimeters);
104     return (*ProcRandrVector[stuff->randrReqType]) (client);
105 }
106 
107 static int _X_COLD
SProcRRGetScreenResources(ClientPtr client)108 SProcRRGetScreenResources(ClientPtr client)
109 {
110     REQUEST(xRRGetScreenResourcesReq);
111 
112     REQUEST_SIZE_MATCH(xRRGetScreenResourcesReq);
113     swaps(&stuff->length);
114     swapl(&stuff->window);
115     return (*ProcRandrVector[stuff->randrReqType]) (client);
116 }
117 
118 static int _X_COLD
SProcRRGetOutputInfo(ClientPtr client)119 SProcRRGetOutputInfo(ClientPtr client)
120 {
121     REQUEST(xRRGetOutputInfoReq);
122 
123     REQUEST_SIZE_MATCH(xRRGetOutputInfoReq);
124     swaps(&stuff->length);
125     swapl(&stuff->output);
126     swapl(&stuff->configTimestamp);
127     return (*ProcRandrVector[stuff->randrReqType]) (client);
128 }
129 
130 static int _X_COLD
SProcRRListOutputProperties(ClientPtr client)131 SProcRRListOutputProperties(ClientPtr client)
132 {
133     REQUEST(xRRListOutputPropertiesReq);
134 
135     REQUEST_SIZE_MATCH(xRRListOutputPropertiesReq);
136     swaps(&stuff->length);
137     swapl(&stuff->output);
138     return (*ProcRandrVector[stuff->randrReqType]) (client);
139 }
140 
141 static int _X_COLD
SProcRRQueryOutputProperty(ClientPtr client)142 SProcRRQueryOutputProperty(ClientPtr client)
143 {
144     REQUEST(xRRQueryOutputPropertyReq);
145 
146     REQUEST_SIZE_MATCH(xRRQueryOutputPropertyReq);
147     swaps(&stuff->length);
148     swapl(&stuff->output);
149     swapl(&stuff->property);
150     return (*ProcRandrVector[stuff->randrReqType]) (client);
151 }
152 
153 static int _X_COLD
SProcRRConfigureOutputProperty(ClientPtr client)154 SProcRRConfigureOutputProperty(ClientPtr client)
155 {
156     REQUEST(xRRConfigureOutputPropertyReq);
157 
158     REQUEST_AT_LEAST_SIZE(xRRConfigureOutputPropertyReq);
159     swaps(&stuff->length);
160     swapl(&stuff->output);
161     swapl(&stuff->property);
162     SwapRestL(stuff);
163     return (*ProcRandrVector[stuff->randrReqType]) (client);
164 }
165 
166 static int _X_COLD
SProcRRChangeOutputProperty(ClientPtr client)167 SProcRRChangeOutputProperty(ClientPtr client)
168 {
169     REQUEST(xRRChangeOutputPropertyReq);
170 
171     REQUEST_AT_LEAST_SIZE(xRRChangeOutputPropertyReq);
172     swaps(&stuff->length);
173     swapl(&stuff->output);
174     swapl(&stuff->property);
175     swapl(&stuff->type);
176     swapl(&stuff->nUnits);
177     switch (stuff->format) {
178     case 8:
179         break;
180     case 16:
181         SwapRestS(stuff);
182         break;
183     case 32:
184         SwapRestL(stuff);
185         break;
186     default:
187         client->errorValue = stuff->format;
188         return BadValue;
189     }
190     return (*ProcRandrVector[stuff->randrReqType]) (client);
191 }
192 
193 static int _X_COLD
SProcRRDeleteOutputProperty(ClientPtr client)194 SProcRRDeleteOutputProperty(ClientPtr client)
195 {
196     REQUEST(xRRDeleteOutputPropertyReq);
197 
198     REQUEST_SIZE_MATCH(xRRDeleteOutputPropertyReq);
199     swaps(&stuff->length);
200     swapl(&stuff->output);
201     swapl(&stuff->property);
202     return (*ProcRandrVector[stuff->randrReqType]) (client);
203 }
204 
205 static int _X_COLD
SProcRRGetOutputProperty(ClientPtr client)206 SProcRRGetOutputProperty(ClientPtr client)
207 {
208     REQUEST(xRRGetOutputPropertyReq);
209 
210     REQUEST_SIZE_MATCH(xRRGetOutputPropertyReq);
211     swaps(&stuff->length);
212     swapl(&stuff->output);
213     swapl(&stuff->property);
214     swapl(&stuff->type);
215     swapl(&stuff->longOffset);
216     swapl(&stuff->longLength);
217     return (*ProcRandrVector[stuff->randrReqType]) (client);
218 }
219 
220 static int _X_COLD
SProcRRCreateMode(ClientPtr client)221 SProcRRCreateMode(ClientPtr client)
222 {
223     xRRModeInfo *modeinfo;
224 
225     REQUEST(xRRCreateModeReq);
226 
227     REQUEST_AT_LEAST_SIZE(xRRCreateModeReq);
228     swaps(&stuff->length);
229     swapl(&stuff->window);
230 
231     modeinfo = &stuff->modeInfo;
232     swapl(&modeinfo->id);
233     swaps(&modeinfo->width);
234     swaps(&modeinfo->height);
235     swapl(&modeinfo->dotClock);
236     swaps(&modeinfo->hSyncStart);
237     swaps(&modeinfo->hSyncEnd);
238     swaps(&modeinfo->hTotal);
239     swaps(&modeinfo->vSyncStart);
240     swaps(&modeinfo->vSyncEnd);
241     swaps(&modeinfo->vTotal);
242     swaps(&modeinfo->nameLength);
243     swapl(&modeinfo->modeFlags);
244     return (*ProcRandrVector[stuff->randrReqType]) (client);
245 }
246 
247 static int _X_COLD
SProcRRDestroyMode(ClientPtr client)248 SProcRRDestroyMode(ClientPtr client)
249 {
250     REQUEST(xRRDestroyModeReq);
251 
252     REQUEST_SIZE_MATCH(xRRDestroyModeReq);
253     swaps(&stuff->length);
254     swapl(&stuff->mode);
255     return (*ProcRandrVector[stuff->randrReqType]) (client);
256 }
257 
258 static int _X_COLD
SProcRRAddOutputMode(ClientPtr client)259 SProcRRAddOutputMode(ClientPtr client)
260 {
261     REQUEST(xRRAddOutputModeReq);
262 
263     REQUEST_SIZE_MATCH(xRRAddOutputModeReq);
264     swaps(&stuff->length);
265     swapl(&stuff->output);
266     swapl(&stuff->mode);
267     return (*ProcRandrVector[stuff->randrReqType]) (client);
268 }
269 
270 static int _X_COLD
SProcRRDeleteOutputMode(ClientPtr client)271 SProcRRDeleteOutputMode(ClientPtr client)
272 {
273     REQUEST(xRRDeleteOutputModeReq);
274 
275     REQUEST_SIZE_MATCH(xRRDeleteOutputModeReq);
276     swaps(&stuff->length);
277     swapl(&stuff->output);
278     swapl(&stuff->mode);
279     return (*ProcRandrVector[stuff->randrReqType]) (client);
280 }
281 
282 static int _X_COLD
SProcRRGetCrtcInfo(ClientPtr client)283 SProcRRGetCrtcInfo(ClientPtr client)
284 {
285     REQUEST(xRRGetCrtcInfoReq);
286 
287     REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq);
288     swaps(&stuff->length);
289     swapl(&stuff->crtc);
290     swapl(&stuff->configTimestamp);
291     return (*ProcRandrVector[stuff->randrReqType]) (client);
292 }
293 
294 static int _X_COLD
SProcRRSetCrtcConfig(ClientPtr client)295 SProcRRSetCrtcConfig(ClientPtr client)
296 {
297     REQUEST(xRRSetCrtcConfigReq);
298 
299     REQUEST_AT_LEAST_SIZE(xRRSetCrtcConfigReq);
300     swaps(&stuff->length);
301     swapl(&stuff->crtc);
302     swapl(&stuff->timestamp);
303     swapl(&stuff->configTimestamp);
304     swaps(&stuff->x);
305     swaps(&stuff->y);
306     swapl(&stuff->mode);
307     swaps(&stuff->rotation);
308     SwapRestL(stuff);
309     return (*ProcRandrVector[stuff->randrReqType]) (client);
310 }
311 
312 static int _X_COLD
SProcRRGetCrtcGammaSize(ClientPtr client)313 SProcRRGetCrtcGammaSize(ClientPtr client)
314 {
315     REQUEST(xRRGetCrtcGammaSizeReq);
316 
317     REQUEST_SIZE_MATCH(xRRGetCrtcGammaSizeReq);
318     swaps(&stuff->length);
319     swapl(&stuff->crtc);
320     return (*ProcRandrVector[stuff->randrReqType]) (client);
321 }
322 
323 static int _X_COLD
SProcRRGetCrtcGamma(ClientPtr client)324 SProcRRGetCrtcGamma(ClientPtr client)
325 {
326     REQUEST(xRRGetCrtcGammaReq);
327 
328     REQUEST_SIZE_MATCH(xRRGetCrtcGammaReq);
329     swaps(&stuff->length);
330     swapl(&stuff->crtc);
331     return (*ProcRandrVector[stuff->randrReqType]) (client);
332 }
333 
334 static int _X_COLD
SProcRRSetCrtcGamma(ClientPtr client)335 SProcRRSetCrtcGamma(ClientPtr client)
336 {
337     REQUEST(xRRSetCrtcGammaReq);
338 
339     REQUEST_AT_LEAST_SIZE(xRRSetCrtcGammaReq);
340     swaps(&stuff->length);
341     swapl(&stuff->crtc);
342     swaps(&stuff->size);
343     SwapRestS(stuff);
344     return (*ProcRandrVector[stuff->randrReqType]) (client);
345 }
346 
347 static int _X_COLD
SProcRRSetCrtcTransform(ClientPtr client)348 SProcRRSetCrtcTransform(ClientPtr client)
349 {
350     int nparams;
351     char *filter;
352     CARD32 *params;
353 
354     REQUEST(xRRSetCrtcTransformReq);
355 
356     REQUEST_AT_LEAST_SIZE(xRRSetCrtcTransformReq);
357     swaps(&stuff->length);
358     swapl(&stuff->crtc);
359     SwapLongs((CARD32 *) &stuff->transform,
360               bytes_to_int32(sizeof(xRenderTransform)));
361     swaps(&stuff->nbytesFilter);
362     filter = (char *) (stuff + 1);
363     params = (CARD32 *) (filter + pad_to_int32(stuff->nbytesFilter));
364     nparams = ((CARD32 *) stuff + client->req_len) - params;
365     if (nparams < 0)
366         return BadLength;
367 
368     SwapLongs(params, nparams);
369     return (*ProcRandrVector[stuff->randrReqType]) (client);
370 }
371 
372 static int _X_COLD
SProcRRGetCrtcTransform(ClientPtr client)373 SProcRRGetCrtcTransform(ClientPtr client)
374 {
375     REQUEST(xRRGetCrtcTransformReq);
376 
377     REQUEST_SIZE_MATCH(xRRGetCrtcTransformReq);
378     swaps(&stuff->length);
379     swapl(&stuff->crtc);
380     return (*ProcRandrVector[stuff->randrReqType]) (client);
381 }
382 
383 static int _X_COLD
SProcRRGetPanning(ClientPtr client)384 SProcRRGetPanning(ClientPtr client)
385 {
386     REQUEST(xRRGetPanningReq);
387 
388     REQUEST_SIZE_MATCH(xRRGetPanningReq);
389     swaps(&stuff->length);
390     swapl(&stuff->crtc);
391     return (*ProcRandrVector[stuff->randrReqType]) (client);
392 }
393 
394 static int _X_COLD
SProcRRSetPanning(ClientPtr client)395 SProcRRSetPanning(ClientPtr client)
396 {
397     REQUEST(xRRSetPanningReq);
398 
399     REQUEST_SIZE_MATCH(xRRSetPanningReq);
400     swaps(&stuff->length);
401     swapl(&stuff->crtc);
402     swapl(&stuff->timestamp);
403     swaps(&stuff->left);
404     swaps(&stuff->top);
405     swaps(&stuff->width);
406     swaps(&stuff->height);
407     swaps(&stuff->track_left);
408     swaps(&stuff->track_top);
409     swaps(&stuff->track_width);
410     swaps(&stuff->track_height);
411     swaps(&stuff->border_left);
412     swaps(&stuff->border_top);
413     swaps(&stuff->border_right);
414     swaps(&stuff->border_bottom);
415     return (*ProcRandrVector[stuff->randrReqType]) (client);
416 }
417 
418 static int _X_COLD
SProcRRSetOutputPrimary(ClientPtr client)419 SProcRRSetOutputPrimary(ClientPtr client)
420 {
421     REQUEST(xRRSetOutputPrimaryReq);
422 
423     REQUEST_SIZE_MATCH(xRRSetOutputPrimaryReq);
424     swaps(&stuff->length);
425     swapl(&stuff->window);
426     swapl(&stuff->output);
427     return ProcRandrVector[stuff->randrReqType] (client);
428 }
429 
430 static int _X_COLD
SProcRRGetOutputPrimary(ClientPtr client)431 SProcRRGetOutputPrimary(ClientPtr client)
432 {
433     REQUEST(xRRGetOutputPrimaryReq);
434 
435     REQUEST_SIZE_MATCH(xRRGetOutputPrimaryReq);
436     swaps(&stuff->length);
437     swapl(&stuff->window);
438     return ProcRandrVector[stuff->randrReqType] (client);
439 }
440 
441 static int _X_COLD
SProcRRGetProviders(ClientPtr client)442 SProcRRGetProviders(ClientPtr client)
443 {
444     REQUEST(xRRGetProvidersReq);
445 
446     REQUEST_SIZE_MATCH(xRRGetProvidersReq);
447     swaps(&stuff->length);
448     swapl(&stuff->window);
449     return ProcRandrVector[stuff->randrReqType] (client);
450 }
451 
452 static int _X_COLD
SProcRRGetProviderInfo(ClientPtr client)453 SProcRRGetProviderInfo(ClientPtr client)
454 {
455     REQUEST(xRRGetProviderInfoReq);
456 
457     REQUEST_SIZE_MATCH(xRRGetProviderInfoReq);
458     swaps(&stuff->length);
459     swapl(&stuff->provider);
460     swapl(&stuff->configTimestamp);
461     return ProcRandrVector[stuff->randrReqType] (client);
462 }
463 
464 static int _X_COLD
SProcRRSetProviderOffloadSink(ClientPtr client)465 SProcRRSetProviderOffloadSink(ClientPtr client)
466 {
467     REQUEST(xRRSetProviderOffloadSinkReq);
468 
469     REQUEST_SIZE_MATCH(xRRSetProviderOffloadSinkReq);
470     swaps(&stuff->length);
471     swapl(&stuff->provider);
472     swapl(&stuff->sink_provider);
473     swapl(&stuff->configTimestamp);
474     return ProcRandrVector[stuff->randrReqType] (client);
475 }
476 
477 static int _X_COLD
SProcRRSetProviderOutputSource(ClientPtr client)478 SProcRRSetProviderOutputSource(ClientPtr client)
479 {
480     REQUEST(xRRSetProviderOutputSourceReq);
481 
482     REQUEST_SIZE_MATCH(xRRSetProviderOutputSourceReq);
483     swaps(&stuff->length);
484     swapl(&stuff->provider);
485     swapl(&stuff->source_provider);
486     swapl(&stuff->configTimestamp);
487     return ProcRandrVector[stuff->randrReqType] (client);
488 }
489 
490 static int _X_COLD
SProcRRListProviderProperties(ClientPtr client)491 SProcRRListProviderProperties(ClientPtr client)
492 {
493     REQUEST(xRRListProviderPropertiesReq);
494 
495     REQUEST_SIZE_MATCH(xRRListProviderPropertiesReq);
496     swaps(&stuff->length);
497     swapl(&stuff->provider);
498     return ProcRandrVector[stuff->randrReqType] (client);
499 }
500 
501 static int _X_COLD
SProcRRQueryProviderProperty(ClientPtr client)502 SProcRRQueryProviderProperty(ClientPtr client)
503 {
504     REQUEST(xRRQueryProviderPropertyReq);
505 
506     REQUEST_SIZE_MATCH(xRRQueryProviderPropertyReq);
507     swaps(&stuff->length);
508     swapl(&stuff->provider);
509     swapl(&stuff->property);
510     return ProcRandrVector[stuff->randrReqType] (client);
511 }
512 
513 static int _X_COLD
SProcRRConfigureProviderProperty(ClientPtr client)514 SProcRRConfigureProviderProperty(ClientPtr client)
515 {
516     REQUEST(xRRConfigureProviderPropertyReq);
517 
518     REQUEST_AT_LEAST_SIZE(xRRConfigureProviderPropertyReq);
519     swaps(&stuff->length);
520     swapl(&stuff->provider);
521     swapl(&stuff->property);
522     /* TODO: no way to specify format? */
523     SwapRestL(stuff);
524     return ProcRandrVector[stuff->randrReqType] (client);
525 }
526 
527 static int _X_COLD
SProcRRChangeProviderProperty(ClientPtr client)528 SProcRRChangeProviderProperty(ClientPtr client)
529 {
530     REQUEST(xRRChangeProviderPropertyReq);
531 
532     REQUEST_AT_LEAST_SIZE(xRRChangeProviderPropertyReq);
533     swaps(&stuff->length);
534     swapl(&stuff->provider);
535     swapl(&stuff->property);
536     swapl(&stuff->type);
537     swapl(&stuff->nUnits);
538     switch (stuff->format) {
539     case 8:
540         break;
541     case 16:
542         SwapRestS(stuff);
543         break;
544     case 32:
545         SwapRestL(stuff);
546         break;
547     }
548     return ProcRandrVector[stuff->randrReqType] (client);
549 }
550 
551 static int _X_COLD
SProcRRDeleteProviderProperty(ClientPtr client)552 SProcRRDeleteProviderProperty(ClientPtr client)
553 {
554     REQUEST(xRRDeleteProviderPropertyReq);
555 
556     REQUEST_SIZE_MATCH(xRRDeleteProviderPropertyReq);
557     swaps(&stuff->length);
558     swapl(&stuff->provider);
559     swapl(&stuff->property);
560     return ProcRandrVector[stuff->randrReqType] (client);
561 }
562 
563 static int _X_COLD
SProcRRGetProviderProperty(ClientPtr client)564 SProcRRGetProviderProperty(ClientPtr client)
565 {
566     REQUEST(xRRGetProviderPropertyReq);
567 
568     REQUEST_SIZE_MATCH(xRRGetProviderPropertyReq);
569     swaps(&stuff->length);
570     swapl(&stuff->provider);
571     swapl(&stuff->property);
572     swapl(&stuff->type);
573     swapl(&stuff->longOffset);
574     swapl(&stuff->longLength);
575     return ProcRandrVector[stuff->randrReqType] (client);
576 }
577 
578 static int _X_COLD
SProcRRGetMonitors(ClientPtr client)579 SProcRRGetMonitors(ClientPtr client) {
580     REQUEST(xRRGetMonitorsReq);
581 
582     REQUEST_SIZE_MATCH(xRRGetMonitorsReq);
583     swaps(&stuff->length);
584     swapl(&stuff->window);
585     return ProcRandrVector[stuff->randrReqType] (client);
586 }
587 
588 static int _X_COLD
SProcRRSetMonitor(ClientPtr client)589 SProcRRSetMonitor(ClientPtr client) {
590     REQUEST(xRRSetMonitorReq);
591 
592     REQUEST_AT_LEAST_SIZE(xRRGetMonitorsReq);
593     swaps(&stuff->length);
594     swapl(&stuff->window);
595     swapl(&stuff->monitor.name);
596     swaps(&stuff->monitor.noutput);
597     swaps(&stuff->monitor.x);
598     swaps(&stuff->monitor.y);
599     swaps(&stuff->monitor.width);
600     swaps(&stuff->monitor.height);
601     SwapRestL(stuff);
602     return ProcRandrVector[stuff->randrReqType] (client);
603 }
604 
605 static int _X_COLD
SProcRRDeleteMonitor(ClientPtr client)606 SProcRRDeleteMonitor(ClientPtr client) {
607     REQUEST(xRRDeleteMonitorReq);
608 
609     REQUEST_SIZE_MATCH(xRRDeleteMonitorReq);
610     swaps(&stuff->length);
611     swapl(&stuff->window);
612     swapl(&stuff->name);
613     return ProcRandrVector[stuff->randrReqType] (client);
614 }
615 
616 static int _X_COLD
SProcRRCreateLease(ClientPtr client)617 SProcRRCreateLease(ClientPtr client) {
618     REQUEST(xRRCreateLeaseReq);
619 
620     REQUEST_AT_LEAST_SIZE(xRRCreateLeaseReq);
621     swaps(&stuff->length);
622     swapl(&stuff->window);
623     swaps(&stuff->nCrtcs);
624     swaps(&stuff->nOutputs);
625     SwapRestL(stuff);
626     return ProcRandrVector[stuff->randrReqType] (client);
627 }
628 
629 static int _X_COLD
SProcRRFreeLease(ClientPtr client)630 SProcRRFreeLease(ClientPtr client) {
631     REQUEST(xRRFreeLeaseReq);
632 
633     REQUEST_SIZE_MATCH(xRRFreeLeaseReq);
634     swaps(&stuff->length);
635     swapl(&stuff->lid);
636     return ProcRandrVector[stuff->randrReqType] (client);
637 }
638 
639 int (*SProcRandrVector[RRNumberRequests]) (ClientPtr) = {
640     SProcRRQueryVersion,        /* 0 */
641 /* we skip 1 to make old clients fail pretty immediately */
642         NULL,                   /* 1 SProcRandrOldGetScreenInfo */
643 /* V1.0 apps share the same set screen config request id */
644         SProcRRSetScreenConfig, /* 2 */
645         NULL,                   /* 3 SProcRandrOldScreenChangeSelectInput */
646 /* 3 used to be ScreenChangeSelectInput; deprecated */
647         SProcRRSelectInput,     /* 4 */
648         SProcRRGetScreenInfo,   /* 5 */
649 /* V1.2 additions */
650         SProcRRGetScreenSizeRange,      /* 6 */
651         SProcRRSetScreenSize,   /* 7 */
652         SProcRRGetScreenResources,      /* 8 */
653         SProcRRGetOutputInfo,   /* 9 */
654         SProcRRListOutputProperties,    /* 10 */
655         SProcRRQueryOutputProperty,     /* 11 */
656         SProcRRConfigureOutputProperty, /* 12 */
657         SProcRRChangeOutputProperty,    /* 13 */
658         SProcRRDeleteOutputProperty,    /* 14 */
659         SProcRRGetOutputProperty,       /* 15 */
660         SProcRRCreateMode,      /* 16 */
661         SProcRRDestroyMode,     /* 17 */
662         SProcRRAddOutputMode,   /* 18 */
663         SProcRRDeleteOutputMode,        /* 19 */
664         SProcRRGetCrtcInfo,     /* 20 */
665         SProcRRSetCrtcConfig,   /* 21 */
666         SProcRRGetCrtcGammaSize,        /* 22 */
667         SProcRRGetCrtcGamma,    /* 23 */
668         SProcRRSetCrtcGamma,    /* 24 */
669 /* V1.3 additions */
670         SProcRRGetScreenResources,      /* 25 GetScreenResourcesCurrent */
671         SProcRRSetCrtcTransform,        /* 26 */
672         SProcRRGetCrtcTransform,        /* 27 */
673         SProcRRGetPanning,      /* 28 */
674         SProcRRSetPanning,      /* 29 */
675         SProcRRSetOutputPrimary,        /* 30 */
676         SProcRRGetOutputPrimary,        /* 31 */
677 /* V1.4 additions */
678         SProcRRGetProviders,            /* 32 */
679         SProcRRGetProviderInfo,         /* 33 */
680         SProcRRSetProviderOffloadSink,  /* 34 */
681         SProcRRSetProviderOutputSource, /* 35 */
682         SProcRRListProviderProperties,  /* 36 */
683         SProcRRQueryProviderProperty,   /* 37 */
684         SProcRRConfigureProviderProperty, /* 38 */
685         SProcRRChangeProviderProperty,  /* 39 */
686         SProcRRDeleteProviderProperty,  /* 40 */
687         SProcRRGetProviderProperty,     /* 41 */
688 /* V1.5 additions */
689         SProcRRGetMonitors,            /* 42 */
690         SProcRRSetMonitor,             /* 43 */
691         SProcRRDeleteMonitor,          /* 44 */
692 /* V1.6 additions */
693         SProcRRCreateLease,            /* 45 */
694         SProcRRFreeLease,              /* 46 */
695 };
696