intel / DRI2: Additional flush of fake front-buffer to real front-buffer

To maintain correctness, the server will copy the real front-buffer to
a newly allocated fake front-buffer in DRI2GetBuffersWithFormat.
However, if the DRI2GetBuffersWithFormat is triggered by glViewport,
this will copy stale data into the new buffer.  Fix this by flushing
the current fake front-buffer to the real front-buffer in
intel_viewport.

Fixes bug #22288.
This commit is contained in:
Ian Romanick
2009-06-26 13:30:16 -07:00
parent 077a06c140
commit 2d86503471
@@ -71,6 +71,8 @@ int INTEL_DEBUG = (0);
#define DRIVER_DATE_GEM "GEM " DRIVER_DATE
static void intel_flush(GLcontext *ctx, GLboolean needs_mi_flush);
static const GLubyte *
intelGetString(GLcontext * ctx, GLenum name)
{
@@ -395,6 +397,15 @@ intel_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
return;
if (!intel->internal_viewport_call && ctx->DrawBuffer->Name == 0) {
/* If we're rendering to the fake front buffer, make sure all the pending
* drawing has landed on the real front buffer. Otherwise when we
* eventually get to DRI2GetBuffersWithFormat the stale real front
* buffer contents will get copied to the new fake front buffer.
*/
if (intel->is_front_buffer_rendering) {
intel_flush(ctx, GL_FALSE);
}
intel_update_renderbuffers(driContext, driContext->driDrawablePriv);
if (driContext->driDrawablePriv != driContext->driReadablePriv)
intel_update_renderbuffers(driContext, driContext->driReadablePriv);