summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/r200/r200_ioctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri/r200/r200_ioctl.c')
-rw-r--r--src/mesa/drivers/dri/r200/r200_ioctl.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.c b/src/mesa/drivers/dri/r200/r200_ioctl.c
index 5d084baf3e..fb462e0850 100644
--- a/src/mesa/drivers/dri/r200/r200_ioctl.c
+++ b/src/mesa/drivers/dri/r200/r200_ioctl.c
@@ -132,6 +132,19 @@ int r200FlushCmdBufLocked( r200ContextPtr rmesa, const char * caller )
rmesa->store.statenr = 0;
rmesa->store.cmd_used = 0;
rmesa->dma.nr_released_bufs = 0;
+ /* Set lost_context so that the first state emit on the new buffer is a full
+ * one. This is because the context might get lost while preparing the next
+ * buffer, and when we lock and find out, we don't have the information to
+ * recreate the state. This function should always be called before the new
+ * buffer is begun, so it's sufficient to just set lost_context here.
+ *
+ * The alternative to this would be to copy out the state on unlock
+ * (approximately) and if we did lose the context, dispatch a cmdbuf to reset
+ * the state to that old copy before continuing with the accumulated command
+ * buffer.
+ */
+ rmesa->lost_context = 1;
+
return ret;
}
@@ -563,9 +576,6 @@ static void r200Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
return;
}
- /* Need to cope with lostcontext here as kernel relies on
- * some residual state:
- */
R200_FIREVERTICES( rmesa );
if ( mask & DD_FRONT_LEFT_BIT ) {
@@ -603,6 +613,13 @@ static void r200Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
cx += dPriv->x;
cy = dPriv->y + dPriv->h - cy - ch;
+ /* We have to emit state along with the clear, since the kernel relies on
+ * some of it. The EmitState that was above R200_FIREVERTICES was an
+ * attempt to do that, except that another context may come in and cause us
+ * to lose our context while we're unlocked.
+ */
+ r200EmitState( rmesa );
+
LOCK_HARDWARE( rmesa );
/* Throttle the number of clear ioctls we do.
@@ -635,6 +652,8 @@ static void r200Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
}
}
+ /* Send current state to the hardware */
+ r200FlushCmdBufLocked( rmesa, __FUNCTION__ );
for ( i = 0 ; i < dPriv->numClipRects ; ) {
GLint nr = MIN2( i + RADEON_NR_SAREA_CLIPRECTS, dPriv->numClipRects );