[maemo-commits] [maemo-commits] r17143 - in projects/haf/trunk/clutter: clutter clutter/x11 debian

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Mon Jan 12 18:23:35 EET 2009
Author: gw
Date: 2009-01-12 18:23:31 +0200 (Mon, 12 Jan 2009)
New Revision: 17143

Modified:
   projects/haf/trunk/clutter/clutter/clutter-main.h
   projects/haf/trunk/clutter/clutter/clutter-stage.c
   projects/haf/trunk/clutter/clutter/x11/clutter-x11-texture-pixmap.c
   projects/haf/trunk/clutter/debian/changelog
Log:
  * It turns out XDamage doesn't work unless explicitly turned on in
    x11-texture-pixmap using .._set_automatic, so totally removed the #ifdefs
  * Modified clutter_stage_redraw_damage to set the stage to be redrawn with
    a delay - which helps get rid of multiple redraws when we get >1 XDamage
    events within a few ms of each other.



Modified: projects/haf/trunk/clutter/clutter/clutter-main.h
===================================================================
--- projects/haf/trunk/clutter/clutter/clutter-main.h	2009-01-12 15:47:27 UTC (rev 17142)
+++ projects/haf/trunk/clutter/clutter/clutter-main.h	2009-01-12 16:23:31 UTC (rev 17143)
@@ -78,6 +78,15 @@
  */
 #define CLUTTER_PRIORITY_TIMELINE       (G_PRIORITY_DEFAULT + 30)
 
+/**
+ * CLUTTER_REDRAW_INTERVAL:
+ *
+ * The amount of time between a redraw request and the actual redraw.
+ *
+ * Since: 0.8.2-maemo
+ */
+#define CLUTTER_REDRAW_INTERVAL         (25)
+
 /* Initialisation */
 void             clutter_base_init        (void);
 ClutterInitError clutter_init             (int          *argc,

Modified: projects/haf/trunk/clutter/clutter/clutter-stage.c
===================================================================
--- projects/haf/trunk/clutter/clutter/clutter-stage.c	2009-01-12 15:47:27 UTC (rev 17142)
+++ projects/haf/trunk/clutter/clutter/clutter-stage.c	2009-01-12 16:23:31 UTC (rev 17143)
@@ -1950,7 +1950,17 @@
   clutter_actor_get_geometry(CLUTTER_ACTOR(stage),
       &stage->priv->damaged_area);
 
-  clutter_stage_queue_redraw_damage(stage);
+  if (!stage->priv->update_idle)
+    {
+      CLUTTER_TIMESTAMP (SCHEDULER, "Adding idle source for stage: %p", stage);
+
+      /* FIXME: weak_ref self in case we disappear before paint? */
+      stage->priv->update_idle =
+        clutter_threads_add_idle_full (CLUTTER_PRIORITY_REDRAW,
+                                       redraw_update_idle,
+                                       stage,
+                                       NULL);
+    }
 }
 
 /**
@@ -1977,12 +1987,16 @@
     {
       CLUTTER_TIMESTAMP (SCHEDULER, "Adding idle source for stage: %p", stage);
 
-      /* FIXME: weak_ref self in case we dissapear before paint? */
+      /* FIXME: weak_ref self in case we disappear before paint? */
       stage->priv->update_idle =
-        clutter_threads_add_idle_full (CLUTTER_PRIORITY_REDRAW,
-                                       redraw_update_idle,
-                                       stage,
-                                       NULL);
+        clutter_threads_add_timeout_full ( CLUTTER_PRIORITY_REDRAW,
+                                           CLUTTER_REDRAW_INTERVAL,
+                                           redraw_update_idle,
+                                           stage,
+                                           NULL);
+      /* we're rendering with a timeout here so we can stop
+       * double-redraws we're doing when we get multiple XDamage events
+       * for what should be a single frame. */
     }
 }
 

Modified: projects/haf/trunk/clutter/clutter/x11/clutter-x11-texture-pixmap.c
===================================================================
--- projects/haf/trunk/clutter/clutter/x11/clutter-x11-texture-pixmap.c	2009-01-12 15:47:27 UTC (rev 17142)
+++ projects/haf/trunk/clutter/clutter/x11/clutter-x11-texture-pixmap.c	2009-01-12 16:23:31 UTC (rev 17143)
@@ -47,14 +47,7 @@
 
 #include "cogl/cogl.h"
 
