summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/r300/r300_state.c89
-rw-r--r--src/mesa/drivers/dri/r300/r300_state.h1
-rw-r--r--src/mesa/drivers/dri/r300/r300_texstate.c1
-rw-r--r--src/mesa/drivers/dri/r300/radeon_context.c2
-rw-r--r--src/mesa/drivers/dri/r300/radeon_lock.c5
5 files changed, 97 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c
index 0987735b505..975213d99d6 100644
--- a/src/mesa/drivers/dri/r300/r300_state.c
+++ b/src/mesa/drivers/dri/r300/r300_state.c
@@ -67,6 +67,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r300_tex.h"
#include "r300_maos.h"
+#include "drirenderbuffer.h"
+
static void r300AlphaFunc(GLcontext * ctx, GLenum func, GLfloat ref)
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
@@ -826,7 +828,7 @@ static void r300ClearStencil(GLcontext * ctx, GLint s)
#define SUBPIXEL_X 0.125
#define SUBPIXEL_Y 0.125
-static void r300UpdateWindow(GLcontext * ctx)
+void r300UpdateWindow(GLcontext * ctx)
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
__DRIdrawablePrivate *dPriv = rmesa->radeon.dri.drawable;
@@ -868,6 +870,88 @@ static void r300DepthRange(GLcontext * ctx, GLclampd nearval, GLclampd farval)
r300UpdateWindow(ctx);
}
+void r300UpdateViewportOffset( GLcontext *ctx )
+{
+ r300ContextPtr rmesa = R300_CONTEXT(ctx);
+ __DRIdrawablePrivate *dPriv = ((radeonContextPtr)rmesa)->dri.drawable;
+ GLfloat xoffset = (GLfloat)dPriv->x;
+ GLfloat yoffset = (GLfloat)dPriv->y + dPriv->h;
+ const GLfloat *v = ctx->Viewport._WindowMap.m;
+
+ GLfloat tx = v[MAT_TX] + xoffset + SUBPIXEL_X;
+ GLfloat ty = (- v[MAT_TY]) + yoffset + SUBPIXEL_Y;
+
+ if ( rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] != *(GLuint *)&tx ||
+ rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] != *(GLuint *)&ty )
+ {
+ /* Note: this should also modify whatever data the context reset
+ * code uses...
+ */
+ rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] = *(GLuint *)&tx;
+ rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] = *(GLuint *)&ty;
+
+ }
+
+ radeonUpdateScissor( ctx );
+}
+
+/**
+ * Tell the card where to render (offset, pitch).
+ * Effected by glDrawBuffer, etc
+ */
+void
+r300UpdateDrawBuffer(GLcontext *ctx)
+{
+ r300ContextPtr rmesa = R300_CONTEXT(ctx);
+ r300ContextPtr r300 = rmesa;
+ struct gl_framebuffer *fb = ctx->DrawBuffer;
+ driRenderbuffer *drb;
+
+ if (fb->_ColorDrawBufferMask[0] == BUFFER_BIT_FRONT_LEFT) {
+ /* draw to front */
+ drb = (driRenderbuffer *) fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer;
+ }
+ else if (fb->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT) {
+ /* draw to back */
+ drb = (driRenderbuffer *) fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer;
+ }
+ else {
+ /* drawing to multiple buffers, or none */
+ return;
+ }
+
+ assert(drb);
+ assert(drb->flippedPitch);
+
+
+ R300_STATECHANGE( rmesa, cb );
+
+ r300->hw.cb.cmd[R300_CB_OFFSET] = drb->flippedOffset + //r300->radeon.state.color.drawOffset +
+ r300->radeon.radeonScreen->fbLocation;
+ r300->hw.cb.cmd[R300_CB_PITCH] = drb->flippedPitch;//r300->radeon.state.color.drawPitch;
+
+ if (r300->radeon.radeonScreen->cpp == 4)
+ r300->hw.cb.cmd[R300_CB_PITCH] |= R300_COLOR_FORMAT_ARGB8888;
+ else
+ r300->hw.cb.cmd[R300_CB_PITCH] |= R300_COLOR_FORMAT_RGB565;
+
+ if (r300->radeon.sarea->tiling_enabled)
+ r300->hw.cb.cmd[R300_CB_PITCH] |= R300_COLOR_TILE_ENABLE;
+#if 0
+ R200_STATECHANGE( rmesa, ctx );
+
+ /* Note: we used the (possibly) page-flipped values */
+ rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET]
+ = ((drb->flippedOffset + rmesa->r200Screen->fbLocation)
+ & R200_COLOROFFSET_MASK);
+ rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = drb->flippedPitch;
+
+ if (rmesa->sarea->tiling_enabled) {
+ rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] |= R200_COLOR_TILE_ENABLE;
+ }
+#endif
+}
+
/* =============================================================
* Polygon state
*/
@@ -1908,6 +1992,9 @@ static void r300InvalidateState(GLcontext * ctx, GLuint new_state)
_tnl_InvalidateState(ctx, new_state);
_ae_invalidate_state(ctx, new_state);
+ if (new_state & (_NEW_BUFFERS | _NEW_COLOR | _NEW_PIXEL)) {
+ r300UpdateDrawBuffer(ctx);
+ }
#ifndef CB_DPATH
/* Go inefficiency! */
r300ResetHwState(r300);
diff --git a/src/mesa/drivers/dri/r300/r300_state.h b/src/mesa/drivers/dri/r300/r300_state.h
index 9564c0716cb..9262a14bc4f 100644
--- a/src/mesa/drivers/dri/r300/r300_state.h
+++ b/src/mesa/drivers/dri/r300/r300_state.h
@@ -63,6 +63,7 @@ extern void r300ResetHwState(r300ContextPtr r300);
extern void r300InitState(r300ContextPtr r300);
extern void r300InitStateFuncs(struct dd_function_table* functions);
+extern void r300UpdateWindow(GLcontext * ctx);
extern void r300SetupVertexShader(r300ContextPtr rmesa);
extern void r300SetupPixelShader(r300ContextPtr rmesa);
diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c
index 0c45ce56123..1bbe2486d91 100644
--- a/src/mesa/drivers/dri/r300/r300_texstate.c
+++ b/src/mesa/drivers/dri/r300/r300_texstate.c
@@ -300,6 +300,7 @@ static void r300SetTexImages(r300ContextPtr rmesa,
/* Setup remaining cube face blits, if needed */
if (tObj->Target == GL_TEXTURE_CUBE_MAP) {
+ WARN_ONCE("Cube map faces arent currently correctly positioned.\n");
/* Round totalSize up to multiple of BLIT_WIDTH_BYTES */
const GLuint faceSize =
(t->base.totalSize + BLIT_WIDTH_BYTES - 1)
diff --git a/src/mesa/drivers/dri/r300/radeon_context.c b/src/mesa/drivers/dri/r300/radeon_context.c
index c045e80602f..b2abbaf7a68 100644
--- a/src/mesa/drivers/dri/r300/radeon_context.c
+++ b/src/mesa/drivers/dri/r300/radeon_context.c
@@ -260,6 +260,8 @@ GLboolean radeonMakeCurrent(__DRIcontextPrivate * driContextPriv,
radeon->vblank_flags);
radeon->dri.drawable = driDrawPriv;
+ r300UpdateWindow(radeon->glCtx);
+ r300UpdateViewportOffset(radeon->glCtx);
#if R200_MERGED
if (IS_R200_CLASS(radeon->radeonScreen)) {
r200UpdateWindow(radeon->glCtx);
diff --git a/src/mesa/drivers/dri/r300/radeon_lock.c b/src/mesa/drivers/dri/r300/radeon_lock.c
index 2af38909bc2..2209d890033 100644
--- a/src/mesa/drivers/dri/r300/radeon_lock.c
+++ b/src/mesa/drivers/dri/r300/radeon_lock.c
@@ -125,7 +125,12 @@ static void r300RegainedLock(radeonContextPtr radeon)
else
radeonSetCliprects(radeon, GL_FRONT_LEFT);
+#if 1
+ r300UpdateViewportOffset( radeon->glCtx );
+ driUpdateFramebufferSize(radeon->glCtx, dPriv);
+#else
radeonUpdateScissor(radeon->glCtx);
+#endif
radeon->lastStamp = dPriv->lastStamp;
}