[Mesa-dev] [PATCH 22/27] dri: Drop unused dri renderbuffer helper functions

Kristian Høgsberg krh at bitplanet.net
Fri Oct 28 15:11:52 PDT 2011


---
 src/gallium/state_trackers/dri/drm/Makefile   |    3 +-
 src/gallium/targets/Makefile.dri              |    3 +-
 src/mesa/drivers/dri/common/Makefile.sources  |    1 -
 src/mesa/drivers/dri/common/drirenderbuffer.c |  200 -------------------------
 src/mesa/drivers/dri/common/drirenderbuffer.h |   71 ---------
 5 files changed, 2 insertions(+), 276 deletions(-)
 delete mode 100644 src/mesa/drivers/dri/common/drirenderbuffer.c
 delete mode 100644 src/mesa/drivers/dri/common/drirenderbuffer.h

diff --git a/src/gallium/state_trackers/dri/drm/Makefile b/src/gallium/state_trackers/dri/drm/Makefile
index 695dc0c..54f1db3 100644
--- a/src/gallium/state_trackers/dri/drm/Makefile
+++ b/src/gallium/state_trackers/dri/drm/Makefile
@@ -24,7 +24,6 @@ C_SOURCES = \
 	$(TOP)/src/mesa/drivers/dri/common/dri_util.c \
 	$(TOP)/src/mesa/drivers/dri/common/xmlconfig.c \
 	$(TOP)/src/mesa/drivers/common/driverfuncs.c \
-	$(TOP)/src/mesa/drivers/dri/common/texmem.c \
-	$(TOP)/src/mesa/drivers/dri/common/drirenderbuffer.c
+	$(TOP)/src/mesa/drivers/dri/common/texmem.c
 
 include ../../../Makefile.template
diff --git a/src/gallium/targets/Makefile.dri b/src/gallium/targets/Makefile.dri
index a26b3ee..941122b 100644
--- a/src/gallium/targets/Makefile.dri
+++ b/src/gallium/targets/Makefile.dri
@@ -18,8 +18,7 @@ COMMON_GALLIUM_SOURCES = \
 
 COMMON_SOURCES = $(COMMON_GALLIUM_SOURCES) \
         $(TOP)/src/mesa/drivers/common/driverfuncs.c \
-        $(TOP)/src/mesa/drivers/dri/common/texmem.c \
-        $(TOP)/src/mesa/drivers/dri/common/drirenderbuffer.c
+        $(TOP)/src/mesa/drivers/dri/common/texmem.c
 
 COMMON_BM_SOURCES = \
 	$(TOP)/src/mesa/drivers/dri/common/dri_bufmgr.c \
diff --git a/src/mesa/drivers/dri/common/Makefile.sources b/src/mesa/drivers/dri/common/Makefile.sources
index f21bf86..5529e47 100644
--- a/src/mesa/drivers/dri/common/Makefile.sources
+++ b/src/mesa/drivers/dri/common/Makefile.sources
@@ -6,7 +6,6 @@ mesa_dri_common_gallium_SOURCES := \
 mesa_dri_common_SOURCES := \
 	$(mesa_dri_common_gallium_SOURCES) \
         texmem.c \
-        drirenderbuffer.c
 
 # Paths are relative to MESA_TOP.
 mesa_dri_common_INCLUDES := \