-/* We need this back on because the lack of notifications for Configure causes
- * textures not to update when they change size, and bug 95594 to revert
- */
-#define XDAMAGE_HANDLING
-
-#ifdef XDAMAGE_HANDLING
 #include <X11/extensions/Xdamage.h>
-#endif
 #include <X11/extensions/Xcomposite.h>
 
 #include <sys/ipc.h>
@@ -85,10 +78,8 @@
   LAST_SIGNAL
 };
 
-#ifdef XDAMAGE_HANDLING
 static ClutterX11FilterReturn
 on_x_event_filter (XEvent *xev, ClutterEvent *cev, gpointer data);
-#endif
 
 static void
 clutter_x11_texture_pixmap_update_area_real (ClutterX11TexturePixmap *texture,
@@ -98,10 +89,8 @@
                                              gint                     height);
 static void
 clutter_x11_texture_pixmap_set_mapped (ClutterX11TexturePixmap *texture, gboolean mapped);
-#ifdef XDAMAGE_HANDLING
 static void
 clutter_x11_texture_pixmap_destroyed (ClutterX11TexturePixmap *texture);
-#endif
 
 static guint signals[LAST_SIGNAL] = { 0, };
 
@@ -116,10 +105,9 @@
   XShmSegmentInfo shminfo;
 
   gboolean      automatic_updates;
-#ifdef XDAMAGE_HANDLING
+
   Damage        damage;
   Drawable      damage_drawable;
-#endif
 
   /* FIXME: lots of gbooleans. coalesce into bitfields */
   gboolean	have_shm;
@@ -131,16 +119,13 @@
   gint          window_x, window_y;
 };
 
-#ifdef XDAMAGE_HANDLING
 static int _damage_event_base = 0;
-#endif
 
 /* FIXME: Ultimatly with current cogl we should subclass clutter actor */
 G_DEFINE_TYPE (ClutterX11TexturePixmap, \
                clutter_x11_texture_pixmap, \
                CLUTTER_TYPE_TEXTURE);
 
-#ifdef XDAMAGE_HANDLING
 static gboolean
 check_extensions (ClutterX11TexturePixmap *texture)
 {
@@ -164,7 +149,6 @@
 
   return TRUE;
 }
-#endif
 
 static void
 free_shm_resources (ClutterX11TexturePixmap *texture)
@@ -268,7 +252,6 @@
   return FALSE;
 }
 
-#ifdef XDAMAGE_HANDLING
 static ClutterX11FilterReturn
 on_x_event_filter (XEvent *xev, ClutterEvent *cev, gpointer data)
 {
@@ -319,7 +302,6 @@
                                                     r_damage[i].y,
                                                     r_damage[i].width,
                                                     r_damage[i].height);
-          g_debug("XDAMAGE END");
           XFree (r_damage);
         }
 
@@ -367,10 +349,8 @@
 
   return CLUTTER_X11_FILTER_CONTINUE;
 }
-#endif
 
 
-#ifdef XDAMAGE_HANDLING
 static void
 free_damage_resources (ClutterX11TexturePixmap *texture)
 {
@@ -392,7 +372,6 @@
 
   clutter_x11_remove_filter (on_x_event_filter, (gpointer)texture);
 }
-#endif
 
 static void
 clutter_x11_texture_pixmap_init (ClutterX11TexturePixmap *self)
@@ -402,21 +381,17 @@
                                    CLUTTER_X11_TYPE_TEXTURE_PIXMAP,
                                    ClutterX11TexturePixmapPrivate);
 
-#ifdef XDAMAGE_HANDLING
   if (!check_extensions (self))
     {
       /* FIMXE: means display lacks needed extensions for at least auto.
        *        - a _can_autoupdate() method ?
       */
     }
-#endif
 
   self->priv->image = NULL;
   self->priv->automatic_updates = FALSE;
-#ifdef XDAMAGE_HANDLING
   self->priv->damage = None;
   self->priv->damage_drawable = None;
-#endif
   self->priv->window = None;
   self->priv->pixmap = None;
   self->priv->pixmap_height = 0;
@@ -436,11 +411,9 @@
   ClutterX11TexturePixmap *texture = CLUTTER_X11_TEXTURE_PIXMAP (object);
   ClutterX11TexturePixmapPrivate *priv = texture->priv;
 
