diff options
Diffstat (limited to 'src/mesa')
20 files changed, 373 insertions, 249 deletions
diff --git a/src/mesa/drivers/dri/common/drirenderbuffer.c b/src/mesa/drivers/dri/common/drirenderbuffer.c index 817cb86c524..df0d27302cc 100644 --- a/src/mesa/drivers/dri/common/drirenderbuffer.c +++ b/src/mesa/drivers/dri/common/drirenderbuffer.c @@ -38,12 +38,16 @@ driDeleteRenderbuffer(struct gl_renderbuffer *rb) * this function. * \param format Either GL_RGBA, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT24, * GL_DEPTH_COMPONENT32, or GL_STENCIL_INDEX8_EXT (for now). + * \param addr address in main memory of the buffer. Probably a memory + * mapped region. * \param cpp chars or bytes per pixel * \param offset start of renderbuffer with respect to start of framebuffer * \param pitch pixels per row */ driRenderbuffer * -driNewRenderbuffer(GLenum format, GLint cpp, GLint offset, GLint pitch) +driNewRenderbuffer(GLenum format, GLvoid *addr, + GLint cpp, GLint offset, GLint pitch, + __DRIdrawablePrivate *dPriv) { driRenderbuffer *drb; @@ -98,7 +102,10 @@ driNewRenderbuffer(GLenum format, GLint cpp, GLint offset, GLint pitch) drb->Base.AllocStorage = driRenderbufferStorage; drb->Base.Delete = driDeleteRenderbuffer; + drb->Base.Data = addr; + /* DRI renderbuffer-specific fields: */ + drb->dPriv = dPriv; drb->offset = offset; drb->pitch = pitch; drb->cpp = cpp; @@ -106,6 +113,7 @@ driNewRenderbuffer(GLenum format, GLint cpp, GLint offset, GLint pitch) /* may be changed if page flipping is active: */ drb->flippedOffset = offset; drb->flippedPitch = pitch; + drb->flippedData = addr; } return drb; } diff --git a/src/mesa/drivers/dri/common/drirenderbuffer.h b/src/mesa/drivers/dri/common/drirenderbuffer.h index bd07bc790f2..f2cc357ff9e 100644 --- a/src/mesa/drivers/dri/common/drirenderbuffer.h +++ b/src/mesa/drivers/dri/common/drirenderbuffer.h @@ -11,6 +11,8 @@ #define DRIRENDERBUFFER_H #include "mtypes.h" +#include "dri_util.h" + typedef struct { struct gl_renderbuffer Base; @@ -38,7 +40,12 @@ typedef struct { */ GLint flippedOffset; GLint flippedPitch; - GLubyte *flippedData; /* mmap'd memory, if used */ + GLvoid *flippedData; /* mmap'd address of buffer memory, if used */ + + /* Pointer to corresponding __DRIdrawablePrivate. This is used to compute + * the window's position within the framebuffer. + */ + __DRIdrawablePrivate *dPriv; /* XXX this is for radeon/r200 only. We should really create a new * r200Renderbuffer class, derived from this class... not a huge deal. @@ -53,7 +60,9 @@ typedef struct { extern driRenderbuffer * -driNewRenderbuffer(GLenum format, GLint cpp, GLint offset, GLint pitch); +driNewRenderbuffer(GLenum format, GLvoid *addr, + GLint cpp, GLint offset, GLint pitch, + __DRIdrawablePrivate *dPriv); extern void driFlipRenderbuffers(struct gl_framebuffer *fb, GLboolean flipped); diff --git a/src/mesa/drivers/dri/fb/fb_dri.c b/src/mesa/drivers/dri/fb/fb_dri.c index 1ef043e1991..c1fab2d5867 100644 --- a/src/mesa/drivers/dri/fb/fb_dri.c +++ b/src/mesa/drivers/dri/fb/fb_dri.c @@ -426,21 +426,27 @@ fbCreateBuffer( __DRIscreenPrivate *driScrnPriv, /* XXX double-check these parameters (bpp vs cpp, etc) */ { - driRenderbuffer *drb = driNewRenderbuffer(GL_RGBA, driScrnPriv->fbBPP / 8, - driScrnPriv->fbOrigin, - driScrnPriv->fbStride); + driRenderbuffer *drb = driNewRenderbuffer(GL_RGBA, + driScrnPriv->pFB, + driScrnPriv->fbBPP / 8, + driScrnPriv->fbOrigin, + driScrnPriv->fbStride, + driDrawPriv); fbSetSpanFunctions(drb, mesaVis); - drb->Base.Data = driScrnPriv->pFB; _mesa_add_renderbuffer(mesa_framebuffer, BUFFER_FRONT_LEFT, &drb->Base); } if (mesaVis->doubleBufferMode) { /* XXX what are the correct origin/stride values? */ - driRenderbuffer *drb = driNewRenderbuffer(GL_RGBA, driScrnPriv->fbBPP /8, - driScrnPriv->fbOrigin, - driScrnPriv->fbStride); + GLvoid *backBuf = _mesa_malloc(driScrnPriv->fbStride + * driScrnPriv->fbHeight); + driRenderbuffer *drb = driNewRenderbuffer(GL_RGBA, + backBuf, + driScrnPriv->fbBPP /8, + driScrnPriv->fbOrigin, + driScrnPriv->fbStride, + driDrawPriv); fbSetSpanFunctions(drb, mesaVis); - drb->Base.Data = _mesa_malloc(driScrnPriv->fbStride * driScrnPriv->fbHeight); _mesa_add_renderbuffer(mesa_framebuffer, BUFFER_BACK_LEFT, &drb->Base); } diff --git a/src/mesa/drivers/dri/fb/fb_egl.c b/src/mesa/drivers/dri/fb/fb_egl.c index 1b91919ec99..94ff9cbb622 100644 --- a/src/mesa/drivers/dri/fb/fb_egl.c +++ b/src/mesa/drivers/dri/fb/fb_egl.c @@ -682,20 +682,21 @@ fbCreateScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLConfig cfg, /* front color renderbuffer */ { - driRenderbuffer *drb = driNewRenderbuffer(GL_RGBA, bytesPerPixel, - origin, stride); + driRenderbuffer *drb = driNewRenderbuffer(GL_RGBA, display->pFB, + bytesPerPixel, + origin, stride, NULL); fbSetSpanFunctions(drb, &vis); - drb->Base.Data = display->pFB; _mesa_add_renderbuffer(surface->mesa_framebuffer, BUFFER_FRONT_LEFT, &drb->Base); } /* back color renderbuffer */ if (vis.doubleBufferMode) { - driRenderbuffer *drb = driNewRenderbuffer(GL_RGBA, bytesPerPixel, - origin, stride); + GLubyte *backBuf = _mesa_malloc(stride * height); + driRenderbuffer *drb = driNewRenderbuffer(GL_RGBA, backBuf, + bytesPerPixel, + origin, stride, NULL); fbSetSpanFunctions(drb, &vis); - drb->Base.Data = _mesa_malloc(stride * height); _mesa_add_renderbuffer(surface->mesa_framebuffer, BUFFER_BACK_LEFT, &drb->Base); } diff --git a/src/mesa/drivers/dri/ffb/ffb_xmesa.c b/src/mesa/drivers/dri/ffb/ffb_xmesa.c index 29aab4acba7..baf4885a3be 100644 --- a/src/mesa/drivers/dri/ffb/ffb_xmesa.c +++ b/src/mesa/drivers/dri/ffb/ffb_xmesa.c @@ -343,28 +343,32 @@ ffbCreateBuffer(__DRIscreenPrivate *driScrnPriv, { driRenderbuffer *frontRb - = driNewRenderbuffer(GL_RGBA, bpp, offset, bogusPitch); + = driNewRenderbuffer(GL_RGBA, NULL, bpp, offset, bogusPitch, + driDrawPriv); ffbSetSpanFunctions(frontRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base); } if (mesaVis->doubleBufferMode) { driRenderbuffer *backRb - = driNewRenderbuffer(GL_RGBA, bpp, offset, bogusPitch); + = driNewRenderbuffer(GL_RGBA, NULL, bpp, offset, bogusPitch, + driDrawPriv); ffbSetSpanFunctions(backRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base); } if (mesaVis->depthBits == 16) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT16, bpp, offset, bogusPitch); + = driNewRenderbuffer(GL_DEPTH_COMPONENT16, NULL, bpp, offset, + bogusPitch, driDrawPriv); ffbSetDepthFunctions(depthRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); } if (mesaVis->stencilBits > 0 && !swStencil) { driRenderbuffer *stencilRb - = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, bpp, offset,bogusPitch); + = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, NULL, bpp, offset, + bogusPitch, driDrawPriv); ffbSetStencilFunctions(stencilRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base); } diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c index af8e0cc08ab..005d11a9b1e 100644 --- a/src/mesa/drivers/dri/i810/i810screen.c +++ b/src/mesa/drivers/dri/i810/i810screen.c @@ -346,41 +346,39 @@ i810CreateBuffer( __DRIscreenPrivate *driScrnPriv, return GL_FALSE; /* not implemented */ } else { -#if 0 - driDrawPriv->driverPrivate = (void *) - _mesa_create_framebuffer(mesaVis, - GL_FALSE, /* software depth buffer? */ - mesaVis->stencilBits > 0, - mesaVis->accumRedBits > 0, - GL_FALSE /* s/w alpha planes */); -#else struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis); { driRenderbuffer *frontRb - = driNewRenderbuffer(GL_RGBA, screen->cpp, - /*screen->frontOffset*/0, screen->backPitch); + = driNewRenderbuffer(GL_RGBA, + driScrnPriv->pFB, + screen->cpp, + /*screen->frontOffset*/0, screen->backPitch, + driDrawPriv); i810SetSpanFunctions(frontRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base); - frontRb->Base.Data = driScrnPriv->pFB; } if (mesaVis->doubleBufferMode) { driRenderbuffer *backRb - = driNewRenderbuffer(GL_RGBA, screen->cpp, - screen->backOffset, screen->backPitch); + = driNewRenderbuffer(GL_RGBA, + screen->back.map, + screen->cpp, + screen->backOffset, screen->backPitch, + driDrawPriv); i810SetSpanFunctions(backRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base); - backRb->Base.Data = (GLubyte *) screen->back.map; } if (mesaVis->depthBits == 16) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp, - screen->depthOffset, screen->backPitch); + = driNewRenderbuffer(GL_DEPTH_COMPONENT16, + screen->depth.map, + screen->cpp, + screen->depthOffset, screen->backPitch, + driDrawPriv); i810SetSpanFunctions(depthRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); - depthRb->Base.Data = (GLubyte *) screen->depth.map; } _mesa_add_soft_renderbuffers(fb, @@ -391,7 +389,7 @@ i810CreateBuffer( __DRIscreenPrivate *driScrnPriv, GL_FALSE, /* alpha */ GL_FALSE /* aux */); driDrawPriv->driverPrivate = (void *) fb; -#endif + return (driDrawPriv->driverPrivate != NULL); } } diff --git a/src/mesa/drivers/dri/i830/i830_screen.c b/src/mesa/drivers/dri/i830/i830_screen.c index 25def0b6fec..591552270af 100644 --- a/src/mesa/drivers/dri/i830/i830_screen.c +++ b/src/mesa/drivers/dri/i830/i830_screen.c @@ -326,52 +326,49 @@ static GLboolean i830CreateBuffer(__DRIscreenPrivate *driScrnPriv, GLboolean swStencil = mesaVis->stencilBits > 0; #endif -#if 0 - driDrawPriv->driverPrivate = (void *) - _mesa_create_framebuffer(mesaVis, - GL_FALSE, /* software depth buffer? */ - swStencil, - mesaVis->accumRedBits > 0, - GL_FALSE /* s/w alpha planes */); -#else struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis); { driRenderbuffer *frontRb - = driNewRenderbuffer(GL_RGBA, screen->cpp, - /*screen->frontOffset*/0, screen->backPitch); + = driNewRenderbuffer(GL_RGBA, NULL, screen->cpp, + /*screen->frontOffset*/0, screen->backPitch, + driDrawPriv); i830SetSpanFunctions(frontRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base); } if (mesaVis->doubleBufferMode) { driRenderbuffer *backRb - = driNewRenderbuffer(GL_RGBA, screen->cpp, - screen->backOffset, screen->backPitch); + = driNewRenderbuffer(GL_RGBA, NULL, screen->cpp, + screen->backOffset, screen->backPitch, + driDrawPriv); i830SetSpanFunctions(backRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base); } if (mesaVis->depthBits == 16) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp, - screen->depthOffset, screen->backPitch); + = driNewRenderbuffer(GL_DEPTH_COMPONENT16, NULL, screen->cpp, + screen->depthOffset, screen->backPitch, + driDrawPriv); i830SetSpanFunctions(depthRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); } else if (mesaVis->depthBits == 24) { if (mesaVis->stencilBits == 8) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp, - screen->depthOffset, screen->backPitch); + = driNewRenderbuffer(GL_DEPTH_COMPONENT24, NULL, screen->cpp, + screen->depthOffset, screen->backPitch, + driDrawPriv); i830SetSpanFunctions(depthRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); } else { /* not really 32-bit Z, but use GL_DEPTH_COMPONENT32 anyway */ driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT32, screen->cpp, - screen->depthOffset, screen->backPitch); + = driNewRenderbuffer(GL_DEPTH_COMPONENT32, NULL, screen->cpp, + screen->depthOffset, screen->backPitch, + driDrawPriv); i830SetSpanFunctions(depthRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); } @@ -379,8 +376,9 @@ static GLboolean i830CreateBuffer(__DRIscreenPrivate *driScrnPriv, if (mesaVis->stencilBits > 0 && !swStencil) { driRenderbuffer *stencilRb - = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, screen->cpp, - screen->depthOffset, screen->backPitch); + = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, NULL, screen->cpp, + screen->depthOffset, screen->backPitch, + driDrawPriv); i830SetSpanFunctions(stencilRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base); } @@ -393,7 +391,6 @@ static GLboolean i830CreateBuffer(__DRIscreenPrivate *driScrnPriv, GL_FALSE, /* alpha */ GL_FALSE /* aux */); driDrawPriv->driverPrivate = (void *) fb; -#endif return (driDrawPriv->driverPrivate != NULL); } diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 27faf6ba127..98b9b2ee6b6 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -243,46 +243,56 @@ static GLboolean intelCreateBuffer( __DRIscreenPrivate *driScrnPriv, { driRenderbuffer *frontRb - = driNewRenderbuffer(GL_RGBA, screen->cpp, - screen->frontOffset, screen->frontPitch); + = driNewRenderbuffer(GL_RGBA, + driScrnPriv->pFB, + screen->cpp, + screen->frontOffset, screen->frontPitch, + driDrawPriv); intelSetSpanFunctions(frontRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base); - frontRb->Base.Data = driScrnPriv->pFB; } if (mesaVis->doubleBufferMode) { driRenderbuffer *backRb - = driNewRenderbuffer(GL_RGBA, screen->cpp, - screen->backOffset, screen->backPitch); + = driNewRenderbuffer(GL_RGBA, + screen->back.map, + screen->cpp, + screen->backOffset, screen->backPitch, + driDrawPriv); intelSetSpanFunctions(backRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base); - backRb->Base.Data = screen->back.map; } if (mesaVis->depthBits == 16) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp, - screen->depthOffset, screen->depthPitch); + = driNewRenderbuffer(GL_DEPTH_COMPONENT16, + screen->depth.map, + screen->cpp, + screen->depthOffset, screen->depthPitch, + driDrawPriv); intelSetSpanFunctions(depthRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); - depthRb->Base.Data = screen->depth.map; } else if (mesaVis->depthBits == 24) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp, - screen->depthOffset, screen->depthPitch); + = driNewRenderbuffer(GL_DEPTH_COMPONENT24, + screen->depth.map, + screen->cpp, + screen->depthOffset, screen->depthPitch, + driDrawPriv); intelSetSpanFunctions(depthRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); - depthRb->Base.Data = screen->depth.map; } if (mesaVis->stencilBits > 0 && !swStencil) { driRenderbuffer *stencilRb - = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, screen->cpp, - screen->depthOffset, screen->depthPitch); + = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, + screen->depth.map, + screen->cpp, + screen->depthOffset, screen->depthPitch, + driDrawPriv); intelSetSpanFunctions(stencilRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base); - stencilRb->Base.Data = screen->depth.map; } _mesa_add_soft_renderbuffers(fb, diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c index 62b1bc2ba52..6d148d3288a 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.c +++ b/src/mesa/drivers/dri/mach64/mach64_screen.c @@ -376,32 +376,43 @@ mach64CreateBuffer( __DRIscreenPrivate *driScrnPriv, { driRenderbuffer *frontRb - = driNewRenderbuffer(GL_RGBA, screen->cpp, - screen->frontOffset, screen->frontPitch); + = driNewRenderbuffer(GL_RGBA, + NULL, + screen->cpp, + screen->frontOffset, screen->frontPitch, + driDrawPriv); mach64SetSpanFunctions(frontRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base); } if (mesaVis->doubleBufferMode) { driRenderbuffer *backRb - = driNewRenderbuffer(GL_RGBA, screen->cpp, - screen->backOffset, screen->backPitch); + = driNewRenderbuffer(GL_RGBA, + NULL, + screen->cpp, + screen->backOffset, screen->backPitch, + driDrawPriv); mach64SetSpanFunctions(backRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base); } if (mesaVis->depthBits == 16) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp, - screen->depthOffset, screen->depthPitch); + = driNewRenderbuffer(GL_DEPTH_COMPONENT16, + NULL, screen->cpp, + screen->depthOffset, screen->depthPitch, + driDrawPriv); mach64SetSpanFunctions(depthRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); } else if (mesaVis->depthBits == 24) { /* XXX I don't think 24-bit Z is supported - so this isn't used */ driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp, - screen->depthOffset, screen->depthPitch); + = driNewRenderbuffer(GL_DEPTH_COMPONENT24, + NULL, + screen->cpp, + screen->depthOffset, screen->depthPitch, + driDrawPriv); mach64SetSpanFunctions(depthRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); } diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index 3e7db69c2d2..ff8ccbf4800 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -735,24 +735,33 @@ mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv, { driRenderbuffer *frontRb - = driNewRenderbuffer(GL_RGBA, screen->cpp, - screen->frontOffset, screen->frontPitch); + = driNewRenderbuffer(GL_RGBA, + NULL, + screen->cpp, + screen->frontOffset, screen->frontPitch, + driDrawPriv); mgaSetSpanFunctions(frontRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base); } if (mesaVis->doubleBufferMode) { driRenderbuffer *backRb - = driNewRenderbuffer(GL_RGBA, screen->cpp, - screen->backOffset, screen->backPitch); + = driNewRenderbuffer(GL_RGBA, + NULL, + screen->cpp, + screen->backOffset, screen->backPitch, + driDrawPriv); mgaSetSpanFunctions(backRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base); } if (mesaVis->depthBits == 16) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp, - screen->depthOffset, screen->depthPitch); + = driNewRenderbuffer(GL_DEPTH_COMPONENT16, + NULL, + screen->cpp, + screen->depthOffset, screen->depthPitch, + driDrawPriv); mgaSetSpanFunctions(depthRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); } @@ -760,31 +769,43 @@ mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv, /* XXX is this right? */ if (mesaVis->stencilBits) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp, - screen->depthOffset, screen->depthPitch); + = driNewRenderbuffer(GL_DEPTH_COMPONENT24, + NULL, + screen->cpp, + screen->depthOffset, screen->depthPitch, + driDrawPriv); mgaSetSpanFunctions(depthRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); } else { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT32, screen->cpp, - screen->depthOffset, screen->depthPitch); + = driNewRenderbuffer(GL_DEPTH_COMPONENT32, + NULL, + screen->cpp, + screen->depthOffset, screen->depthPitch, + driDrawPriv); mgaSetSpanFunctions(depthRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); } } else if (mesaVis->depthBits == 32) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT32, screen->cpp, - screen->depthOffset, screen->depthPitch); + = driNewRenderbuffer(GL_DEPTH_COMPONENT32, + NULL, + screen->cpp, + screen->depthOffset, screen->depthPitch, + driDrawPriv); mgaSetSpanFunctions(depthRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); } if (mesaVis->stencilBits > 0 && !swStencil) { driRenderbuffer *stencilRb - = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, screen->cpp, - screen->depthOffset, screen->depthPitch); + = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, + NULL, + screen->cpp, + screen->depthOffset, screen->depthPitch, + driDrawPriv); mgaSetSpanFunctions(stencilRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base); } diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index 442eb6b9ecf..5d1b6e42d6f 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -275,31 +275,43 @@ r128CreateBuffer( __DRIscreenPrivate *driScrnPriv, { driRenderbuffer *frontRb - = driNewRenderbuffer(GL_RGBA, screen->cpp, - screen->frontOffset, screen->frontPitch); + = driNewRenderbuffer(GL_RGBA, + NULL, + screen->cpp, + screen->frontOffset, screen->frontPitch, + driDrawPriv); r128SetSpanFunctions(frontRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base); } if (mesaVis->doubleBufferMode) { driRenderbuffer *backRb - = driNewRenderbuffer(GL_RGBA, screen->cpp, - screen->backOffset, screen->backPitch); + = driNewRenderbuffer(GL_RGBA, + NULL, + screen->cpp, + screen->backOffset, screen->backPitch, + driDrawPriv); r128SetSpanFunctions(backRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base); } if (mesaVis->depthBits == 16) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp, - screen->depthOffset, screen->depthPitch); + = driNewRenderbuffer(GL_DEPTH_COMPONENT16, + NULL, + screen->cpp, + screen->depthOffset, screen->depthPitch, + driDrawPriv); r128SetSpanFunctions(depthRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); } else if (mesaVis->depthBits == 24) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp, - screen->depthOffset, screen->depthPitch); + = driNewRenderbuffer(GL_DEPTH_COMPONENT24, + NULL, + screen->cpp, + screen->depthOffset, screen->depthPitch, + driDrawPriv); r128SetSpanFunctions(depthRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); } diff --git a/src/mesa/drivers/dri/r200/r200_screen.c b/src/mesa/drivers/dri/r200/r200_screen.c index a8dacaf5d8d..a6f5059baa0 100644 --- a/src/mesa/drivers/dri/r200/r200_screen.c +++ b/src/mesa/drivers/dri/r200/r200_screen.c @@ -552,8 +552,11 @@ r200CreateBuffer( __DRIscreenPrivate *driScrnPriv, /* front color renderbuffer */ { driRenderbuffer *frontRb - = driNewRenderbuffer(GL_RGBA, screen->cpp, - screen->frontOffset, screen->frontPitch); + = driNewRenderbuffer(GL_RGBA, + driScrnPriv->pFB + screen->frontOffset, + screen->cpp, + screen->frontOffset, screen->frontPitch, + driDrawPriv); r200SetSpanFunctions(frontRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base); } @@ -561,8 +564,11 @@ r200CreateBuffer( __DRIscreenPrivate *driScrnPriv, /* back color renderbuffer */ if (mesaVis->doubleBufferMode) { driRenderbuffer *backRb - = driNewRenderbuffer(GL_RGBA, screen->cpp, - screen->backOffset, screen->backPitch); + = driNewRenderbuffer(GL_RGBA, + driScrnPriv->pFB + screen->backOffset, + screen->cpp, + screen->backOffset, screen->backPitch, + driDrawPriv); r200SetSpanFunctions(backRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base); } @@ -570,16 +576,22 @@ r200CreateBuffer( __DRIscreenPrivate *driScrnPriv, /* depth renderbuffer */ if (mesaVis->depthBits == 16) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp, - screen->depthOffset, screen->depthPitch); + = driNewRenderbuffer(GL_DEPTH_COMPONENT16, + driScrnPriv->pFB + screen->depthOffset, + screen->cpp, + screen->depthOffset, screen->depthPitch, + driDrawPriv); r200SetSpanFunctions(depthRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); depthRb->depthHasSurface = screen->depthHasSurface; } else if (mesaVis->depthBits == 24) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp, - screen->depthOffset, screen->depthPitch); + = driNewRenderbuffer(GL_DEPTH_COMPONENT24, + driScrnPriv->pFB + screen->depthOffset, + screen->cpp, + screen->depthOffset, screen->depthPitch, + driDrawPriv); r200SetSpanFunctions(depthRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); depthRb->depthHasSurface = screen->depthHasSurface; @@ -588,8 +600,11 @@ r200CreateBuffer( __DRIscreenPrivate *driScrnPriv, /* stencil renderbuffer */ if (mesaVis->stencilBits > 0 && !swStencil) { driRenderbuffer *stencilRb - = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, screen->cpp, - screen->depthOffset, screen->depthPitch); + = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, + driScrnPriv->pFB + screen->depthOffset, + screen->cpp, + screen->depthOffset, screen->depthPitch, + driDrawPriv); r200SetSpanFunctions(stencilRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base); stencilRb->depthHasSurface = screen->depthHasSurface; diff --git a/src/mesa/drivers/dri/r300/radeon_screen.c b/src/mesa/drivers/dri/r300/radeon_screen.c index 03c30f82973..eb6100c6271 100644 --- a/src/mesa/drivers/dri/r300/radeon_screen.c +++ b/src/mesa/drivers/dri/r300/radeon_screen.c @@ -665,46 +665,59 @@ radeonCreateBuffer(__DRIscreenPrivate * driScrnPriv, const GLboolean swAccum = mesaVis->accumRedBits > 0; const GLboolean swStencil = mesaVis->stencilBits > 0 && mesaVis->depthBits != 24; -#if 0 - driDrawPriv->driverPrivate = (void *) - _mesa_create_framebuffer(mesaVis, - swDepth, - swStencil, swAccum, swAlpha); -#else + struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis); { driRenderbuffer *frontRb - = driNewRenderbuffer(GL_RGBA, screen->cpp, - screen->frontOffset, screen->frontPitch); + = driNewRenderbuffer(GL_RGBA, NULL, + screen->cpp, + screen->frontOffset, + screen->frontPitch, + driDrawPriv); radeonSetSpanFunctions(frontRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base); } if (mesaVis->doubleBufferMode) { driRenderbuffer *backRb - = driNewRenderbuffer(GL_RGBA, screen->cpp, - screen->backOffset, screen->backPitch); + = driNewRenderbuffer(GL_RGBA, NULL, + screen->cpp, + screen->backOffset, + screen->backPitch, + driDrawPriv); radeonSetSpanFunctions(backRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base); } if (mesaVis->depthBits == 16) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp, - screen->depthOffset, screen->depthPitch); + = driNewRenderbuffer(GL_DEPTH_COMPONENT16, + NULL, + screen->cpp, + screen->depthOffset, + screen->depthPitch, + driDrawPriv); radeonSetSpanFunctions(depthRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); } else if (mesaVis->depthBits == 24) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp, - screen->depthOffset, screen->depthPitch); + = driNewRenderbuffer(GL_DEPTH_COMPONENT24, + NULL, + screen->cpp, + screen->depthOffset, + screen->depthPitch, + driDrawPriv); radeonSetSpanFunctions(depthRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); } if (mesaVis->stencilBits > 0 && !swStencil) { driRenderbuffer *stencilRb - = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, screen->cpp, - screen->depthOffset, screen->depthPitch); + = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, + NULL, + screen->cpp, + screen->depthOffset, + screen->depthPitch, + driDrawPriv); radeonSetSpanFunctions(stencilRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base); } @@ -717,7 +730,7 @@ radeonCreateBuffer(__DRIscreenPrivate * driScrnPriv, swAlpha, GL_FALSE /* aux */); driDrawPriv->driverPrivate = (void *) fb; -#endif + return (driDrawPriv->driverPrivate != NULL); } } diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index a95b3672fcc..1e731e575d9 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -477,8 +477,11 @@ radeonCreateBuffer( __DRIscreenPrivate *driScrnPriv, /* front color renderbuffer */ { driRenderbuffer *frontRb - = driNewRenderbuffer(GL_RGBA, screen->cpp, - screen->frontOffset, screen->frontPitch); + = driNewRenderbuffer(GL_RGBA, + driScrnPriv->pFB + screen->frontOffset, + screen->cpp, + screen->frontOffset, screen->frontPitch, + driDrawPriv); radeonSetSpanFunctions(frontRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base); } @@ -486,8 +489,11 @@ radeonCreateBuffer( __DRIscreenPrivate *driScrnPriv, /* back color renderbuffer */ if (mesaVis->doubleBufferMode) { driRenderbuffer *backRb - = driNewRenderbuffer(GL_RGBA, screen->cpp, - screen->backOffset, screen->backPitch); + = driNewRenderbuffer(GL_RGBA, + driScrnPriv->pFB + screen->backOffset, + screen->cpp, + screen->backOffset, screen->backPitch, + driDrawPriv); radeonSetSpanFunctions(backRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base); } @@ -495,16 +501,22 @@ radeonCreateBuffer( __DRIscreenPrivate *driScrnPriv, /* depth renderbuffer */ if (mesaVis->depthBits == 16) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp, - screen->depthOffset, screen->depthPitch); + = driNewRenderbuffer(GL_DEPTH_COMPONENT16, + driScrnPriv->pFB + screen->depthOffset, + screen->cpp, + screen->depthOffset, screen->depthPitch, + driDrawPriv); radeonSetSpanFunctions(depthRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); depthRb->depthHasSurface = screen->depthHasSurface; } else if (mesaVis->depthBits == 24) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp, - screen->depthOffset, screen->depthPitch); + = driNewRenderbuffer(GL_DEPTH_COMPONENT24, + driScrnPriv->pFB + screen->depthOffset, + screen->cpp, + screen->depthOffset, screen->depthPitch, + driDrawPriv); radeonSetSpanFunctions(depthRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); depthRb->depthHasSurface = screen->depthHasSurface; @@ -513,8 +525,11 @@ radeonCreateBuffer( __DRIscreenPrivate *driScrnPriv, /* stencil renderbuffer */ if (mesaVis->stencilBits > 0 && !swStencil) { driRenderbuffer *stencilRb - = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, screen->cpp, - screen->depthOffset, screen->depthPitch); + = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, + driScrnPriv->pFB + screen->depthOffset, + screen->cpp, + screen->depthOffset, screen->depthPitch, + driDrawPriv); radeonSetSpanFunctions(stencilRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base); stencilRb->depthHasSurface = screen->depthHasSurface; diff --git a/src/mesa/drivers/dri/s3v/s3v_xmesa.c b/src/mesa/drivers/dri/s3v/s3v_xmesa.c index 603c4168b50..533424cdeab 100644 --- a/src/mesa/drivers/dri/s3v/s3v_xmesa.c +++ b/src/mesa/drivers/dri/s3v/s3v_xmesa.c @@ -65,29 +65,22 @@ s3vCreateBuffer( __DRIscreenPrivate *driScrnPriv, return GL_FALSE; /* not implemented */ } else { -#if 0 - driDrawPriv->driverPrivate = (void *) - _mesa_create_framebuffer(mesaVis, - GL_FALSE, /* software depth buffer? */ - mesaVis->stencilBits > 0, - mesaVis->accumRedBits > 0, - mesaVis->alphaBits > 0 - ); -#else struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis); { driRenderbuffer *frontRb - = driNewRenderbuffer(GL_RGBA, screen->cpp, - screen->frontOffset, screen->frontPitch); + = driNewRenderbuffer(GL_RGBA, NULL, screen->cpp, + screen->frontOffset, screen->frontPitch, + driDrawPriv); s3vSetSpanFunctions(frontRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base); } if (mesaVis->doubleBufferMode) { driRenderbuffer *backRb - = driNewRenderbuffer(GL_RGBA, screen->cpp, - screen->backOffset, screen->backPitch); + = driNewRenderbuffer(GL_RGBA, NULL, screen->cpp, + screen->backOffset, screen->backPitch, + driDrawPriv); s3vSetSpanFunctions(backRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base); backRb->backBuffer = GL_TRUE; @@ -95,15 +88,17 @@ s3vCreateBuffer( __DRIscreenPrivate *driScrnPriv, if (mesaVis->depthBits == 16) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp, - screen->depthOffset, screen->depthPitch); + = driNewRenderbuffer(GL_DEPTH_COMPONENT16, NULL, screen->cpp, + screen->depthOffset, screen->depthPitch, + driDrawPriv); s3vSetSpanFunctions(depthRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); } else if (mesaVis->depthBits == 24) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp, - screen->depthOffset, screen->depthPitch); + = driNewRenderbuffer(GL_DEPTH_COMPONENT24, NULL, screen->cpp, + screen->depthOffset, screen->depthPitch, + driDrawPriv); s3vSetSpanFunctions(depthRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); } @@ -111,7 +106,9 @@ s3vCreateBuffer( __DRIscreenPrivate *driScrnPriv, /* no h/w stencil yet? if (mesaVis->stencilBits > 0) { driRenderbuffer *stencilRb - = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT); + = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, NULL, + screen->cpp, screen->depthOffset, + screen->depthPitch, driDrawPriv); s3vSetSpanFunctions(stencilRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base); } @@ -125,7 +122,7 @@ s3vCreateBuffer( __DRIscreenPrivate *driScrnPriv, GL_FALSE, /* alpha */ GL_FALSE /* aux */); driDrawPriv->driverPrivate = (void *) fb; -#endif + return (driDrawPriv->driverPrivate != NULL); } } diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c index 477564cad3b..2f93ae24500 100644 --- a/src/mesa/drivers/dri/savage/savage_xmesa.c +++ b/src/mesa/drivers/dri/savage/savage_xmesa.c @@ -611,15 +611,7 @@ savageCreateBuffer( __DRIscreenPrivate *driScrnPriv, return GL_FALSE; /* not implemented */ } else { - GLboolean swStencil = mesaVis->stencilBits > 0 && mesaVis->depthBits != 24; -#if 0 - driDrawPriv->driverPrivate = (void *) - _mesa_create_framebuffer(mesaVis, - GL_FALSE, /* software depth buffer? */ - swStencil, - mesaVis->accumRedBits > 0, - mesaVis->alphaBits > 0 ); -#else + GLboolean swStencil = mesaVis->stencilBits > 0 && mesaVis->depthBits != 24; struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis); /* * XXX: this value needs to be set according to the config file @@ -630,47 +622,59 @@ savageCreateBuffer( __DRIscreenPrivate *driScrnPriv, { driRenderbuffer *frontRb - = driNewRenderbuffer(GL_RGBA, screen->cpp, - screen->frontOffset, screen->aperturePitch); + = driNewRenderbuffer(GL_RGBA, + (GLubyte *) screen->aperture.map + + 0x01000000 * TARGET_FRONT, + screen->cpp, + screen->frontOffset, screen->aperturePitch, + driDrawPriv); savageSetSpanFunctions(frontRb, mesaVis, float_depth); _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base); - frontRb->Base.Data = frontRb->flippedData - = (GLubyte *) screen->aperture.map + 0x01000000 * TARGET_FRONT; } if (mesaVis->doubleBufferMode) { driRenderbuffer *backRb - = driNewRenderbuffer(GL_RGBA, screen->cpp, - screen->backOffset, screen->aperturePitch); + = driNewRenderbuffer(GL_RGBA, + (GLubyte *) screen->aperture.map + + 0x01000000 * TARGET_BACK, + screen->cpp, + screen->backOffset, screen->aperturePitch, + driDrawPriv); savageSetSpanFunctions(backRb, mesaVis, float_depth); _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base); - backRb->Base.Data = backRb->flippedData - = (GLubyte *) screen->aperture.map + 0x01000000 * TARGET_BACK; } if (mesaVis->depthBits == 16) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->zpp, - screen->depthOffset, screen->aperturePitch); + = driNewRenderbuffer(GL_DEPTH_COMPONENT16, + (GLubyte *) screen->aperture.map + + 0x01000000 * TARGET_DEPTH, + screen->zpp, + screen->depthOffset, screen->aperturePitch, + driDrawPriv); savageSetSpanFunctions(depthRb, mesaVis, float_depth); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); - depthRb->Base.Data = depthRb->flippedData - = (GLubyte *) screen->aperture.map + 0x01000000 * TARGET_DEPTH; } else if (mesaVis->depthBits == 24) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->zpp, - screen->depthOffset, screen->aperturePitch); + = driNewRenderbuffer(GL_DEPTH_COMPONENT24, + (GLubyte *) screen->aperture.map + + 0x01000000 * TARGET_DEPTH, + screen->zpp, + screen->depthOffset, screen->aperturePitch, + driDrawPriv); savageSetSpanFunctions(depthRb, mesaVis, float_depth); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); - depthRb->Base.Data = depthRb->flippedData - = (GLubyte *) screen->aperture.map + 0x01000000 * TARGET_DEPTH; } if (mesaVis->stencilBits > 0 && !swStencil) { driRenderbuffer *stencilRb - = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, screen->zpp, - screen->depthOffset, screen->aperturePitch); + = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, + (GLubyte *) screen->aperture.map + + 0x01000000 * TARGET_DEPTH, + screen->zpp, + screen->depthOffset, screen->aperturePitch, + driDrawPriv); savageSetSpanFunctions(stencilRb, mesaVis, float_depth); _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base); } @@ -683,8 +687,8 @@ savageCreateBuffer( __DRIscreenPrivate *driScrnPriv, GL_FALSE, /* alpha */ GL_FALSE /* aux */); driDrawPriv->driverPrivate = (void *) fb; -#endif - return (driDrawPriv->driverPrivate != NULL); + + return (driDrawPriv->driverPrivate != NULL); } } diff --git a/src/mesa/drivers/dri/sis/sis_screen.c b/src/mesa/drivers/dri/sis/sis_screen.c index dcbf62640b8..604ffda2dc4 100644 --- a/src/mesa/drivers/dri/sis/sis_screen.c +++ b/src/mesa/drivers/dri/sis/sis_screen.c @@ -215,38 +215,38 @@ sisCreateBuffer( __DRIscreenPrivate *driScrnPriv, /* XXX double-check the Offset/Pitch parameters! */ { driRenderbuffer *frontRb - = driNewRenderbuffer(GL_RGBA, screen->cpp, - 0, driScrnPriv->fbStride); + = driNewRenderbuffer(GL_RGBA, NULL, screen->cpp, + 0, driScrnPriv->fbStride, driDrawPriv); sisSetSpanFunctions(frontRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base); } if (mesaVis->doubleBufferMode) { driRenderbuffer *backRb - = driNewRenderbuffer(GL_RGBA, screen->cpp, - 0, driScrnPriv->fbStride); + = driNewRenderbuffer(GL_RGBA, NULL, screen->cpp, + 0, driScrnPriv->fbStride, driDrawPriv); sisSetSpanFunctions(backRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base); } if (mesaVis->depthBits == 16) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp, - 0, driScrnPriv->fbStride); + = driNewRenderbuffer(GL_DEPTH_COMPONENT16, NULL, screen->cpp, + 0, driScrnPriv->fbStride, driDrawPriv); sisSetSpanFunctions(depthRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); } else if (mesaVis->depthBits == 24) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp, - 0, driScrnPriv->fbStride); + = driNewRenderbuffer(GL_DEPTH_COMPONENT24, NULL, screen->cpp, + 0, driScrnPriv->fbStride, driDrawPriv); sisSetSpanFunctions(depthRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); } else if (mesaVis->depthBits == 32) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT32, screen->cpp, - 0, driScrnPriv->fbStride); + = driNewRenderbuffer(GL_DEPTH_COMPONENT32, NULL, screen->cpp, + 0, driScrnPriv->fbStride, driDrawPriv); sisSetSpanFunctions(depthRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); } diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c index ab64f7986de..0a4499cfae7 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c @@ -163,51 +163,47 @@ tdfxCreateBuffer( __DRIscreenPrivate *driScrnPriv, return GL_FALSE; /* not implemented */ } else { -#if 0 - driDrawPriv->driverPrivate = (void *) - _mesa_create_framebuffer( mesaVis, - GL_FALSE, /* software depth buffer? */ - mesaVis->stencilBits > 0, - mesaVis->accumRedBits > 0, - GL_FALSE /* software alpha channel? */ ); -#else struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis); { driRenderbuffer *frontRb - = driNewRenderbuffer(GL_RGBA, screen->cpp, - screen->fbOffset, screen->width); + = driNewRenderbuffer(GL_RGBA, NULL, screen->cpp, + screen->fbOffset, screen->width, driDrawPriv); tdfxSetSpanFunctions(frontRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base); } if (mesaVis->doubleBufferMode) { driRenderbuffer *backRb - = driNewRenderbuffer(GL_RGBA, screen->cpp, - screen->backOffset, screen->width); + = driNewRenderbuffer(GL_RGBA, NULL, screen->cpp, + screen->backOffset, screen->width, + driDrawPriv); tdfxSetSpanFunctions(backRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base); } if (mesaVis->depthBits == 16) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp, - screen->depthOffset, screen->width); + = driNewRenderbuffer(GL_DEPTH_COMPONENT16, NULL, screen->cpp, + screen->depthOffset, screen->width, + driDrawPriv); tdfxSetSpanFunctions(depthRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); } else if (mesaVis->depthBits == 24) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp, - screen->depthOffset, screen->width); + = driNewRenderbuffer(GL_DEPTH_COMPONENT24, NULL, screen->cpp, + screen->depthOffset, screen->width, + driDrawPriv); tdfxSetSpanFunctions(depthRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); } if (mesaVis->stencilBits > 0) { driRenderbuffer *stencilRb - = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, screen->cpp, - screen->depthOffset, screen->width); + = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, NULL, screen->cpp, + screen->depthOffset, screen->width, + driDrawPriv); tdfxSetSpanFunctions(stencilRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base); } @@ -220,7 +216,7 @@ tdfxCreateBuffer( __DRIscreenPrivate *driScrnPriv, GL_FALSE, /* alpha */ GL_FALSE /* aux */); driDrawPriv->driverPrivate = (void *) fb; -#endif + return (driDrawPriv->driverPrivate != NULL); } } diff --git a/src/mesa/drivers/dri/trident/trident_context.c b/src/mesa/drivers/dri/trident/trident_context.c index b44c6205c9c..f43c1e732c4 100644 --- a/src/mesa/drivers/dri/trident/trident_context.c +++ b/src/mesa/drivers/dri/trident/trident_context.c @@ -206,21 +206,13 @@ tridentCreateBuffer( __DRIscreenPrivate *driScrnPriv, return GL_FALSE; /* not implemented */ } else { -#if 0 - driDrawPriv->driverPrivate = (void *) - _mesa_create_framebuffer(mesaVis, - GL_FALSE, /* software depth buffer? */ - mesaVis->stencilBits > 0, - mesaVis->accumRedBits > 0, - mesaVis->alphaBits > 0 - ); -#else struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis); { driRenderbuffer *frontRb - = driNewRenderbuffer(GL_RGBA, screen->cpp, - screen->frontOffset, screen->frontPitch); + = driNewRenderbuffer(GL_RGBA, NULL, screen->cpp, + screen->frontOffset, screen->frontPitch, + driDrawPriv); /* tridentSetSpanFunctions(frontRb, mesaVis); */ @@ -229,8 +221,9 @@ tridentCreateBuffer( __DRIscreenPrivate *driScrnPriv, if (mesaVis->doubleBufferMode) { driRenderbuffer *backRb - = driNewRenderbuffer(GL_RGBA, screen->cpp, - screen->backOffset, screen->backPitch); + = driNewRenderbuffer(GL_RGBA, NULL, screen->cpp, + screen->backOffset, screen->backPitch, + driDrawPriv); /* tridentSetSpanFunctions(backRb, mesaVis); */ @@ -239,8 +232,9 @@ tridentCreateBuffer( __DRIscreenPrivate *driScrnPriv, if (mesaVis->depthBits == 16) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp, - screen->depthOffset, screen->depthPitch); + = driNewRenderbuffer(GL_DEPTH_COMPONENT16, NULL, screen->cpp, + screen->depthOffset, screen->depthPitch, + driDrawPriv); /* tridentSetSpanFunctions(depthRb, mesaVis); */ @@ -248,8 +242,9 @@ tridentCreateBuffer( __DRIscreenPrivate *driScrnPriv, } else if (mesaVis->depthBits == 24) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp, - screen->depthOffset, screen->depthPitch); + = driNewRenderbuffer(GL_DEPTH_COMPONENT24, NULL, screen->cpp, + screen->depthOffset, screen->depthPitch, + driDrawPriv); /* tridentSetSpanFunctions(depthRb, mesaVis); */ @@ -273,7 +268,7 @@ tridentCreateBuffer( __DRIscreenPrivate *driScrnPriv, GL_FALSE, /* alpha */ GL_FALSE /* aux */); driDrawPriv->driverPrivate = (void *) fb; -#endif + return (driDrawPriv->driverPrivate != NULL); } } diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index ddd360cc240..2f7f726a598 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -44,6 +44,7 @@ #include "via_dri.h" #include "GL/internal/dri_interface.h" +#include "drirenderbuffer.h" /* Radeon configuration */ @@ -240,49 +241,60 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv, */ #if 000 + /* This code _should_ be put to use. We have to move the + * viaRenderbuffer members out of the via_context structure. + * Those members should just be the renderbuffers hanging off the + * gl_framebuffer object. + */ /* XXX check/fix the offset/pitch parameters! */ { driRenderbuffer *frontRb - = driNewRenderbuffer(GL_RGBA, screen->bytesPerPixel, - 0, screen->width); + = driNewRenderbuffer(GL_RGBA, NULL, + screen->bytesPerPixel, + 0, screen->width, driDrawPriv); viaSetSpanFunctions(frontRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base); } if (mesaVis->doubleBufferMode) { driRenderbuffer *backRb - = driNewRenderbuffer(GL_RGBA, screen->bytesPerPixel, - 0, screen->width); + = driNewRenderbuffer(GL_RGBA, NULL, + screen->bytesPerPixel, + 0, screen->width, driDrawPriv); viaSetSpanFunctions(backRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base); } if (mesaVis->depthBits == 16) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->bytesPerPixel, - 0, screen->width); + = driNewRenderbuffer(GL_DEPTH_COMPONENT16, NULL, + screen->bytesPerPixel, + 0, screen->width, driDrawPriv); viaSetSpanFunctions(depthRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); } else if (mesaVis->depthBits == 24) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->bytesPerPixel, - 0, screen->width); + = driNewRenderbuffer(GL_DEPTH_COMPONENT24, NULL, + screen->bytesPerPixel, + 0, screen->width, driDrawPriv); viaSetSpanFunctions(depthRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); } else if (mesaVis->depthBits == 32) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT32, screen->bytesPerPixel, - 0, screen->width); + = driNewRenderbuffer(GL_DEPTH_COMPONENT32, NULL, + screen->bytesPerPixel, + 0, screen->width, driDrawPriv); viaSetSpanFunctions(depthRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); } if (mesaVis->stencilBits > 0 && !swStencil) { driRenderbuffer *stencilRb - = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, screen->bytesPerPixel, - 0, screen->width); + = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, NULL, + screen->bytesPerPixel, + 0, screen->width, driDrawPriv); viaSetSpanFunctions(stencilRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base); } |