diff --git a/src/mesa/drivers/dri/common/drirenderbuffer.c b/src/mesa/drivers/dri/common/drirenderbuffer.c
deleted file mode 100644
index 7ac1ab1..0000000
--- a/src/mesa/drivers/dri/common/drirenderbuffer.c
+++ /dev/null
@@ -1,200 +0,0 @@
-
-#include "main/mtypes.h"
-#include "main/formats.h"
-#include "main/renderbuffer.h"
-#include "main/imports.h"
-#include "drirenderbuffer.h"
-
-
-/**
- * This will get called when a window (gl_framebuffer) is resized (probably
- * via driUpdateFramebufferSize(), below).
- * Just update width, height and internal format fields for now.
- * There's usually no memory allocation above because the present
- * DRI drivers use statically-allocated full-screen buffers. If that's not
- * the case for a DRI driver, a different AllocStorage method should
- * be used.
- */
-static GLboolean
-driRenderbufferStorage(struct gl_context *ctx, struct gl_renderbuffer *rb,
-                       GLenum internalFormat, GLuint width, GLuint height)
-{
-   rb->Width = width;
-   rb->Height = height;
-   rb->InternalFormat = internalFormat;
-   return GL_TRUE;
-}
-
-
-static void
-driDeleteRenderbuffer(struct gl_renderbuffer *rb)
-{
-   /* don't free rb->Data  Chances are it's a memory mapped region for
-    * the dri drivers.
-    */
-   free(rb);
-}
-
-
-/**
- * Allocate a new driRenderbuffer object.
- * Individual drivers are free to implement different versions of
- * this function.
- *
- * At this time, this function can only be used for window-system
- * renderbuffers, not user-created RBOs.
- *
- * \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(gl_format format, GLvoid *addr,
-                   GLint cpp, GLint offset, GLint pitch,
-                   __DRIdrawable *dPriv)
-{
-   driRenderbuffer *drb;
-
-   assert(cpp > 0);
-   assert(pitch > 0);
-
-   drb = calloc(1, sizeof(driRenderbuffer));
-   if (drb) {
-      const GLuint name = 0;
-
-      _mesa_init_renderbuffer(&drb->Base, name);
-
-      /* Make sure we're using a null-valued GetPointer routine */
-      assert(drb->Base.GetPointer(NULL, &drb->Base, 0, 0) == NULL);
-
-      switch (format) {
-      case MESA_FORMAT_ARGB8888:
-         if (cpp == 2) {
-            /* override format */
-            format = MESA_FORMAT_RGB565;
-         }
-         drb->Base.DataType = GL_UNSIGNED_BYTE;
-         break;
-      case MESA_FORMAT_Z16:
-         /* Depth */
-         /* we always Get/Put 32-bit Z values */
-         drb->Base.DataType = GL_UNSIGNED_INT;
-         assert(cpp == 2);
-         break;
-      case MESA_FORMAT_Z32:
-         /* Depth */
-         /* we always Get/Put 32-bit Z values */
-         drb->Base.DataType = GL_UNSIGNED_INT;
-         assert(cpp == 4);
-         break;
-      case MESA_FORMAT_Z24_S8:
-         drb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT;
-         assert(cpp == 4);
-         break;
-      case MESA_FORMAT_S8_Z24:
-         drb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT;
-         assert(cpp == 4);
-         break;
-      case MESA_FORMAT_S8:
-         /* Stencil */
-         drb->Base.DataType = GL_UNSIGNED_BYTE;
-         break;
-      default:
-         _mesa_problem(NULL, "Bad format 0x%x in driNewRenderbuffer", format);
-         return NULL;
-      }
-
-      drb->Base.Format = format;
-
-      drb->Base.InternalFormat =
-      drb->Base._BaseFormat = _mesa_get_format_base_format(format);
-
-      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;
-
-      /* may be changed if page flipping is active: */
-      drb->flippedOffset = offset;
-      drb->flippedPitch = pitch;
-      drb->flippedData = addr;
-   }
-   return drb;
-}
-
-
-/**
- * Update the front and back renderbuffers' flippedPitch/Offset/Data fields.
- * If stereo, flip both the left and right pairs.
- * This is used when we do double buffering via page flipping.
- * \param fb  the framebuffer we're page flipping
- * \param flipped  if true, set flipped values, else set non-flipped values
- */
-void
-driFlipRenderbuffers(struct gl_framebuffer *fb, GLboolean flipped)
-{
-   const GLuint count = fb->Visual.stereoMode ? 2 : 1;
-   GLuint lr; /* left or right */
-
-   /* we shouldn't really call this function if single-buffered, but
-    * play it safe.
-    */
-   if (!fb->Visual.doubleBufferMode)
-      return;
-
-   for (lr = 0; lr < count; lr++) {
-      GLuint frontBuf = (lr == 0) ? BUFFER_FRONT_LEFT : BUFFER_FRONT_RIGHT;
-      GLuint backBuf  = (lr == 0) ? BUFFER_BACK_LEFT  : BUFFER_BACK_RIGHT;
-      driRenderbuffer *front_drb
-         = (driRenderbuffer *) fb->Attachment[frontBuf].Renderbuffer;
-      driRenderbuffer *back_drb
-         = (driRenderbuffer *) fb->Attachment[backBuf].Renderbuffer;
-
-      if (flipped) {
-         front_drb->flippedOffset = back_drb->offset;
-         front_drb->flippedPitch  = back_drb->pitch;
-         front_drb->flippedData   = back_drb->Base.Data;
-         back_drb->flippedOffset  = front_drb->offset;
-         back_drb->flippedPitch   = front_drb->pitch;
-         back_drb->flippedData    = front_drb->Base.Data;
-      }
-      else {
-         front_drb->flippedOffset = front_drb->offset;
-         front_drb->flippedPitch  = front_drb->pitch;
-         front_drb->flippedData   = front_drb->Base.Data;
-         back_drb->flippedOffset  = back_drb->offset;
-         back_drb->flippedPitch   = back_drb->pitch;
-         back_drb->flippedData    = back_drb->Base.Data;
-      }
-   }
-}
-
-
-/**
- * Check that the gl_framebuffer associated with dPriv is the right size.
- * Resize the gl_framebuffer if needed.
- * It's expected that the dPriv->driverPrivate member points to a
- * gl_framebuffer object.
- */
-void
-driUpdateFramebufferSize(struct gl_context *ctx, const __DRIdrawable *dPriv)
-{
-   struct gl_framebuffer *fb = (struct gl_framebuffer *) dPriv->driverPrivate;
-   if (fb && (dPriv->w != fb->Width || dPriv->h != fb->Height)) {
-      ctx->Driver.ResizeBuffers(ctx, fb, dPriv->w, dPriv->h);
-      /* if the driver needs the hw lock for ResizeBuffers, the drawable
-         might have changed again by now */
-      assert(fb->Width == dPriv->w);
-      assert(fb->Height == dPriv->h);
-   }
-}
diff --git a/src/mesa/drivers/dri/common/drirenderbuffer.h b/src/mesa/drivers/dri/common/drirenderbuffer.h
deleted file mode 100644
index b9065b2..0000000
--- a/src/mesa/drivers/dri/common/drirenderbuffer.h
+++ /dev/null
@@ -1,71 +0,0 @@
-
-/**
- * A driRenderbuffer is dervied from gl_renderbuffer.
- * It describes a color buffer (front or back), a depth buffer, or stencil
- * buffer etc.
- * Specific to DRI drivers are the offset and pitch fields.
- */
-
-
-#ifndef DRIRENDERBUFFER_H
-#define DRIRENDERBUFFER_H
-
-#include "main/mtypes.h"
-#include "main/formats.h"
-#include "dri_util.h"
-
-
-typedef struct {
-   struct gl_renderbuffer Base;
-
-   /* Chars or bytes per pixel.  If Z and Stencil are stored together this
-    * will typically be 32 whether this a depth or stencil renderbuffer.
-    */
-   GLint cpp;
-
-   /* Buffer position and pitch (row stride).  Recall that for today's DRI
-    * drivers, we have statically allocated color/depth/stencil buffers.
-    * So this information describes the whole screen, not just a window.
-    * To address pixels in a window, we need to know the window's position
-    * and size with respect to the screen.
-    */
-   GLint offset;  /* in bytes */
-   GLint pitch;   /* in pixels */
-
-   /* If the driver can do page flipping (full-screen double buffering)
-    * the current front/back buffers may get swapped.
-    * If page flipping is disabled, these  fields will be identical to
-    * the offset/pitch/Data above.
-    * If page flipping is enabled, and this is the front(back) renderbuffer,
-    * flippedOffset/Pitch/Data will have the back(front) renderbuffer's values.
-    */
-   GLint flippedOffset;
-   GLint flippedPitch;
-   GLvoid *flippedData;  /* mmap'd address of buffer memory, if used */
-
-   /* Pointer to corresponding __DRIdrawable.  This is used to compute
-    * the window's position within the framebuffer.
-    */
-   __DRIdrawable *dPriv;
-
-   /* XXX this is for radeon/r200 only.  We should really create a new
-    * r200Renderbuffer class, derived from this class...  not a huge deal.
-    */
-   GLboolean depthHasSurface;
-} driRenderbuffer;
-
-
-extern driRenderbuffer *
-driNewRenderbuffer(gl_format format, GLvoid *addr,
-                   GLint cpp, GLint offset, GLint pitch,
-                   __DRIdrawable *dPriv);
-
-extern void
-driFlipRenderbuffers(struct gl_framebuffer *fb, GLboolean flipped);
-
-
-extern void
-driUpdateFramebufferSize(struct gl_context *ctx, const __DRIdrawable *dPriv);
-
-
-#endif /* DRIRENDERBUFFER_H */
-- 
1.7.7



More information about the mesa-dev mailing list