glx: queue full redraws for the first 2 frames

To consider that we've see a number of drivers that can struggle to get
going and may produce a bad first frame we now force the first 2 frames
to be full redraws. This became a serious issue after we started using
clipped redraws more aggressively because we assumed that after the
first frame the full framebuffer was valid and we only redraw the
content that changes. With buggy drivers though, applications would be
left with junk covering a lot of the stage until some event triggered a
full redraw.
This commit is contained in:
Robert Bragg 2010-09-08 01:18:30 +01:00
parent 771348b369
commit 1e7f22db3b
2 changed files with 10 additions and 0 deletions

View File

@ -527,6 +527,9 @@ _clutter_stage_glx_redraw (ClutterStageGLX *stage_glx,
if (G_LIKELY (backend_glx->can_blit_sub_buffer) && if (G_LIKELY (backend_glx->can_blit_sub_buffer) &&
/* NB: a degenerate redraw clip width == full stage redraw */ /* NB: a degenerate redraw clip width == full stage redraw */
stage_glx->bounding_redraw_clip.width != 0 && stage_glx->bounding_redraw_clip.width != 0 &&
/* some drivers struggle to get going and produce some junk
* frames when starting up... */
G_LIKELY (stage_glx->frame_count > 3) &&
/* While resizing a window clipped redraws are disabled to avoid /* While resizing a window clipped redraws are disabled to avoid
* artefacts. See clutter-event-x11.c:event_translate for a * artefacts. See clutter-event-x11.c:event_translate for a
* detailed explanation */ * detailed explanation */
@ -739,5 +742,7 @@ _clutter_stage_glx_redraw (ClutterStageGLX *stage_glx,
/* reset the redraw clipping for the next paint... */ /* reset the redraw clipping for the next paint... */
stage_glx->initialized_redraw_clip = FALSE; stage_glx->initialized_redraw_clip = FALSE;
stage_glx->frame_count++;
} }

View File

@ -53,6 +53,11 @@ struct _ClutterStageGLX
GLXPixmap glxpixmap; GLXPixmap glxpixmap;
GLXWindow glxwin; GLXWindow glxwin;
/* We only enable clipped redraws after 2 frames, since we've seen
* a lot of drivers can struggle to get going and may output some
* junk frames to start with. */
unsigned long frame_count;
gboolean initialized_redraw_clip; gboolean initialized_redraw_clip;
ClutterGeometry bounding_redraw_clip; ClutterGeometry bounding_redraw_clip;
}; };