xm_api.c File Reference

All the XMesa* API functions. More...

Include dependency graph for xm_api.c:

Go to the source code of this file.

Defines

#define NUM_VISUAL_TYPES   6

Functions

static int host_byte_order (void)
 Return the host's byte order as LSBFirst or MSBFirst ala X.
int xmesa_check_for_xshm (XMesaDisplay *display)
 Check if the X Shared Memory extension is available.
static int bits_per_pixel (XMesaVisual xmv)
 Return the true number of bits per pixel for XImages.
static int window_exists_err_handler (XMesaDisplay *dpy, XErrorEvent *xerr)
static GLboolean window_exists (XMesaDisplay *dpy, Window win)
static Status get_drawable_size (XMesaDisplay *dpy, Drawable d, uint *width, uint *height)
static void xmesa_get_window_size (XMesaDisplay *dpy, XMesaBuffer b, GLuint *width, GLuint *height)
 Return the size of the window (or pixmap) that corresponds to the given XMesaBuffer.
static GLuint choose_pixel_format (XMesaVisual v)
 Choose the pixel format for the given visual.
static XMesaBuffer create_xmesa_buffer (XMesaDrawable d, BufferType type, XMesaVisual vis, XMesaColormap cmap)
 Allocate a new XMesaBuffer object which corresponds to the given drawable.
XMesaBuffer xmesa_find_buffer (XMesaDisplay *dpy, XMesaColormap cmap, XMesaBuffer notThis)
 Find an XMesaBuffer by matching X display and colormap but NOT matching the notThis buffer.
static void xmesa_free_buffer (XMesaBuffer buffer)
 Remove buffer from linked list, delete if no longer referenced.
static GLboolean initialize_visual_and_buffer (XMesaVisual v, XMesaBuffer b, GLboolean rgb_flag, XMesaDrawable window, XMesaColormap cmap)
 When a context is bound for the first time, we can finally finish initializing the context's visual and buffer information.
static GLint xmesa_convert_from_x_visual_type (int visualType)
 Convert an X visual type to a GLX visual type.
PUBLIC XMesaVisual XMesaCreateVisual (XMesaDisplay *display, XMesaVisualInfo visinfo, GLboolean rgb_flag, GLboolean alpha_flag, GLboolean db_flag, GLboolean stereo_flag, GLboolean ximage_flag, GLint depth_size, GLint stencil_size, GLint accum_red_size, GLint accum_green_size, GLint accum_blue_size, GLint accum_alpha_size, GLint num_samples, GLint level, GLint visualCaveat)
PUBLIC void XMesaDestroyVisual (XMesaVisual v)
PUBLIC XMesaContext XMesaCreateContext (XMesaVisual v, XMesaContext share_list)
 Create a new XMesaContext.
PUBLIC void XMesaDestroyContext (XMesaContext c)
PUBLIC XMesaBuffer XMesaCreateWindowBuffer (XMesaVisual v, XMesaWindow w)
 Private function for creating an XMesaBuffer which corresponds to an X window or pixmap.
PUBLIC XMesaBuffer XMesaCreatePixmapBuffer (XMesaVisual v, XMesaPixmap p, XMesaColormap cmap)
 Create a new XMesaBuffer from an X pixmap.
XMesaBuffer XMesaCreatePixmapTextureBuffer (XMesaVisual v, XMesaPixmap p, XMesaColormap cmap, int format, int target, int mipmap)
 For GLX_EXT_texture_from_pixmap.
XMesaBuffer XMesaCreatePBuffer (XMesaVisual v, XMesaColormap cmap, unsigned int width, unsigned int height)
PUBLIC void XMesaDestroyBuffer (XMesaBuffer b)
void xmesa_check_and_update_buffer_size (XMesaContext xmctx, XMesaBuffer drawBuffer)
 Query the current window size and update the corresponding GLframebuffer and all attached renderbuffers.
GLboolean XMesaMakeCurrent (XMesaContext c, XMesaBuffer b)
PUBLIC GLboolean XMesaMakeCurrent2 (XMesaContext c, XMesaBuffer drawBuffer, XMesaBuffer readBuffer)
GLboolean XMesaUnbindContext (XMesaContext c)
XMesaContext XMesaGetCurrentContext (void)
XMesaBuffer XMesaGetCurrentBuffer (void)
XMesaBuffer XMesaGetCurrentReadBuffer (void)
GLboolean XMesaSetFXmode (GLint mode)
PUBLIC void XMesaSwapBuffers (XMesaBuffer b)
void XMesaCopySubBuffer (XMesaBuffer b, int x, int y, int width, int height)
GLboolean XMesaGetDepthBuffer (XMesaBuffer b, GLint *width, GLint *height, GLint *bytesPerValue, void **buffer)
void XMesaFlush (XMesaContext c)
const char * XMesaGetString (XMesaContext c, int name)
XMesaBuffer XMesaFindBuffer (XMesaDisplay *dpy, XMesaDrawable d)
void xmesa_destroy_buffers_on_display (XMesaDisplay *dpy)
 Free/destroy all XMesaBuffers associated with given display.
