summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mesa/drivers/dri/r300/radeon_context.h5
-rw-r--r--src/mesa/drivers/dri/r300/radeon_ioctl.c4
-rw-r--r--src/mesa/drivers/dri/r300/radeon_span.c87
-rw-r--r--src/mesa/drivers/dri/r300/radeon_state.c3
4 files changed, 12 insertions, 87 deletions
diff --git a/src/mesa/drivers/dri/r300/radeon_context.h b/src/mesa/drivers/dri/r300/radeon_context.h
index 189bc6ad02..671c14df03 100644
--- a/src/mesa/drivers/dri/r300/radeon_context.h
+++ b/src/mesa/drivers/dri/r300/radeon_context.h
@@ -144,13 +144,8 @@ struct radeon_colorbuffer_state {
GLint drawOffset, drawPitch;
};
-struct radeon_pixel_state {
- GLint readOffset, readPitch;
-};
-
struct radeon_state {
struct radeon_colorbuffer_state color;
- struct radeon_pixel_state pixel;
struct radeon_scissor_state scissor;
};
diff --git a/src/mesa/drivers/dri/r300/radeon_ioctl.c b/src/mesa/drivers/dri/r300/radeon_ioctl.c
index af489e2a84..fcde99dbd1 100644
--- a/src/mesa/drivers/dri/r300/radeon_ioctl.c
+++ b/src/mesa/drivers/dri/r300/radeon_ioctl.c
@@ -51,6 +51,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r300_state.h"
#include "radeon_reg.h"
+#include "drirenderbuffer.h"
#include "vblank.h"
static void radeonWaitForIdle(radeonContextPtr radeon);
@@ -282,6 +283,9 @@ void radeonPageFlip(const __DRIdrawablePrivate * dPriv)
radeon->swap_count++;
(void)(*dri_interface->getUST) (&radeon->swap_ust);
+ driFlipRenderbuffers(radeon->glCtx->WinSysDrawBuffer,
+ radeon->sarea->pfCurrentPage);
+
if (radeon->sarea->pfCurrentPage == 1) {
radeon->state.color.drawOffset = radeon->radeonScreen->frontOffset;
radeon->state.color.drawPitch = radeon->radeonScreen->frontPitch;
diff --git a/src/mesa/drivers/dri/r300/radeon_span.c b/src/mesa/drivers/dri/r300/radeon_span.c
index 8902c93e59..7703e4ac32 100644
--- a/src/mesa/drivers/dri/r300/radeon_span.c
+++ b/src/mesa/drivers/dri/r300/radeon_span.c
@@ -49,10 +49,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
driRenderbuffer* drb = (driRenderbuffer*)rb; \
__DRIscreenPrivate *sPriv = radeon->dri.screen; \
__DRIdrawablePrivate *dPriv = radeon->dri.drawable; \
- GLuint pitch = drb->pitch * drb->cpp; \
+ GLuint pitch = drb->flippedPitch * drb->cpp; \
GLuint height = dPriv->h; \
char *buf = (char *)(sPriv->pFB + \
- drb->offset + \
+ drb->flippedOffset + \
(dPriv->x * drb->cpp) + \
(dPriv->y * pitch)); \
GLuint p; \
@@ -228,59 +228,6 @@ do { \
#define TAG(x) radeon##x##_24_8_LINEAR
#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 radeonSetBuffer(GLcontext * ctx,
- GLframebuffer * colorBuffer, GLuint bufferBit)
-{
- radeonContextPtr radeon = RADEON_CONTEXT(ctx);
- int buffer;
-
- switch (bufferBit) {
- case BUFFER_BIT_FRONT_LEFT:
- buffer = 0;
- break;
-
- case BUFFER_BIT_BACK_LEFT:
- buffer = 1;
- break;
-
- default:
- _mesa_problem(ctx, "Bad bufferBit in %s", __FUNCTION__);
- return;
- }
-
- if (radeon->doPageFlip && radeon->sarea->pfCurrentPage == 1)
- buffer ^= 1;
-
-#if 0
- fprintf(stderr, "%s: using %s buffer\n", __FUNCTION__,
- buffer ? "back" : "front");
-#endif
-
- if (buffer) {
- radeon->state.pixel.readOffset =
- radeon->radeonScreen->backOffset;
- radeon->state.pixel.readPitch =
- radeon->radeonScreen->backPitch;
- radeon->state.color.drawOffset =
- radeon->radeonScreen->backOffset;
- radeon->state.color.drawPitch =
- radeon->radeonScreen->backPitch;
- } else {
- radeon->state.pixel.readOffset =
- radeon->radeonScreen->frontOffset;
- radeon->state.pixel.readPitch =
- radeon->radeonScreen->frontPitch;
- radeon->state.color.drawOffset =
- radeon->radeonScreen->frontOffset;
- radeon->state.color.drawPitch =
- radeon->radeonScreen->frontPitch;
- }
-}
/* Move locking out to get reasonable span performance (10x better
* than doing this in HW_LOCK above). WaitForIdle() is the main
@@ -310,9 +257,10 @@ static void radeonSpanRenderStart(GLcontext * ctx)
*/
{
int p;
+ driRenderbuffer *drb =
+ (driRenderbuffer *) ctx->WinSysDrawBuffer->_ColorDrawBuffers[0][0];
volatile int *read_buf =
- (volatile int *)(radeon->dri.screen->pFB +
- radeon->state.pixel.readOffset);
+ (volatile int *)(radeon->dri.screen->pFB + drb->offset);
p = *read_buf;
*read_buf = p;
}
@@ -328,12 +276,8 @@ static void radeonSpanRenderFinish(GLcontext * ctx)
void radeonInitSpanFuncs(GLcontext * ctx)
{
- radeonContextPtr radeon = RADEON_CONTEXT(ctx);
struct swrast_device_driver *swdd =
_swrast_GetDeviceDriverReference(ctx);
-
- swdd->SetBuffer = radeonSetBuffer;
-
swdd->SpanRenderStart = radeonSpanRenderStart;
swdd->SpanRenderFinish = radeonSpanRenderFinish;
}
@@ -364,28 +308,13 @@ void radeonSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
}
}
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
- drb->Base.GetRow = radeonReadDepthSpan_16_LINEAR;
- drb->Base.GetValues = radeonReadDepthPixels_16_LINEAR;
- drb->Base.PutRow = radeonWriteDepthSpan_16_LINEAR;
- drb->Base.PutMonoRow = radeonWriteMonoDepthSpan_16_LINEAR;
- drb->Base.PutValues = radeonWriteDepthPixels_16_LINEAR;
- drb->Base.PutMonoValues = NULL;
+ radeonInitDepthPointers_16_LINEAR(&drb->Base);
}
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
- drb->Base.GetRow = radeonReadDepthSpan_24_8_LINEAR;
- drb->Base.GetValues = radeonReadDepthPixels_24_8_LINEAR;
- drb->Base.PutRow = radeonWriteDepthSpan_24_8_LINEAR;
- drb->Base.PutMonoRow = radeonWriteMonoDepthSpan_24_8_LINEAR;
- drb->Base.PutValues = radeonWriteDepthPixels_24_8_LINEAR;
- drb->Base.PutMonoValues = NULL;
+ radeonInitDepthPointers_24_8_LINEAR(&drb->Base);
}
else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
- drb->Base.GetRow = radeonReadStencilSpan_24_8_LINEAR;
- drb->Base.GetValues = radeonReadStencilPixels_24_8_LINEAR;
- drb->Base.PutRow = radeonWriteStencilSpan_24_8_LINEAR;
- drb->Base.PutMonoRow = radeonWriteMonoStencilSpan_24_8_LINEAR;
- drb->Base.PutValues = radeonWriteStencilPixels_24_8_LINEAR;
- drb->Base.PutMonoValues = NULL;
+ radeonInitStencilPointers_24_8_LINEAR(&drb->Base);
}
}
diff --git a/src/mesa/drivers/dri/r300/radeon_state.c b/src/mesa/drivers/dri/r300/radeon_state.c
index 0cacbb5ebf..7b64b34ed1 100644
--- a/src/mesa/drivers/dri/r300/radeon_state.c
+++ b/src/mesa/drivers/dri/r300/radeon_state.c
@@ -229,9 +229,6 @@ void radeonInitState(radeonContextPtr radeon)
radeon->state.color.drawOffset = radeon->radeonScreen->frontOffset;
radeon->state.color.drawPitch = radeon->radeonScreen->frontPitch;
}
-
- radeon->state.pixel.readOffset = radeon->state.color.drawOffset;
- radeon->state.pixel.readPitch = radeon->state.color.drawPitch;
}