~ubuntu-branches/ubuntu/edgy/xorg-server/edgy-updates

« back to all changes in this revision

Viewing changes to GL/glx/single2.c

  • Committer: Bazaar Package Importer
  • Author(s): Rodrigo Parra Novo
  • Date: 2006-07-25 20:06:28 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20060725200628-gjmmd9gxfxdc4ejs
Tags: 1:1.1.1-0ubuntu1
* New Upstream version
* Changed Build-Depends from mesa-swrast-source to mesa-swx11-source,
  following Debian package nomenclature
* Re-did 12_security_policy_in_etc.diff for 1.1.1
* Dropped 15_security_allocate_local.diff (applied upstream)
* Dropped 16_SECURITY_setuid.diff (applied upstream)
* Dropped 000_ubuntu_fix_read_kernel_mapping.patch (applied upstream)
* Dropped 002_ubuntu_fix_for_certain_intel_chipsets.patch (applied upstream)
* Updated versioned Build-Depends on mesa-swx11-source to version
  6.5.0.cvs.20060725-0ubuntu1
* Added arrayobj.c, arrayobj.h, bitset.h & rbadaptors.h to
  GL/symlink-mesa.sh (linked from mesa-swx11-source)
* Added arrayobj.c to default build target on GL/mesa/main

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
#include <dix-config.h>
40
40
#endif
41
41
 
 
42
#include <string.h>
 
43
#include <stdio.h>
 
44
#include <stdlib.h>
 
45
 
42
46
#include "glxserver.h"
43
47
#include "glxutil.h"
44
48
#include "glxext.h"
 
49
#include "indirect_dispatch.h"
45
50
#include "unpack.h"
46
 
#include "g_disptab.h"
47
 
#include "GL/glx_ansic.h"
 
51
#include "glapitable.h"
 
52
#include "glapi.h"
 
53
#include "glthread.h"
 
54
#include "dispatch.h"
48
55
 
49
56
int __glXDisp_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc)
50
57
{
62
69
    size = *(GLsizei *)(pc+0);
63
70
    type = *(GLenum *)(pc+4);
64
71
    if (cx->feedbackBufSize < size) {
65
 
        cx->feedbackBuf = (GLfloat *) __glXRealloc(cx->feedbackBuf,
 
72
        cx->feedbackBuf = (GLfloat *) xrealloc(cx->feedbackBuf,
66
73
                                                   (size_t)size 
67
74
                                                   * __GLX_SIZE_FLOAT32);
68
75
        if (!cx->feedbackBuf) {
71
78
        }
72
79
        cx->feedbackBufSize = size;
73
80
    }
74
 
    glFeedbackBuffer(size, type, cx->feedbackBuf);
 
81
    CALL_FeedbackBuffer( GET_DISPATCH(), (size, type, cx->feedbackBuf) );
75
82
    __GLX_NOTE_UNFLUSHED_CMDS(cx);
76
83
    return Success;
77
84
}
90
97
    pc += __GLX_SINGLE_HDR_SIZE;
91
98
    size = *(GLsizei *)(pc+0);
92
99
    if (cx->selectBufSize < size) {
93
 
        cx->selectBuf = (GLuint *) __glXRealloc(cx->selectBuf,
 
100
        cx->selectBuf = (GLuint *) xrealloc(cx->selectBuf,
94
101
                                                (size_t) size 
95
102
                                                * __GLX_SIZE_CARD32);
96
103
        if (!cx->selectBuf) {
99
106
        }
100
107
        cx->selectBufSize = size;
101
108
    }
102
 
    glSelectBuffer(size, cx->selectBuf);
 
109
    CALL_SelectBuffer( GET_DISPATCH(), (size, cx->selectBuf) );
103
110
    __GLX_NOTE_UNFLUSHED_CMDS(cx);
104
111
    return Success;
105
112
}
121
128
 
122
129
    pc += __GLX_SINGLE_HDR_SIZE;
123
130
    newMode = *(GLenum*) pc;
124
 
    retval = glRenderMode(newMode);
 
131
    retval = CALL_RenderMode( GET_DISPATCH(), (newMode) );
125
132
 
126
133
    /* Check that render mode worked */
127
 
    glGetIntegerv(GL_RENDER_MODE, &newModeCheck);
 
134
    CALL_GetIntegerv( GET_DISPATCH(), (GL_RENDER_MODE, &newModeCheck) );
128
135
    if (newModeCheck != newMode) {
129
136
        /* Render mode change failed.  Bail */
130
137
        newMode = newModeCheck;
212
219
                return error;
213
220
        }
214
221
 
215
 
        glFlush();
 
222
        CALL_Flush( GET_DISPATCH(), () );
216
223
        __GLX_NOTE_FLUSHED_CMDS(cx);
217
224
        return Success;
218
225
}
229
236
    }
230
237
 
231
238
    /* Do a local glFinish */
232
 
    glFinish();
 
239
    CALL_Finish( GET_DISPATCH(), () );
233
240
    __GLX_NOTE_FLUSHED_CMDS(cx);
234
241
 
235
242
    /* Send empty reply packet to indicate finish is finished */
258
265
   ** pull tokens out of shortest string
259
266
   ** include space in combo_string for final separator and null terminator
260
267
   */
