From a078d75a27b99252ede6520e24b145106ab98aa2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 27 May 2002 17:06:59 +0000 Subject: [PATCH] some initial work for fbconfigs/pbuffers --- src/mesa/drivers/x11/fakeglx.c | 22 +++++++++++++++------- src/mesa/drivers/x11/xm_api.c | 12 +++++------- src/mesa/drivers/x11/xmesaP.h | 13 ++++++++++--- 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c index 5e698ec..7df84b7 100644 --- a/src/mesa/drivers/x11/fakeglx.c +++ b/src/mesa/drivers/x11/fakeglx.c @@ -1,4 +1,4 @@ -/* $Id: fakeglx.c,v 1.63 2002/04/19 00:47:07 brianp Exp $ */ +/* $Id: fakeglx.c,v 1.64 2002/05/27 17:06:59 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1709,6 +1709,7 @@ extern XMesaBuffer XMesaCreatePBuffer( XMesaVisual v, XMesaColormap cmap, +/* PBUFFER */ static GLXFBConfig * Fake_glXChooseFBConfig( Display *dpy, int screen, const int *attribList, int *nitems ) @@ -1721,6 +1722,7 @@ Fake_glXChooseFBConfig( Display *dpy, int screen, } +/* PBUFFER */ static int Fake_glXGetFBConfigAttrib( Display *dpy, GLXFBConfig config, int attribute, int *value ) @@ -1880,16 +1882,19 @@ Fake_glXGetFBConfigAttrib( Display *dpy, GLXFBConfig config, } +/* PBUFFER */ static GLXFBConfig * Fake_glXGetFBConfigs( Display *dpy, int screen, int *nelements ) { + /* Get list of all X visuals, create FBconfigs from them */ (void) dpy; (void) screen; - (void) nelements; + nelements = 0; return 0; } +/* PBUFFER */ static XVisualInfo * Fake_glXGetVisualFromFBConfig( Display *dpy, GLXFBConfig config ) { @@ -1903,6 +1908,7 @@ Fake_glXGetVisualFromFBConfig( Display *dpy, GLXFBConfig config ) } +/* PBUFFER */ static GLXWindow Fake_glXCreateWindow( Display *dpy, GLXFBConfig config, Window win, const int *attribList ) @@ -1973,6 +1979,7 @@ Fake_glXDestroyPixmap( Display *dpy, GLXPixmap pixmap ) } +/* PBUFFER */ static GLXPbuffer Fake_glXCreatePbuffer( Display *dpy, GLXFBConfig config, const int *attribList ) @@ -2011,6 +2018,7 @@ Fake_glXCreatePbuffer( Display *dpy, GLXFBConfig config, } +/* PBUFFER */ static void Fake_glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf ) { @@ -2019,6 +2027,7 @@ Fake_glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf ) } +/* PBUFFER */ static void Fake_glXQueryDrawable( Display *dpy, GLXDrawable draw, int attribute, unsigned int *value ) @@ -2054,6 +2063,7 @@ Fake_glXCreateNewContext( Display *dpy, GLXFBConfig config, } +/* PBUFFER */ static int Fake_glXQueryContext( Display *dpy, GLXContext ctx, int attribute, int *value ) { @@ -2072,6 +2082,7 @@ Fake_glXQueryContext( Display *dpy, GLXContext ctx, int attribute, int *value ) } +/* PBUFFER */ static void Fake_glXSelectEvent( Display *dpy, GLXDrawable drawable, unsigned long mask ) { @@ -2081,6 +2092,7 @@ Fake_glXSelectEvent( Display *dpy, GLXDrawable drawable, unsigned long mask ) } +/* PBUFFER */ static void Fake_glXGetSelectedEvent( Display *dpy, GLXDrawable drawable, unsigned long *mask ) @@ -2128,11 +2140,7 @@ Fake_glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count) static Bool Fake_glXMakeCurrentReadSGI(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx) { - (void) dpy; - (void) draw; - (void) read; - (void) ctx; - return False; + return Fake_glXMakeContextCurrent( dpy, draw, read, ctx ); } /* not used diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index 9ee36a4..d155f14 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -1,4 +1,4 @@ -/* $Id: xm_api.c,v 1.35 2002/03/16 00:53:15 brianp Exp $ */ +/* $Id: xm_api.c,v 1.36 2002/05/27 17:06:59 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -283,8 +283,6 @@ static GLint gamma_adjust( GLfloat gamma, GLint value, GLint max ) * visinfo - desribes the visual to be used for XImages * Return: true number of bits per pixel for XImages */ -#define GET_BITS_PER_PIXEL(xmv) bits_per_pixel(xmv) - #ifdef XFree86Server static int bits_per_pixel( XMesaVisual xmv ) @@ -1209,7 +1207,7 @@ static GLboolean initialize_visual_and_buffer( int client, } /* Save true bits/pixel */ - v->BitsPerPixel = GET_BITS_PER_PIXEL(v); + v->BitsPerPixel = bits_per_pixel(v); assert(v->BitsPerPixel > 0); @@ -1751,7 +1749,7 @@ XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v, XMesaWindow w, } b->xm_visual = v; - b->pixmap_flag = GL_FALSE; + b->type = WINDOW; b->display = v->display; #ifdef XFree86Server b->cmap = (ColormapPtr)LookupIDByType(wColormap(w), RT_COLORMAP); @@ -1897,7 +1895,7 @@ XMesaBuffer XMesaCreatePixmapBuffer( XMesaVisual v, assert(v); b->xm_visual = v; - b->pixmap_flag = GL_TRUE; + b->type = PIXMAP; b->display = v->display; b->cmap = cmap; @@ -2549,7 +2547,7 @@ void XMesaGarbageCollect( void ) XMesaBuffer b, next; for (b=XMesaBufferList; b; b=next) { next = b->Next; - if (b->display && b->frontbuffer && !b->pixmap_flag) { + if (b->display && b->frontbuffer && b->type == WINDOW) { #ifdef XFree86Server /* NOT_NEEDED */ #else diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h index d61ee88..ae90d99 100644 --- a/src/mesa/drivers/x11/xmesaP.h +++ b/src/mesa/drivers/x11/xmesaP.h @@ -1,4 +1,4 @@ -/* $Id: xmesaP.h,v 1.27 2002/03/16 00:53:15 brianp Exp $ */ +/* $Id: xmesaP.h,v 1.28 2002/05/27 17:06:59 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -136,6 +136,14 @@ struct xmesa_context { +typedef enum { + WINDOW, /* An X window */ + GLXWINDOW, /* GLX window */ + PIXMAP, /* GLX pixmap */ + PBUFFER /* GLX Pbuffer */ +} BufferType; + + /* * "Derived" from GLframebuffer. Basically corresponds to a GLXDrawable. */ @@ -145,8 +153,7 @@ struct xmesa_buffer { XMesaVisual xm_visual; /* the X/Mesa visual */ XMesaDisplay *display; - GLboolean pixmap_flag; /* is the buffer a Pixmap? */ - GLboolean pbuffer_flag; /* is the buffer a Pbuffer? */ + BufferType type; /* window, pixmap, pbuffer or glxwindow */ XMesaDrawable frontbuffer; /* either a window or pixmap */ XMesaPixmap backpixmap; /* back buffer Pixmap */ XMesaImage *backimage; /* back buffer simulated XImage */ -- 2.7.4