From 153b4d5cdd934812d8c24ef10bb8bbbe852eaf62 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 8 Jan 2009 15:23:51 +0000 Subject: [PATCH] xlib: remove some XMesa types, just use the native Xlib ones --- src/gallium/state_trackers/xlib/fakeglx.c | 4 +- src/gallium/state_trackers/xlib/old_xmesa.h | 28 ++++---- src/gallium/state_trackers/xlib/old_xmesa_x.h | 10 --- src/gallium/state_trackers/xlib/xm_api.c | 68 +++++++++---------- src/gallium/state_trackers/xlib/xmesaP.h | 18 ++--- 5 files changed, 59 insertions(+), 69 deletions(-) diff --git a/src/gallium/state_trackers/xlib/fakeglx.c b/src/gallium/state_trackers/xlib/fakeglx.c index 864f355a689..4dc45adcb51 100644 --- a/src/gallium/state_trackers/xlib/fakeglx.c +++ b/src/gallium/state_trackers/xlib/fakeglx.c @@ -2195,7 +2195,7 @@ Fake_glXCreateWindow( Display *dpy, GLXFBConfig config, Window win, static void Fake_glXDestroyWindow( Display *dpy, GLXWindow window ) { - XMesaBuffer b = XMesaFindBuffer(dpy, (XMesaDrawable) window); + XMesaBuffer b = XMesaFindBuffer(dpy, (Drawable) window); if (b) XMesaDestroyBuffer(b); /* don't destroy X window */ @@ -2316,7 +2316,7 @@ Fake_glXCreatePixmap( Display *dpy, GLXFBConfig config, Pixmap pixmap, static void Fake_glXDestroyPixmap( Display *dpy, GLXPixmap pixmap ) { - XMesaBuffer b = XMesaFindBuffer(dpy, (XMesaDrawable)pixmap); + XMesaBuffer b = XMesaFindBuffer(dpy, (Drawable)pixmap); if (b) XMesaDestroyBuffer(b); /* don't destroy X pixmap */ diff --git a/src/gallium/state_trackers/xlib/old_xmesa.h b/src/gallium/state_trackers/xlib/old_xmesa.h index 771848f7dac..0d34378c8f6 100644 --- a/src/gallium/state_trackers/xlib/old_xmesa.h +++ b/src/gallium/state_trackers/xlib/old_xmesa.h @@ -127,8 +127,8 @@ typedef struct xmesa_buffer *XMesaBuffer; * visualCaveat - ala the GLX extension, usually GLX_NONE_EXT * Return; a new XMesaVisual or 0 if error. */ -extern XMesaVisual XMesaCreateVisual( XMesaDisplay *display, - XMesaVisualInfo visinfo, +extern XMesaVisual XMesaCreateVisual( Display *display, + XVisualInfo * visinfo, GLboolean rgb_flag, GLboolean alpha_flag, GLboolean db_flag, @@ -187,15 +187,15 @@ extern GLboolean XMesaCopyContext( XMesaContext src, /* * Create an XMesaBuffer from an X window. */ -extern XMesaBuffer XMesaCreateWindowBuffer( XMesaVisual v, XMesaWindow w ); +extern XMesaBuffer XMesaCreateWindowBuffer( XMesaVisual v, Window w ); /* * Create an XMesaBuffer from an X pixmap. */ extern XMesaBuffer XMesaCreatePixmapBuffer( XMesaVisual v, - XMesaPixmap p, - XMesaColormap cmap ); + Pixmap p, + Colormap cmap ); /* @@ -209,8 +209,8 @@ extern void XMesaDestroyBuffer( XMesaBuffer b ); * * New in Mesa 2.3. */ -extern XMesaBuffer XMesaFindBuffer( XMesaDisplay *dpy, - XMesaDrawable d ); +extern XMesaBuffer XMesaFindBuffer( Display *dpy, + Drawable d ); @@ -286,8 +286,8 @@ extern void XMesaCopySubBuffer( XMesaBuffer b, * GL_FALSE = context is single buffered */ extern GLboolean XMesaGetBackBuffer( XMesaBuffer b, - XMesaPixmap *pixmap, - XMesaImage **ximage ); + Pixmap *pixmap, + XImage **ximage ); @@ -368,7 +368,7 @@ extern void XMesaResizeBuffers( XMesaBuffer b ); * Create a pbuffer. * New in Mesa 4.1 */ -extern XMesaBuffer XMesaCreatePBuffer(XMesaVisual v, XMesaColormap cmap, +extern XMesaBuffer XMesaCreatePBuffer(XMesaVisual v, Colormap cmap, unsigned int width, unsigned int height); @@ -378,16 +378,16 @@ extern XMesaBuffer XMesaCreatePBuffer(XMesaVisual v, XMesaColormap cmap, * New in Mesa 7.1 */ extern void -XMesaBindTexImage(XMesaDisplay *dpy, XMesaBuffer drawable, int buffer, +XMesaBindTexImage(Display *dpy, XMesaBuffer drawable, int buffer, const int *attrib_list); extern void -XMesaReleaseTexImage(XMesaDisplay *dpy, XMesaBuffer drawable, int buffer); +XMesaReleaseTexImage(Display *dpy, XMesaBuffer drawable, int buffer); extern XMesaBuffer -XMesaCreatePixmapTextureBuffer(XMesaVisual v, XMesaPixmap p, - XMesaColormap cmap, +XMesaCreatePixmapTextureBuffer(XMesaVisual v, Pixmap p, + Colormap cmap, int format, int target, int mipmap); diff --git a/src/gallium/state_trackers/xlib/old_xmesa_x.h b/src/gallium/state_trackers/xlib/old_xmesa_x.h index 865bab4313b..75e5cec38b4 100644 --- a/src/gallium/state_trackers/xlib/old_xmesa_x.h +++ b/src/gallium/state_trackers/xlib/old_xmesa_x.h @@ -39,16 +39,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef _XMESA_X_H_ #define _XMESA_X_H_ -typedef Display XMesaDisplay; -typedef Pixmap XMesaPixmap; -typedef Colormap XMesaColormap; -typedef Drawable XMesaDrawable; -typedef Window XMesaWindow; -typedef GC XMesaGC; -typedef XVisualInfo *XMesaVisualInfo; -typedef XImage XMesaImage; -typedef XPoint XMesaPoint; -typedef XColor XMesaColor; #define XMesaDestroyImage XDestroyImage diff --git a/src/gallium/state_trackers/xlib/xm_api.c b/src/gallium/state_trackers/xlib/xm_api.c index 58f7bde4e0f..d00617c4f4a 100644 --- a/src/gallium/state_trackers/xlib/xm_api.c +++ b/src/gallium/state_trackers/xlib/xm_api.c @@ -101,7 +101,7 @@ static int host_byte_order( void ) * 1 = shared XImage support available * 2 = shared Pixmap support available also */ -int xmesa_check_for_xshm( XMesaDisplay *display ) +int xmesa_check_for_xshm( Display *display ) { #if defined(USE_XSHM) int major, minor, ignore; @@ -143,9 +143,9 @@ int xmesa_check_for_xshm( XMesaDisplay *display ) static int bits_per_pixel( XMesaVisual xmv ) { - XMesaDisplay *dpy = xmv->display; - XMesaVisualInfo visinfo = xmv->visinfo; - XMesaImage *img; + Display *dpy = xmv->display; + XVisualInfo * visinfo = xmv->visinfo; + XImage *img; int bitsPerPixel; /* Create a temporary XImage */ img = XCreateImage( dpy, visinfo->visual, visinfo->depth, @@ -178,7 +178,7 @@ bits_per_pixel( XMesaVisual xmv ) */ static GLboolean WindowExistsFlag; -static int window_exists_err_handler( XMesaDisplay* dpy, XErrorEvent* xerr ) +static int window_exists_err_handler( Display* dpy, XErrorEvent* xerr ) { (void) dpy; if (xerr->error_code == BadWindow) { @@ -187,10 +187,10 @@ static int window_exists_err_handler( XMesaDisplay* dpy, XErrorEvent* xerr ) return 0; } -static GLboolean window_exists( XMesaDisplay *dpy, Window win ) +static GLboolean window_exists( Display *dpy, Window win ) { XWindowAttributes wa; - int (*old_handler)( XMesaDisplay*, XErrorEvent* ); + int (*old_handler)( Display*, XErrorEvent* ); WindowExistsFlag = GL_TRUE; old_handler = XSetErrorHandler(window_exists_err_handler); XGetWindowAttributes( dpy, win, &wa ); /* dummy request */ @@ -199,7 +199,7 @@ static GLboolean window_exists( XMesaDisplay *dpy, Window win ) } static Status -get_drawable_size( XMesaDisplay *dpy, Drawable d, uint *width, uint *height ) +get_drawable_size( Display *dpy, Drawable d, uint *width, uint *height ) { Window root; Status stat; @@ -219,7 +219,7 @@ get_drawable_size( XMesaDisplay *dpy, Drawable d, uint *width, uint *height ) * \param height returns height in pixels */ static void -xmesa_get_window_size(XMesaDisplay *dpy, XMesaBuffer b, +xmesa_get_window_size(Display *dpy, XMesaBuffer b, GLuint *width, GLuint *height) { Status stat; @@ -303,8 +303,8 @@ XMesaBuffer XMesaBufferList = NULL; * \return new XMesaBuffer or NULL if any problem */ static XMesaBuffer -create_xmesa_buffer(XMesaDrawable d, BufferType type, - XMesaVisual vis, XMesaColormap cmap) +create_xmesa_buffer(Drawable d, BufferType type, + XMesaVisual vis, Colormap cmap) { XMesaBuffer b; GLframebuffer *fb; @@ -397,7 +397,7 @@ create_xmesa_buffer(XMesaDrawable d, BufferType type, * the notThis buffer. */ XMesaBuffer -xmesa_find_buffer(XMesaDisplay *dpy, XMesaColormap cmap, XMesaBuffer notThis) +xmesa_find_buffer(Display *dpy, Colormap cmap, XMesaBuffer notThis) { XMesaBuffer b; for (b = XMesaBufferList; b; b = b->Next) { @@ -475,8 +475,8 @@ xmesa_free_buffer(XMesaBuffer buffer) */ static GLboolean initialize_visual_and_buffer(XMesaVisual v, XMesaBuffer b, - GLboolean rgb_flag, XMesaDrawable window, - XMesaColormap cmap) + GLboolean rgb_flag, Drawable window, + Colormap cmap) { ASSERT(!b || b->xm_visual == v); @@ -598,8 +598,8 @@ xmesa_convert_from_x_visual_type( int visualType ) * Return; a new XMesaVisual or 0 if error. */ PUBLIC -XMesaVisual XMesaCreateVisual( XMesaDisplay *display, - XMesaVisualInfo visinfo, +XMesaVisual XMesaCreateVisual( Display *display, + XVisualInfo * visinfo, GLboolean rgb_flag, GLboolean alpha_flag, GLboolean db_flag, @@ -826,11 +826,11 @@ void XMesaDestroyContext( XMesaContext c ) * \return new XMesaBuffer or NULL if error */ PUBLIC XMesaBuffer -XMesaCreateWindowBuffer(XMesaVisual v, XMesaWindow w) +XMesaCreateWindowBuffer(XMesaVisual v, Window w) { XWindowAttributes attr; XMesaBuffer b; - XMesaColormap cmap; + Colormap cmap; int depth; assert(v); @@ -856,12 +856,12 @@ XMesaCreateWindowBuffer(XMesaVisual v, XMesaWindow w) cmap = XCreateColormap(v->display, w, attr.visual, AllocNone); } - b = create_xmesa_buffer((XMesaDrawable) w, WINDOW, v, cmap); + b = create_xmesa_buffer((Drawable) w, WINDOW, v, cmap); if (!b) return NULL; if (!initialize_visual_and_buffer( v, b, v->mesa_visual.rgbMode, - (XMesaDrawable) w, cmap )) { + (Drawable) w, cmap )) { xmesa_free_buffer(b); return NULL; } @@ -881,18 +881,18 @@ XMesaCreateWindowBuffer(XMesaVisual v, XMesaWindow w) * \returns new XMesaBuffer or NULL if error */ PUBLIC XMesaBuffer -XMesaCreatePixmapBuffer(XMesaVisual v, XMesaPixmap p, XMesaColormap cmap) +XMesaCreatePixmapBuffer(XMesaVisual v, Pixmap p, Colormap cmap) { XMesaBuffer b; assert(v); - b = create_xmesa_buffer((XMesaDrawable) p, PIXMAP, v, cmap); + b = create_xmesa_buffer((Drawable) p, PIXMAP, v, cmap); if (!b) return NULL; if (!initialize_visual_and_buffer(v, b, v->mesa_visual.rgbMode, - (XMesaDrawable) p, cmap)) { + (Drawable) p, cmap)) { xmesa_free_buffer(b); return NULL; } @@ -905,8 +905,8 @@ XMesaCreatePixmapBuffer(XMesaVisual v, XMesaPixmap p, XMesaColormap cmap) * For GLX_EXT_texture_from_pixmap */ XMesaBuffer -XMesaCreatePixmapTextureBuffer(XMesaVisual v, XMesaPixmap p, - XMesaColormap cmap, +XMesaCreatePixmapTextureBuffer(XMesaVisual v, Pixmap p, + Colormap cmap, int format, int target, int mipmap) { GET_CURRENT_CONTEXT(ctx); @@ -915,7 +915,7 @@ XMesaCreatePixmapTextureBuffer(XMesaVisual v, XMesaPixmap p, assert(v); - b = create_xmesa_buffer((XMesaDrawable) p, PIXMAP, v, cmap); + b = create_xmesa_buffer((Drawable) p, PIXMAP, v, cmap); if (!b) return NULL; @@ -953,7 +953,7 @@ XMesaCreatePixmapTextureBuffer(XMesaVisual v, XMesaPixmap p, b->TextureMipmap = mipmap; if (!initialize_visual_and_buffer(v, b, v->mesa_visual.rgbMode, - (XMesaDrawable) p, cmap)) { + (Drawable) p, cmap)) { xmesa_free_buffer(b); return NULL; } @@ -964,11 +964,11 @@ XMesaCreatePixmapTextureBuffer(XMesaVisual v, XMesaPixmap p, XMesaBuffer -XMesaCreatePBuffer(XMesaVisual v, XMesaColormap cmap, +XMesaCreatePBuffer(XMesaVisual v, Colormap cmap, unsigned int width, unsigned int height) { - XMesaWindow root; - XMesaDrawable drawable; /* X Pixmap Drawable */ + Window root; + Drawable drawable; /* X Pixmap Drawable */ XMesaBuffer b; /* allocate pixmap for front buffer */ @@ -1221,7 +1221,7 @@ const char *XMesaGetString( XMesaContext c, int name ) -XMesaBuffer XMesaFindBuffer( XMesaDisplay *dpy, XMesaDrawable d ) +XMesaBuffer XMesaFindBuffer( Display *dpy, Drawable d ) { XMesaBuffer b; for (b=XMesaBufferList; b; b=b->Next) { @@ -1236,7 +1236,7 @@ XMesaBuffer XMesaFindBuffer( XMesaDisplay *dpy, XMesaDrawable d ) /** * Free/destroy all XMesaBuffers associated with given display. */ -void xmesa_destroy_buffers_on_display(XMesaDisplay *dpy) +void xmesa_destroy_buffers_on_display(Display *dpy) { XMesaBuffer b, next; for (b = XMesaBufferList; b; b = next) { @@ -1298,7 +1298,7 @@ XMesaResizeBuffers( XMesaBuffer b ) PUBLIC void -XMesaBindTexImage(XMesaDisplay *dpy, XMesaBuffer drawable, int buffer, +XMesaBindTexImage(Display *dpy, XMesaBuffer drawable, int buffer, const int *attrib_list) { } @@ -1306,7 +1306,7 @@ XMesaBindTexImage(XMesaDisplay *dpy, XMesaBuffer drawable, int buffer, PUBLIC void -XMesaReleaseTexImage(XMesaDisplay *dpy, XMesaBuffer drawable, int buffer) +XMesaReleaseTexImage(Display *dpy, XMesaBuffer drawable, int buffer) { } diff --git a/src/gallium/state_trackers/xlib/xmesaP.h b/src/gallium/state_trackers/xlib/xmesaP.h index 3b225a440f9..f79bd593ff8 100644 --- a/src/gallium/state_trackers/xlib/xmesaP.h +++ b/src/gallium/state_trackers/xlib/xmesaP.h @@ -46,8 +46,8 @@ extern XMesaBuffer XMesaBufferList; */ struct xmesa_visual { GLvisual mesa_visual; /* Device independent visual parameters */ - XMesaDisplay *display; /* The X11 display */ - XMesaVisualInfo visinfo; /* X's visual info (pointer to private copy) */ + Display *display; /* The X11 display */ + XVisualInfo * visinfo; /* X's visual info (pointer to private copy) */ XVisualInfo *vishandle; /* Only used in fakeglx.c */ GLint BitsPerPixel; /* True bits per pixel for XImages */ @@ -86,11 +86,11 @@ struct xmesa_buffer { GLboolean wasCurrent; /* was ever the current buffer? */ XMesaVisual xm_visual; /* the X/Mesa visual */ - XMesaDrawable drawable; /* Usually the X window ID */ - XMesaColormap cmap; /* the X colormap */ + Drawable drawable; /* Usually the X window ID */ + Colormap cmap; /* the X colormap */ BufferType type; /* window, pixmap, pbuffer or glxwindow */ - XMesaImage *tempImage; + XImage *tempImage; unsigned long selectedEvents;/* for pbuffers only */ GLuint shm; /* X Shared Memory extension status: */ @@ -101,7 +101,7 @@ struct xmesa_buffer { XShmSegmentInfo shminfo; #endif - XMesaGC gc; /* scratch GC for span, line, tri drawing */ + GC gc; /* scratch GC for span, line, tri drawing */ /* GLX_EXT_texture_from_pixmap */ GLint TextureTarget; /** GLX_TEXTURE_1D_EXT, for example */ @@ -134,13 +134,13 @@ extern void xmesa_delete_framebuffer(struct gl_framebuffer *fb); extern XMesaBuffer -xmesa_find_buffer(XMesaDisplay *dpy, XMesaColormap cmap, XMesaBuffer notThis); +xmesa_find_buffer(Display *dpy, Colormap cmap, XMesaBuffer notThis); extern void xmesa_check_and_update_buffer_size(XMesaContext xmctx, XMesaBuffer drawBuffer); extern void -xmesa_destroy_buffers_on_display(XMesaDisplay *dpy); +xmesa_destroy_buffers_on_display(Display *dpy); static INLINE GLuint xmesa_buffer_width(XMesaBuffer b) @@ -155,6 +155,6 @@ xmesa_buffer_height(XMesaBuffer b) } extern int -xmesa_check_for_xshm(XMesaDisplay *display); +xmesa_check_for_xshm(Display *display); #endif -- 2.30.2