xmesaP.h

Go to the documentation of this file.
00001 /*
00002  * Mesa 3-D graphics library
00003  * Version:  7.1
00004  *
00005  * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
00006  *
00007  * Permission is hereby granted, free of charge, to any person obtaining a
00008  * copy of this software and associated documentation files (the "Software"),
00009  * to deal in the Software without restriction, including without limitation
00010  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00011  * and/or sell copies of the Software, and to permit persons to whom the
00012  * Software is furnished to do so, subject to the following conditions:
00013  *
00014  * The above copyright notice and this permission notice shall be included
00015  * in all copies or substantial portions of the Software.
00016  *
00017  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00018  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00019  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00020  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00021  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00022  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00023  */
00024 
00025 
00026 #ifndef XMESAP_H
00027 #define XMESAP_H
00028 
00029 
00030 #include "GL/xmesa.h"
00031 #include "mtypes.h"
00032 #ifdef XFree86Server
00033 #include "xm_image.h"
00034 #endif
00035 
00036 #include "state_tracker/st_context.h"
00037 #include "state_tracker/st_public.h"
00038 #include "pipe/p_thread.h"
00039 
00040 
00041 extern pipe_mutex _xmesa_lock;
00042 
00043 extern XMesaBuffer XMesaBufferList;
00044 
00045 /*
00046  */
00047 #define XMESA_SOFTPIPE 1
00048 #define XMESA_AUB      2
00049 extern int xmesa_mode;
00050 
00051 
00056 struct xmesa_visual {
00057    GLvisual mesa_visual;        /* Device independent visual parameters */
00058    XMesaDisplay *display;       /* The X11 display */
00059 #ifdef XFree86Server
00060    GLint ColormapEntries;
00061    GLint nplanes;
00062 #else
00063    XMesaVisualInfo visinfo;     /* X's visual info (pointer to private copy) */
00064    XVisualInfo *vishandle;      /* Only used in fakeglx.c */
00065 #endif
00066    GLint BitsPerPixel;          /* True bits per pixel for XImages */
00067 
00068    GLboolean ximage_flag;       /* Use XImage for back buffer (not pixmap)? */
00069 };
00070 
00071 
00076 struct xmesa_context {
00077    struct st_context *st;
00078    XMesaVisual xm_visual;       
00079    XMesaBuffer xm_buffer;       
00080 };
00081 
00082 
00086 typedef enum {
00087    WINDOW,          /* An X window */
00088    GLXWINDOW,       /* GLX window */
00089    PIXMAP,          /* GLX pixmap */
00090    PBUFFER          /* GLX Pbuffer */
00091 } BufferType;
00092 
00093 
00098 struct xmesa_buffer {
00099    struct st_framebuffer *stfb;
00100 
00101    GLboolean wasCurrent;        /* was ever the current buffer? */
00102    XMesaVisual xm_visual;       /* the X/Mesa visual */
00103    XMesaDrawable drawable;      /* Usually the X window ID */
00104    XMesaColormap cmap;          /* the X colormap */
00105    BufferType type;             /* window, pixmap, pbuffer or glxwindow */
00106 
00107    XMesaImage *tempImage;
00108    unsigned long selectedEvents;/* for pbuffers only */
00109 
00110    GLuint shm;                  /* X Shared Memory extension status:    */
00111                                 /*    0 = not available                 */
00112                                 /*    1 = XImage support available      */
00113                                 /*    2 = Pixmap support available too  */
00114 #if defined(USE_XSHM) && !defined(XFree86Server)
00115    XShmSegmentInfo shminfo;
00116 #endif
00117 
00118    XMesaGC gc;                  /* scratch GC for span, line, tri drawing */
00119 
00120    /* GLX_EXT_texture_from_pixmap */
00121    GLint TextureTarget; 
00122    GLint TextureFormat; 
00123    GLint TextureMipmap; 
00125    struct xmesa_buffer *Next;   /* Linked list pointer: */
00126 };
00127 
00128 
00129 
00131 static INLINE XMesaContext
00132 xmesa_context(GLcontext *ctx)
00133 {
00134    return (XMesaContext) ctx->DriverCtx;
00135 }
00136 
00137 
00139 static INLINE XMesaBuffer
00140 xmesa_buffer(GLframebuffer *fb)
00141 {
00142    struct st_framebuffer *stfb = (struct st_framebuffer *) fb;
00143    return (XMesaBuffer) st_framebuffer_private(stfb);
00144 }
00145 
00146 
00147 extern void
00148 xmesa_delete_framebuffer(struct gl_framebuffer *fb);
00149 
00150 extern XMesaBuffer
00151 xmesa_find_buffer(XMesaDisplay *dpy, XMesaColormap cmap, XMesaBuffer notThis);
00152 
00153 extern void
00154 xmesa_check_and_update_buffer_size(XMesaContext xmctx, XMesaBuffer drawBuffer);
00155 
00156 extern void
00157 xmesa_destroy_buffers_on_display(XMesaDisplay *dpy);
00158 
00159 extern struct pipe_context *
00160 xmesa_create_pipe_context(XMesaContext xm, uint pixelformat);
00161 
00162 static INLINE GLuint
00163 xmesa_buffer_width(XMesaBuffer b)
00164 {
00165    return b->stfb->Base.Width;
00166 }
00167 
00168 static INLINE GLuint
00169 xmesa_buffer_height(XMesaBuffer b)
00170 {
00171    return b->stfb->Base.Height;
00172 }
00173 
00174 extern void
00175 xmesa_display_surface(XMesaBuffer b, const struct pipe_surface *surf);
00176 
00177 extern int
00178 xmesa_check_for_xshm(XMesaDisplay *display);
00179 
00180 #endif

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