summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/unichrome
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri/unichrome')
-rw-r--r--src/mesa/drivers/dri/unichrome/via_context.c26
-rw-r--r--src/mesa/drivers/dri/unichrome/via_context.h2
-rw-r--r--src/mesa/drivers/dri/unichrome/via_ioctl.c20
-rw-r--r--src/mesa/drivers/dri/unichrome/via_screen.c68
-rw-r--r--src/mesa/drivers/dri/unichrome/via_screen.h1
-rw-r--r--src/mesa/drivers/dri/unichrome/via_span.c64
-rw-r--r--src/mesa/drivers/dri/unichrome/via_span.h5
7 files changed, 160 insertions, 26 deletions
diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c
index 6d11502504..8bbcaccf69 100644
--- a/src/mesa/drivers/dri/unichrome/via_context.c
+++ b/src/mesa/drivers/dri/unichrome/via_context.c
@@ -36,6 +36,7 @@
#include "state.h"
#include "simple_list.h"
#include "extensions.h"
+#include "framebuffer.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
@@ -220,12 +221,17 @@ calculate_buffer_parameters( struct via_context *vmesa )
}
-void viaReAllocateBuffers(GLframebuffer *drawbuffer)
+void viaReAllocateBuffers(GLcontext *ctx, GLframebuffer *drawbuffer,
+ GLuint width, GLuint height)
{
- GET_CURRENT_CONTEXT(ctx);
struct via_context *vmesa = VIA_CONTEXT(ctx);
+#if 0
_swrast_alloc_buffers( drawbuffer );
+#else
+ _mesa_resize_framebuffer(ctx, drawbuffer, width, height);
+#endif
+
calculate_buffer_parameters( vmesa );
}
@@ -581,7 +587,7 @@ viaDestroyContext(__DRIcontextPrivate *driContextPriv)
/* check if we're deleting the currently bound context */
if (vmesa == current) {
VIA_FLUSH_DMA(vmesa);
- _mesa_make_current2(NULL, NULL, NULL);
+ _mesa_make_current(NULL, NULL, NULL);
}
if (vmesa) {
@@ -622,8 +628,8 @@ void viaXMesaWindowMoved(struct via_context *vmesa)
if (!dPriv)
return;
- switch (vmesa->glCtx->Color._DrawDestMask[0]) {
- case DD_FRONT_LEFT_BIT:
+ switch (vmesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0]) {
+ case BUFFER_BIT_FRONT_LEFT:
if (dPriv->numBackClipRects == 0) {
vmesa->numClipRects = dPriv->numClipRects;
vmesa->pClipRects = dPriv->pClipRects;
@@ -633,7 +639,7 @@ void viaXMesaWindowMoved(struct via_context *vmesa)
vmesa->pClipRects = dPriv->pBackClipRects;
}
break;
- case DD_BACK_LEFT_BIT:
+ case BUFFER_BIT_BACK_LEFT:
vmesa->numClipRects = dPriv->numClipRects;
vmesa->pClipRects = dPriv->pClipRects;
break;
@@ -700,9 +706,9 @@ viaMakeCurrent(__DRIcontextPrivate *driContextPriv,
ctx->Driver.DrawBuffer( ctx, ctx->Color.DrawBuffer[0] );
}
- _mesa_make_current2(vmesa->glCtx,
- (GLframebuffer *)driDrawPriv->driverPrivate,
- (GLframebuffer *)driReadPriv->driverPrivate);
+ _mesa_make_current(vmesa->glCtx,
+ (GLframebuffer *)driDrawPriv->driverPrivate,
+ (GLframebuffer *)driReadPriv->driverPrivate);
viaXMesaWindowMoved(vmesa);
ctx->Driver.Scissor(vmesa->glCtx,
@@ -712,7 +718,7 @@ viaMakeCurrent(__DRIcontextPrivate *driContextPriv,
vmesa->glCtx->Scissor.Height);
}
else {
- _mesa_make_current(0,0);
+ _mesa_make_current(NULL, NULL, NULL);
}
return GL_TRUE;
diff --git a/src/mesa/drivers/dri/unichrome/via_context.h b/src/mesa/drivers/dri/unichrome/via_context.h
index 9db382d49c..c1de1df8a9 100644
--- a/src/mesa/drivers/dri/unichrome/via_context.h
+++ b/src/mesa/drivers/dri/unichrome/via_context.h
@@ -386,7 +386,7 @@ extern void viaEmitHwStateLocked(struct via_context *vmesa);
extern void viaEmitScissorValues(struct via_context *vmesa, int box_nr, int emit);
extern void viaXMesaSetBackClipRects(struct via_context *vmesa);
extern void viaXMesaSetFrontClipRects(struct via_context *vmesa);
-extern void viaReAllocateBuffers(GLframebuffer *drawbuffer);
+extern void viaReAllocateBuffers(GLcontext *ctx, GLframebuffer *drawbuffer, GLuint width, GLuint height);
extern void viaXMesaWindowMoved(struct via_context *vmesa);
extern GLboolean viaTexCombineState(struct via_context *vmesa,
diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.c b/src/mesa/drivers/dri/unichrome/via_ioctl.c
index b9997be1ef..651c5f6e31 100644
--- a/src/mesa/drivers/dri/unichrome/via_ioctl.c
+++ b/src/mesa/drivers/dri/unichrome/via_ioctl.c
@@ -214,31 +214,31 @@ static void viaClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
VIA_FLUSH_DMA(vmesa);
- if (mask & DD_FRONT_LEFT_BIT) {
+ if (mask & BUFFER_BIT_FRONT_LEFT) {
flag |= VIA_FRONT;
- mask &= ~DD_FRONT_LEFT_BIT;
+ mask &= ~BUFFER_BIT_FRONT_LEFT;
}
- if (mask & DD_BACK_LEFT_BIT) {
+ if (mask & BUFFER_BIT_BACK_LEFT) {
flag |= VIA_BACK;
- mask &= ~DD_BACK_LEFT_BIT;
+ mask &= ~BUFFER_BIT_BACK_LEFT;
}
- if (mask & DD_DEPTH_BIT) {
+ if (mask & BUFFER_BIT_DEPTH) {
flag |= VIA_DEPTH;
clear_depth = (GLuint)(ctx->Depth.Clear * vmesa->ClearDepth);
clear_depth_mask &= ~vmesa->depth_clear_mask;
- mask &= ~DD_DEPTH_BIT;
+ mask &= ~BUFFER_BIT_DEPTH;
}
- if (mask & DD_STENCIL_BIT) {
+ if (mask & BUFFER_BIT_STENCIL) {
if (vmesa->have_hw_stencil) {
if (ctx->Stencil.WriteMask[0] == 0xff) {
flag |= VIA_DEPTH;
clear_depth &= ~0xff;
clear_depth |= (ctx->Stencil.Clear & 0xff);
clear_depth_mask &= ~vmesa->stencil_clear_mask;
- mask &= ~DD_STENCIL_BIT;
+ mask &= ~BUFFER_BIT_STENCIL;
}
else {
if (VIA_DEBUG & DEBUG_2D)
@@ -252,9 +252,9 @@ static void viaClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
if (vmesa->viaScreen->bytesPerPixel == 2 &&
vmesa->ClearMask & 0xf0000000) {
if (flag & VIA_FRONT)
- mask |= DD_FRONT_LEFT_BIT;
+ mask |= BUFFER_BIT_FRONT_LEFT;
if (flag & VIA_BACK)
- mask |= DD_BACK_LEFT_BIT;
+ mask |= BUFFER_BIT_BACK_LEFT;
flag &= ~(VIA_FRONT | VIA_BACK);
}
diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c
index dbe7a38c3d..e302011665 100644
--- a/src/mesa/drivers/dri/unichrome/via_screen.c
+++ b/src/mesa/drivers/dri/unichrome/via_screen.c
@@ -28,6 +28,8 @@
#include "dri_util.h"
#include "glheader.h"
#include "context.h"
+#include "framebuffer.h"
+#include "renderbuffer.h"
#include "matrix.h"
#include "simple_list.h"
#include "vblank.h"
@@ -212,12 +214,15 @@ viaDestroyScreen(__DRIscreenPrivate *sPriv)
sPriv->private = NULL;
}
+
static GLboolean
viaCreateBuffer(__DRIscreenPrivate *driScrnPriv,
__DRIdrawablePrivate *driDrawPriv,
const __GLcontextModes *mesaVis,
GLboolean isPixmap)
{
+ viaScreenPrivate *screen = (viaScreenPrivate *) driScrnPriv->private;
+
GLboolean swStencil = (mesaVis->stencilBits > 0 &&
mesaVis->depthBits != 24);
@@ -238,13 +243,74 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv,
return GL_FALSE;
}
else {
+#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);
+
+ /* XXX check/fix the offset/pitch parameters! */
+ {
+ driRenderbuffer *frontRb
+ = driNewRenderbuffer(GL_RGBA, screen->cpp,
+ 0, screen->width);
+ viaSetSpanFunctions(frontRb, mesaVis);
+ _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
+ }
+
+ if (mesaVis->doubleBufferMode) {
+ driRenderbuffer *backRb
+ = driNewRenderbuffer(GL_RGBA, screen->cpp,
+ 0, screen->width);
+ viaSetSpanFunctions(backRb, mesaVis);
+ _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
+ }
+
+ if (mesaVis->depthBits == 16) {
+ driRenderbuffer *depthRb
+ = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp,
+ 0, screen->width);
+ viaSetSpanFunctions(depthRb, mesaVis);
+ _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
+ }
+ else if (mesaVis->depthBits == 24) {
+ driRenderbuffer *depthRb
+ = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp,
+ 0, screen->width);
+ viaSetSpanFunctions(depthRb, mesaVis);
+ _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
+ }
+ else if (mesaVis->depthBits == 32) {
+ driRenderbuffer *depthRb
+ = driNewRenderbuffer(GL_DEPTH_COMPONENT32, screen->cpp,
+ 0, screen->width);
+ viaSetSpanFunctions(depthRb, mesaVis);
+ _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
+ }
+
+ /* no h/w stencil?
+ if (mesaVis->stencilBits > 0 && !swStencil) {
+ driRenderbuffer *stencilRb
+ = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, screen->cpp,
+ screen->depthOffset, screen->depthPitch);
+ viaSetSpanFunctions(stencilRb, mesaVis);
+ _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base);
+ }
+ */
+
+ _mesa_add_soft_renderbuffers(fb,
+ GL_FALSE, /* color */
+ GL_FALSE, /* depth */
+ swStencil,
+ mesaVis->accumRedBits > 0,
+ GL_FALSE, /* alpha */
+ GL_FALSE /* aux */);
+ driDrawPriv->driverPrivate = (void *) fb;
+#endif
return (driDrawPriv->driverPrivate != NULL);
}
}
diff --git a/src/mesa/drivers/dri/unichrome/via_screen.h b/src/mesa/drivers/dri/unichrome/via_screen.h
index 01613eac21..8239960a63 100644
--- a/src/mesa/drivers/dri/unichrome/via_screen.h
+++ b/src/mesa/drivers/dri/unichrome/via_screen.h
@@ -72,6 +72,7 @@ typedef struct {
driOptionCache optionCache;
} viaScreenPrivate;
+
extern GLboolean
viaCreateContext(const __GLcontextModes *mesaVis,
__DRIcontextPrivate *driContextPriv,
diff --git a/src/mesa/drivers/dri/unichrome/via_span.c b/src/mesa/drivers/dri/unichrome/via_span.c
index e5e25f08c1..0fbac9b506 100644
--- a/src/mesa/drivers/dri/unichrome/via_span.c
+++ b/src/mesa/drivers/dri/unichrome/via_span.c
@@ -178,10 +178,10 @@ static void viaSetBuffer(GLcontext *ctx, GLframebuffer *colorBuffer,
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
- if (bufferBit == DD_FRONT_LEFT_BIT) {
+ if (bufferBit == BUFFER_BIT_FRONT_LEFT) {
vmesa->drawBuffer = vmesa->readBuffer = &vmesa->front;
}
- else if (bufferBit == DD_BACK_LEFT_BIT) {
+ else if (bufferBit == BUFFER_BIT_BACK_LEFT) {
vmesa->drawBuffer = vmesa->readBuffer = &vmesa->back;
}
else {
@@ -207,10 +207,13 @@ void viaSpanRenderFinish( GLcontext *ctx )
void viaInitSpanFuncs(GLcontext *ctx)
{
+#if 0
struct via_context *vmesa = VIA_CONTEXT(ctx);
+#endif
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
swdd->SetBuffer = viaSetBuffer;
+#if 0
if (vmesa->viaScreen->bitsPerPixel == 16) {
viaInitPointers_565( swdd );
}
@@ -220,7 +223,8 @@ void viaInitSpanFuncs(GLcontext *ctx)
else {
assert(0);
}
-
+#endif
+#if 0
if (vmesa->glCtx->Visual.depthBits == 16) {
swdd->ReadDepthSpan = viaReadDepthSpan_16;
swdd->WriteDepthSpan = viaWriteDepthSpan_16;
@@ -247,11 +251,12 @@ void viaInitSpanFuncs(GLcontext *ctx)
swdd->ReadDepthPixels = viaReadDepthPixels_32;
swdd->WriteDepthPixels = viaWriteDepthPixels_32;
}
+#endif
swdd->SpanRenderStart = viaSpanRenderStart;
swdd->SpanRenderFinish = viaSpanRenderFinish;
-
+#if 0
swdd->WriteCI8Span = NULL;
swdd->WriteCI32Span = NULL;
swdd->WriteMonoCISpan = NULL;
@@ -259,4 +264,55 @@ void viaInitSpanFuncs(GLcontext *ctx)
swdd->WriteMonoCIPixels = NULL;
swdd->ReadCI32Span = NULL;
swdd->ReadCI32Pixels = NULL;
+#endif
+}
+
+
+
+/**
+ * Plug in the Get/Put routines for the given driRenderbuffer.
+ */
+void
+viaSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
+{
+ if (drb->Base.InternalFormat == GL_RGBA) {
+ if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
+ viaInitPointers_565(&drb->Base);
+ }
+ else {
+ viaInitPointers_8888(&drb->Base);
+ }
+ }
+ else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
+ drb->Base.GetRow = viaReadDepthSpan_16;
+ drb->Base.GetValues = viaReadDepthPixels_16;
+ drb->Base.PutRow = viaWriteDepthSpan_16;
+ drb->Base.PutMonoRow = viaWriteMonoDepthSpan_16;
+ drb->Base.PutValues = viaWriteDepthPixels_16;
+ drb->Base.PutMonoValues = NULL;
+ }
+ else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
+ drb->Base.GetRow = viaReadDepthSpan_24_8;
+ drb->Base.GetValues = viaReadDepthPixels_24_8;
+ drb->Base.PutRow = viaWriteDepthSpan_24_8;
+ drb->Base.PutMonoRow = viaWriteMonoDepthSpan_24_8;
+ drb->Base.PutValues = viaWriteDepthPixels_24_8;
+ drb->Base.PutMonoValues = NULL;
+ }
+ else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT32) {
+ drb->Base.GetRow = viaReadDepthSpan_32;
+ drb->Base.GetValues = viaReadDepthPixels_32;
+ drb->Base.PutRow = viaWriteDepthSpan_32;
+ drb->Base.PutMonoRow = viaWriteMonoDepthSpan_32;
+ drb->Base.PutValues = viaWriteDepthPixels_32;
+ drb->Base.PutMonoValues = NULL;
+ }
+ else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
+ drb->Base.GetRow = viaReadStencilSpan_24_8;
+ drb->Base.GetValues = viaReadStencilPixels_24_8;
+ drb->Base.PutRow = viaWriteStencilSpan_24_8;
+ drb->Base.PutMonoRow = viaWriteMonoStencilSpan_24_8;
+ drb->Base.PutValues = viaWriteStencilPixels_24_8;
+ drb->Base.PutMonoValues = NULL;
+ }
}
diff --git a/src/mesa/drivers/dri/unichrome/via_span.h b/src/mesa/drivers/dri/unichrome/via_span.h
index 71b3f82c03..c3bd24b0e7 100644
--- a/src/mesa/drivers/dri/unichrome/via_span.h
+++ b/src/mesa/drivers/dri/unichrome/via_span.h
@@ -25,8 +25,13 @@
#ifndef _VIA_SPAN_H
#define _VIA_SPAN_H
+#include "drirenderbuffer.h"
+
extern void viaInitSpanFuncs(GLcontext *ctx);
extern void viaSpanRenderStart( GLcontext *ctx );
extern void viaSpanRenderFinish( GLcontext *ctx );
+extern void
+viaSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis);
+
#endif