From 1e7f22db3b7cdf9c8154ec7c3ae7cb9b83ac0655 Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Wed, 8 Sep 2010 01:18:30 +0100 Subject: [PATCH] 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. --- clutter/glx/clutter-stage-glx.c | 5 +++++ clutter/glx/clutter-stage-glx.h | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/clutter/glx/clutter-stage-glx.c b/clutter/glx/clutter-stage-glx.c index 2c49a9ef2..d22ca99df 100644 --- a/clutter/glx/clutter-stage-glx.c +++ b/clutter/glx/clutter-stage-glx.c @@ -527,6 +527,9 @@ _clutter_stage_glx_redraw (ClutterStageGLX *stage_glx, if (G_LIKELY (backend_glx->can_blit_sub_buffer) && /* NB: a degenerate redraw clip width == full stage redraw */ 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 * artefacts. See clutter-event-x11.c:event_translate for a * detailed explanation */ @@ -739,5 +742,7 @@ _clutter_stage_glx_redraw (ClutterStageGLX *stage_glx, /* reset the redraw clipping for the next paint... */ stage_glx->initialized_redraw_clip = FALSE; + + stage_glx->frame_count++; } diff --git a/clutter/glx/clutter-stage-glx.h b/clutter/glx/clutter-stage-glx.h index a7347f8ca..bc81f0baa 100644 --- a/clutter/glx/clutter-stage-glx.h +++ b/clutter/glx/clutter-stage-glx.h @@ -53,6 +53,11 @@ struct _ClutterStageGLX GLXPixmap glxpixmap; 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; ClutterGeometry bounding_redraw_clip; };