summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2007-07-11 17:01:30 +0100
committerKeith Whitwell <[email protected]>2007-07-11 17:01:30 +0100
commit20cf13e03b1703937b4228aba8355b34d664aafb (patch)
treee1ae513db5f98028291bf3d43ab2b6eea8db4582 /src
parentfb67b1609e211ed16828e10ffc1c36e54f655112 (diff)
Fix screen corruption on resize.
Move buffer resize check to immediately after swapbuffers. Update cliprects inside the locked region of swapbuffers.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_blit.c13
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_buffers.c95
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_context.c11
3 files changed, 17 insertions, 102 deletions
diff --git a/src/mesa/drivers/dri/i915tex/intel_blit.c b/src/mesa/drivers/dri/i915tex/intel_blit.c
index d6651f62be1..c755eac6b2c 100644
--- a/src/mesa/drivers/dri/i915tex/intel_blit.c
+++ b/src/mesa/drivers/dri/i915tex/intel_blit.c
@@ -79,6 +79,13 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv,
*/
LOCK_HARDWARE(intel);
+ if (intel->revalidateDrawable) {
+ __DRIscreenPrivate *sPriv = intel->driScreen;
+ if (dPriv) {
+ DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);
+ }
+ }
+
if (dPriv && dPriv->numClipRects) {
struct intel_framebuffer *intel_fb = dPriv->driverPrivate;
const struct intel_region *frontRegion
@@ -171,6 +178,12 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv,
}
UNLOCK_HARDWARE(intel);
+
+ if (intel->revalidateDrawable) {
+ intel->revalidateDrawable = GL_FALSE;
+ intelWindowMoved(intel);
+ }
+
}
diff --git a/src/mesa/drivers/dri/i915tex/intel_buffers.c b/src/mesa/drivers/dri/i915tex/intel_buffers.c
index 67f992e4a21..5aed3ad0ecc 100644
--- a/src/mesa/drivers/dri/i915tex/intel_buffers.c
+++ b/src/mesa/drivers/dri/i915tex/intel_buffers.c
@@ -162,60 +162,12 @@ intelSetPrivbufClipRects(struct intel_context *intel)
intel->fakeClipRect.y1 = 0;
intel->fakeClipRect.x2 = dPriv->w;
intel->fakeClipRect.y2 = dPriv->h;
- intel->pClipRects = &intel->fakeClipRect;
intel->numClipRects = 1;
+ intel->pClipRects = &intel->fakeClipRect;
intel->drawX = 0;
intel->drawY = 0;
}
-/**
- * As above, but for rendering to front buffer of a window.
- * \sa intelSetRenderbufferClipRects
- */
-static void
-intelSetFrontClipRects(struct intel_context *intel)
-{
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
-
- if (!dPriv)
- return;
-
- intel->numClipRects = dPriv->numClipRects;
- intel->pClipRects = dPriv->pClipRects;
- intel->drawX = dPriv->x;
- intel->drawY = dPriv->y;
-}
-
-
-/**
- * As above, but for rendering to back buffer of a window.
- */
-static void
-intelSetBackClipRects(struct intel_context *intel)
-{
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- struct intel_framebuffer *intel_fb;
-
- if (!dPriv)
- return;
-
- intel_fb = dPriv->driverPrivate;
-
- if (intel_fb->pf_active || dPriv->numBackClipRects == 0) {
- /* use the front clip rects */
- intel->numClipRects = dPriv->numClipRects;
- intel->pClipRects = dPriv->pClipRects;
- intel->drawX = dPriv->x;
- intel->drawY = dPriv->y;
- }
- else {
- /* use the back clip rects */
- intel->numClipRects = dPriv->numBackClipRects;
- intel->pClipRects = dPriv->pBackClipRects;
- intel->drawX = dPriv->backX;
- intel->drawY = dPriv->backY;
- }
-}
/**
@@ -231,27 +183,10 @@ intelWindowMoved(struct intel_context *intel)
if (!intel->ctx.DrawBuffer) {
/* when would this happen? -BP */
- intelSetFrontClipRects(intel);
- }
- else if (1 || intel->ctx.DrawBuffer->Name != 0) {
- /* drawing to user-created FBO - do nothing */
- /* Cliprects would be set from intelDrawBuffer() */
- }
- else {
- /* drawing to a window */
- switch (intel_fb->Base._ColorDrawBufferMask[0]) {
- case BUFFER_BIT_FRONT_LEFT:
- intelSetFrontClipRects(intel);
- break;
- case BUFFER_BIT_BACK_LEFT:
- intelSetBackClipRects(intel);
- break;
- default:
- /* glDrawBuffer(GL_NONE or GL_FRONT_AND_BACK): software fallback */
- intelSetFrontClipRects(intel);
- }
+ intel->numClipRects = 0;
}
+
if (intel->intelScreen->driScrnPriv->ddxMinor >= 7) {
drmI830Sarea *sarea = intel->sarea;
drm_clip_rect_t drw_rect = { .x1 = dPriv->x, .x2 = dPriv->x + dPriv->w,
@@ -957,23 +892,6 @@ intelSwapBuffers(__DRIdrawablePrivate * dPriv)
intel_fb->swap_ust = ust;
}
- if (intel->revalidateDrawable) {
- __DRIscreenPrivate *sPriv = intel->driScreen;
- LOCK_HARDWARE(intel);
- DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);
- intel->revalidateDrawable = GL_FALSE;
- UNLOCK_HARDWARE(intel);
- if (dPriv && intel->lastStamp != dPriv->lastStamp) {
- /* XXX this doesn't appear to work quite right.
- And in any case, it will never get called with single buffered
- rendering here...
- And if it's only a window move (not resize), don't need to do anything. */
- if (INTEL_DEBUG & DEBUG_LOCK)
- _mesa_printf("doing defered drawable update\n");
- intelWindowMoved(intel);
- intel->lastStamp = dPriv->lastStamp;
- }
- }
}
else {
/* XXX this shouldn't be an error but we can't handle it for now */
@@ -1061,12 +979,7 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb)
/*
* How many color buffers are we drawing into?
*/
- if (fb->_NumColorDrawBuffers[0] != 1
-#if 0
- /* XXX FBO temporary - always use software rendering */
- || 1
-#endif
- ) {
+ if (fb->_NumColorDrawBuffers[0] != 1) {
/* writing to 0 or 2 or 4 color buffers */
/*_mesa_debug(ctx, "Software rendering\n");*/
FALLBACK(intel, INTEL_FALLBACK_DRAW_BUFFER, GL_TRUE);
diff --git a/src/mesa/drivers/dri/i915tex/intel_context.c b/src/mesa/drivers/dri/i915tex/intel_context.c
index aa2078e762a..531b4adde80 100644
--- a/src/mesa/drivers/dri/i915tex/intel_context.c
+++ b/src/mesa/drivers/dri/i915tex/intel_context.c
@@ -727,17 +727,6 @@ intelContendedLock(struct intel_context *intel, GLuint flags)
intel->current_rotation = sarea->rotation;
}
#endif
-
-#if 0
- /* Drawable changed?
- */
- if (dPriv && intel->lastStamp != dPriv->lastStamp) {
- if (INTEL_DEBUG & DEBUG_LOCK)
- _mesa_printf("drawable change detected but defering update\n");
-/* intelWindowMoved(intel);
- intel->lastStamp = dPriv->lastStamp;*/
- }
-#endif
}