void XMesaGarbageCollect (void)
unsigned long XMesaDitherColor (XMesaContext xmesa, GLint x, GLint y, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
PUBLIC void XMesaResizeBuffers (XMesaBuffer b)
PUBLIC void XMesaBindTexImage (XMesaDisplay *dpy, XMesaBuffer drawable, int buffer, const int *attrib_list)
PUBLIC void XMesaReleaseTexImage (XMesaDisplay *dpy, XMesaBuffer drawable, int buffer)

Variables

pipe_mutex _xmesa_lock
 Global X driver lock.
int xmesa_mode
static GLboolean WindowExistsFlag
XMesaBuffer XMesaBufferList = NULL


Detailed Description

All the XMesa* API functions.

NOTES:

The window coordinate system origin (0,0) is in the lower-left corner of the window. X11's window coordinate origin is in the upper-left corner of the window. Therefore, most drawing functions in this file have to flip Y coordinates.

Define USE_XSHM in the Makefile with -DUSE_XSHM if you want to compile in support for the MIT Shared Memory extension. If enabled, when you use an Ximage for the back buffer in double buffered mode, the "swap" operation will be faster. You must also link with -lXext.

Byte swapping: If the Mesa host and the X display use a different byte order then there's some trickiness to be aware of when using XImages. The byte ordering used for the XImage is that of the X display, not the Mesa host. The color-to-pixel encoding for True/DirectColor must be done according to the display's visual red_mask, green_mask, and blue_mask. If XPutPixel is used to put a pixel into an XImage then XPutPixel will do byte swapping if needed. If one wants to directly "poke" the pixel into the XImage's buffer then the pixel must be byte swapped first.

Definition in file xm_api.c.


Define Documentation

#define NUM_VISUAL_TYPES   6

Definition at line 573 of file xm_api.c.


Function Documentation

static int bits_per_pixel ( XMesaVisual  xmv  )  [static]

Return the true number of bits per pixel for XImages.

For example, if we request a 24-bit deep visual we may actually need/get 32bpp XImages. This function returns the appropriate bpp. Input: dpy - the X display visinfo - desribes the visual to be used for XImages Return: true number of bits per pixel for XImages

Definition at line 147 of file xm_api.c.

References assert, MALLOC, and XMesaDestroyImage().

00148 {
00149 #ifdef XFree86Server
00150    const int depth = xmv->nplanes;
00151    int i;
00152    assert(depth > 0);
00153    for (i = 0; i < screenInfo.numPixmapFormats; i++) {
00154       if (screenInfo.formats[i].depth == depth)
00155          return screenInfo.formats[i].bitsPerPixel;
00156    }
00157    return depth;  /* should never get here, but this should be safe */
00158 #else
00159    XMesaDisplay *dpy = xmv->display;
00160    XMesaVisualInfo visinfo = xmv->visinfo;
00161    XMesaImage *img;
00162    int bitsPerPixel;
00163    /* Create a temporary XImage */
00164    img = XCreateImage( dpy, visinfo->visual, visinfo->depth,
00165                        ZPixmap, 0,           /*format, offset*/
00166                        (char*) MALLOC(8),    /*data*/
00167                        1, 1,                 /*width, height*/
00168                        32,                   /*bitmap_pad*/
00169                        0                     /*bytes_per_line*/
00170                      );
00171    assert(img);
00172    /* grab the bits/pixel value */
00173    bitsPerPixel = img->bits_per_pixel;
00174    /* free the XImage */
00175    _mesa_free( img->data );
00176    img->data = NULL;
00177    XMesaDestroyImage( img );
00178    return bitsPerPixel;
00179 #endif
00180 }

static GLuint choose_pixel_format ( XMesaVisual  v  )  [static]

Choose the pixel format for the given visual.

This will tell the gallium driver how to pack pixel data into drawing surfaces.

Definition at line 267 of file xm_api.c.

References assert, PIPE_FORMAT_A8R8G8B8_UNORM, PIPE_FORMAT_B8G8R8A8_UNORM, PIPE_FORMAT_R5G6B5_UNORM, and PIPE_FORMAT_R8G8B8A8_UNORM.

00268 {
00269    if (   GET_REDMASK(v)   == 0x0000ff
00270        && GET_GREENMASK(v) == 0x00ff00
00271        && GET_BLUEMASK(v)  == 0xff0000
00272        && v->BitsPerPixel == 32) {
00273       if (CHECK_BYTE_ORDER(v)) {
00274          /* no byteswapping needed */
00275          return 0 /* PIXEL_FORMAT_U_A8_B8_G8_R8 */;
00276       }
00277       else {
00278          return PIPE_FORMAT_R8G8B8A8_UNORM;
00279       }
00280    }
00281    else if (   GET_REDMASK(v)   == 0xff0000
00282             && GET_GREENMASK(v) == 0x00ff00
00283             && GET_BLUEMASK(v)  == 0x0000ff
00284             && v->BitsPerPixel == 32) {
00285       if (CHECK_BYTE_ORDER(v)) {
00286          /* no byteswapping needed */
00287          return PIPE_FORMAT_A8R8G8B8_UNORM;
00288       }
00289       else {
00290          return PIPE_FORMAT_B8G8R8A8_UNORM;
00291       }
00292    }
00293    else if (   GET_REDMASK(v)   == 0xf800
00294             && GET_GREENMASK(v) == 0x07e0
00295             && GET_BLUEMASK(v)  == 0x001f
00296             && CHECK_BYTE_ORDER(v)
00297             && v->BitsPerPixel == 16) {
00298       /* 5-6-5 RGB */
00299       return PIPE_FORMAT_R5G6B5_UNORM;
00300    }
00301 
00302    assert(0);
00303    return 0;
00304 }

static XMesaBuffer create_xmesa_buffer ( XMesaDrawable  d,
BufferType  type,
XMesaVisual  vis,
XMesaColormap  cmap 
) [static]

Allocate a new XMesaBuffer object which corresponds to the given drawable.

Note that XMesaBuffer is derived from GLframebuffer. The new XMesaBuffer will not have any size (Width=Height=0).

Parameters:
d the corresponding X drawable (window or pixmap)
type either WINDOW, PIXMAP or PBUFFER, describing d
vis the buffer's visual
cmap the window's colormap, if known.
Returns:
new XMesaBuffer or NULL if any problem

Definition at line 327 of file xm_api.c.

References ASSERT, CALLOC_STRUCT, choose_pixel_format(), get_drawable_size(), PBUFFER, PIPE_FORMAT_NONE, PIPE_FORMAT_S8_UNORM, PIPE_FORMAT_S8Z24_UNORM, PIPE_FORMAT_X8Z24_UNORM, PIPE_FORMAT_Z16_UNORM, PIPE_FORMAT_Z32_UNORM, PIXMAP, st_create_framebuffer(), WINDOW, and XMesaBufferList.

00329 {
00330    XMesaBuffer b;
00331    GLframebuffer *fb;
00332    enum pipe_format colorFormat, depthFormat, stencilFormat;
00333    uint width, height;
00334 
00335    ASSERT(type == WINDOW || type == PIXMAP || type == PBUFFER);
00336 
00337    b = (XMesaBuffer) CALLOC_STRUCT(xmesa_buffer);
00338    if (!b)
00339       return NULL;
00340 
00341    b->drawable = d;
00342 
00343    b->xm_visual = vis;
00344    b->type = type;
00345    b->cmap = cmap;
00346 
00347    /* determine PIPE_FORMATs for buffers */
00348    colorFormat = choose_pixel_format(vis);
00349 
00350    if (vis->mesa_visual.depthBits == 0)
00351       depthFormat = PIPE_FORMAT_NONE;
00352 #ifdef GALLIUM_CELL /* XXX temporary for Cell! */
00353    else
00354       depthFormat = PIPE_FORMAT_S8Z24_UNORM;
00355 #else
00356    else if (vis->mesa_visual.depthBits <= 16)
00357       depthFormat = PIPE_FORMAT_Z16_UNORM;
00358    else if (vis->mesa_visual.depthBits <= 24)
00359       depthFormat = PIPE_FORMAT_S8Z24_UNORM;
00360    else
00361       depthFormat = PIPE_FORMAT_Z32_UNORM;
00362 #endif
00363 
00364    if (vis->mesa_visual.stencilBits == 8) {
00365       if (depthFormat == PIPE_FORMAT_S8Z24_UNORM)
00366          stencilFormat = depthFormat;
00367       else
00368          stencilFormat = PIPE_FORMAT_S8_UNORM;
00369    }
00370    else {
00371       /* no stencil */
00372       stencilFormat = PIPE_FORMAT_NONE;
00373       if (depthFormat == PIPE_FORMAT_S8Z24_UNORM) {
00374          /* use 24-bit Z, undefined stencil channel */
00375          depthFormat = PIPE_FORMAT_X8Z24_UNORM;
00376       }
00377    }
00378 
00379 
00380    get_drawable_size(vis->display, d, &width, &height);
00381 
00382    /*
00383     * Create framebuffer, but we'll plug in our own renderbuffers below.
00384     */
00385    b->stfb = st_create_framebuffer(&vis->mesa_visual,
00386                                    colorFormat, depthFormat, stencilFormat,
00387                                    width, height,
00388                                    (void *) b);
00389    fb = &b->stfb->Base;
00390 
00391    /*
00392     * Create scratch XImage for xmesa_display_surface()
00393     */
00394    b->tempImage = XCreateImage(vis->display,
00395                                vis->visinfo->visual,
00396                                vis->visinfo->depth,
00397                                ZPixmap, 0,   /* format, offset */
00398                                NULL,         /* data */
00399                                0, 0,         /* size */
00400                                32,           /* bitmap_pad */
00401                                0);           /* bytes_per_line */
00402 
00403    /* GLX_EXT_texture_from_pixmap */
00404    b->TextureTarget = 0;
00405    b->TextureFormat = GLX_TEXTURE_FORMAT_NONE_EXT;
00406    b->TextureMipmap = 0;
00407 
00408    /* insert buffer into linked list */
00409    b->Next = XMesaBufferList;
00410    XMesaBufferList = b;
00411 
00412    return b;
00413 }

static Status get_drawable_size ( XMesaDisplay *  dpy,
Drawable  d,
uint width,
uint height 
) [static]

Definition at line 217 of file xm_api.c.

00218 {
00219    Window root;
00220    Status stat;
00221    int xpos, ypos;
00222    unsigned int w, h, bw, depth;
00223    stat = XGetGeometry(dpy, d, &root, &xpos, &ypos, &w, &h, &bw, &depth);
00224    *width = w;
00225    *height = h;
00226    return stat;
00227 }

static int host_byte_order ( void   )  [static]

Return the host's byte order as LSBFirst or MSBFirst ala X.

Definition at line 92 of file xm_api.c.

00093 {
00094    int i = 1;
00095    char *cptr = (char *) &i;
00096    return (*cptr==1) ? LSBFirst : MSBFirst;
00097 }

static GLboolean initialize_visual_and_buffer ( XMesaVisual  v,
XMesaBuffer  b,
GLboolean  rgb_flag,
XMesaDrawable  window,
XMesaColormap  cmap 
) [static]

When a context is bound for the first time, we can finally finish initializing the context's visual and buffer information.

Parameters:
v the XMesaVisual to initialize
b the XMesaBuffer to initialize (may be NULL)
rgb_flag TRUE = RGBA mode, FALSE = color index mode
window the window/pixmap we're rendering into
cmap the colormap associated with the window/pixmap
Returns:
GL_TRUE=success, GL_FALSE=failure

Definition at line 498 of file xm_api.c.

References assert, ASSERT, bits_per_pixel(), and xmesa_check_for_xshm().

00501 {
00502 #ifdef XFree86Server
00503    int client = (window) ? CLIENT_ID(window->id) : 0;
00504 #endif
00505 
00506    ASSERT(!b || b->xm_visual == v);
00507 
00508    /* Save true bits/pixel */
00509    v->BitsPerPixel = bits_per_pixel(v);
00510    assert(v->BitsPerPixel > 0);
00511 
00512    if (rgb_flag == GL_FALSE) {
00513       /* COLOR-INDEXED WINDOW: not supported*/
00514       return GL_FALSE;
00515    }
00516    else {
00517       /* RGB WINDOW:
00518        * We support RGB rendering into almost any kind of visual.
00519        */
00520       const int xclass = v->mesa_visual.visualType;
00521       if (xclass != GLX_TRUE_COLOR && xclass == !GLX_DIRECT_COLOR) {
00522          _mesa_warning(NULL,
00523             "XMesa: RGB mode rendering not supported in given visual.\n");
00524          return GL_FALSE;
00525       }
00526       v->mesa_visual.indexBits = 0;
00527 
00528       if (v->BitsPerPixel == 32) {
00529          /* We use XImages for all front/back buffers.  If an X Window or
00530           * X Pixmap is 32bpp, there's no guarantee that the alpha channel
00531           * will be preserved.  For XImages we're in luck.
00532           */
00533          v->mesa_visual.alphaBits = 8;
00534       }
00535    }
00536 
00537    /*
00538     * If MESA_INFO env var is set print out some debugging info
00539     * which can help Brian figure out what's going on when a user
00540     * reports bugs.
00541     */
00542    if (_mesa_getenv("MESA_INFO")) {
00543       _mesa_printf("X/Mesa visual = %p\n", (void *) v);
00544       _mesa_printf("X/Mesa level = %d\n", v->mesa_visual.level);
00545       _mesa_printf("X/Mesa depth = %d\n", GET_VISUAL_DEPTH(v));
00546       _mesa_printf("X/Mesa bits per pixel = %d\n", v->BitsPerPixel);
00547    }
00548 
00549    if (b && window) {
00550       /* these should have been set in create_xmesa_buffer */
00551       ASSERT(b->drawable == window);
00552 
00553       /* Setup for single/double buffering */
00554       if (v->mesa_visual.doubleBufferMode) {
00555          /* Double buffered */
00556          b->shm = xmesa_check_for_xshm( v->display );
00557       }
00558 
00559       /* X11 graphics context */
00560 #ifdef XFree86Server
00561       b->gc = CreateScratchGC(v->display, window->depth);
00562 #else
00563       b->gc = XCreateGC( v->display, window, 0, NULL );
00564 #endif
00565       XMesaSetFunction( v->display, b->gc, GXcopy );
00566    }
00567 
00568    return GL_TRUE;
00569 }

static GLboolean window_exists ( XMesaDisplay *  dpy,
Window  win 
) [static]

Definition at line 205 of file xm_api.c.

References window_exists_err_handler(), and WindowExistsFlag.

00206 {
00207    XWindowAttributes wa;
00208    int (*old_handler)( XMesaDisplay*, XErrorEvent* );
00209    WindowExistsFlag = GL_TRUE;
00210    old_handler = XSetErrorHandler(window_exists_err_handler);
00211    XGetWindowAttributes( dpy, win, &wa ); /* dummy request */
00212    XSetErrorHandler(old_handler);
00213    return WindowExistsFlag;
00214 }

static int window_exists_err_handler ( XMesaDisplay *  dpy,
XErrorEvent *  xerr 
) [static]

Definition at line 196 of file xm_api.c.

References WindowExistsFlag.

00197 {
00198    (void) dpy;
00199    if (xerr->error_code == BadWindow) {
00200       WindowExistsFlag = GL_FALSE;
00201    }
00202    return 0;
00203 }

void xmesa_check_and_update_buffer_size ( XMesaContext  xmctx,
XMesaBuffer  drawBuffer 
)

Query the current window size and update the corresponding GLframebuffer and all attached renderbuffers.

Called when: 1. the first time a buffer is bound to a context. 2. from the XMesaResizeBuffers() API function. 3. SwapBuffers. XXX probabaly from xm_flush_frontbuffer() too... Note: it's possible (and legal) for xmctx to be NULL. That can happen when resizing a buffer when no rendering context is bound.

Definition at line 1071 of file xm_api.c.

01074 {
01075    GLuint width, height;
01076    xmesa_get_window_size(drawBuffer->xm_visual->display, drawBuffer, &width, &height);

int xmesa_check_for_xshm ( XMesaDisplay *  display  ) 

Check if the X Shared Memory extension is available.

Return: 0 = not available 1 = shared XImage support available 2 = shared Pixmap support available also

Definition at line 107 of file xm_api.c.

00108 {
00109 #if defined(USE_XSHM) && !defined(XFree86Server)
00110    int major, minor, ignore;
00111    Bool pixmaps;
00112 
00113    if (getenv("SP_NO_RAST")) 
00114       return 0;
00115 
00116    if (getenv("MESA_NOSHM")) {
00117       return 0;
00118    }
00119 
00120    if (XQueryExtension( display, "MIT-SHM", &ignore, &ignore, &ignore )) {
00121       if (XShmQueryVersion( display, &major, &minor, &pixmaps )==True) {
00122          return (pixmaps==True) ? 2 : 1;
00123       }
00124       else {
00125          return 0;
00126       }
00127    }
00128    else {
00129       return 0;
00130    }
00131 #else
00132    /* No  XSHM support */
00133    return 0;
00134 #endif
00135 }

static GLint xmesa_convert_from_x_visual_type ( int  visualType  )  [static]

Convert an X visual type to a GLX visual type.

Parameters:
visualType X visual type (i.e., TrueColor, StaticGray, etc.) to be converted.
Returns:
If visualType is a valid X visual type, a GLX visual type will be returned. Otherwise GLX_NONE will be returned.
Note:
This code was lifted directly from lib/GL/glx/glcontextmodes.c in the DRI CVS tree.

Definition at line 588 of file xm_api.c.

References NUM_VISUAL_TYPES.

00589 {
00590     static const int glx_visual_types[ NUM_VISUAL_TYPES ] = {
00591         GLX_STATIC_GRAY,  GLX_GRAY_SCALE,
00592         GLX_STATIC_COLOR, GLX_PSEUDO_COLOR,
00593         GLX_TRUE_COLOR,   GLX_DIRECT_COLOR
00594     };
00595 
00596     return ( (unsigned) visualType < NUM_VISUAL_TYPES )
00597         ? glx_visual_types[ visualType ] : GLX_NONE;
00598 }

void xmesa_destroy_buffers_on_display ( XMesaDisplay *  dpy  ) 

Free/destroy all XMesaBuffers associated with given display.

Definition at line 1343 of file xm_api.c.

01346 {
01347    XMesaBuffer b, next;
01348    for (b = XMesaBufferList; b; b = next) {
01349       next = b->Next;
01350       if (b->xm_visual->display == dpy) {
01351          xmesa_free_buffer(b);
01352       }

XMesaBuffer xmesa_find_buffer ( XMesaDisplay *  dpy,
XMesaColormap  cmap,
XMesaBuffer  notThis 
)

Find an XMesaBuffer by matching X display and colormap but NOT matching the notThis buffer.

Definition at line 421 of file xm_api.c.

References XMesaBufferList.

00422 {
00423    XMesaBuffer b;
00424    for (b = XMesaBufferList; b; b = b->Next) {
00425       if (b->xm_visual->display == dpy &&
00426           b->cmap == cmap &&
00427           b != notThis) {
00428          return b;
00429       }
00430    }
00431    return NULL;
00432 }

static void xmesa_free_buffer ( XMesaBuffer  buffer  )  [static]

Remove buffer from linked list, delete if no longer referenced.

Definition at line 439 of file xm_api.c.

References XMesaBufferList.

00440 {
00441    XMesaBuffer prev = NULL, b;
00442 
00443    for (b = XMesaBufferList; b; b = b->Next) {
00444       if (b == buffer) {
00445          struct gl_framebuffer *fb = &buffer->stfb->Base;
00446 
00447          /* unlink buffer from list */
00448          if (prev)
00449             prev->Next = buffer->Next;
00450          else
00451             XMesaBufferList = buffer->Next;
00452 
00453          /* mark as delete pending */
00454          fb->DeletePending = GL_TRUE;
00455 
00456          /* Since the X window for the XMesaBuffer is going away, we don't
00457           * want to dereference this pointer in the future.
00458           */
00459          b->drawable = 0;
00460 
00461          buffer->tempImage->data = NULL;
00462          XDestroyImage(buffer->tempImage);
00463 
00464          /* Unreference.  If count = zero we'll really delete the buffer */
00465          _mesa_unreference_framebuffer(&fb);
00466 
00467          XFreeGC(b->xm_visual->display, b->gc);
00468 
00469          free(buffer);
00470 
00471          return;
00472       }
00473       /* continue search */
00474       prev = b;
00475    }
00476    /* buffer not found in XMesaBufferList */
00477    _mesa_problem(NULL,"xmesa_free_buffer() - buffer not found\n");
00478 }

static void xmesa_get_window_size ( XMesaDisplay *  dpy,
XMesaBuffer  b,
GLuint *  width,
GLuint *  height 
) [static]

Return the size of the window (or pixmap) that corresponds to the given XMesaBuffer.

Parameters:
width returns width in pixels
height returns height in pixels

Definition at line 238 of file xm_api.c.

References _xmesa_lock, get_drawable_size(), MAX_HEIGHT, MAX_WIDTH, MIN2, pipe_mutex_lock, and pipe_mutex_unlock.

00240 {
00241 #ifdef XFree86Server
00242    *width = MIN2(b->drawable->width, MAX_WIDTH);
00243    *height = MIN2(b->drawable->height, MAX_HEIGHT);
00244 #else
00245    Status stat;
00246 
00247    pipe_mutex_lock(_xmesa_lock);
00248    XSync(b->xm_visual->display, 0); /* added for Chromium */
00249    stat = get_drawable_size(dpy, b->drawable, width, height);
00250    pipe_mutex_unlock(_xmesa_lock);
00251 
00252    if (!stat) {
00253       /* probably querying a window that's recently been destroyed */
00254       _mesa_warning(NULL, "XGetGeometry failed!\n");
00255       *width = *height = 1;
00256    }
00257 #endif
00258 }

PUBLIC void XMesaBindTexImage ( XMesaDisplay *  dpy,
XMesaBuffer  drawable,
int  buffer,
const int *  attrib_list 
)

Definition at line 1409 of file xm_api.c.

01413 {

void XMesaCopySubBuffer ( XMesaBuffer  b,
int  x,
int  y,
int  width,
int  height 
)

Definition at line 1259 of file xm_api.c.

References FALSE, st_get_framebuffer_surface(), ST_SURFACE_BACK_LEFT, ST_SURFACE_FRONT_LEFT, and pipe_context::surface_copy.

01262 {
01263    struct pipe_surface *surf_front
01264       = st_get_framebuffer_surface(b->stfb, ST_SURFACE_FRONT_LEFT);
01265    struct pipe_surface *surf_back
01266       = st_get_framebuffer_surface(b->stfb, ST_SURFACE_BACK_LEFT);
01267    struct pipe_context *pipe = NULL; /* XXX fix */
01268 
01269    if (!surf_front || !surf_back)
01270       return;
01271 
01272    pipe->surface_copy(pipe,
01273                       FALSE,
01274                       surf_front, x, y,  /* dest */
01275                       surf_back, x, y,   /* src */

PUBLIC XMesaContext XMesaCreateContext ( XMesaVisual  v,
XMesaContext  share_list 
)

Create a new XMesaContext.

Parameters:
v the XMesaVisual
share_list another XMesaContext with which to share display lists or NULL if no sharing is wanted.
Returns:
an XMesaContext or NULL if error.

Definition at line 776 of file xm_api.c.

References _xmesa_lock, assert, CALLOC_STRUCT, choose_pixel_format(), pipe_context::destroy, FREE, pipe_mutex_init, st_create_context(), st_destroy_context(), XMESA_AUB, xmesa_create_i965simple(), xmesa_create_pipe_context(), xmesa_get_pipe_winsys_aub(), xmesa_mode, and XMESA_SOFTPIPE.

00778 {
00779    static GLboolean firstTime = GL_TRUE;
00780    struct pipe_context *pipe;
00781    XMesaContext c;
00782    GLcontext *mesaCtx;
00783    uint pf;
00784 
00785    if (firstTime) {
00786       pipe_mutex_init(_xmesa_lock);
00787       firstTime = GL_FALSE;
00788    }
00789 
00790    /* Note: the XMesaContext contains a Mesa GLcontext struct (inheritance) */
00791    c = (XMesaContext) CALLOC_STRUCT(xmesa_context);
00792    if (!c)
00793       return NULL;
00794 
00795    pf = choose_pixel_format(v);
00796    assert(pf);
00797 
00798    c->xm_visual = v;
00799    c->xm_buffer = NULL;   /* set later by XMesaMakeCurrent */
00800 
00801    if (!getenv("XM_AUB")) {
00802       xmesa_mode = XMESA_SOFTPIPE;
00803       pipe = xmesa_create_pipe_context( c, pf );
00804    }
00805    else {
00806       xmesa_mode = XMESA_AUB;
00807       pipe = xmesa_create_i965simple(xmesa_get_pipe_winsys_aub(v));
00808    }
00809 
00810    if (pipe == NULL)
00811       goto fail;
00812 
00813    c->st = st_create_context(pipe, &v->mesa_visual,
00814                              share_list ? share_list->st : NULL);
00815    if (c->st == NULL)
00816       goto fail;
00817    
00818    mesaCtx = c->st->ctx;
00819    c->st->ctx->DriverCtx = c;
00820 
00821 #if 00
00822    _mesa_enable_sw_extensions(mesaCtx);
00823    _mesa_enable_1_3_extensions(mesaCtx);
00824    _mesa_enable_1_4_extensions(mesaCtx);
00825    _mesa_enable_1_5_extensions(mesaCtx);
00826    _mesa_enable_2_0_extensions(mesaCtx);
00827 #endif
00828 
00829 #ifdef XFree86Server
00830    /* If we're running in the X server, do bounds checking to prevent
00831     * segfaults and server crashes!
00832     */
00833    mesaCtx->Const.CheckArrayBounds = GL_TRUE;
00834 #endif
00835 
00836    return c;
00837 
00838  fail:
00839    if (c->st)
00840       st_destroy_context(c->st);
00841    else if (pipe)
00842       pipe->destroy(pipe);
00843    FREE(c);
00844    return NULL;

XMesaBuffer XMesaCreatePBuffer ( XMesaVisual  v,
XMesaColormap  cmap,
unsigned int  width,
unsigned int  height 
)

Definition at line 1018 of file xm_api.c.

References create_xmesa_buffer(), initialize_visual_and_buffer(), PBUFFER, and xmesa_free_buffer().

01021 {
01022 #ifndef XFree86Server
01023    XMesaWindow root;
01024    XMesaDrawable drawable;  /* X Pixmap Drawable */
01025    XMesaBuffer b;
01026 
01027    /* allocate pixmap for front buffer */
01028    root = RootWindow( v->display, v->visinfo->screen );
01029    drawable = XCreatePixmap(v->display, root, width, height,
01030                             v->visinfo->depth);
01031    if (!drawable)
01032       return NULL;
01033 
01034    b = create_xmesa_buffer(drawable, PBUFFER, v, cmap);
01035    if (!b)
01036       return NULL;
01037 
01038    if (!initialize_visual_and_buffer(v, b, v->mesa_visual.rgbMode,
01039                                      drawable, cmap)) {
01040       xmesa_free_buffer(b);
01041       return NULL;
01042    }
01043 
01044    return b;
01045 #else
01046    return 0;

PUBLIC XMesaBuffer XMesaCreatePixmapBuffer ( XMesaVisual  v,
XMesaPixmap  p,
XMesaColormap  cmap 
)

Create a new XMesaBuffer from an X pixmap.

Parameters:
v the XMesaVisual
p the pixmap
cmap the colormap, may be 0 if using a GLX_TRUE_COLOR or GLX_DIRECT_COLOR visual for the pixmap
Returns:
new XMesaBuffer or NULL if error

Definition at line 935 of file xm_api.c.

References assert, create_xmesa_buffer(), initialize_visual_and_buffer(), PIXMAP, and xmesa_free_buffer().

00937 {
00938    XMesaBuffer b;
00939 
00940    assert(v);
00941 
00942    b = create_xmesa_buffer((XMesaDrawable) p, PIXMAP, v, cmap);
00943    if (!b)
00944       return NULL;
00945 
00946    if (!initialize_visual_and_buffer(v, b, v->mesa_visual.rgbMode,
00947                                      (XMesaDrawable) p, cmap)) {
00948       xmesa_free_buffer(b);
00949       return NULL;
00950    }
00951 
00952    return b;

XMesaBuffer XMesaCreatePixmapTextureBuffer ( XMesaVisual  v,
XMesaPixmap  p,
XMesaColormap  cmap,
int  format,
int  target,
int  mipmap 
)

For GLX_EXT_texture_from_pixmap.

Definition at line 959 of file xm_api.c.

References assert, create_xmesa_buffer(), initialize_visual_and_buffer(), PIXMAP, xmesa_free_buffer(), xmesa_get_window_size(), and XMesaDestroyBuffer().

00963 {
00964    GET_CURRENT_CONTEXT(ctx);
00965    XMesaBuffer b;
00966    GLuint width, height;
00967 
00968    assert(v);
00969 
00970    b = create_xmesa_buffer((XMesaDrawable) p, PIXMAP, v, cmap);
00971    if (!b)
00972       return NULL;
00973 
00974    /* get pixmap size, update framebuffer/renderbuffer dims */
00975    xmesa_get_window_size(v->display, b, &width, &height);
00976    _mesa_resize_framebuffer(NULL, &(b->stfb->Base), width, height);
00977 
00978    if (target == 0) {
00979       /* examine dims */
00980       if (ctx->Extensions.ARB_texture_non_power_of_two) {
00981          target = GLX_TEXTURE_2D_EXT;
00982       }
00983       else if (   _mesa_bitcount(width)  == 1
00984                && _mesa_bitcount(height) == 1) {
00985          /* power of two size */
00986          if (height == 1) {
00987             target = GLX_TEXTURE_1D_EXT;
00988          }
00989          else {
00990             target = GLX_TEXTURE_2D_EXT;
00991          }
00992       }
00993       else if (ctx->Extensions.NV_texture_rectangle) {
00994          target = GLX_TEXTURE_RECTANGLE_EXT;
00995       }
00996       else {
00997          /* non power of two textures not supported */
00998          XMesaDestroyBuffer(b);
00999          return 0;
01000       }
01001    }
01002 
01003    b->TextureTarget = target;
01004    b->TextureFormat = format;
01005    b->TextureMipmap = mipmap;
01006 
01007    if (!initialize_visual_and_buffer(v, b, v->mesa_visual.rgbMode,
01008                                      (XMesaDrawable) p, cmap)) {
01009       xmesa_free_buffer(b);
01010       return NULL;
01011    }
01012 
01013    return b;

PUBLIC XMesaVisual XMesaCreateVisual ( XMesaDisplay *  display,
XMesaVisualInfo  visinfo,
GLboolean  rgb_flag,
GLboolean  alpha_flag,
GLboolean  db_flag,
GLboolean  stereo_flag,
GLboolean  ximage_flag,
GLint  depth_size,
GLint  stencil_size,
GLint  accum_red_size,
GLint  accum_green_size,
GLint  accum_blue_size,
GLint  accum_alpha_size,
GLint  num_samples,
GLint  level,
GLint  visualCaveat 
)

Definition at line 630 of file xm_api.c.

References assert, CALLOC_STRUCT, initialize_visual_and_buffer(), MALLOC, and xmesa_convert_from_x_visual_type().

00646 {
00647    XMesaVisual v;
00648    GLint red_bits, green_bits, blue_bits, alpha_bits;
00649 
00650 #ifndef XFree86Server
00651    /* For debugging only */
00652    if (_mesa_getenv("MESA_XSYNC")) {
00653       /* This makes debugging X easier.
00654        * In your debugger, set a breakpoint on _XError to stop when an
00655        * X protocol error is generated.
00656        */
00657       XSynchronize( display, 1 );
00658    }
00659 #endif
00660 
00661    v = (XMesaVisual) CALLOC_STRUCT(xmesa_visual);
00662    if (!v) {
00663       return NULL;
00664    }
00665 
00666    v->display = display;
00667 
00668    /* Save a copy of the XVisualInfo struct because the user may X_mesa_free()
00669     * the struct but we may need some of the information contained in it
00670     * at a later time.
00671     */
00672 #ifndef XFree86Server
00673    v->visinfo = (XVisualInfo *) MALLOC(sizeof(*visinfo));
00674    if(!v->visinfo) {
00675       _mesa_free(v);
00676       return NULL;
00677    }
00678    MEMCPY(v->visinfo, visinfo, sizeof(*visinfo));
00679 #endif
00680 
00681    v->ximage_flag = ximage_flag;
00682 
00683 #ifdef XFree86Server
00684    /* We could calculate these values by ourselves.  nplanes is either the sum
00685     * of the red, green, and blue bits or the number index bits.
00686     * ColormapEntries is either (1U << index_bits) or
00687     * (1U << max(redBits, greenBits, blueBits)).
00688     */
00689    assert(visinfo->nplanes > 0);
00690    v->nplanes = visinfo->nplanes;
00691    v->ColormapEntries = visinfo->ColormapEntries;
00692 
00693    v->mesa_visual.redMask = visinfo->redMask;
00694    v->mesa_visual.greenMask = visinfo->greenMask;
00695    v->mesa_visual.blueMask = visinfo->blueMask;
00696    v->mesa_visual.visualID = visinfo->vid;
00697    v->mesa_visual.screen = 0; /* FIXME: What should be done here? */
00698 #else
00699    v->mesa_visual.redMask = visinfo->red_mask;
00700    v->mesa_visual.greenMask = visinfo->green_mask;
00701    v->mesa_visual.blueMask = visinfo->blue_mask;
00702    v->mesa_visual.visualID = visinfo->visualid;
00703    v->mesa_visual.screen = visinfo->screen;
00704 #endif
00705 
00706 #if defined(XFree86Server) || !(defined(__cplusplus) || defined(c_plusplus))
00707    v->mesa_visual.visualType = xmesa_convert_from_x_visual_type(visinfo->class);
00708 #else
00709    v->mesa_visual.visualType = xmesa_convert_from_x_visual_type(visinfo->c_class);
00710 #endif
00711 
00712    v->mesa_visual.visualRating = visualCaveat;
00713 
00714    if (alpha_flag)
00715       v->mesa_visual.alphaBits = 8;
00716 
00717    (void) initialize_visual_and_buffer( v, NULL, rgb_flag, 0, 0 );
00718 
00719    {
00720       const int xclass = v->mesa_visual.visualType;
00721       if (xclass == GLX_TRUE_COLOR || xclass == GLX_DIRECT_COLOR) {
00722          red_bits   = _mesa_bitcount(GET_REDMASK(v));
00723          green_bits = _mesa_bitcount(GET_GREENMASK(v));
00724          blue_bits  = _mesa_bitcount(GET_BLUEMASK(v));
00725       }
00726       else {
00727          /* this is an approximation */
00728          int depth;
00729          depth = GET_VISUAL_DEPTH(v);
00730          red_bits = depth / 3;
00731          depth -= red_bits;
00732          green_bits = depth / 2;
00733          depth -= green_bits;
00734          blue_bits = depth;
00735          alpha_bits = 0;
00736          assert( red_bits + green_bits + blue_bits == GET_VISUAL_DEPTH(v) );
00737       }
00738       alpha_bits = v->mesa_visual.alphaBits;
00739    }
00740 
00741    _mesa_initialize_visual( &v->mesa_visual,
00742                             rgb_flag, db_flag, stereo_flag,
00743                             red_bits, green_bits,
00744                             blue_bits, alpha_bits,
00745                             v->mesa_visual.indexBits,
00746                             depth_size,
00747                             stencil_size,
00748                             accum_red_size, accum_green_size,
00749                             accum_blue_size, accum_alpha_size,
00750                             0 );
00751 
00752    /* XXX minor hack */
00753    v->mesa_visual.level = level;
00754    return v;

PUBLIC XMesaBuffer XMesaCreateWindowBuffer ( XMesaVisual  v,
XMesaWindow  w 
)

Private function for creating an XMesaBuffer which corresponds to an X window or pixmap.

Parameters:
v the window's XMesaVisual
w the window we're wrapping
Returns:
new XMesaBuffer or NULL if error

Definition at line 870 of file xm_api.c.

References assert, create_xmesa_buffer(), initialize_visual_and_buffer(), WINDOW, and xmesa_free_buffer().

00872 {
00873 #ifndef XFree86Server
00874    XWindowAttributes attr;
00875 #endif
00876    XMesaBuffer b;
00877    XMesaColormap cmap;
00878    int depth;
00879 
00880    assert(v);
00881    assert(w);
00882 
00883    /* Check that window depth matches visual depth */
00884 #ifdef XFree86Server
00885    depth = ((XMesaDrawable)w)->depth;
00886 #else
00887    XGetWindowAttributes( v->display, w, &attr );
00888    depth = attr.depth;
00889 #endif
00890    if (GET_VISUAL_DEPTH(v) != depth) {
00891       _mesa_warning(NULL, "XMesaCreateWindowBuffer: depth mismatch between visual (%d) and window (%d)!\n",
00892                     GET_VISUAL_DEPTH(v), depth);
00893       return NULL;
00894    }
00895 
00896    /* Find colormap */
00897 #ifdef XFree86Server
00898    cmap = (ColormapPtr)LookupIDByType(wColormap(w), RT_COLORMAP);
00899 #else
00900    if (attr.colormap) {
00901       cmap = attr.colormap;
00902    }
00903    else {
00904       _mesa_warning(NULL, "Window %u has no colormap!\n", (unsigned int) w);
00905       /* this is weird, a window w/out a colormap!? */
00906       /* OK, let's just allocate a new one and hope for the best */
00907       cmap = XCreateColormap(v->display, w, attr.visual, AllocNone);
00908    }
00909 #endif
00910 
00911    b = create_xmesa_buffer((XMesaDrawable) w, WINDOW, v, cmap);
00912    if (!b)
00913       return NULL;
00914 
00915    if (!initialize_visual_and_buffer( v, b, v->mesa_visual.rgbMode,
00916                                       (XMesaDrawable) w, cmap )) {
00917       xmesa_free_buffer(b);
00918       return NULL;
00919    }
00920 
00921    return b;

PUBLIC void XMesaDestroyBuffer ( XMesaBuffer  b  ) 

Definition at line 1054 of file xm_api.c.

References xmesa_free_buffer().

01057 {

PUBLIC void XMesaDestroyContext ( XMesaContext  c  ) 

Definition at line 849 of file xm_api.c.

References st_destroy_context().

00851 {
00852    struct pipe_screen *screen = c->st->pipe->screen;
00853    st_destroy_context(c->st);
00854    /* FIXME: We should destroy the screen here, but if we do so, surfaces may 
00855     * outlive it, causing segfaults
00856    screen->destroy(screen);
00857    */
00858    _mesa_free(c);

PUBLIC void XMesaDestroyVisual ( XMesaVisual  v  ) 

Definition at line 758 of file xm_api.c.

00760 {
00761 #ifndef XFree86Server
00762    _mesa_free(v->visinfo);
00763 #endif
00764    _mesa_free(v);

unsigned long XMesaDitherColor ( XMesaContext  xmesa,
GLint  x,
GLint  y,
GLfloat  red,
GLfloat  green,
GLfloat  blue,
GLfloat  alpha 
)

Definition at line 1382 of file xm_api.c.

01387 {
01388    /* no longer supported */

XMesaBuffer XMesaFindBuffer ( XMesaDisplay *  dpy,
XMesaDrawable  d 
)

Definition at line 1328 of file xm_api.c.

References XMesaBufferList.

01331 {
01332    XMesaBuffer b;
01333    for (b=XMesaBufferList; b; b=b->Next) {
01334       if (b->drawable == d && b->xm_visual->display == dpy) {
01335          return b;
01336       }
01337    }

void XMesaFlush ( XMesaContext  c  ) 

Definition at line 1298 of file xm_api.c.

References st_finish().

01301 {
01302    if (c && c->xm_visual->display) {
01303 #ifdef XFree86Server
01304       /* NOT_NEEDED */
01305 #else
01306       st_finish(c->st);
01307       XSync( c->xm_visual->display, False );
01308 #endif

void XMesaGarbageCollect ( void   ) 

Definition at line 1359 of file xm_api.c.

References WINDOW, window_exists(), XMesaBufferList, and XMesaDestroyBuffer().

01362 {
01363    XMesaBuffer b, next;
01364    for (b=XMesaBufferList; b; b=next) {
01365       next = b->Next;
01366       if (b->xm_visual &&
01367           b->xm_visual->display &&
01368           b->drawable &&
01369           b->type == WINDOW) {
01370 #ifdef XFree86Server
01371          /* NOT_NEEDED */
01372 #else
01373          XSync(b->xm_visual->display, False);
01374          if (!window_exists( b->xm_visual->display, b->drawable )) {
01375             /* found a dead window, free the ancillary info */
01376             XMesaDestroyBuffer( b );
01377          }
01378 #endif
01379       }

XMesaBuffer XMesaGetCurrentBuffer ( void   ) 

Definition at line 1157 of file xm_api.c.

References xmesa_buffer().

01160 {
01161    GET_CURRENT_CONTEXT(ctx);
01162    if (ctx) {
01163       XMesaBuffer xmbuf = xmesa_buffer(ctx->DrawBuffer);
01164       return xmbuf;
01165    }
01166    else {
01167       return 0;

XMesaContext XMesaGetCurrentContext ( void   ) 

Definition at line 1144 of file xm_api.c.

References xmesa_context().

01147 {
01148    GET_CURRENT_CONTEXT(ctx);
01149    if (ctx) {
01150       XMesaContext xmesa = xmesa_context(ctx);
01151       return xmesa;
01152    }
01153    else {
01154       return 0;

XMesaBuffer XMesaGetCurrentReadBuffer ( void   ) 

Definition at line 1171 of file xm_api.c.

References xmesa_buffer().

01174 {
01175    GET_CURRENT_CONTEXT(ctx);
01176    if (ctx) {
01177       return xmesa_buffer(ctx->ReadBuffer);
01178    }
01179    else {
01180       return 0;

GLboolean XMesaGetDepthBuffer ( XMesaBuffer  b,
GLint *  width,
GLint *  height,
GLint *  bytesPerValue,
void **  buffer 
)

Definition at line 1287 of file xm_api.c.

01287          :  GL_TRUE or GL_FALSE to indicate success or failure.
01288  */
01289 GLboolean XMesaGetDepthBuffer( XMesaBuffer b, GLint *width, GLint *height,
01290                                GLint *bytesPerValue, void **buffer )
01291 {
01292    *width = 0;
01293    *height = 0;
01294    *bytesPerValue = 0;
01295    *buffer = 0;

const char* XMesaGetString ( XMesaContext  c,
int  name 
)

Definition at line 1312 of file xm_api.c.

01315 {
01316    (void) c;
01317    if (name==XMESA_VERSION) {
01318       return "5.0";
01319    }
01320    else if (name==XMESA_EXTENSIONS) {
01321       return "";
01322    }
01323    else {
01324       return NULL;

GLboolean XMesaMakeCurrent ( XMesaContext  c,
XMesaBuffer  b 
)

Definition at line 1082 of file xm_api.c.

References XMesaMakeCurrent2().

01085 {

PUBLIC GLboolean XMesaMakeCurrent2 ( XMesaContext  c,
XMesaBuffer  drawBuffer,
XMesaBuffer  readBuffer 
)

Definition at line 1092 of file xm_api.c.

References st_make_current(), and xmesa_check_and_update_buffer_size().

01096 {
01097    if (c) {
01098       if (!drawBuffer || !readBuffer)
01099          return GL_FALSE;  /* must specify buffers! */
01100 
01101 #if 0
01102       /* XXX restore this optimization */
01103       if (&(c->mesa) == _mesa_get_current_context()
01104           && c->mesa.DrawBuffer == &drawBuffer->mesa_buffer
01105           && c->mesa.ReadBuffer == &readBuffer->mesa_buffer
01106           && xmesa_buffer(c->mesa.DrawBuffer)->wasCurrent) {
01107          /* same context and buffer, do nothing */
01108          return GL_TRUE;
01109       }
01110 #endif
01111 
01112       c->xm_buffer = drawBuffer;
01113 
01114       /* Call this periodically to detect when the user has begun using
01115        * GL rendering from multiple threads.
01116        */
01117       _glapi_check_multithread();
01118 
01119       st_make_current(c->st, drawBuffer->stfb, readBuffer->stfb);
01120 
01121       xmesa_check_and_update_buffer_size(c, drawBuffer);
01122       if (readBuffer != drawBuffer)
01123          xmesa_check_and_update_buffer_size(c, readBuffer);
01124 
01125       /* Solution to Stephane Rehel's problem with glXReleaseBuffersMESA(): */
01126       drawBuffer->wasCurrent = GL_TRUE;
01127    }
01128    else {
01129       /* Detach */
01130       st_make_current( NULL, NULL, NULL );
01131    }

PUBLIC void XMesaReleaseTexImage ( XMesaDisplay *  dpy,
XMesaBuffer  drawable,
int  buffer 
)

Definition at line 1417 of file xm_api.c.

01420 {

PUBLIC void XMesaResizeBuffers ( XMesaBuffer  b  ) 

Definition at line 1396 of file xm_api.c.

References xmesa_check_and_update_buffer_size(), and xmesa_context().

01399 {
01400    GET_CURRENT_CONTEXT(ctx);
01401    XMesaContext xmctx = xmesa_context(ctx);
01402    if (!xmctx)
01403       return;

GLboolean XMesaSetFXmode ( GLint  mode  ) 

Definition at line 1220 of file xm_api.c.

01223 {
01224    (void) mode;

PUBLIC void XMesaSwapBuffers ( XMesaBuffer  b  ) 

Definition at line 1234 of file xm_api.c.

References st_get_framebuffer_surface(), st_notify_swapbuffers(), ST_SURFACE_BACK_LEFT, XMESA_AUB, xmesa_check_and_update_buffer_size(), xmesa_display_aub(), xmesa_display_surface(), and xmesa_mode.

01237 {
01238    struct pipe_surface *surf;
01239 
01240    /* If we're swapping the buffer associated with the current context
01241     * we have to flush any pending rendering commands first.
01242     */
01243    st_notify_swapbuffers(b->stfb);
01244 
01245    surf = st_get_framebuffer_surface(b->stfb, ST_SURFACE_BACK_LEFT);
01246    if (surf) {
01247       if (xmesa_mode == XMESA_AUB)
01248          xmesa_display_aub( surf );
01249       else
01250          xmesa_display_surface(b, surf);
01251    }
01252 

GLboolean XMesaUnbindContext ( XMesaContext  c  ) 

Definition at line 1137 of file xm_api.c.

01140 {
01141    /* A no-op for XFree86 integration purposes */


Variable Documentation

pipe_mutex _xmesa_lock

Global X driver lock.

Definition at line 77 of file xm_api.c.

GLboolean WindowExistsFlag [static]

Definition at line 194 of file xm_api.c.

int xmesa_mode

Definition at line 80 of file xm_api.c.

XMesaBuffer XMesaBufferList = NULL

Definition at line 312 of file xm_api.c.


Generated on Tue Sep 29 06:25:50 2009 for Gallium3D by  doxygen 1.5.4