summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/savage
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2005-09-03 16:43:02 +0000
committerBrian Paul <[email protected]>2005-09-03 16:43:02 +0000
commit687918b794d12a0ff5d395b8cf87880dbe8012bf (patch)
tree280d1b882dc3bfd0e105d14a1f9d90c7cef935dd /src/mesa/drivers/dri/savage
parente6925b51e1e71dc45079636ce336a09806356999 (diff)
SetBuffer, renderbuffer changes
Diffstat (limited to 'src/mesa/drivers/dri/savage')
-rw-r--r--src/mesa/drivers/dri/savage/savage_xmesa.c35
-rw-r--r--src/mesa/drivers/dri/savage/savagecontext.h9
-rw-r--r--src/mesa/drivers/dri/savage/savageioctl.c6
-rw-r--r--src/mesa/drivers/dri/savage/savagespan.c119
-rw-r--r--src/mesa/drivers/dri/savage/savagestate.c7
5 files changed, 59 insertions, 117 deletions
diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c
index 12cf78535ad..477564cad3b 100644
--- a/src/mesa/drivers/dri/savage/savage_xmesa.c
+++ b/src/mesa/drivers/dri/savage/savage_xmesa.c
@@ -634,6 +634,8 @@ savageCreateBuffer( __DRIscreenPrivate *driScrnPriv,
screen->frontOffset, screen->aperturePitch);
savageSetSpanFunctions(frontRb, mesaVis, float_depth);
_mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
+ frontRb->Base.Data = frontRb->flippedData
+ = (GLubyte *) screen->aperture.map + 0x01000000 * TARGET_FRONT;
}
if (mesaVis->doubleBufferMode) {
@@ -642,26 +644,32 @@ savageCreateBuffer( __DRIscreenPrivate *driScrnPriv,
screen->backOffset, screen->aperturePitch);
savageSetSpanFunctions(backRb, mesaVis, float_depth);
_mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
+ backRb->Base.Data = backRb->flippedData
+ = (GLubyte *) screen->aperture.map + 0x01000000 * TARGET_BACK;
}
if (mesaVis->depthBits == 16) {
driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp,
+ = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->zpp,
screen->depthOffset, screen->aperturePitch);
savageSetSpanFunctions(depthRb, mesaVis, float_depth);
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
+ depthRb->Base.Data = depthRb->flippedData
+ = (GLubyte *) screen->aperture.map + 0x01000000 * TARGET_DEPTH;
}
else if (mesaVis->depthBits == 24) {
driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp,
+ = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->zpp,
screen->depthOffset, screen->aperturePitch);
savageSetSpanFunctions(depthRb, mesaVis, float_depth);
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
+ depthRb->Base.Data = depthRb->flippedData
+ = (GLubyte *) screen->aperture.map + 0x01000000 * TARGET_DEPTH;
}
if (mesaVis->stencilBits > 0 && !swStencil) {
driRenderbuffer *stencilRb
- = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, screen->cpp,
+ = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, screen->zpp,
screen->depthOffset, screen->aperturePitch);
savageSetSpanFunctions(stencilRb, mesaVis, float_depth);
_mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base);
@@ -805,16 +813,25 @@ savageMakeCurrent(__DRIcontextPrivate *driContextPriv,
__DRIdrawablePrivate *driReadPriv)
{
if (driContextPriv) {
- savageContextPtr imesa = (savageContextPtr) driContextPriv->driverPrivate;
-
+ savageContextPtr imesa
+ = (savageContextPtr) driContextPriv->driverPrivate;
+ struct gl_framebuffer *drawBuffer
+ = (GLframebuffer *) driDrawPriv->driverPrivate;
+ struct gl_framebuffer *readBuffer
+ = (GLframebuffer *) driReadPriv->driverPrivate;
+ driRenderbuffer *frontRb = (driRenderbuffer *)
+ drawBuffer->Attachment[BUFFER_FRONT_LEFT].Renderbuffer;
+ driRenderbuffer *backRb = (driRenderbuffer *)
+ drawBuffer->Attachment[BUFFER_BACK_LEFT].Renderbuffer;
+
+ assert(frontRb->Base.Data);
+ assert(backRb->Base.Data);
+
imesa->driReadable = driReadPriv;
imesa->driDrawable = driDrawPriv;
- imesa->mesa_drawable = driDrawPriv;
imesa->dirty = ~0;
- _mesa_make_current(imesa->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate);
+ _mesa_make_current(imesa->glCtx, drawBuffer, readBuffer);
savageXMesaWindowMoved( imesa );
}
diff --git a/src/mesa/drivers/dri/savage/savagecontext.h b/src/mesa/drivers/dri/savage/savagecontext.h
index 4c095996851..c4573b0da41 100644
--- a/src/mesa/drivers/dri/savage/savagecontext.h
+++ b/src/mesa/drivers/dri/savage/savagecontext.h
@@ -236,8 +236,6 @@ struct savage_context_t {
/* These refer to the current draw (front vs. back) buffer:
*/
- GLubyte *drawMap; /* draw buffer address in virtual mem */
- GLubyte *readMap;
int drawX; /* origin of drawable in draw buffer */
int drawY;
GLuint numClipRects; /* cliprects for that buffer */
@@ -277,13 +275,6 @@ struct savage_context_t {
__DRIdrawablePrivate *driDrawable;
__DRIdrawablePrivate *driReadable;
- /**
- * Drawable used by Mesa for software fallbacks for reading and
- * writing. It is set by Mesa's \c SetBuffer callback, and will always be
- * either \c mga_context_t::driDrawable or \c mga_context_t::driReadable.
- */
- __DRIdrawablePrivate *mesa_drawable;
-
__DRIscreenPrivate *driScreen;
savageScreenPrivate *savageScreen;
drm_savage_sarea_t *sarea;
diff --git a/src/mesa/drivers/dri/savage/savageioctl.c b/src/mesa/drivers/dri/savage/savageioctl.c
index 30d008e1be8..1906c78cc34 100644
--- a/src/mesa/drivers/dri/savage/savageioctl.c
+++ b/src/mesa/drivers/dri/savage/savageioctl.c
@@ -254,9 +254,9 @@ static void savage_BCI_swap(savageContextPtr imesa)
else
imesa->toggle = TARGET_BACK;
- imesa->drawMap = (char *)imesa->apertureBase[imesa->toggle];
- imesa->readMap = (char *)imesa->apertureBase[imesa->toggle];
-
+ driFlipRenderbuffers(imesa->glCtx->DrawBuffer,
+ imesa->toggle != TARGET_FRONT);
+
imesa->regs.s4.destCtrl.ni.offset = imesa->savageScreen->backOffset>>11;
imesa->dirty |= SAVAGE_UPLOAD_GLOBAL;
bciptr = SAVAGE_GET_BCI_POINTER(imesa,3);
diff --git a/src/mesa/drivers/dri/savage/savagespan.c b/src/mesa/drivers/dri/savage/savagespan.c
index 2158391c103..6396332794f 100644
--- a/src/mesa/drivers/dri/savage/savagespan.c
+++ b/src/mesa/drivers/dri/savage/savagespan.c
@@ -32,30 +32,26 @@
#define DBG 0
-#define LOCAL_VARS \
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx); \
- __DRIdrawablePrivate *dPriv = imesa->mesa_drawable; \
- savageScreenPrivate *savageScreen = imesa->savageScreen; \
- GLuint cpp = savageScreen->cpp; \
- GLuint pitch = imesa->aperturePitch; \
- GLuint height = dPriv->h; \
- GLubyte *buf = map + \
- dPriv->x * cpp + \
- dPriv->y * pitch; \
- GLubyte *read_buf = buf; \
- GLuint p; \
+#define LOCAL_VARS \
+ savageContextPtr imesa = SAVAGE_CONTEXT(ctx); \
+ __DRIdrawablePrivate *dPriv = imesa->driDrawable; \
+ driRenderbuffer *drb = (driRenderbuffer *) rb; \
+ GLuint cpp = drb->cpp; \
+ GLuint pitch = drb->pitch; \
+ GLuint height = dPriv->h; \
+ GLubyte *buf = drb->Base.Data + dPriv->x * cpp + dPriv->y * pitch; \
+ GLubyte *read_buf = buf; \
+ GLuint p; \
(void) p; (void) read_buf;
-#define LOCAL_DEPTH_VARS \
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx); \
- __DRIdrawablePrivate *dPriv = imesa->mesa_drawable; \
- savageScreenPrivate *savageScreen = imesa->savageScreen; \
- GLuint zpp = savageScreen->zpp; \
- GLuint pitch = imesa->aperturePitch; \
- GLuint height = dPriv->h; \
- GLubyte *buf = imesa->apertureBase[TARGET_DEPTH] + \
- dPriv->x * zpp + \
- dPriv->y * pitch
+#define LOCAL_DEPTH_VARS \
+ savageContextPtr imesa = SAVAGE_CONTEXT(ctx); \
+ __DRIdrawablePrivate *dPriv = imesa->driDrawable; \
+ driRenderbuffer *drb = (driRenderbuffer *) rb; \
+ GLuint zpp = drb->cpp; \
+ GLuint pitch = drb->pitch; \
+ GLuint height = dPriv->h; \
+ GLubyte *buf = drb->Base.Data + dPriv->x * zpp + dPriv->y * pitch;
#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
@@ -65,13 +61,9 @@
#define HW_UNLOCK()
-#define HW_WRITE_LOCK() \
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx); \
- GLubyte *map = imesa->drawMap;
+#define HW_WRITE_LOCK()
-#define HW_READ_LOCK() \
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx); \
- GLubyte *map = imesa->readMap;
+#define HW_READ_LOCK()
/* 16 bit, 565 rgb color spanline and pixel functions
@@ -110,7 +102,7 @@
#define READ_DEPTH( d, _x, _y ) \
d = 0xFFFF - *(GLushort *)(buf + ((_x)<<1) + (_y)*pitch)
-#define TAG(x) savage##x##_16
+#define TAG(x) savage##x##_z16
#include "depthtmp.h"
@@ -127,7 +119,7 @@
savageDecodeFloat16( *(GLushort *)(buf + ((_x)<<1) + (_y)*pitch) ) * \
65535.0
-#define TAG(x) savage##x##_16f
+#define TAG(x) savage##x##_z16f
#include "depthtmp.h"
@@ -146,7 +138,7 @@
#define READ_DEPTH( d, _x, _y ) \
d = 0x00FFFFFF - (*(GLuint *)(buf + ((_x)<<2) + (_y)*pitch) & 0x00FFFFFF)
-#define TAG(x) savage##x##_8_24
+#define TAG(x) savage##x##_s8_z24
#include "depthtmp.h"
@@ -166,7 +158,7 @@
*(GLuint *)(buf + ((_x)<<2) + (_y)*pitch) & 0x00FFFFFF) \
* 16777215.0
-#define TAG(x) savage##x##_8_24f
+#define TAG(x) savage##x##_s8_z24f
#include "depthtmp.h"
@@ -180,36 +172,10 @@
#define READ_STENCIL( d, _x, _y ) \
d = (GLstencil)((*(GLuint *)(buf + ((_x)<<2) + (_y)*pitch) & 0xFF000000) >> 24)
-#define TAG(x) savage##x##_8_24
+#define TAG(x) savage##x##_s8_z24
#include "stenciltmp.h"
-/*
- * This function is called to specify which buffer to read and write
- * for software rasterization (swrast) fallbacks. This doesn't necessarily
- * correspond to glDrawBuffer() or glReadBuffer() calls.
- */
-static void savageDDSetBuffer(GLcontext *ctx, GLframebuffer *buffer,
- GLuint bufferBit)
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- GLubyte *map;
-
- assert((bufferBit == BUFFER_BIT_FRONT_LEFT) || (bufferBit == BUFFER_BIT_BACK_LEFT));
-
- map = (bufferBit == BUFFER_BIT_FRONT_LEFT)
- ? imesa->apertureBase[TARGET_FRONT]
- : imesa->apertureBase[TARGET_BACK];
-
- imesa->drawMap = map;
- imesa->readMap = map;
-
- assert( (buffer == imesa->driDrawable->driverPrivate)
- || (buffer == imesa->driReadable->driverPrivate) );
-
- imesa->mesa_drawable = (buffer == imesa->driDrawable->driverPrivate)
- ? imesa->driDrawable : imesa->driReadable;
-}
/*
* Wrappers around _swrast_Copy/Draw/ReadPixels that make sure all
@@ -267,8 +233,6 @@ static void savageSpanRenderStart( GLcontext *ctx )
void savageDDInitSpanFuncs( GLcontext *ctx )
{
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
-
- swdd->SetBuffer = savageDDSetBuffer;
swdd->SpanRenderStart = savageSpanRenderStart;
/* Pixel path fallbacks.
@@ -299,44 +263,21 @@ savageSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis,
}
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
if (float_depth) {
- drb->Base.GetRow = savageReadDepthSpan_16f;
- drb->Base.GetValues = savageReadDepthPixels_16f;
- drb->Base.PutRow = savageWriteDepthSpan_16f;
- drb->Base.PutMonoRow = savageWriteMonoDepthSpan_16f;
- drb->Base.PutValues = savageWriteDepthPixels_16f;
+ savageInitDepthPointers_z16f(&drb->Base);
}
else {
- drb->Base.GetRow = savageReadDepthSpan_16;
- drb->Base.GetValues = savageReadDepthPixels_16;
- drb->Base.PutRow = savageWriteDepthSpan_16;
- drb->Base.PutMonoRow = savageWriteMonoDepthSpan_16;
- drb->Base.PutValues = savageWriteDepthPixels_16;
+ savageInitDepthPointers_z16(&drb->Base);
}
- drb->Base.PutMonoValues = NULL;
}
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
if (float_depth) {
- drb->Base.GetRow = savageReadDepthSpan_8_24f;
- drb->Base.GetValues = savageReadDepthPixels_8_24f;
- drb->Base.PutRow = savageWriteDepthSpan_8_24f;
- drb->Base.PutMonoRow = savageWriteMonoDepthSpan_8_24f;
- drb->Base.PutValues = savageWriteDepthPixels_8_24f;
+ savageInitDepthPointers_s8_z24f(&drb->Base);
}
else {
- drb->Base.GetRow = savageReadDepthSpan_8_24;
- drb->Base.GetValues = savageReadDepthPixels_8_24;
- drb->Base.PutRow = savageWriteDepthSpan_8_24;
- drb->Base.PutMonoRow = savageWriteMonoDepthSpan_8_24;
- drb->Base.PutValues = savageWriteDepthPixels_8_24;
+ savageInitDepthPointers_s8_z24(&drb->Base);
}
- drb->Base.PutMonoValues = NULL;
}
else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
- drb->Base.GetRow = savageReadStencilSpan_8_24;
- drb->Base.GetValues = savageReadStencilPixels_8_24;
- drb->Base.PutRow = savageWriteStencilSpan_8_24;
- drb->Base.PutMonoRow = savageWriteMonoStencilSpan_8_24;
- drb->Base.PutValues = savageWriteStencilPixels_8_24;
- drb->Base.PutMonoValues = NULL;
+ savageInitStencilPointers_s8_z24(&drb->Base);
}
}
diff --git a/src/mesa/drivers/dri/savage/savagestate.c b/src/mesa/drivers/dri/savage/savagestate.c
index 996d5b91717..4affe8799b9 100644
--- a/src/mesa/drivers/dri/savage/savagestate.c
+++ b/src/mesa/drivers/dri/savage/savagestate.c
@@ -665,11 +665,6 @@ static void savageDDDrawBuffer(GLcontext *ctx, GLenum mode )
return;
}
- /* We want to update the s/w rast state too so that r200SetBuffer() (?)
- * gets called.
- */
- _swrast_DrawBuffer(ctx, mode);
-
if (destCtrl != imesa->regs.s4.destCtrl.ui)
imesa->dirty |= SAVAGE_UPLOAD_GLOBAL;
}
@@ -1663,8 +1658,6 @@ void savageDDInitState( savageContextPtr imesa ) {
imesa->regs.s4.destCtrl.ni.dstWidthInTile =
(imesa->savageScreen->width+31)>>5;
}
- imesa->drawMap = imesa->apertureBase[imesa->toggle];
- imesa->readMap = imesa->apertureBase[imesa->toggle];
imesa->NotFirstFrame = GL_FALSE;
imesa->regs.s4.zBufOffset.ni.offset=imesa->savageScreen->depthOffset>>11;