dri: Drop unused dri renderbuffer helper functions

This commit is contained in:
Kristian Høgsberg 2011-10-28 16:51:11 -04:00
parent c467db4cc7
commit a14bb89d3f
7 changed files with 3 additions and 259 deletions

View file

@ -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

View file

@ -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 \

View file

@ -5,8 +5,7 @@ mesa_dri_common_gallium_SOURCES := \
mesa_dri_common_SOURCES := \
$(mesa_dri_common_gallium_SOURCES) \
texmem.c \
drirenderbuffer.c
texmem.c
# Paths are relative to MESA_TOP.
mesa_dri_common_INCLUDES := \

View file

@ -1,180 +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;
}
}
}

View file

@ -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 */

View file

@ -54,7 +54,6 @@
#include "intel_bufmgr.h"
#include "intel_screen.h"
#include "drirenderbuffer.h"
#include "utils.h"
#include "../glsl/ralloc.h"

View file

@ -35,7 +35,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "radeon_common.h"
#include "xmlpool.h" /* for symbolic values of enum-type options */
#include "utils.h"
#include "drirenderbuffer.h"
#include "drivers/common/meta.h"
#include "main/context.h"
#include "main/framebuffer.h"