From ad271b8c98021dc82c0714d768a6642aee10794f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 26 Sep 2005 00:38:00 +0000 Subject: Added XMesaDrawable to xmesa_renderbuffer. Use it in a few places instead of the XMesaPixmap field to avoid some X server-side issues with casting. --- src/mesa/drivers/x11/xm_api.c | 86 ++++++++++++++++++-------------- src/mesa/drivers/x11/xm_dd.c | 4 +- src/mesa/drivers/x11/xm_span.c | 110 ++++++++++++++++++++--------------------- src/mesa/drivers/x11/xmesaP.h | 16 ++++-- 4 files changed, 120 insertions(+), 96 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index a402d608e04..aa0f8917f08 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -560,8 +560,8 @@ alloc_shm_back_buffer(XMesaBuffer b, GLuint width, GLuint height) shmctl( b->shminfo.shmid, IPC_RMID, 0 ); /* nobody else needs it */ /* Finally, try an XShmPutImage to be really sure the extension works */ - gc = XCreateGC( b->xm_visual->display, b->frontxrb->pixmap, 0, NULL ); - XShmPutImage( b->xm_visual->display, b->frontxrb->pixmap, gc, + gc = XCreateGC( b->xm_visual->display, b->frontxrb->drawable, 0, NULL ); + XShmPutImage( b->xm_visual->display, b->frontxrb->drawable, gc, b->backxrb->ximage, 0, 0, 0, 0, 1, 1 /*one pixel*/, False ); XSync( b->xm_visual->display, False ); XFreeGC( b->xm_visual->display, gc ); @@ -587,6 +587,7 @@ alloc_shm_back_buffer(XMesaBuffer b, GLuint width, GLuint height) + /* * Setup an off-screen pixmap or Ximage to use as the back buffer. * Input: b - the X/Mesa buffer @@ -640,6 +641,11 @@ xmesa_alloc_back_buffer( XMesaBuffer b, GLuint width, GLuint height ) XMesaDestroyImage( b->backxrb->ximage ); b->backxrb->ximage = NULL; } + /* this call just updates the width/origin fields in the xrb */ + b->backxrb->Base.AllocStorage(NULL, &b->backxrb->Base, + b->backxrb->Base.InternalFormat, + b->backxrb->ximage->width, + b->backxrb->ximage->height); } b->backxrb->pixmap = None; } @@ -655,7 +661,7 @@ xmesa_alloc_back_buffer( XMesaBuffer b, GLuint width, GLuint height ) } /* Allocate new back pixmap */ b->backxrb->pixmap = XMesaCreatePixmap( b->xm_visual->display, - b->frontxrb->pixmap, + b->frontxrb->drawable, width, height, GET_VISUAL_DEPTH(b->xm_visual) ); b->backxrb->ximage = NULL; @@ -1274,7 +1280,8 @@ static GLboolean initialize_visual_and_buffer( int client, if (b && window) { /* Do window-specific initializations */ - b->frontxrb->pixmap = window; + b->frontxrb->drawable = window; + b->frontxrb->pixmap = (XMesaPixmap) window; /* Setup for single/double buffering */ if (v->mesa_visual.doubleBufferMode) { @@ -1329,7 +1336,7 @@ static GLboolean initialize_visual_and_buffer( int client, XMesaPutPixel(v->hpcr_clear_ximage, i, 0, 0); XMesaPutPixel(v->hpcr_clear_ximage, i, 1, 0); } - XMesaPutImage(b->display, (XMesaDrawable)v->hpcr_clear_pixmap, + XMesaPutImage(b->display, (XMesaDrawable) v->hpcr_clear_pixmap, b->cleargc, v->hpcr_clear_ximage, 0, 0, 0, 0, 16, 2); XMesaSetFillStyle( v->display, b->cleargc, FillTiled); XMesaSetTile( v->display, b->cleargc, v->hpcr_clear_pixmap ); @@ -1804,7 +1811,7 @@ XMesaCreateWindowBuffer2(XMesaVisual v, XMesaWindow w, XMesaContext c) } if (!initialize_visual_and_buffer( client, v, b, v->mesa_visual.rgbMode, - (XMesaDrawable)w, cmap )) { + (XMesaDrawable) w, cmap )) { free_xmesa_buffer(client, b); return NULL; } @@ -1926,7 +1933,7 @@ XMesaCreatePixmapBuffer(XMesaVisual v, XMesaPixmap p, XMesaColormap cmap) #endif if (!initialize_visual_and_buffer(client, v, b, v->mesa_visual.rgbMode, - (XMesaDrawable)p, cmap)) { + (XMesaDrawable) p, cmap)) { free_xmesa_buffer(client, b); return NULL; } @@ -1977,8 +1984,8 @@ void XMesaDestroyBuffer( XMesaBuffer b ) int client = 0; #ifdef XFree86Server - if (b->frontxrb->pixmap) - client = CLIENT_ID(b->frontxrb->pixmap->id); + if (b->frontxrb->drawable) + client = CLIENT_ID(b->frontxrb->drawable->id); #endif if (b->gc) XMesaFreeGC( b->xm_visual->display, b->gc ); @@ -1987,25 +1994,25 @@ void XMesaDestroyBuffer( XMesaBuffer b ) if (b->xm_visual->mesa_visual.doubleBufferMode) { - if (b->backxrb->ximage) { + if (b->backxrb->ximage) { #if defined(USE_XSHM) && !defined(XFree86Server) - if (b->shm) { - XShmDetach( b->xm_visual->display, &b->shminfo ); - XDestroyImage( b->backxrb->ximage ); - shmdt( b->shminfo.shmaddr ); - } - else + if (b->shm) { + XShmDetach( b->xm_visual->display, &b->shminfo ); + XDestroyImage( b->backxrb->ximage ); + shmdt( b->shminfo.shmaddr ); + } + else #endif - XMesaDestroyImage( b->backxrb->ximage ); - } - if (b->backxrb->pixmap) { - XMesaFreePixmap( b->xm_visual->display, b->backxrb->pixmap ); - if (b->xm_visual->hpcr_clear_flag) { - XMesaFreePixmap( b->xm_visual->display, - b->xm_visual->hpcr_clear_pixmap ); - XMesaDestroyImage( b->xm_visual->hpcr_clear_ximage ); - } - } + XMesaDestroyImage( b->backxrb->ximage ); + } + if (b->backxrb->pixmap) { + XMesaFreePixmap( b->xm_visual->display, b->backxrb->pixmap ); + if (b->xm_visual->hpcr_clear_flag) { + XMesaFreePixmap( b->xm_visual->display, + b->xm_visual->hpcr_clear_pixmap ); + XMesaDestroyImage( b->xm_visual->hpcr_clear_ximage ); + } + } } if (b->rowimage) { _mesa_free( b->rowimage->data ); @@ -2334,7 +2341,7 @@ void XMesaSwapBuffers( XMesaBuffer b ) #if defined(USE_XSHM) && !defined(XFree86Server) if (b->shm) { /*_glthread_LOCK_MUTEX(_xmesa_lock);*/ - XShmPutImage( b->xm_visual->display, b->frontxrb->pixmap, + XShmPutImage( b->xm_visual->display, b->frontxrb->drawable, b->swapgc, b->backxrb->ximage, 0, 0, 0, 0, b->mesa_buffer.Width, b->mesa_buffer.Height, @@ -2345,7 +2352,7 @@ void XMesaSwapBuffers( XMesaBuffer b ) #endif { /*_glthread_LOCK_MUTEX(_xmesa_lock);*/ - XMesaPutImage( b->xm_visual->display, b->frontxrb->pixmap, + XMesaPutImage( b->xm_visual->display, b->frontxrb->drawable, b->swapgc, b->backxrb->ximage, 0, 0, 0, 0, b->mesa_buffer.Width, b->mesa_buffer.Height ); @@ -2357,7 +2364,7 @@ void XMesaSwapBuffers( XMesaBuffer b ) /*_glthread_LOCK_MUTEX(_xmesa_lock);*/ XMesaCopyArea( b->xm_visual->display, b->backxrb->pixmap, /* source drawable */ - b->frontxrb->pixmap, /* dest. drawable */ + b->frontxrb->drawable, /* dest. drawable */ b->swapgc, 0, 0, b->mesa_buffer.Width, b->mesa_buffer.Height, 0, 0 /* dest region */ @@ -2406,7 +2413,7 @@ void XMesaCopySubBuffer( XMesaBuffer b, int x, int y, int width, int height ) #if defined(USE_XSHM) && !defined(XFree86Server) if (b->shm) { /* XXX assuming width and height aren't too large! */ - XShmPutImage( b->xm_visual->display, b->frontxrb->pixmap, + XShmPutImage( b->xm_visual->display, b->frontxrb->drawable, b->swapgc, b->backxrb->ximage, x, yTop, x, yTop, width, height, False ); @@ -2416,7 +2423,7 @@ void XMesaCopySubBuffer( XMesaBuffer b, int x, int y, int width, int height ) #endif { /* XXX assuming width and height aren't too large! */ - XMesaPutImage( b->xm_visual->display, b->frontxrb->pixmap, + XMesaPutImage( b->xm_visual->display, b->frontxrb->drawable, b->swapgc, b->backxrb->ximage, x, yTop, x, yTop, width, height ); @@ -2426,7 +2433,7 @@ void XMesaCopySubBuffer( XMesaBuffer b, int x, int y, int width, int height ) /* Copy pixmap to window on server */ XMesaCopyArea( b->xm_visual->display, b->backxrb->pixmap, /* source drawable */ - b->frontxrb->pixmap, /* dest. drawable */ + b->frontxrb->drawable, /* dest. drawable */ b->swapgc, x, yTop, width, height, /* source region */ x, yTop /* dest region */ @@ -2445,6 +2452,7 @@ void XMesaCopySubBuffer( XMesaBuffer b, int x, int y, int width, int height ) * Return: GL_TRUE = context is double buffered * GL_FALSE = context is single buffered */ +#ifndef XFree86Server GLboolean XMesaGetBackBuffer( XMesaBuffer b, XMesaPixmap *pixmap, XMesaImage **ximage ) @@ -2462,6 +2470,7 @@ GLboolean XMesaGetBackBuffer( XMesaBuffer b, return GL_FALSE; } } +#endif /* XFree86Server */ /* @@ -2528,7 +2537,7 @@ XMesaBuffer XMesaFindBuffer( XMesaDisplay *dpy, XMesaDrawable d ) { XMesaBuffer b; for (b=XMesaBufferList; b; b=b->Next) { - if (b->frontxrb->pixmap==d && b->display==dpy) { + if (b->frontxrb->drawable == d && b->display == dpy) { return b; } } @@ -2546,12 +2555,12 @@ void XMesaGarbageCollect( void ) XMesaBuffer b, next; for (b=XMesaBufferList; b; b=next) { next = b->Next; - if (b->display && b->frontxrb->pixmap && b->type == WINDOW) { + if (b->display && b->frontxrb->drawable && b->type == WINDOW) { #ifdef XFree86Server /* NOT_NEEDED */ #else XSync(b->display, False); - if (!window_exists( b->display, b->frontxrb->pixmap )) { + if (!window_exists( b->display, b->frontxrb->drawable )) { /* found a dead window, free the ancillary info */ XMesaDestroyBuffer( b ); } @@ -2636,8 +2645,13 @@ unsigned long XMesaDitherColor( XMesaContext xmesa, GLint x, GLint y, void XMesaResizeBuffers( XMesaBuffer b ) { #ifdef XFree86Server + GLuint winwidth, winheight; GET_CURRENT_CONTEXT(ctx); - xmesa_resize_buffers(ctx, &(b->mesa_buffer), 0, 0); + + winwidth = MIN2(b->frontxrb->drawable->width, MAX_WIDTH); + winheight = MIN2(b->frontxrb->drawable->height, MAX_HEIGHT); + + xmesa_resize_buffers(ctx, &(b->mesa_buffer), winwidth, winheight); #else Window root; int xpos, ypos; diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index 3e7174ab928..e26b54f8e41 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -105,8 +105,8 @@ get_buffer_size( GLframebuffer *buffer, GLuint *width, GLuint *height ) unsigned int winwidth, winheight; #ifdef XFree86Server /* XFree86 GLX renderer */ - winwidth = MIN2(xmBuffer->frontxrb->pixmap->width, MAX_WIDTH); - winheight = MIN2(xmBuffer->frontxrb->pixmap->height, MAX_HEIGHT); + winwidth = MIN2(xmBuffer->frontxrb->drawable->width, MAX_WIDTH); + winheight = MIN2(xmBuffer->frontxrb->drawable->height, MAX_HEIGHT); #else Window root; int winx, winy; diff --git a/src/mesa/drivers/x11/xm_span.c b/src/mesa/drivers/x11/xm_span.c index 768472f80a8..64fa34a1320 100644 --- a/src/mesa/drivers/x11/xm_span.c +++ b/src/mesa/drivers/x11/xm_span.c @@ -188,7 +188,7 @@ static void put_row_TRUECOLOR_pixmap( PUT_ROW_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = XMESA_BUFFER(ctx->DrawBuffer)->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; @@ -225,7 +225,7 @@ static void put_row_rgb_TRUECOLOR_pixmap( RGB_SPAN_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); @@ -260,7 +260,7 @@ static void put_row_TRUEDITHER_pixmap( PUT_ROW_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); @@ -295,7 +295,7 @@ static void put_row_rgb_TRUEDITHER_pixmap( RGB_SPAN_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); @@ -330,7 +330,7 @@ static void put_row_8A8B8G8R_pixmap( PUT_ROW_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); @@ -364,7 +364,7 @@ static void put_row_rgb_8A8B8G8R_pixmap( RGB_SPAN_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); @@ -397,7 +397,7 @@ static void put_row_8A8R8G8B_pixmap( PUT_ROW_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); @@ -431,7 +431,7 @@ static void put_row_rgb_8A8R8G8B_pixmap( RGB_SPAN_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); @@ -464,7 +464,7 @@ static void put_row_8R8G8B_pixmap( PUT_ROW_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); @@ -497,7 +497,7 @@ static void put_row_8R8G8B24_pixmap( PUT_ROW_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; y = YFLIP(xrb, y); if (mask) { @@ -593,7 +593,7 @@ static void put_row_rgb_8R8G8B_pixmap( RGB_SPAN_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); @@ -625,7 +625,7 @@ static void put_row_rgb_8R8G8B24_pixmap( RGB_SPAN_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; y = YFLIP(xrb, y); if (mask) { @@ -726,7 +726,7 @@ static void put_row_5R6G5B_pixmap( PUT_ROW_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); @@ -759,7 +759,7 @@ static void put_row_DITHER_5R6G5B_pixmap( PUT_ROW_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); @@ -794,7 +794,7 @@ static void put_row_rgb_5R6G5B_pixmap( RGB_SPAN_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); @@ -827,7 +827,7 @@ static void put_row_rgb_DITHER_5R6G5B_pixmap( RGB_SPAN_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); @@ -862,7 +862,7 @@ static void put_row_DITHER_pixmap( PUT_ROW_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; XDITHER_SETUP(y); @@ -895,7 +895,7 @@ static void put_row_rgb_DITHER_pixmap( RGB_SPAN_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; XDITHER_SETUP(y); @@ -928,7 +928,7 @@ static void put_row_1BIT_pixmap( PUT_ROW_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; SETUP_1BIT; @@ -963,7 +963,7 @@ static void put_row_rgb_1BIT_pixmap( RGB_SPAN_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; SETUP_1BIT; @@ -998,7 +998,7 @@ static void put_row_HPCR_pixmap( PUT_ROW_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); @@ -1031,7 +1031,7 @@ static void put_row_rgb_HPCR_pixmap( RGB_SPAN_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); @@ -1063,7 +1063,7 @@ static void put_row_LOOKUP_pixmap( PUT_ROW_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; LOOKUP_SETUP; @@ -1095,7 +1095,7 @@ static void put_row_rgb_LOOKUP_pixmap( RGB_SPAN_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; LOOKUP_SETUP; @@ -1127,7 +1127,7 @@ static void put_row_GRAYSCALE_pixmap( PUT_ROW_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); @@ -1158,7 +1158,7 @@ static void put_row_rgb_GRAYSCALE_pixmap( RGB_SPAN_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); @@ -2237,7 +2237,7 @@ static void put_values_TRUECOLOR_pixmap( PUT_VALUES_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; DITHER_SETUP; @@ -2434,7 +2434,7 @@ static void put_values_1BIT_pixmap( PUT_VALUES_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; SETUP_1BIT; @@ -2457,7 +2457,7 @@ static void put_values_HPCR_pixmap( PUT_VALUES_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; LOOKUP_SETUP; @@ -2501,7 +2501,7 @@ static void put_values_GRAYSCALE_pixmap( PUT_VALUES_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; const unsigned long pixel = xmesa_color_to_pixel(ctx, color[RCOMP], color[GCOMP], color[BCOMP], color[ACOMP], xmesa->pixelformat); @@ -2865,7 +2865,7 @@ put_mono_row_ci_pixmap( PUT_MONO_ROW_ARGS ) XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; XMesaSetForeground( xmesa->display, gc, colorIndex ); @@ -2902,7 +2902,7 @@ static void put_mono_row_TRUEDITHER_pixmap( PUT_MONO_ROW_ARGS ) struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; register GLuint i; @@ -2927,7 +2927,7 @@ static void put_mono_row_DITHER_pixmap( PUT_MONO_ROW_ARGS ) struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; register GLuint i; @@ -2951,7 +2951,7 @@ static void put_mono_row_1BIT_pixmap( PUT_MONO_ROW_ARGS ) struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; register GLuint i; @@ -3263,7 +3263,7 @@ static void put_mono_values_pixmap( PUT_MONO_VALUES_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; const unsigned long pixel = xmesa_color_to_pixel(ctx, color[RCOMP], @@ -3285,7 +3285,7 @@ put_mono_values_ci_pixmap( PUT_MONO_VALUES_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; XMesaSetForeground( xmesa->display, gc, colorIndex ); @@ -3307,7 +3307,7 @@ static void put_mono_values_TRUEDITHER_pixmap( PUT_MONO_VALUES_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; @@ -3332,7 +3332,7 @@ static void put_mono_values_DITHER_pixmap( PUT_MONO_VALUES_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; @@ -3355,7 +3355,7 @@ static void put_mono_values_1BIT_pixmap( PUT_MONO_VALUES_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; @@ -3650,7 +3650,7 @@ static void put_row_ci_pixmap( PUT_ROW_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); @@ -3709,7 +3709,7 @@ static void put_values_ci_pixmap( PUT_VALUES_ARGS ) const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; for (i=0;idisplay->GetImage)(xrb->pixmap, + (*xmesa->display->GetImage)(xrb->drawable, x, y, n, 1, ZPixmap, ~0L, (pointer)index); #endif @@ -3867,7 +3867,7 @@ get_row_rgba(GLcontext *ctx, struct gl_renderbuffer *rb, span = XMesaCreateImage(xmesa->xm_visual->BitsPerPixel, n, 1, NULL); span->data = (char *)MALLOC(span->height * span->bytes_per_line); error = (!span->data); - (*xmesa->display->GetImage)(xrb->pixmap, + (*xmesa->display->GetImage)(xrb->drawable, x, YFLIP(xrb, y), n, 1, ZPixmap, ~0L, (pointer)span->data); #else @@ -4262,7 +4262,7 @@ get_values_ci(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint i; if (xrb->pixmap) { for (i=0;idisplay, xrb->pixmap, + indx[i] = (GLuint) read_pixel( xmesa->display, xrb->drawable, x[i], YFLIP(xrb, y[i]) ); } } @@ -4288,7 +4288,7 @@ get_values_rgba(GLcontext *ctx, struct gl_renderbuffer *rb, register GLuint i; if (xrb->pixmap) { - XMesaDrawable buffer = xrb->pixmap; + XMesaDrawable buffer = xrb->drawable; switch (xmesa->pixelformat) { case PF_Truecolor: case PF_Dither_True: diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h index 5f4e3d4cf29..efe88a00442 100644 --- a/src/mesa/drivers/x11/xmesaP.h +++ b/src/mesa/drivers/x11/xmesaP.h @@ -161,13 +161,23 @@ typedef enum { #define BACK_XIMAGE 2 +/** + * An xmesa_renderbuffer represents the back or front color buffer. + * For the front color buffer: + * is the X window + * For the back color buffer: + * Either or will be used, never both. + * In any case, always equals . + * For stand-alone Mesa, we could merge and into one + * field. We don't do that for the server-side GLcore module because + * pixmaps and drawables are different and we'd need a bunch of casts. + */ struct xmesa_renderbuffer { struct gl_renderbuffer Base; /* Base class */ - XMesaDrawable pixmap; /* Either an X Window ID (front color buf) */ - /* or X Pixmap ID (back color buf) */ - + XMesaDrawable drawable; /* Usually the X window ID */ + XMesaPixmap pixmap; /* Back color buffer */ XMesaImage *ximage; /* The back buffer, if not using a Pixmap */ GLubyte *origin1; /* used for PIXEL_ADDR1 macro */ -- cgit v1.2.3