summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_buffers.c6
-rw-r--r--src/mesa/drivers/dri/r200/r200_context.c6
-rw-r--r--src/mesa/drivers/dri/r200/r200_lock.c6
-rw-r--r--src/mesa/drivers/dri/r200/r200_state.c37
-rw-r--r--src/mesa/drivers/dri/r200/r200_state.h2
-rw-r--r--src/mesa/drivers/dri/r300/r300_cmdbuf.c3
-rw-r--r--src/mesa/drivers/dri/r300/r300_ioctl.c6
-rw-r--r--src/mesa/drivers/dri/r300/r300_reg.h7
-rw-r--r--src/mesa/drivers/dri/r300/r300_render.c12
-rw-r--r--src/mesa/drivers/dri/r300/radeon_mm.c2
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_context.c10
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_lock.c1
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_state.c2
13 files changed, 59 insertions, 41 deletions
diff --git a/src/mesa/drivers/dri/i915tex/intel_buffers.c b/src/mesa/drivers/dri/i915tex/intel_buffers.c
index 45fd2fa8de0..62ff54b0075 100644
--- a/src/mesa/drivers/dri/i915tex/intel_buffers.c
+++ b/src/mesa/drivers/dri/i915tex/intel_buffers.c
@@ -327,6 +327,9 @@ intelWindowMoved(struct intel_context *intel)
}
for (i = 0; i < intel_fb->pf_num_pages; i++) {
+ if (!intel_fb->color_rb[i])
+ continue;
+
vbl.request.sequence = intel_fb->color_rb[i]->vbl_pending;
drmWaitVBlank(intel->driFd, &vbl);
}
@@ -336,7 +339,8 @@ intelWindowMoved(struct intel_context *intel)
intel_fb->vbl_waited = intel_fb->vbl_seq;
for (i = 0; i < intel_fb->pf_num_pages; i++) {
- intel_fb->color_rb[i]->vbl_pending = intel_fb->vbl_waited;
+ if (intel_fb->color_rb[i])
+ intel_fb->color_rb[i]->vbl_pending = intel_fb->vbl_waited;
}
}
} else {
diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c
index fc6eb93daa8..3abcdf9e183 100644
--- a/src/mesa/drivers/dri/r200/r200_context.c
+++ b/src/mesa/drivers/dri/r200/r200_context.c
@@ -673,11 +673,13 @@ r200MakeCurrent( __DRIcontextPrivate *driContextPriv,
&newCtx->vbl_seq );
}
+ newCtx->dri.readable = driReadPriv;
+
if ( newCtx->dri.drawable != driDrawPriv ||
- newCtx->dri.readable != driReadPriv ) {
+ newCtx->lastStamp != driDrawPriv->lastStamp ) {
newCtx->dri.drawable = driDrawPriv;
- newCtx->dri.readable = driReadPriv;
+ r200SetCliprects(newCtx);
r200UpdateWindow( newCtx->glCtx );
r200UpdateViewportOffset( newCtx->glCtx );
}
diff --git a/src/mesa/drivers/dri/r200/r200_lock.c b/src/mesa/drivers/dri/r200/r200_lock.c
index bcc0c916396..9ffdb2b2127 100644
--- a/src/mesa/drivers/dri/r200/r200_lock.c
+++ b/src/mesa/drivers/dri/r200/r200_lock.c
@@ -92,13 +92,9 @@ void r200GetLock( r200ContextPtr rmesa, GLuint flags )
if ( rmesa->lastStamp != drawable->lastStamp ) {
r200UpdatePageFlipping( rmesa );
- if (rmesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT)
- r200SetCliprects( rmesa, GL_BACK_LEFT );
- else
- r200SetCliprects( rmesa, GL_FRONT_LEFT );
+ r200SetCliprects( rmesa );
r200UpdateViewportOffset( rmesa->glCtx );
driUpdateFramebufferSize(rmesa->glCtx, drawable);
- rmesa->lastStamp = drawable->lastStamp;
}
R200_STATECHANGE( rmesa, ctx );
diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c
index bdb487f2b93..16726d7d55a 100644
--- a/src/mesa/drivers/dri/r200/r200_state.c
+++ b/src/mesa/drivers/dri/r200/r200_state.c
@@ -1691,6 +1691,11 @@ static void r200ClearStencil( GLcontext *ctx, GLint s )
#define SUBPIXEL_X 0.125
#define SUBPIXEL_Y 0.125
+
+/**
+ * Called when window size or position changes or viewport or depth range
+ * state is changed. We update the hardware viewport state here.
+ */
void r200UpdateWindow( GLcontext *ctx )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
@@ -1843,19 +1848,18 @@ static void r200LogicOpCode( GLcontext *ctx, GLenum opcode )
}
-void r200SetCliprects( r200ContextPtr rmesa, GLenum mode )
+/*
+ * Set up the cliprects for either front or back-buffer drawing.
+ */
+void r200SetCliprects( r200ContextPtr rmesa )
{
__DRIdrawablePrivate *const drawable = rmesa->dri.drawable;
__DRIdrawablePrivate *const readable = rmesa->dri.readable;
GLframebuffer *const draw_fb = (GLframebuffer*) drawable->driverPrivate;
GLframebuffer *const read_fb = (GLframebuffer*) readable->driverPrivate;
- switch ( mode ) {
- case GL_FRONT_LEFT:
- rmesa->numClipRects = drawable->numClipRects;
- rmesa->pClipRects = drawable->pClipRects;
- break;
- case GL_BACK_LEFT:
+ if (draw_fb->_ColorDrawBufferMask[0]
+ == BUFFER_BIT_BACK_LEFT) {
/* Can't ignore 2d windows if we are page flipping.
*/
if ( drawable->numBackClipRects == 0 || rmesa->doPageFlip ) {
@@ -1866,11 +1870,12 @@ void r200SetCliprects( r200ContextPtr rmesa, GLenum mode )
rmesa->numClipRects = drawable->numBackClipRects;
rmesa->pClipRects = drawable->pBackClipRects;
}
- break;
- default:
- fprintf(stderr, "bad mode in r200SetCliprects\n");
- return;
}
+ else {
+ /* front buffer (or none, or multiple buffers) */
+ rmesa->numClipRects = drawable->numClipRects;
+ rmesa->pClipRects = drawable->pClipRects;
+ }
if ((draw_fb->Width != drawable->w) || (draw_fb->Height != drawable->h)) {
_mesa_resize_framebuffer(rmesa->glCtx, draw_fb,
@@ -1889,6 +1894,8 @@ void r200SetCliprects( r200ContextPtr rmesa, GLenum mode )
if (rmesa->state.scissor.enabled)
r200RecalcScissorRects( rmesa );
+
+ rmesa->lastStamp = drawable->lastStamp;
}
@@ -1908,19 +1915,17 @@ static void r200DrawBuffer( GLcontext *ctx, GLenum mode )
*/
switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
case BUFFER_BIT_FRONT_LEFT:
- FALLBACK( rmesa, R200_FALLBACK_DRAW_BUFFER, GL_FALSE );
- r200SetCliprects( rmesa, GL_FRONT_LEFT );
- break;
case BUFFER_BIT_BACK_LEFT:
FALLBACK( rmesa, R200_FALLBACK_DRAW_BUFFER, GL_FALSE );
- r200SetCliprects( rmesa, GL_BACK_LEFT );
break;
default:
- /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
+ /* 0 (GL_NONE) buffers or multiple color drawing buffers */
FALLBACK( rmesa, R200_FALLBACK_DRAW_BUFFER, GL_TRUE );
return;
}
+ r200SetCliprects( rmesa );
+
/* We'll set the drawing engine's offset/pitch parameters later
* when we update other state.
*/
diff --git a/src/mesa/drivers/dri/r200/r200_state.h b/src/mesa/drivers/dri/r200/r200_state.h
index 98c6fbe40bb..f34090b619b 100644
--- a/src/mesa/drivers/dri/r200/r200_state.h
+++ b/src/mesa/drivers/dri/r200/r200_state.h
@@ -44,7 +44,7 @@ extern void r200InitTnlFuncs( GLcontext *ctx );
extern void r200UpdateMaterial( GLcontext *ctx );
-extern void r200SetCliprects( r200ContextPtr rmesa, GLenum mode );
+extern void r200SetCliprects( r200ContextPtr rmesa );
extern void r200RecalcScissorRects( r200ContextPtr rmesa );
extern void r200UpdateViewportOffset( GLcontext *ctx );
extern void r200UpdateWindow( GLcontext *ctx );
diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c
index 89725447f1d..e4511e0c21c 100644
--- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c
+++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c
@@ -174,11 +174,12 @@ static __inline__ void r300DoEmitState(r300ContextPtr r300, GLboolean dirty)
dest ++;
r300->cmdbuf.count_used ++;
+ /* Emit cache flush */
*dest = cmdpacket0(R300_TX_CNTL, 1);
dest ++;
r300->cmdbuf.count_used ++;
- *dest = 0x0;
+ *dest = R300_TX_FLUSH;
dest ++;
r300->cmdbuf.count_used ++;
diff --git a/src/mesa/drivers/dri/r300/r300_ioctl.c b/src/mesa/drivers/dri/r300/r300_ioctl.c
index 6fa34ee482a..f0741f978d4 100644
--- a/src/mesa/drivers/dri/r300/r300_ioctl.c
+++ b/src/mesa/drivers/dri/r300/r300_ioctl.c
@@ -162,11 +162,11 @@ static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer)
cmd2[8].u = r300PackFloat32(ctx->Color.ClearColor[3]);
reg_start(R300_RB3D_DSTCACHE_CTLSTAT,0);
- e32(0x0000000a);
+ e32(R300_RB3D_DSTCACHE_0A);
- reg_start(0x4f18,0);
- e32(0x00000003);
+ reg_start(R300_RB3D_ZCACHE_CTLSTAT,0);
+ e32(R300_RB3D_ZCACHE_CTLSTAT_03);
cp_wait(rmesa, R300_WAIT_3D | R300_WAIT_3D_CLEAN);
}
diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h
index 7bc832c871c..f9accadf61c 100644
--- a/src/mesa/drivers/dri/r300/r300_reg.h
+++ b/src/mesa/drivers/dri/r300/r300_reg.h
@@ -497,6 +497,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
/* Zero to flush caches. */
#define R300_TX_CNTL 0x4100
+#define R300_TX_FLUSH 0x0
/* The upper enable bits are guessed, based on fglrx reported limits. */
#define R300_TX_ENABLE 0x4104
@@ -1395,6 +1396,12 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
/* gap */
+#define R300_RB3D_ZCACHE_CTLSTAT 0x4F18 /* GUESS */
+# define R300_RB3D_ZCACHE_CTLSTAT_01 0x1
+# define R300_RB3D_ZCACHE_CTLSTAT_03 0x3
+
+/* gap */
+
#define R300_RB3D_DEPTHOFFSET 0x4F20
#define R300_RB3D_DEPTHPITCH 0x4F24
# define R300_DEPTHPITCH_MASK 0x00001FF8 /* GUESS */
diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c
index 211c451f661..659ec3ff54c 100644
--- a/src/mesa/drivers/dri/r300/r300_render.c
+++ b/src/mesa/drivers/dri/r300/r300_render.c
@@ -344,10 +344,10 @@ GLboolean r300_run_vb_render(GLcontext *ctx,
r300UpdateShaderStates(rmesa);
reg_start(R300_RB3D_DSTCACHE_CTLSTAT,0);
- e32(0x0000000a);
+ e32(R300_RB3D_DSTCACHE_0A);
- reg_start(0x4f18,0);
- e32(0x00000003);
+ reg_start(R300_RB3D_ZCACHE_CTLSTAT,0);
+ e32(R300_RB3D_ZCACHE_CTLSTAT_03);
r300EmitState(rmesa);
@@ -360,10 +360,10 @@ GLboolean r300_run_vb_render(GLcontext *ctx,
}
reg_start(R300_RB3D_DSTCACHE_CTLSTAT,0);
- e32(0x0000000a/*0x2*/);
+ e32(R300_RB3D_DSTCACHE_0A /*R300_RB3D_DSTCACHE_02*/);
- reg_start(0x4f18,0);
- e32(0x00000003/*0x1*/);
+ reg_start(R300_RB3D_ZCACHE_CTLSTAT,0);
+ e32(R300_RB3D_ZCACHE_CTLSTAT_03 /*R300_RB3D_ZCACHE_CTLSTAT_01*/);
#ifdef USER_BUFFERS
r300UseArrays(ctx);
diff --git a/src/mesa/drivers/dri/r300/radeon_mm.c b/src/mesa/drivers/dri/r300/radeon_mm.c
index 32ed1f43939..065f288e4ca 100644
--- a/src/mesa/drivers/dri/r300/radeon_mm.c
+++ b/src/mesa/drivers/dri/r300/radeon_mm.c
@@ -284,7 +284,7 @@ static void emit_lin_cp(r300ContextPtr rmesa, unsigned long dst, unsigned long s
}
reg_start(R300_RB3D_DSTCACHE_CTLSTAT,0);
- e32(0x0000000a);
+ e32(R300_RB3D_DSTCACHE_0A);
reg_start(0x342c,0);
e32(0x00000005);
diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c
index 6bc2c4aa5c5..0d25951b648 100644
--- a/src/mesa/drivers/dri/radeon/radeon_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_context.c
@@ -594,12 +594,14 @@ radeonMakeCurrent( __DRIcontextPrivate *driContextPriv,
driDrawableInitVBlank( driDrawPriv, newCtx->vblank_flags,
&newCtx->vbl_seq );
}
-
- if ( (newCtx->dri.drawable != driDrawPriv)
- || (newCtx->dri.readable != driReadPriv) ) {
+
+ newCtx->dri.readable = driReadPriv;
+
+ if ( (newCtx->dri.drawable != driDrawPriv) ||
+ newCtx->lastStamp != driDrawPriv->lastStamp ) {
newCtx->dri.drawable = driDrawPriv;
- newCtx->dri.readable = driReadPriv;
+ radeonSetCliprects(newCtx);
radeonUpdateWindow( newCtx->glCtx );
radeonUpdateViewportOffset( newCtx->glCtx );
}
diff --git a/src/mesa/drivers/dri/radeon/radeon_lock.c b/src/mesa/drivers/dri/radeon/radeon_lock.c
index e6ab6af4562..cdf8a19fb13 100644
--- a/src/mesa/drivers/dri/radeon/radeon_lock.c
+++ b/src/mesa/drivers/dri/radeon/radeon_lock.c
@@ -96,7 +96,6 @@ void radeonGetLock( radeonContextPtr rmesa, GLuint flags )
radeonSetCliprects( rmesa );
radeonUpdateViewportOffset( rmesa->glCtx );
driUpdateFramebufferSize(rmesa->glCtx, drawable);
- rmesa->lastStamp = drawable->lastStamp;
}
RADEON_STATECHANGE( rmesa, ctx );
diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c
index e19202fa443..4de05c7697d 100644
--- a/src/mesa/drivers/dri/radeon/radeon_state.c
+++ b/src/mesa/drivers/dri/radeon/radeon_state.c
@@ -1675,6 +1675,8 @@ void radeonSetCliprects( radeonContextPtr rmesa )
if (rmesa->state.scissor.enabled)
radeonRecalcScissorRects( rmesa );
+
+ rmesa->lastStamp = drawable->lastStamp;
}