-#ifdef XDAMAGE_HANDLING
   free_damage_resources (texture);
 
   clutter_x11_remove_filter (on_x_event_filter_too, (gpointer)texture);
-#endif
 
   if (priv->owns_pixmap && priv->pixmap)
     {
@@ -1134,7 +1107,6 @@
   if (priv->window == window && automatic == priv->window_redirect_automatic)
     return;
 
-#ifdef XDAMAGE_HANDLING
   if (priv->window)
     {
       clutter_x11_remove_filter (on_x_event_filter_too, (gpointer)texture);
@@ -1146,7 +1118,6 @@
       XSync (clutter_x11_get_default_display (), False);
       clutter_x11_untrap_x_errors ();
     }
-#endif
 
   priv->window = window;
   priv->window_redirect_automatic = automatic;
@@ -1167,26 +1138,22 @@
         return;
       }
 
-#ifdef XDAMAGE_HANDLING
     XCompositeRedirectWindow
                        (dpy,
                         window,
                         automatic ?
                         CompositeRedirectAutomatic : CompositeRedirectManual);
-#endif
     XSync (dpy, False);
   }
 
   clutter_x11_untrap_x_errors ();
 
-#ifdef XDAMAGE_HANDLING
   if (priv->window)
     {
       XSelectInput (dpy, priv->window,
                     attr.your_event_mask | StructureNotifyMask);
       clutter_x11_add_filter (on_x_event_filter_too, (gpointer)texture);
     }
-#endif
 
   g_object_ref (texture);
   g_object_notify (G_OBJECT (texture), "window");
@@ -1290,7 +1257,6 @@
     }
 }
 
-#ifdef XDAMAGE_HANDLING
 static void
 clutter_x11_texture_pixmap_destroyed (ClutterX11TexturePixmap *texture)
 {
@@ -1309,7 +1275,6 @@
    * be useful e.g. for destroy animations -- app's responsibility.
    */
 }
-#endif
 
 /**
  * clutter_x11_texture_pixmap_update_area:
@@ -1342,9 +1307,7 @@
                                           gboolean                 setting)
 {
   ClutterX11TexturePixmapPrivate *priv;
-#ifdef XDAMAGE_HANDLING
   Display                        *dpy;
-#endif
 
   g_return_if_fail (CLUTTER_X11_IS_TEXTURE_PIXMAP (texture));
 
@@ -1353,7 +1316,6 @@
   if (setting == priv->automatic_updates)
     return;
 
-#ifdef XDAMAGE_HANDLING
   dpy = clutter_x11_get_default_display();
 
   if (setting == TRUE)
@@ -1376,7 +1338,6 @@
     }
   else
     free_damage_resources (texture);
-#endif
 
   priv->automatic_updates = setting;
 

Modified: projects/haf/trunk/clutter/debian/changelog
===================================================================
--- projects/haf/trunk/clutter/debian/changelog	2009-01-12 15:47:27 UTC (rev 17142)
+++ projects/haf/trunk/clutter/debian/changelog	2009-01-12 16:23:31 UTC (rev 17143)
@@ -1,8 +1,12 @@
 clutter (0.8.2-0maemo14~unreleased) unstable; urgency=low
 
-  * unreleased
+  * It turns out XDamage doesn't work unless explicitly turned on in
+    x11-texture-pixmap using .._set_automatic, so totally removed the #ifdefs
+  * Modified clutter_stage_redraw_damage to set the stage to be redrawn with
+    a delay - which helps get rid of multiple redraws when we get >1 XDamage
+    events within a few ms of each other.
 
- -- Gordon Williams <gordon.williams at collabora.co.uk>  Mon, 12 Jan 2009 17:31:48 +0200
+ -- Gordon Williams <gordon.williams at collabora.co.uk>  Mon, 12 Jan 2009 16:21:48 +0000
 
 clutter (0.8.2-0maemo13) unstable; urgency=low
 
@@ -23,7 +27,7 @@
   * Commented out extra code that caused clutter to not compile with -Werror
   * Reinstated XDamage and XComposite as something in it reverted bug 95594 
     (and multiple XDamage shouldn't be an issue with the next bunch of work
-    I'm working on)
+    I'm working on).
 
  -- Gordon Williams <gordon.williams at collabora.co.uk>  Wed, 12 Jan 2009 12:17:52 +0000
 


More information about the maemo-commits mailing list