From f822604e3ea376d211319c45ff81ae8e709d8eea Mon Sep 17 00:00:00 2001From: Robert Bragg <robert@linux.intel.com>Date: Tue, 2 Mar 2010 18:02:28 +0000Subject: [PATCH] tfp: stream raw rectangle updates to ClutterX11TexturePixmapThis changes the way we handle Damage events so instead of getting anevent when the damaged region becomes non-empty we new get sent alldamage rectangles and pass those directly though to Clutter.ClutterGLXTexturePixmap was recently updated so that calls toclutter_x11_texture_pixmap_update_area are now cheap (glXBindTexImageEXTcalls are now deferred until just before painting) and sinceClutterGLXTexturePixmap is now capable of queueing clipped redraws thatcan result in only updating a sub-region of the stage during a repaintcycle this has the potential for greatly improved performance for someuse cases.CLUTTER_PAINT=redraws can be used to visualize what parts of the stageare redrawn and with this patch applied I can open an xterm and as Itype I see that only the damaged areas of the terminal are beingredrawn.--- src/compositor/mutter-window.c | 70 ++++++---------------------------------- 1 files changed, 10 insertions(+), 60 deletions(-)diff --git a/src/compositor/mutter-window.c b/src/compositor/mutter-window.cindex c0d56ea..28737cf 100644--- a/src/compositor/mutter-window.c+++ b/src/compositor/mutter-window.c@@ -347,7 +347,8 @@ mutter_window_constructed (GObject *object) if (priv->attrs.class == InputOnly) priv->damage = None; else- priv->damage = XDamageCreate (xdisplay, xwindow, XDamageReportNonEmpty);+ priv->damage = XDamageCreate (xdisplay, xwindow,+ XDamageReportRawRectangles); format = XRenderFindVisualFormat (xdisplay, priv->attrs.visual);@@ -1611,64 +1612,6 @@ check_needs_repair (MutterWindow *self) full = TRUE; }- /*- * TODO -- on some gfx hardware updating the whole texture instead of- * the individual rectangles is actually quicker, so we might want to- * make this a configurable option (on desktop HW with multiple pipelines- * it is usually quicker to just update the damaged parts).- *- * If we are using TFP we update the whole texture (this simply trigers- * the texture rebind).- */- if (full-#ifdef HAVE_GLX_TEXTURE_PIXMAP- || (CLUTTER_GLX_IS_TEXTURE_PIXMAP (priv->actor) &&- clutter_glx_texture_pixmap_using_extension- (CLUTTER_GLX_TEXTURE_PIXMAP (priv->actor)))-#endif /* HAVE_GLX_TEXTURE_PIXMAP */- )- {- XDamageSubtract (xdisplay, priv->damage, None, None);-- clutter_x11_texture_pixmap_update_area- (CLUTTER_X11_TEXTURE_PIXMAP (priv->actor),- 0,- 0,- clutter_actor_get_width (priv->actor),- clutter_actor_get_height (priv->actor));- }- else- {- XRectangle *r_damage;- XRectangle r_bounds;- XserverRegion parts;- int i, r_count;-- parts = XFixesCreateRegion (xdisplay, 0, 0);- XDamageSubtract (xdisplay, priv->damage, None, parts);-- r_damage = XFixesFetchRegionAndBounds (xdisplay,- parts,- &r_count,- &r_bounds);-- if (r_damage)- {- for (i = 0; i < r_count; ++i)- {- clutter_x11_texture_pixmap_update_area- (CLUTTER_X11_TEXTURE_PIXMAP (priv->actor),- r_damage[i].x,- r_damage[i].y,- r_damage[i].width,- r_damage[i].height);- }- }-- XFree (r_damage);- XFixesDestroyRegion (xdisplay, parts);- }- meta_error_trap_pop (display, FALSE); priv->needs_repair = FALSE;@@ -1678,7 +1621,14 @@ void mutter_window_process_damage (MutterWindow *self, XDamageNotifyEvent *event) {- mutter_window_mark_for_repair (self);+ MutterWindowPrivate *priv = self->priv;+ ClutterX11TexturePixmap *texture_x11 =+ CLUTTER_X11_TEXTURE_PIXMAP (priv->actor);+ clutter_x11_texture_pixmap_update_area (texture_x11,+ event->area.x,+ event->area.y,+ event->area.width,+ event->area.height); } void-- 1.6.3.3