xmesaP.h File Reference

Include dependency graph for xmesaP.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  xmesa_visual
 Visual inforation, derived from GLvisual. More...
struct  xmesa_context
 Context info, derived from st_context. More...
struct  xmesa_buffer
 Framebuffer information, derived from. More...

Defines

#define XMESA_SOFTPIPE   1
#define XMESA_AUB   2

Enumerations

enum  BufferType { WINDOW, GLXWINDOW, PIXMAP, PBUFFER }
 Types of X/GLX drawables we might render into. More...

Functions

static XMesaContext xmesa_context (GLcontext *ctx)
 cast wrapper
static XMesaBuffer xmesa_buffer (GLframebuffer *fb)
 cast wrapper
void xmesa_delete_framebuffer (struct gl_framebuffer *fb)
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.
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.
void xmesa_destroy_buffers_on_display (XMesaDisplay *dpy)
 Free/destroy all XMesaBuffers associated with given display.
struct pipe_contextxmesa_create_pipe_context (XMesaContext xm, uint pixelformat)
static GLuint xmesa_buffer_width (XMesaBuffer b)
static GLuint xmesa_buffer_height (XMesaBuffer b)
void xmesa_display_surface (XMesaBuffer b, const struct pipe_surface *surf)
 Display/copy the image in the surface into the X window specified by the XMesaBuffer.
int xmesa_check_for_xshm (XMesaDisplay *display)
 Check if the X Shared Memory extension is available.

Variables

pipe_mutex _xmesa_lock
 Global X driver lock.
XMesaBuffer XMesaBufferList
int xmesa_mode


Define Documentation

#define XMESA_AUB   2

Definition at line 48 of file xmesaP.h.

#define XMESA_SOFTPIPE   1

Definition at line 47 of file xmesaP.h.


Enumeration Type Documentation

enum BufferType

Types of X/GLX drawables we might render into.

Enumerator:
WINDOW 
GLXWINDOW 
PIXMAP 
PBUFFER 

Definition at line 86 of file xmesaP.h.

00086              {
00087    WINDOW,          /* An X window */
00088    GLXWINDOW,       /* GLX window */
00089    PIXMAP,          /* GLX pixmap */
00090    PBUFFER          /* GLX Pbuffer */
00091 } BufferType;


Function Documentation

static XMesaBuffer xmesa_buffer ( GLframebuffer *  fb  )  [static]

cast wrapper

Definition at line 140 of file xmesaP.h.

References st_framebuffer_private().

00141 {
00142    struct st_framebuffer *stfb = (struct st_framebuffer *) fb;
00143    return (XMesaBuffer) st_framebuffer_private(stfb);
00144 }

static GLuint xmesa_buffer_height ( XMesaBuffer  b  )  [static]

Definition at line 169 of file xmesaP.h.

00170 {
00171    return b->stfb->Base.Height;
00172 }

static GLuint xmesa_buffer_width ( XMesaBuffer  b  )  [static]

Definition at line 163 of file xmesaP.h.

00164 {
00165    return b->stfb->Base.Width;
00166 }

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 XMesaContext xmesa_context ( GLcontext *  ctx  )  [static]

cast wrapper

Definition at line 132 of file xmesaP.h.

00133 {
00134    return (XMesaContext) ctx->DriverCtx;
00135 }

struct pipe_context* xmesa_create_pipe_context ( XMesaContext  xm,
uint  pixelformat 
) [read]

Definition at line 680 of file xm_winsys.c.

References cell_create_context(), cell_create_screen(), cell_get_winsys(), pipe_context::priv, softpipe_create(), softpipe_create_screen(), trace_context_create(), trace_screen_create(), xmesa_get_pipe_winsys(), and xmesa_get_pipe_winsys_aub().

00683 {
00684    struct pipe_winsys *pws;
00685    struct pipe_context *pipe;
00686    
00687    if (getenv("XM_AUB")) {
00688       pws = xmesa_get_pipe_winsys_aub(xmesa->xm_visual);
00689    }
00690    else {
00691       pws = xmesa_get_pipe_winsys(xmesa->xm_visual);
00692    }
00693 
00694 #ifdef GALLIUM_CELL
00695    if (!getenv("GALLIUM_NOCELL")) {
00696       struct cell_winsys *cws = cell_get_winsys(pixelformat);
00697       struct pipe_screen *screen = cell_create_screen(pws);
00698 
00699       pipe = cell_create_context(screen, cws);
00700    }
00701    else
00702 #endif
00703    {
00704       struct pipe_screen *screen = softpipe_create_screen(pws);
00705 
00706       pipe = softpipe_create(screen, pws, NULL);
00707 
00708 #ifdef GALLIUM_TRACE
00709       screen = trace_screen_create(screen);
00710       
00711       pipe = trace_context_create(screen, pipe);
00712 #endif
00713    }
00714 
00715    if (pipe)
00716       pipe->priv = xmesa;
00717 

void xmesa_delete_framebuffer ( struct gl_framebuffer *  fb  ) 

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       }

void xmesa_display_surface ( XMesaBuffer  b,
const struct pipe_surface surf 
)

Display/copy the image in the surface into the X window specified by the XMesaBuffer.

Definition at line 383 of file xm_winsys.c.

00386 {
00387    XImage *ximage;
00388    struct xm_buffer *xm_buf = xm_buffer(surf->buffer);
00389    static boolean no_swap = 0;
00390    static boolean firsttime = 1;
00391    static int tileSize = 0;
00392 
00393    if (firsttime) {
00394       no_swap = getenv("SP_NO_RAST") != NULL;
00395 #ifdef GALLIUM_CELL
00396       if (!getenv("GALLIUM_NOCELL")) {
00397          tileSize = 32; 
00398       }
00399 #endif
00400       firsttime = 0;
00401    }
00402 
00403    if (no_swap)
00404       return;
00405 
00406    if (tileSize) {
00407       xmesa_display_surface_tiled(b, surf);
00408       return;
00409    }
00410 
00411    if (XSHM_ENABLED(xm_buf) && (xm_buf->tempImage == NULL)) {
00412       assert(surf->block.width == 1);
00413       assert(surf->block.height == 1);
00414       alloc_shm_ximage(xm_buf, b, surf->stride/surf->block.size, surf->height);
00415    }
00416 
00417    ximage = (XSHM_ENABLED(xm_buf)) ? xm_buf->tempImage : b->tempImage;
00418    ximage->data = xm_buf->data;
00419 
00420    /* display image in Window */
00421    if (XSHM_ENABLED(xm_buf)) {
00422 #if defined(USE_XSHM) && !defined(XFree86Server)
00423       XShmPutImage(b->xm_visual->display, b->drawable, b->gc,
00424                    ximage, 0, 0, 0, 0, surf->width, surf->height, False);
00425 #endif
00426    } else {
00427       /* check that the XImage has been previously initialized */
00428       assert(ximage->format);
00429       assert(ximage->bitmap_unit);
00430 
00431       /* update XImage's fields */
00432       ximage->width = surf->width;
00433       ximage->height = surf->height;
00434       ximage->bytes_per_line = surf->stride;
00435 
00436       XPutImage(b->xm_visual->display, b->drawable, b->gc,
00437                 ximage, 0, 0, 0, 0, surf->width, surf->height);

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 }


Variable Documentation

pipe_mutex _xmesa_lock

Global X driver lock.

Definition at line 77 of file xm_api.c.

int xmesa_mode

Definition at line 80 of file xm_api.c.

XMesaBuffer XMesaBufferList

Definition at line 312 of file xm_api.c.


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