singlepixswap.c revision f7df2e56
1/*
2 * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
3 * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice including the dates of first publication and
13 * either this permission notice or a reference to
14 * http://oss.sgi.com/projects/FreeB/
15 * shall be included in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
22 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * SOFTWARE.
24 *
25 * Except as contained in this notice, the name of Silicon Graphics, Inc.
26 * shall not be used in advertising or otherwise to promote the sale, use or
27 * other dealings in this Software without prior written authorization from
28 * Silicon Graphics, Inc.
29 */
30
31#ifdef HAVE_DIX_CONFIG_H
32#include <dix-config.h>
33#endif
34
35#include "glxserver.h"
36#include "glxext.h"
37#include "singlesize.h"
38#include "unpack.h"
39#include "indirect_dispatch.h"
40#include "indirect_size_get.h"
41
42int
43__glXDispSwap_ReadPixels(__GLXclientState * cl, GLbyte * pc)
44{
45    GLsizei width, height;
46    GLenum format, type;
47    GLboolean swapBytes, lsbFirst;
48    GLint compsize;
49
50    __GLX_DECLARE_SWAP_VARIABLES;
51    __GLXcontext *cx;
52    ClientPtr client = cl->client;
53    int error;
54    char *answer, answerBuffer[200];
55
56    REQUEST_FIXED_SIZE(xGLXSingleReq, 28);
57
58    __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag);
59    cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
60    if (!cx) {
61        return error;
62    }
63
64    pc += __GLX_SINGLE_HDR_SIZE;
65    __GLX_SWAP_INT(pc + 0);
66    __GLX_SWAP_INT(pc + 4);
67    __GLX_SWAP_INT(pc + 8);
68    __GLX_SWAP_INT(pc + 12);
69    __GLX_SWAP_INT(pc + 16);
70    __GLX_SWAP_INT(pc + 20);
71
72    width = *(GLsizei *) (pc + 8);
73    height = *(GLsizei *) (pc + 12);
74    format = *(GLenum *) (pc + 16);
75    type = *(GLenum *) (pc + 20);
76    swapBytes = *(GLboolean *) (pc + 24);
77    lsbFirst = *(GLboolean *) (pc + 25);
78    compsize = __glReadPixels_size(format, type, width, height);
79    if (compsize < 0)
80        return BadLength;
81
82    glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes);
83    glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst);
84    __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
85    __glXClearErrorOccured();
86    glReadPixels(*(GLint *) (pc + 0), *(GLint *) (pc + 4),
87                 *(GLsizei *) (pc + 8), *(GLsizei *) (pc + 12),
88                 *(GLenum *) (pc + 16), *(GLenum *) (pc + 20), answer);
89
90    if (__glXErrorOccured()) {
91        __GLX_BEGIN_REPLY(0);
92        __GLX_SWAP_REPLY_HEADER();
93        __GLX_SEND_HEADER();
94    }
95    else {
96        __GLX_BEGIN_REPLY(compsize);
97        __GLX_SWAP_REPLY_HEADER();
98        __GLX_SEND_HEADER();
99        __GLX_SEND_VOID_ARRAY(compsize);
100    }
101    cx->hasUnflushedCommands = GL_FALSE;
102    return Success;
103}
104
105int
106__glXDispSwap_GetTexImage(__GLXclientState * cl, GLbyte * pc)
107{
108    GLint level, compsize;
109    GLenum format, type, target;
110    GLboolean swapBytes;
111
112    __GLX_DECLARE_SWAP_VARIABLES;
113    __GLXcontext *cx;
114    ClientPtr client = cl->client;
115    int error;
116    char *answer, answerBuffer[200];
117    GLint width = 0, height = 0, depth = 1;
118
119    REQUEST_FIXED_SIZE(xGLXSingleReq, 20);
120
121    __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag);
122    cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
123    if (!cx) {
124        return error;
125    }
126
127    pc += __GLX_SINGLE_HDR_SIZE;
128    __GLX_SWAP_INT(pc + 0);
129    __GLX_SWAP_INT(pc + 4);
130    __GLX_SWAP_INT(pc + 8);
131    __GLX_SWAP_INT(pc + 12);
132
133    level = *(GLint *) (pc + 4);
134    format = *(GLenum *) (pc + 8);
135    type = *(GLenum *) (pc + 12);
136    target = *(GLenum *) (pc + 0);
137    swapBytes = *(GLboolean *) (pc + 16);
138
139    glGetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, &width);
140    glGetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, &height);
141    if (target == GL_TEXTURE_3D) {
142        glGetTexLevelParameteriv(target, level, GL_TEXTURE_DEPTH, &depth);
143    }
144    /*
145     * The three queries above might fail if we're in a state where queries
146     * are illegal, but then width, height, and depth would still be zero anyway.
147     */
148    compsize =
149        __glGetTexImage_size(target, level, format, type, width, height, depth);
150    if (compsize < 0)
151        return BadLength;
152
153    glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes);
154    __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
155    __glXClearErrorOccured();
156    glGetTexImage(*(GLenum *) (pc + 0), *(GLint *) (pc + 4),
157                  *(GLenum *) (pc + 8), *(GLenum *) (pc + 12), answer);
158
159    if (__glXErrorOccured()) {
160        __GLX_BEGIN_REPLY(0);
161        __GLX_SWAP_REPLY_HEADER();
162        __GLX_SEND_HEADER();
163    }
164    else {
165        __GLX_BEGIN_REPLY(compsize);
166        __GLX_SWAP_REPLY_HEADER();
167        __GLX_SWAP_INT(&width);
168        __GLX_SWAP_INT(&height);
169        __GLX_SWAP_INT(&depth);
170        ((xGLXGetTexImageReply *) &__glXReply)->width = width;
171        ((xGLXGetTexImageReply *) &__glXReply)->height = height;
172        ((xGLXGetTexImageReply *) &__glXReply)->depth = depth;
173        __GLX_SEND_HEADER();
174        __GLX_SEND_VOID_ARRAY(compsize);
175    }
176    return Success;
177}
178
179int
180__glXDispSwap_GetPolygonStipple(__GLXclientState * cl, GLbyte * pc)
181{
182    GLboolean lsbFirst;
183    __GLXcontext *cx;
184    ClientPtr client = cl->client;
185    int error;
186    GLubyte answerBuffer[200];
187    char *answer;
188
189    __GLX_DECLARE_SWAP_VARIABLES;
190
191    REQUEST_FIXED_SIZE(xGLXSingleReq, 4);
192
193    __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag);
194    cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
195    if (!cx) {
196        return error;
197    }
198    pc += __GLX_SINGLE_HDR_SIZE;
199    lsbFirst = *(GLboolean *) (pc + 0);
200
201    glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst);
202    __GLX_GET_ANSWER_BUFFER(answer, cl, 128, 1);
203
204    __glXClearErrorOccured();
205    glGetPolygonStipple((GLubyte *) answer);
206    if (__glXErrorOccured()) {
207        __GLX_BEGIN_REPLY(0);
208        __GLX_SWAP_REPLY_HEADER();
209        __GLX_SEND_HEADER();
210    }
211    else {
212        __GLX_BEGIN_REPLY(128);
213        __GLX_SWAP_REPLY_HEADER();
214        __GLX_SEND_HEADER();
215        __GLX_SEND_BYTE_ARRAY(128);
216    }
217    return Success;
218}
219
220static int
221GetSeparableFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
222{
223    GLint compsize, compsize2;
224    GLenum format, type, target;
225    GLboolean swapBytes;
226    __GLXcontext *cx;
227    ClientPtr client = cl->client;
228    int error;
229
230    __GLX_DECLARE_SWAP_VARIABLES;
231    char *answer, answerBuffer[200];
232    GLint width = 0, height = 0;
233
234    cx = __glXForceCurrent(cl, tag, &error);
235    if (!cx) {
236        return error;
237    }
238
239    __GLX_SWAP_INT(pc + 0);
240    __GLX_SWAP_INT(pc + 4);
241    __GLX_SWAP_INT(pc + 8);
242
243    format = *(GLenum *) (pc + 4);
244    type = *(GLenum *) (pc + 8);
245    target = *(GLenum *) (pc + 0);
246    swapBytes = *(GLboolean *) (pc + 12);
247
248    /* target must be SEPARABLE_2D, however I guess we can let the GL
249       barf on this one.... */
250
251    glGetConvolutionParameteriv(target, GL_CONVOLUTION_WIDTH, &width);
252    glGetConvolutionParameteriv(target, GL_CONVOLUTION_HEIGHT, &height);
253    /*
254     * The two queries above might fail if we're in a state where queries
255     * are illegal, but then width and height would still be zero anyway.
256     */
257    compsize = __glGetTexImage_size(target, 1, format, type, width, 1, 1);
258    compsize2 = __glGetTexImage_size(target, 1, format, type, height, 1, 1);
259
260    if ((compsize = safe_pad(compsize)) < 0)
261        return BadLength;
262    if ((compsize2 = safe_pad(compsize2)) < 0)
263        return BadLength;
264
265    glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes);
266    __GLX_GET_ANSWER_BUFFER(answer, cl, safe_add(compsize, compsize2), 1);
267    __glXClearErrorOccured();
268    glGetSeparableFilter(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4),
269                         *(GLenum *) (pc + 8), answer, answer + compsize, NULL);
270
271    if (__glXErrorOccured()) {
272        __GLX_BEGIN_REPLY(0);
273        __GLX_SWAP_REPLY_HEADER();
274    }
275    else {
276        __GLX_BEGIN_REPLY(compsize + compsize2);
277        __GLX_SWAP_REPLY_HEADER();
278        __GLX_SWAP_INT(&width);
279        __GLX_SWAP_INT(&height);
280        ((xGLXGetSeparableFilterReply *) &__glXReply)->width = width;
281        ((xGLXGetSeparableFilterReply *) &__glXReply)->height = height;
282        __GLX_SEND_VOID_ARRAY(compsize + compsize2);
283    }
284
285    return Success;
286}
287
288int
289__glXDispSwap_GetSeparableFilter(__GLXclientState * cl, GLbyte * pc)
290{
291    const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
292    ClientPtr client = cl->client;
293
294    REQUEST_FIXED_SIZE(xGLXSingleReq, 16);
295    return GetSeparableFilter(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
296}
297
298int
299__glXDispSwap_GetSeparableFilterEXT(__GLXclientState * cl, GLbyte * pc)
300{
301    const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
302    ClientPtr client = cl->client;
303
304    REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16);
305    return GetSeparableFilter(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
306}
307
308static int
309GetConvolutionFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
310{
311    GLint compsize;
312    GLenum format, type, target;
313    GLboolean swapBytes;
314    __GLXcontext *cx;
315    ClientPtr client = cl->client;
316    int error;
317
318    __GLX_DECLARE_SWAP_VARIABLES;
319    char *answer, answerBuffer[200];
320    GLint width = 0, height = 0;
321
322    cx = __glXForceCurrent(cl, tag, &error);
323    if (!cx) {
324        return error;
325    }
326
327    __GLX_SWAP_INT(pc + 0);
328    __GLX_SWAP_INT(pc + 4);
329    __GLX_SWAP_INT(pc + 8);
330
331    format = *(GLenum *) (pc + 4);
332    type = *(GLenum *) (pc + 8);
333    target = *(GLenum *) (pc + 0);
334    swapBytes = *(GLboolean *) (pc + 12);
335
336    glGetConvolutionParameteriv(target, GL_CONVOLUTION_WIDTH, &width);
337    if (target == GL_CONVOLUTION_2D) {
338        height = 1;
339    }
340    else {
341        glGetConvolutionParameteriv(target, GL_CONVOLUTION_HEIGHT, &height);
342    }
343    /*
344     * The two queries above might fail if we're in a state where queries
345     * are illegal, but then width and height would still be zero anyway.
346     */
347    compsize = __glGetTexImage_size(target, 1, format, type, width, height, 1);
348    if (compsize < 0)
349        return BadLength;
350
351    glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes);
352    __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
353    __glXClearErrorOccured();
354    glGetConvolutionFilter(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4),
355                           *(GLenum *) (pc + 8), answer);
356
357    if (__glXErrorOccured()) {
358        __GLX_BEGIN_REPLY(0);
359        __GLX_SWAP_REPLY_HEADER();
360    }
361    else {
362        __GLX_BEGIN_REPLY(compsize);
363        __GLX_SWAP_REPLY_HEADER();
364        __GLX_SWAP_INT(&width);
365        __GLX_SWAP_INT(&height);
366        ((xGLXGetConvolutionFilterReply *) &__glXReply)->width = width;
367        ((xGLXGetConvolutionFilterReply *) &__glXReply)->height = height;
368        __GLX_SEND_VOID_ARRAY(compsize);
369    }
370
371    return Success;
372}
373
374int
375__glXDispSwap_GetConvolutionFilter(__GLXclientState * cl, GLbyte * pc)
376{
377    const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
378    ClientPtr client = cl->client;
379
380    REQUEST_FIXED_SIZE(xGLXSingleReq, 16);
381    return GetConvolutionFilter(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
382}
383
384int
385__glXDispSwap_GetConvolutionFilterEXT(__GLXclientState * cl, GLbyte * pc)
386{
387    const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
388    ClientPtr client = cl->client;
389
390    REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16);
391    return GetConvolutionFilter(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
392}
393
394static int
395GetHistogram(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
396{
397    GLint compsize;
398    GLenum format, type, target;
399    GLboolean swapBytes, reset;
400    __GLXcontext *cx;
401    ClientPtr client = cl->client;
402    int error;
403
404    __GLX_DECLARE_SWAP_VARIABLES;
405    char *answer, answerBuffer[200];
406    GLint width = 0;
407
408    cx = __glXForceCurrent(cl, tag, &error);
409    if (!cx) {
410        return error;
411    }
412
413    __GLX_SWAP_INT(pc + 0);
414    __GLX_SWAP_INT(pc + 4);
415    __GLX_SWAP_INT(pc + 8);
416
417    format = *(GLenum *) (pc + 4);
418    type = *(GLenum *) (pc + 8);
419    target = *(GLenum *) (pc + 0);
420    swapBytes = *(GLboolean *) (pc + 12);
421    reset = *(GLboolean *) (pc + 13);
422
423    glGetHistogramParameteriv(target, GL_HISTOGRAM_WIDTH, &width);
424    /*
425     * The one query above might fail if we're in a state where queries
426     * are illegal, but then width would still be zero anyway.
427     */
428    compsize = __glGetTexImage_size(target, 1, format, type, width, 1, 1);
429    if (compsize < 0)
430        return BadLength;
431
432    glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes);
433    __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
434    __glXClearErrorOccured();
435    glGetHistogram(target, reset, format, type, answer);
436
437    if (__glXErrorOccured()) {
438        __GLX_BEGIN_REPLY(0);
439        __GLX_SWAP_REPLY_HEADER();
440    }
441    else {
442        __GLX_BEGIN_REPLY(compsize);
443        __GLX_SWAP_REPLY_HEADER();
444        __GLX_SWAP_INT(&width);
445        ((xGLXGetHistogramReply *) &__glXReply)->width = width;
446        __GLX_SEND_VOID_ARRAY(compsize);
447    }
448
449    return Success;
450}
451
452int
453__glXDispSwap_GetHistogram(__GLXclientState * cl, GLbyte * pc)
454{
455    const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
456    ClientPtr client = cl->client;
457
458    REQUEST_FIXED_SIZE(xGLXSingleReq, 16);
459    return GetHistogram(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
460}
461
462int
463__glXDispSwap_GetHistogramEXT(__GLXclientState * cl, GLbyte * pc)
464{
465    const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
466    ClientPtr client = cl->client;
467
468    REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16);
469    return GetHistogram(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
470}
471
472static int
473GetMinmax(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
474{
475    GLint compsize;
476    GLenum format, type, target;
477    GLboolean swapBytes, reset;
478    __GLXcontext *cx;
479    ClientPtr client = cl->client;
480    int error;
481
482    __GLX_DECLARE_SWAP_VARIABLES;
483    char *answer, answerBuffer[200];
484
485    cx = __glXForceCurrent(cl, tag, &error);
486    if (!cx) {
487        return error;
488    }
489
490    __GLX_SWAP_INT(pc + 0);
491    __GLX_SWAP_INT(pc + 4);
492    __GLX_SWAP_INT(pc + 8);
493
494    format = *(GLenum *) (pc + 4);
495    type = *(GLenum *) (pc + 8);
496    target = *(GLenum *) (pc + 0);
497    swapBytes = *(GLboolean *) (pc + 12);
498    reset = *(GLboolean *) (pc + 13);
499
500    compsize = __glGetTexImage_size(target, 1, format, type, 2, 1, 1);
501    if (compsize < 0)
502        return BadLength;
503
504    glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes);
505    __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
506    __glXClearErrorOccured();
507    glGetMinmax(target, reset, format, type, answer);
508
509    if (__glXErrorOccured()) {
510        __GLX_BEGIN_REPLY(0);
511        __GLX_SWAP_REPLY_HEADER();
512    }
513    else {
514        __GLX_BEGIN_REPLY(compsize);
515        __GLX_SWAP_REPLY_HEADER();
516        __GLX_SEND_VOID_ARRAY(compsize);
517    }
518
519    return Success;
520}
521
522int
523__glXDispSwap_GetMinmax(__GLXclientState * cl, GLbyte * pc)
524{
525    const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
526    ClientPtr client = cl->client;
527
528    REQUEST_FIXED_SIZE(xGLXSingleReq, 16);
529    return GetMinmax(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
530}
531
532int
533__glXDispSwap_GetMinmaxEXT(__GLXclientState * cl, GLbyte * pc)
534{
535    const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
536    ClientPtr client = cl->client;
537
538    REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16);
539    return GetMinmax(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
540}
541
542static int
543GetColorTable(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
544{
545    GLint compsize;
546    GLenum format, type, target;
547    GLboolean swapBytes;
548    __GLXcontext *cx;
549    ClientPtr client = cl->client;
550    int error;
551
552    __GLX_DECLARE_SWAP_VARIABLES;
553    char *answer, answerBuffer[200];
554    GLint width = 0;
555
556    cx = __glXForceCurrent(cl, tag, &error);
557    if (!cx) {
558        return error;
559    }
560
561    __GLX_SWAP_INT(pc + 0);
562    __GLX_SWAP_INT(pc + 4);
563    __GLX_SWAP_INT(pc + 8);
564
565    format = *(GLenum *) (pc + 4);
566    type = *(GLenum *) (pc + 8);
567    target = *(GLenum *) (pc + 0);
568    swapBytes = *(GLboolean *) (pc + 12);
569
570    glGetColorTableParameteriv(target, GL_COLOR_TABLE_WIDTH, &width);
571    /*
572     * The one query above might fail if we're in a state where queries
573     * are illegal, but then width would still be zero anyway.
574     */
575    compsize = __glGetTexImage_size(target, 1, format, type, width, 1, 1);
576    if (compsize < 0)
577        return BadLength;
578
579    glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes);
580    __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
581    __glXClearErrorOccured();
582    glGetColorTable(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4),
583                    *(GLenum *) (pc + 8), answer);
584
585    if (__glXErrorOccured()) {
586        __GLX_BEGIN_REPLY(0);
587        __GLX_SWAP_REPLY_HEADER();
588    }
589    else {
590        __GLX_BEGIN_REPLY(compsize);
591        __GLX_SWAP_REPLY_HEADER();
592        __GLX_SWAP_INT(&width);
593        ((xGLXGetColorTableReply *) &__glXReply)->width = width;
594        __GLX_SEND_VOID_ARRAY(compsize);
595    }
596
597    return Success;
598}
599
600int
601__glXDispSwap_GetColorTable(__GLXclientState * cl, GLbyte * pc)
602{
603    const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
604    ClientPtr client = cl->client;
605
606    REQUEST_FIXED_SIZE(xGLXSingleReq, 16);
607    return GetColorTable(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
608}
609
610int
611__glXDispSwap_GetColorTableSGI(__GLXclientState * cl, GLbyte * pc)
612{
613    const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
614    ClientPtr client = cl->client;
615
616    REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16);
617    return GetColorTable(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
618}
619