261
 
   if ( (clen = __glXStrlen(cext_string)) > (slen = __glXStrlen(sext_string)) ) {
262
 
        combo_string = (char *) __glXMalloc(slen + 2);
263
 
        s1 = (char *) __glXMalloc(slen + 2); __glXStrcpy(s1, sext_string);
 
268
   clen = strlen(cext_string);
 
269
   slen = strlen(sext_string);
 
270
   if (clen > slen) {
 
271
        combo_string = (char *) xalloc(slen + 2);
 
272
        s1 = (char *) xalloc(slen + 2);
 
273
        if (s1) strcpy(s1, sext_string);
264
274
        s2 = cext_string;
265
275
   } else {
266
 
        combo_string = (char *) __glXMalloc(clen + 2);
267
 
        s1 = (char *) __glXMalloc(clen + 2); __glXStrcpy(s1, cext_string);
 
276
        combo_string = (char *) xalloc(clen + 2);
 
277
        s1 = (char *) xalloc(clen + 2);
 
278
        if (s1) strcpy(s1, cext_string);
268
279
        s2 = sext_string;
269
280
   }
270
281
   if (!combo_string || !s1) {
271
 
        if (combo_string) __glXFree(combo_string);
272
 
        if (s1) __glXFree(s1);
 
282
        if (combo_string)
 
283
            xfree(combo_string);
 
284
        if (s1)
 
285
            xfree(s1);
273
286
        return NULL;
274
287
   }
275
288
   combo_string[0] = '\0';
276
289
 
277
290
   /* Get first extension token */
278
 
   token = __glXStrtok( s1, SEPARATOR);
 
291
   token = strtok( s1, SEPARATOR);
279
292
   while ( token != NULL ) {
280
293
 
281
294
        /*
283
296
        ** beware of extension names which are prefixes of other extension names
284
297
        */
285
298
        const char *p = s2;
286
 
        end = p + __glXStrlen(p);
 
299
        end = p + strlen(p);
287
300
        while (p < end) {
288
 
            size_t n = __glXStrcspn(p, SEPARATOR);
289
 
            if ((__glXStrlen(token) == n) && (__glXStrncmp(token, p, n) == 0)) {
290
 
                combo_string = __glXStrcat( combo_string, token);
291
 
                combo_string = __glXStrcat( combo_string, SEPARATOR);
 
301
            size_t n = strcspn(p, SEPARATOR);
 
302
            if ((strlen(token) == n) && (strncmp(token, p, n) == 0)) {
 
303
                combo_string = strcat(combo_string, token);
 
304
                combo_string = strcat(combo_string, SEPARATOR);
292
305
            }
293
306
            p += (n + 1);
294
307
        }
295
308
 
296
309
        /* Get next extension token */
297
 
        token = __glXStrtok( NULL, SEPARATOR);
 
310
        token = strtok( NULL, SEPARATOR);
298
311
   }
299
 
   __glXFree(s1);
 
312
   xfree(s1);
300
313
   return combo_string;
301
314
}
302
315
 
326
339
 
327
340
    pc += __GLX_SINGLE_HDR_SIZE;
328
341
    name = *(GLenum *)(pc + 0);
329
 
    string = (const char *)glGetString(name);
 
342
    string = (const char *) CALL_GetString( GET_DISPATCH(), (name) );
330
343
    client = cl->client;
331
344
 
332
345
    /*
340
353
        buf = __glXcombine_strings(buf1,
341
354
                                      cx->pGlxScreen->GLextensions);
342
355
        if (buf1 != NULL) {
343
 
            __glXFree(buf1);
 
356
            xfree(buf1);
344
357
        }
345
358
        string = buf;
346
359
    }
347
360
    else if ( name == GL_VERSION ) {
348
361
        if ( atof( string ) > atof( GLServerVersion ) ) {
349
 
            buf = __glXMalloc( __glXStrlen( string ) 
350
 
                               + __glXStrlen( GLServerVersion )
351
 
                               + 4 );
 
362
            buf = xalloc( strlen( string ) + strlen( GLServerVersion ) + 4 );
352
363
            if ( buf == NULL ) {
353
364
                string = GLServerVersion;
354
365
            }
355
366
            else {
356
 
                __glXSprintf( buf, "%s (%s)", GLServerVersion, string );
 
367
                sprintf( buf, "%s (%s)", GLServerVersion, string );
357
368
                string = buf;
358
369
            }
359
370
        }
360
371
    }
361
372
    if (string) {
362
 
        length = __glXStrlen((const char *) string) + 1;
 
373
        length = strlen((const char *) string) + 1;
363
374
    }
364
375
 
365
376
    __GLX_BEGIN_REPLY(length);
372
383
 
373
384
    __GLX_SEND_HEADER();
374
385
    WriteToClient(client, length, (char *) string); 
375
 
    if (buf != NULL) {
376
 
        __glXFree(buf);
377
 
    }
 
386
    if (buf != NULL)
 
387
        xfree(buf);
 
388
 
378
389
    return Success;
379
390
}
380
391
 
382
393
{
383
394
    return DoGetString(cl, pc, GL_FALSE);
384
395
}
385
 
 
386
 
int __glXDisp_GetClipPlane(__GLXclientState *cl, GLbyte *pc)
387
 
{
388
 
    __GLXcontext *cx;
389
 
    ClientPtr client = cl->client;
390
 
    int error;
391
 
    GLdouble answer[4];
392
 
 
393
 
    cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
394
 
    if (!cx) {
395
 
        return error;
396
 
    }
397
 
    pc += __GLX_SINGLE_HDR_SIZE;
398
 
 
399
 
    __glXClearErrorOccured();
400
 
    glGetClipPlane(*(GLenum   *)(pc + 0), answer);
401
 
    if (__glXErrorOccured()) {
402
 
        __GLX_BEGIN_REPLY(0);
403
 
        __GLX_SEND_HEADER();
404
 
    } else {
405
 
        __GLX_BEGIN_REPLY(32);
406
 
        __GLX_SEND_HEADER();
407
 
        __GLX_SEND_DOUBLE_ARRAY(4);
408
 
    }
409
 
    return Success;
410
 
}
411