summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/radeon
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri/radeon')
-rw-r--r--src/mesa/drivers/dri/radeon/Makefile1
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_context.c13
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_ioctl.c16
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_lock.c4
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_screen.c63
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_screen.h3
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_span.c65
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_span.h4
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_state.c6
9 files changed, 148 insertions, 27 deletions
diff --git a/src/mesa/drivers/dri/radeon/Makefile b/src/mesa/drivers/dri/radeon/Makefile
index b9f9186f59..af5f203f3c 100644
--- a/src/mesa/drivers/dri/radeon/Makefile
+++ b/src/mesa/drivers/dri/radeon/Makefile
@@ -16,6 +16,7 @@ COMMON_SOURCES = \
../common/vblank.c \
../common/xmlconfig.c \
../common/dri_util.c \
+ ../common/drirenderbuffer.c \
../common/glcontextmodes.c
DRIVER_SOURCES = \
diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c
index 037ea0f003..60eecc741c 100644
--- a/src/mesa/drivers/dri/radeon/radeon_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_context.c
@@ -42,6 +42,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "imports.h"
#include "matrix.h"
#include "extensions.h"
+#include "framebuffer.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
@@ -182,7 +183,7 @@ static const struct tnl_pipeline_stage *radeon_pipeline[] = {
static void radeonInitDriverFuncs( struct dd_function_table *functions )
{
functions->GetBufferSize = radeonGetBufferSize;
- functions->ResizeBuffers = _swrast_alloc_buffers;
+ functions->ResizeBuffers = _mesa_resize_framebuffer;
functions->GetString = radeonGetString;
}
@@ -491,7 +492,7 @@ void radeonDestroyContext( __DRIcontextPrivate *driContextPriv )
/* check if we're deleting the currently bound context */
if (rmesa == current) {
RADEON_FIREVERTICES( rmesa );
- _mesa_make_current2(NULL, NULL, NULL);
+ _mesa_make_current(NULL, NULL, NULL);
}
/* Free radeon context resources */
@@ -603,9 +604,9 @@ radeonMakeCurrent( __DRIcontextPrivate *driContextPriv,
radeonUpdateViewportOffset( newCtx->glCtx );
}
- _mesa_make_current2( newCtx->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate );
+ _mesa_make_current( newCtx->glCtx,
+ (GLframebuffer *) driDrawPriv->driverPrivate,
+ (GLframebuffer *) driReadPriv->driverPrivate );
if (newCtx->vb.enabled)
radeonVtxfmtMakeCurrent( newCtx->glCtx );
@@ -613,7 +614,7 @@ radeonMakeCurrent( __DRIcontextPrivate *driContextPriv,
} else {
if (RADEON_DEBUG & DEBUG_DRI)
fprintf(stderr, "%s ctx is null\n", __FUNCTION__);
- _mesa_make_current( NULL, NULL );
+ _mesa_make_current( NULL, NULL, NULL );
}
if (RADEON_DEBUG & DEBUG_DRI)
diff --git a/src/mesa/drivers/dri/radeon/radeon_ioctl.c b/src/mesa/drivers/dri/radeon/radeon_ioctl.c
index cf7e9a8b27..3e1fc4baff 100644
--- a/src/mesa/drivers/dri/radeon/radeon_ioctl.c
+++ b/src/mesa/drivers/dri/radeon/radeon_ioctl.c
@@ -1048,26 +1048,26 @@ static void radeonClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
radeonFlush( ctx );
- if ( mask & DD_FRONT_LEFT_BIT ) {
+ if ( mask & BUFFER_BIT_FRONT_LEFT ) {
flags |= RADEON_FRONT;
color_mask = rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK];
- mask &= ~DD_FRONT_LEFT_BIT;
+ mask &= ~BUFFER_BIT_FRONT_LEFT;
}
- if ( mask & DD_BACK_LEFT_BIT ) {
+ if ( mask & BUFFER_BIT_BACK_LEFT ) {
flags |= RADEON_BACK;
color_mask = rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK];
- mask &= ~DD_BACK_LEFT_BIT;
+ mask &= ~BUFFER_BIT_BACK_LEFT;
}
- if ( mask & DD_DEPTH_BIT ) {
+ if ( mask & BUFFER_BIT_DEPTH ) {
flags |= RADEON_DEPTH;
- mask &= ~DD_DEPTH_BIT;
+ mask &= ~BUFFER_BIT_DEPTH;
}
- if ( (mask & DD_STENCIL_BIT) && rmesa->state.stencil.hwBuffer ) {
+ if ( (mask & BUFFER_BIT_STENCIL) && rmesa->state.stencil.hwBuffer ) {
flags |= RADEON_STENCIL;
- mask &= ~DD_STENCIL_BIT;
+ mask &= ~BUFFER_BIT_STENCIL;
}
if ( mask ) {
diff --git a/src/mesa/drivers/dri/radeon/radeon_lock.c b/src/mesa/drivers/dri/radeon/radeon_lock.c
index 7dab02e6b5..bb121fc587 100644
--- a/src/mesa/drivers/dri/radeon/radeon_lock.c
+++ b/src/mesa/drivers/dri/radeon/radeon_lock.c
@@ -56,7 +56,7 @@ radeonUpdatePageFlipping( radeonContextPtr rmesa )
rmesa->doPageFlip = rmesa->sarea->pfState;
- use_back = (rmesa->glCtx->Color._DrawDestMask[0] == DD_BACK_LEFT_BIT);
+ use_back = (rmesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT);
use_back ^= (rmesa->sarea->pfCurrentPage == 1);
if ( RADEON_DEBUG & DEBUG_VERBOSE )
@@ -108,7 +108,7 @@ void radeonGetLock( radeonContextPtr rmesa, GLuint flags )
if ( rmesa->lastStamp != dPriv->lastStamp ) {
radeonUpdatePageFlipping( rmesa );
- if (rmesa->glCtx->Color._DrawDestMask[0] == DD_BACK_LEFT_BIT)
+ if (rmesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT)
radeonSetCliprects( rmesa, GL_BACK_LEFT );
else
radeonSetCliprects( rmesa, GL_FRONT_LEFT );
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c
index cfba884638..edc9244366 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
@@ -38,15 +38,20 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "glheader.h"
#include "imports.h"
+#include "mtypes.h"
+#include "framebuffer.h"
+#include "renderbuffer.h"
#define STANDALONE_MMIO
#include "radeon_context.h"
#include "radeon_screen.h"
#include "radeon_macros.h"
+#include "radeon_span.h"
#include "utils.h"
#include "context.h"
#include "vblank.h"
+#include "drirenderbuffer.h"
#include "GL/internal/dri_interface.h"
@@ -451,10 +456,8 @@ radeonInitDriver( __DRIscreenPrivate *sPriv )
}
-
/**
- * Create and initialize the Mesa and driver specific pixmap buffer
- * data.
+ * Create the Mesa framebuffer and renderbuffers for a given window/drawable.
*
* \todo This function (and its interface) will need to be updated to support
* pbuffers.
@@ -465,6 +468,8 @@ radeonCreateBuffer( __DRIscreenPrivate *driScrnPriv,
const __GLcontextModes *mesaVis,
GLboolean isPixmap )
{
+ radeonScreenPtr screen = (radeonScreenPtr) driScrnPriv->private;
+
if (isPixmap) {
return GL_FALSE; /* not implemented */
}
@@ -474,12 +479,64 @@ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ radeonSetSpanFunctions(stencilRb, mesaVis);
+ _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base);
+ }
+
+ _mesa_add_soft_renderbuffers(fb,
+ GL_FALSE, /* color */
+ swDepth,
+ swStencil,
+ swAccum,
+ swAlpha,
+ GL_FALSE /* aux */);
+ driDrawPriv->driverPrivate = (void *) fb;
+#endif
return (driDrawPriv->driverPrivate != NULL);
}
}
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.h b/src/mesa/drivers/dri/radeon/radeon_screen.h
index b7ad8c0769..b9cbeaac33 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.h
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.h
@@ -100,7 +100,4 @@ typedef struct {
driOptionCache optionCache;
} radeonScreenRec, *radeonScreenPtr;
-extern radeonScreenPtr radeonCreateScreen( __DRIscreenPrivate *sPriv );
-extern void radeonDestroyScreen( __DRIscreenPrivate *sPriv );
-
#endif /* __RADEON_SCREEN_H__ */
diff --git a/src/mesa/drivers/dri/radeon/radeon_span.c b/src/mesa/drivers/dri/radeon/radeon_span.c
index 38ba5a50e5..9315543c15 100644
--- a/src/mesa/drivers/dri/radeon/radeon_span.c
+++ b/src/mesa/drivers/dri/radeon/radeon_span.c
@@ -313,7 +313,7 @@ static void radeonSetBuffer( GLcontext *ctx,
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
switch ( bufferBit ) {
- case DD_FRONT_LEFT_BIT:
+ case BUFFER_BIT_FRONT_LEFT:
if ( rmesa->sarea->pfCurrentPage == 1 ) {
rmesa->state.pixel.readOffset = rmesa->radeonScreen->backOffset;
rmesa->state.pixel.readPitch = rmesa->radeonScreen->backPitch;
@@ -326,7 +326,7 @@ static void radeonSetBuffer( GLcontext *ctx,
rmesa->state.color.drawPitch = rmesa->radeonScreen->frontPitch;
}
break;
- case DD_BACK_LEFT_BIT:
+ case BUFFER_BIT_BACK_LEFT:
if ( rmesa->sarea->pfCurrentPage == 1 ) {
rmesa->state.pixel.readOffset = rmesa->radeonScreen->frontOffset;
rmesa->state.pixel.readPitch = rmesa->radeonScreen->frontPitch;
@@ -375,6 +375,7 @@ void radeonInitSpanFuncs( GLcontext *ctx )
switch ( rmesa->radeonScreen->cpp ) {
case 2:
+#if 0
swdd->WriteRGBASpan = radeonWriteRGBASpan_RGB565;
swdd->WriteRGBSpan = radeonWriteRGBSpan_RGB565;
swdd->WriteMonoRGBASpan = radeonWriteMonoRGBASpan_RGB565;
@@ -382,9 +383,11 @@ void radeonInitSpanFuncs( GLcontext *ctx )
swdd->WriteMonoRGBAPixels = radeonWriteMonoRGBAPixels_RGB565;
swdd->ReadRGBASpan = radeonReadRGBASpan_RGB565;
swdd->ReadRGBAPixels = radeonReadRGBAPixels_RGB565;
+#endif
break;
case 4:
+#if 0
swdd->WriteRGBASpan = radeonWriteRGBASpan_ARGB8888;
swdd->WriteRGBSpan = radeonWriteRGBSpan_ARGB8888;
swdd->WriteMonoRGBASpan = radeonWriteMonoRGBASpan_ARGB8888;
@@ -392,6 +395,7 @@ void radeonInitSpanFuncs( GLcontext *ctx )
swdd->WriteMonoRGBAPixels = radeonWriteMonoRGBAPixels_ARGB8888;
swdd->ReadRGBASpan = radeonReadRGBASpan_ARGB8888;
swdd->ReadRGBAPixels = radeonReadRGBAPixels_ARGB8888;
+#endif
break;
default:
@@ -400,13 +404,16 @@ void radeonInitSpanFuncs( GLcontext *ctx )
switch ( rmesa->glCtx->Visual.depthBits ) {
case 16:
+#if 0
swdd->ReadDepthSpan = radeonReadDepthSpan_16;
swdd->WriteDepthSpan = radeonWriteDepthSpan_16;
swdd->ReadDepthPixels = radeonReadDepthPixels_16;
swdd->WriteDepthPixels = radeonWriteDepthPixels_16;
+#endif
break;
case 24:
+#if 0
swdd->ReadDepthSpan = radeonReadDepthSpan_24_8;
swdd->WriteDepthSpan = radeonWriteDepthSpan_24_8;
swdd->ReadDepthPixels = radeonReadDepthPixels_24_8;
@@ -416,6 +423,7 @@ void radeonInitSpanFuncs( GLcontext *ctx )
swdd->WriteStencilSpan = radeonWriteStencilSpan_24_8;
swdd->ReadStencilPixels = radeonReadStencilPixels_24_8;
swdd->WriteStencilPixels = radeonWriteStencilPixels_24_8;
+#endif
break;
default:
@@ -425,3 +433,56 @@ void radeonInitSpanFuncs( GLcontext *ctx )
swdd->SpanRenderStart = radeonSpanRenderStart;
swdd->SpanRenderFinish = radeonSpanRenderFinish;
}
+
+
+/**
+ * Plug in the Get/Put routines for the given driRenderbuffer.
+ */
+void
+radeonSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
+{
+ if (drb->Base.InternalFormat == GL_RGBA) {
+ if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
+ drb->Base.GetRow = radeonReadRGBASpan_RGB565;
+ drb->Base.GetValues = radeonReadRGBAPixels_RGB565;
+ drb->Base.PutRow = radeonWriteRGBASpan_RGB565;
+ drb->Base.PutRowRGB = radeonWriteRGBSpan_RGB565;
+ drb->Base.PutMonoRow = radeonWriteMonoRGBASpan_RGB565;
+ drb->Base.PutValues = radeonWriteRGBAPixels_RGB565;
+ drb->Base.PutMonoValues = radeonWriteMonoRGBAPixels_RGB565;
+ }
+ else {
+ drb->Base.GetRow = radeonReadRGBASpan_ARGB8888;
+ drb->Base.GetValues = radeonReadRGBAPixels_ARGB8888;
+ drb->Base.PutRow = radeonWriteRGBASpan_ARGB8888;
+ drb->Base.PutRowRGB = radeonWriteRGBSpan_ARGB8888;
+ drb->Base.PutMonoRow = radeonWriteMonoRGBASpan_ARGB8888;
+ drb->Base.PutValues = radeonWriteRGBAPixels_ARGB8888;
+ drb->Base.PutMonoValues = radeonWriteMonoRGBAPixels_ARGB8888;
+ }
+ }
+ else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
+ drb->Base.GetRow = radeonReadDepthSpan_16;
+ drb->Base.GetValues = radeonReadDepthPixels_16;
+ drb->Base.PutRow = radeonWriteDepthSpan_16;
+ drb->Base.PutMonoRow = radeonWriteMonoDepthSpan_16;
+ drb->Base.PutValues = radeonWriteDepthPixels_16;
+ drb->Base.PutMonoValues = NULL;
+ }
+ else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
+ drb->Base.GetRow = radeonReadDepthSpan_24_8;
+ drb->Base.GetValues = radeonReadDepthPixels_24_8;
+ drb->Base.PutRow = radeonWriteDepthSpan_24_8;
+ drb->Base.PutMonoRow = radeonWriteMonoDepthSpan_24_8;
+ drb->Base.PutValues = radeonWriteDepthPixels_24_8;
+ drb->Base.PutMonoValues = NULL;
+ }
+ else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
+ drb->Base.GetRow = radeonReadStencilSpan_24_8;
+ drb->Base.GetValues = radeonReadStencilPixels_24_8;
+ drb->Base.PutRow = radeonWriteStencilSpan_24_8;
+ drb->Base.PutMonoRow = radeonWriteMonoStencilSpan_24_8;
+ drb->Base.PutValues = radeonWriteStencilPixels_24_8;
+ drb->Base.PutMonoValues = NULL;
+ }
+}
diff --git a/src/mesa/drivers/dri/radeon/radeon_span.h b/src/mesa/drivers/dri/radeon/radeon_span.h
index 097af4b1bf..13b308e1c4 100644
--- a/src/mesa/drivers/dri/radeon/radeon_span.h
+++ b/src/mesa/drivers/dri/radeon/radeon_span.h
@@ -37,6 +37,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef __RADEON_SPAN_H__
#define __RADEON_SPAN_H__
+#include "drirenderbuffer.h"
+
extern void radeonInitSpanFuncs( GLcontext *ctx );
+extern void radeonSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis);
+
#endif
diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c
index 532458ebf4..3a491f5ded 100644
--- a/src/mesa/drivers/dri/radeon/radeon_state.c
+++ b/src/mesa/drivers/dri/radeon/radeon_state.c
@@ -1661,12 +1661,12 @@ static void radeonDrawBuffer( GLcontext *ctx, GLenum mode )
/*
* _DrawDestMask is easier to cope with than <mode>.
*/
- switch ( ctx->Color._DrawDestMask[0] ) {
- case DD_FRONT_LEFT_BIT:
+ switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
+ case BUFFER_BIT_FRONT_LEFT:
FALLBACK( rmesa, RADEON_FALLBACK_DRAW_BUFFER, GL_FALSE );
radeonSetCliprects( rmesa, GL_FRONT_LEFT );
break;
- case DD_BACK_LEFT_BIT:
+ case BUFFER_BIT_BACK_LEFT:
FALLBACK( rmesa, RADEON_FALLBACK_DRAW_BUFFER, GL_FALSE );
radeonSetCliprects( rmesa, GL_BACK_LEFT );
break;