Add new void *addr and __DRIdrawablePrivate parameters to
authorBrian Paul <brian.paul@tungstengraphics.com>
Sun, 4 Sep 2005 22:13:42 +0000 (22:13 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Sun, 4 Sep 2005 22:13:42 +0000 (22:13 +0000)
driNewRenderbuffer().

20 files changed:
src/mesa/drivers/dri/common/drirenderbuffer.c
src/mesa/drivers/dri/common/drirenderbuffer.h
src/mesa/drivers/dri/fb/fb_dri.c
src/mesa/drivers/dri/fb/fb_egl.c
src/mesa/drivers/dri/ffb/ffb_xmesa.c
src/mesa/drivers/dri/i810/i810screen.c
src/mesa/drivers/dri/i830/i830_screen.c
src/mesa/drivers/dri/i915/intel_screen.c
src/mesa/drivers/dri/mach64/mach64_screen.c
src/mesa/drivers/dri/mga/mga_xmesa.c
src/mesa/drivers/dri/r128/r128_screen.c
src/mesa/drivers/dri/r200/r200_screen.c
src/mesa/drivers/dri/r300/radeon_screen.c
src/mesa/drivers/dri/radeon/radeon_screen.c
src/mesa/drivers/dri/s3v/s3v_xmesa.c
src/mesa/drivers/dri/savage/savage_xmesa.c
src/mesa/drivers/dri/sis/sis_screen.c
src/mesa/drivers/dri/tdfx/tdfx_screen.c
src/mesa/drivers/dri/trident/trident_context.c
src/mesa/drivers/dri/unichrome/via_screen.c

index 817cb86c524cdc54941f76ae226f5dcca0cfb951..df0d27302cc0bd235d58671f05f697c5b101a2a3 100644 (file)
@@ -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;
 }
index bd07bc790f21dbba89a66578196837eee80f7977..f2cc357ff9e5e451855b6050673017f6909df4dc 100644 (file)
@@ -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);
index 1ef043e1991cf62d97d41573416b9855b0cc370c..c1fab2d586772b6e38c4925e9ec6b78bf68bf872 100644 (file)
@@ -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);
       }
index 1b91919ec99c226de1aac14f01a1bd75eb6bdb43..94ff9cbb6225c17e2215d96b52c4ac90129c71a5 100644 (file)
@@ -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);
    }
index 29aab4acba76d6fd267a491935d61045355303f9..baf4885a3be31ccb8ac1d11db80636caf7e80f88 100644 (file)
@@ -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);
       }
index af8e0cc08ab0c22da61598ac50ee737d02fe43d9..005d11a9b1eea9e25a9a463695e5943dab46ef7a 100644 (file)
@@ -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);
    }
 }
index 25def0b6fec9ac9f3ccf333be61e46cadcd366c0..591552270af99bb44f9c45767598697fae0769b0 100644 (file)
@@ -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);
    }
index 27faf6ba127301a209aa7c933ecaf6cf1ca597f3..98b9b2ee6b6887835d603bb88c33b34573529f32 100644 (file)
@@ -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,
index 62b1bc2ba527fc7b722791f22f53f9a0013280c4..6d148d3288ab4045cf6a6fc9b756411965fce735 100644 (file)
@@ -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);
       }
index 3e7db69c2d22d9008ba20fd3e169f7191a95c11c..ff8ccbf480012771581f760e95c207c35cf4e3ce 100644 (file)
@@ -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);
       }
index 442eb6b9ecf54b1ce5c5d095d2813086417aa884..5d1b6e42d6f333b5b55c204d58dedf1c7fa2ebfe 100644 (file)
@@ -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);
       }
index a8dacaf5d8d4c8137b2c9ea9b1e731a654ed384c..a6f5059baa0cf3db9eaae1c00f5efd78f54da932 100644 (file)
@@ -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;
index 03c30f82973bbdcad76c72da4f52ef91a770699c..eb6100c62715f055e0dea2fd6b478f78926a9d5e 100644 (file)
@@ -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);
        }
 }
index a95b3672fcc9d2f82a32f864295a429afca9ecb0..1e731e575d9945a97ce592558a5185e302c89256 100644 (file)
@@ -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;
index 603c4168b503d33d8bc517184a83f252dfdaf305..533424cdeab26f57f82c657bcac3e9fdc0c08a3f 100644 (file)
@@ -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);
    }
 }
index 477564cad3b13f427cda9fe108951c317439d4e5..2f93ae245000e231c568c232cf806a92fb51d3e8 100644 (file)
@@ -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);
    }
 }
 
index dcbf62640b8952e9d27d6dfa987dc371aeee01ae..604ffda2dc49a5ba76ac3ebea94bae64d6313c92 100644 (file)
@@ -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);
       }
index ab64f7986de58fab4b1d3a75c6671d031080d760..0a4499cfae7bcbb03811d44f2f0e76dd85cf0007 100644 (file)
@@ -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);
    }
 }
index b44c6205c9c5169d54d7792586ca45711305de72..f43c1e732c45db3b019440aa9d255cfd82a700a2 100644 (file)
@@ -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);
    }
 }
index ddd360cc240d6885a4f6b23de28f58ee50c36132..2f7f726a598a4efd0084541193a2c356bbd2d1ce 100644 (file)
@@ -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);
       }