summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/s3v
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri/s3v')
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_context.h2
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_dd.c3
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_screen.h3
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_span.c61
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_state.c6
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_xmesa.c99
6 files changed, 146 insertions, 28 deletions
diff --git a/src/mesa/drivers/dri/s3v/s3v_context.h b/src/mesa/drivers/dri/s3v/s3v_context.h
index 1c0bca3fb8f..b94fee6a8ee 100644
--- a/src/mesa/drivers/dri/s3v/s3v_context.h
+++ b/src/mesa/drivers/dri/s3v/s3v_context.h
@@ -16,6 +16,7 @@
#include "mtypes.h"
#include "drm.h"
#include "mm.h"
+#include "drirenderbuffer.h"
/* Flags for context */
#define S3V_FRONT_BUFFER 0x00000001
@@ -162,6 +163,7 @@ void s3vGetLock( s3vContextPtr vmesa, GLuint flags );
void s3vInitExtensions( GLcontext *ctx );
void s3vInitDriverFuncs( GLcontext *ctx );
void s3vInitSpanFuncs( GLcontext *ctx );
+void s3vSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis);
void s3vInitState( s3vContextPtr vmesa );
void s3vInitHW( s3vContextPtr vmesa );
void s3vInitStateFuncs( GLcontext *ctx );
diff --git a/src/mesa/drivers/dri/s3v/s3v_dd.c b/src/mesa/drivers/dri/s3v/s3v_dd.c
index 3346c86a0c4..2c8e230f3ef 100644
--- a/src/mesa/drivers/dri/s3v/s3v_dd.c
+++ b/src/mesa/drivers/dri/s3v/s3v_dd.c
@@ -10,6 +10,7 @@
#endif
#include "context.h"
+#include "framebuffer.h"
#include "swrast/swrast.h"
#define S3V_DATE "20020207"
@@ -96,7 +97,7 @@ void s3vInitDriverFuncs( GLcontext *ctx )
ctx->Driver.CopyPixels = _swrast_CopyPixels;
ctx->Driver.DrawPixels = _swrast_DrawPixels;
ctx->Driver.ReadPixels = _swrast_ReadPixels;
- ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
+ ctx->Driver.ResizeBuffers = _mesa_resize_framebuffer;
/* Swrast hooks for imaging extensions:
*/
diff --git a/src/mesa/drivers/dri/s3v/s3v_screen.h b/src/mesa/drivers/dri/s3v/s3v_screen.h
index bbbffbb8e1a..0c4f69efac3 100644
--- a/src/mesa/drivers/dri/s3v/s3v_screen.h
+++ b/src/mesa/drivers/dri/s3v/s3v_screen.h
@@ -2,6 +2,8 @@
* Author: Max Lingua <[email protected]>
*/
+#include "mtypes.h"
+
typedef struct _s3vRegion {
drm_handle_t handle;
drmSize size;
@@ -34,3 +36,4 @@ typedef struct {
int textureSize;
int logTextureGranularity;
} s3vScreenRec, *s3vScreenPtr;
+
diff --git a/src/mesa/drivers/dri/s3v/s3v_span.c b/src/mesa/drivers/dri/s3v/s3v_span.c
index 6266d371052..e4a48ebfc84 100644
--- a/src/mesa/drivers/dri/s3v/s3v_span.c
+++ b/src/mesa/drivers/dri/s3v/s3v_span.c
@@ -232,10 +232,10 @@ static void s3vSetBuffer( GLcontext *ctx, GLframebuffer *colorBuffer,
s3vContextPtr vmesa = S3V_CONTEXT(ctx);
switch ( bufferBit ) {
- case DD_FRONT_LEFT_BIT:
+ case BUFFER_BIT_FRONT_LEFT:
vmesa->drawOffset = vmesa->readOffset = 0;
break;
- case DD_BACK_LEFT_BIT:
+ case BUFFER_BIT_BACK_LEFT:
vmesa->drawOffset = vmesa->readOffset = vmesa->driScreen->fbHeight *
vmesa->driScreen->fbWidth *
vmesa->s3vScreen->cpp;
@@ -251,6 +251,7 @@ void s3vInitSpanFuncs( GLcontext *ctx )
swdd->SetBuffer = s3vSetBuffer;
+#if 0
switch ( vmesa->s3vScreen->cpp ) {
case 2:
swdd->WriteRGBASpan = s3vWriteRGBASpan_RGB555;
@@ -279,14 +280,17 @@ void s3vInitSpanFuncs( GLcontext *ctx )
default:
break;
}
+#endif
switch ( vmesa->glCtx->Visual.depthBits ) {
case 15:
case 16:
+#if 0
swdd->ReadDepthSpan = s3vReadDepthSpan_16;
swdd->WriteDepthSpan = s3vWriteDepthSpan_16;
swdd->ReadDepthPixels = s3vReadDepthPixels_16;
swdd->WriteDepthPixels = s3vWriteDepthPixels_16;
+#endif
break;
#if 0
@@ -307,3 +311,56 @@ void s3vInitSpanFuncs( GLcontext *ctx )
break;
}
}
+
+
+/**
+ * Plug in the Get/Put routines for the given driRenderbuffer.
+ */
+void
+s3vSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
+{
+ if (drb->Base.InternalFormat == GL_RGBA) {
+ if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
+ drb->Base.GetRow = s3vReadRGBASpan_RGB555;
+ drb->Base.GetValues = s3vReadRGBAPixels_RGB555;
+ drb->Base.PutRow = s3vWriteRGBASpan_RGB555;
+ drb->Base.PutRowRGB = s3vWriteRGBSpan_RGB555;
+ drb->Base.PutMonoRow = s3vWriteMonoRGBASpan_RGB555;
+ drb->Base.PutValues = s3vWriteRGBAPixels_RGB555;
+ drb->Base.PutMonoValues = s3vWriteMonoRGBAPixels_RGB555;
+ }
+ else {
+ drb->Base.GetRow = s3vReadRGBASpan_ARGB8888;
+ drb->Base.GetValues = s3vReadRGBAPixels_ARGB8888;
+ drb->Base.PutRow = s3vWriteRGBASpan_ARGB8888;
+ drb->Base.PutRowRGB = s3vWriteRGBSpan_ARGB8888;
+ drb->Base.PutMonoRow = s3vWriteMonoRGBASpan_ARGB8888;
+ drb->Base.PutValues = s3vWriteRGBAPixels_ARGB8888;
+ drb->Base.PutMonoValues = s3vWriteMonoRGBAPixels_ARGB8888;
+ }
+ }
+ else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
+ drb->Base.GetRow = s3vReadDepthSpan_16;
+ drb->Base.GetValues = s3vReadDepthPixels_16;
+ drb->Base.PutRow = s3vWriteDepthSpan_16;
+ drb->Base.PutMonoRow = s3vWriteMonoDepthSpan_16;
+ drb->Base.PutValues = s3vWriteDepthPixels_16;
+ drb->Base.PutMonoValues = NULL;
+ }
+ else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
+ drb->Base.GetRow = NULL;
+ drb->Base.GetValues = NULL;
+ drb->Base.PutRow = NULL;
+ drb->Base.PutMonoRow = NULL;
+ drb->Base.PutValues = NULL;
+ drb->Base.PutMonoValues = NULL;
+ }
+ else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
+ drb->Base.GetRow = NULL;
+ drb->Base.GetValues = NULL;
+ drb->Base.PutRow = NULL;
+ drb->Base.PutMonoRow = NULL;
+ drb->Base.PutValues = NULL;
+ drb->Base.PutMonoValues = NULL;
+ }
+}
diff --git a/src/mesa/drivers/dri/s3v/s3v_state.c b/src/mesa/drivers/dri/s3v/s3v_state.c
index f92859d4edc..84aaf4c5b13 100644
--- a/src/mesa/drivers/dri/s3v/s3v_state.c
+++ b/src/mesa/drivers/dri/s3v/s3v_state.c
@@ -117,8 +117,8 @@ static void s3vDDClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
DMAOUT(vmesa->DestXY);
DMAFINISH();
- if (mask & DD_DEPTH_BIT) { /* depth */
- DEBUG(("DD_DEPTH_BIT\n"));
+ if (mask & BUFFER_BIT_DEPTH) { /* depth */
+ DEBUG(("BUFFER_BIT_DEPTH\n"));
_stride = ((cw+31)&~31) * 2;
@@ -142,7 +142,7 @@ static void s3vDDClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
DMAFINISH();
DEBUG(("vmesa->ClearDepth = 0x%x\n", vmesa->ClearDepth));
- mask &= ~DD_DEPTH_BIT;
+ mask &= ~BUFFER_BIT_DEPTH;
}
if (!vmesa->NotClipped) {
diff --git a/src/mesa/drivers/dri/s3v/s3v_xmesa.c b/src/mesa/drivers/dri/s3v/s3v_xmesa.c
index 84072b14716..61d4cbccbd9 100644
--- a/src/mesa/drivers/dri/s3v/s3v_xmesa.c
+++ b/src/mesa/drivers/dri/s3v/s3v_xmesa.c
@@ -7,6 +7,8 @@
#include "context.h"
#include "matrix.h"
#include "s3v_dri.h"
+#include "framebuffer.h"
+#include "renderbuffer.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
@@ -57,10 +59,13 @@ s3vCreateBuffer( __DRIscreenPrivate *driScrnPriv,
const __GLcontextModes *mesaVis,
GLboolean isPixmap )
{
+ s3vScreenPtr screen = (s3vScreenPtr) driScrnPriv->private;
+
if (isPixmap) {
return GL_FALSE; /* not implemented */
}
else {
+#if 0
driDrawPriv->driverPrivate = (void *)
_mesa_create_framebuffer(mesaVis,
GL_FALSE, /* software depth buffer? */
@@ -68,6 +73,58 @@ s3vCreateBuffer( __DRIscreenPrivate *driScrnPriv,
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);
+ 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);
+ s3vSetSpanFunctions(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);
+ 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);
+ s3vSetSpanFunctions(depthRb, mesaVis);
+ _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
+ }
+
+ /* no h/w stencil yet?
+ if (mesaVis->stencilBits > 0) {
+ driRenderbuffer *stencilRb
+ = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT);
+ s3vSetSpanFunctions(stencilRb, mesaVis);
+ _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base);
+ }
+ */
+
+ _mesa_add_soft_renderbuffers(fb,
+ GL_FALSE, /* color */
+ GL_FALSE, /* depth */
+ mesaVis->stencilBits > 0,
+ mesaVis->accumRedBits > 0,
+ GL_FALSE, /* alpha */
+ GL_FALSE /* aux */);
+ driDrawPriv->driverPrivate = (void *) fb;
+#endif
return (driDrawPriv->driverPrivate != NULL);
}
}
@@ -205,7 +262,7 @@ s3vMakeCurrent(__DRIcontextPrivate *driContextPriv,
*/
/*
- _mesa_make_current2( newVirgeCtx->glCtx,
+ _mesa_make_current( newVirgeCtx->glCtx,
(GLframebuffer *) driDrawPriv->driverPrivate,
(GLframebuffer *) driReadPriv->driverPrivate );
@@ -221,13 +278,11 @@ s3vMakeCurrent(__DRIcontextPrivate *driContextPriv,
WRITE(newVirgeCtx->buf, S3VWindow, newVirgeCtx->Window);
#endif
-
-
newVirgeCtx->new_state |= S3V_NEW_WINDOW; /* FIXME */
- _mesa_make_current2( newVirgeCtx->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate );
+ _mesa_make_current( newVirgeCtx->glCtx,
+ (GLframebuffer *) driDrawPriv->driverPrivate,
+ (GLframebuffer *) driReadPriv->driverPrivate );
if (!newVirgeCtx->glCtx->Viewport.Width) {
_mesa_set_viewport(newVirgeCtx->glCtx, 0, 0,
@@ -245,23 +300,23 @@ s3vMakeCurrent(__DRIcontextPrivate *driContextPriv,
newVirgeCtx->new_state |= S3V_NEW_CLIP;
- if (1) {
- cx = dPriv->x;
- cw = dPriv->w;
- cy = dPriv->y;
- ch = dPriv->h;
- }
-
- x1 = y1 = 0;
- x2 = cw-1;
- y2 = ch-1;
-
-/* src_stride = vmesa->s3vScreen->w * vmesa->s3vScreen->cpp;
- dest_stride = ((x2+31)&~31) * vmesa->s3vScreen->cpp; */
- src_stride = vmesa->driScreen->fbWidth * 2;
- dest_stride = ((x2+31)&~31) * 2;
+ if (1) {
+ cx = dPriv->x;
+ cw = dPriv->w;
+ cy = dPriv->y;
+ ch = dPriv->h;
+ }
+
+ x1 = y1 = 0;
+ x2 = cw-1;
+ y2 = ch-1;
+
+ /* src_stride = vmesa->s3vScreen->w * vmesa->s3vScreen->cpp;
+ dest_stride = ((x2+31)&~31) * vmesa->s3vScreen->cpp; */
+ src_stride = vmesa->driScreen->fbWidth * 2;
+ dest_stride = ((x2+31)&~31) * 2;
} else {
- _mesa_make_current( 0, 0 );
+ _mesa_make_current( NULL, NULL, NULL );
}
return GL_TRUE;