[maemo-commits] [maemo-commits] r18506 - in projects/haf/trunk/clutter0.8: clutter clutter/cogl/gles debian

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed May 27 14:29:58 EEST 2009
Author: gw
Date: 2009-05-27 14:29:45 +0300 (Wed, 27 May 2009)
New Revision: 18506

Modified:
   projects/haf/trunk/clutter0.8/clutter/clutter-actor.c
   projects/haf/trunk/clutter0.8/clutter/clutter-fixed.h
   projects/haf/trunk/clutter0.8/clutter/cogl/gles/cogl-gles2-wrapper.c
   projects/haf/trunk/clutter0.8/clutter/cogl/gles/cogl-texture.c
   projects/haf/trunk/clutter0.8/debian/changelog
Log:
  Speedups based on profiling

  * clutter/clutter-actor.c: Disable visibility detection by default - we must
    enable it explicitly for actors in hildon-desktop now
  * clutter/clutter-fixed.h: Now use macro rather than inline asm function -
    this produces much better assembler for cogl_util_mtx_transform
  * clutter/cogl/gles/cogl-gles2-wrapper.c: slight unroll + big speedup for
    cogl_gles2_wrapper_mult_matrix, also special case for cogl_translatex
    which accounted for most of the cogl_gles2_wrapper_mult_matrix calls.
  * clutter/cogl/gles/cogl-texture.c: changed 'if !cogl_is_texture' to
    g_return_if_fail, as we don't want these runtime checks, and 
    cogl_is_texture is *very* slow (linear search)


Modified: projects/haf/trunk/clutter0.8/clutter/clutter-actor.c
===================================================================
--- projects/haf/trunk/clutter0.8/clutter/clutter-actor.c	2009-05-27 11:28:07 UTC (rev 18505)
+++ projects/haf/trunk/clutter0.8/clutter/clutter-actor.c	2009-05-27 11:29:45 UTC (rev 18506)
@@ -2978,7 +2978,7 @@
   priv->scale_y      = CFX_ONE;
   priv->shader_data  = NULL;
   priv->show_on_set_parent = TRUE;
-  priv->visibility_detect = TRUE;
+  priv->visibility_detect = FALSE;
   priv->allow_redraw      = TRUE;
 
   priv->needs_width_request  = TRUE;

Modified: projects/haf/trunk/clutter0.8/clutter/clutter-fixed.h
===================================================================
--- projects/haf/trunk/clutter0.8/clutter/clutter-fixed.h	2009-05-27 11:28:07 UTC (rev 18505)
+++ projects/haf/trunk/clutter0.8/clutter/clutter-fixed.h	2009-05-27 11:29:45 UTC (rev 18506)
@@ -290,7 +290,12 @@
 #define CFX_INT         CLUTTER_FIXED_INT
 #define CFX_MUL         CLUTTER_FIXED_MUL
 #define CFX_DIV         CLUTTER_FIXED_DIV
-#define CFX_QMUL(x,y)   clutter_qmulx (x,y)
+//#define CFX_QMUL(x,y)   clutter_qmulx (x,y)
+/* remove inline asm function as the overhead is greater than just inlining -
+ * and it doesn't include the possibility of evaluating as a constant
+ * expression */
+#define CFX_QMUL(x,y)   \
+     ((ClutterFixed)(((long long)(x) * (long long)(y)) >> CFX_Q))
 #define CFX_QDIV(x,y)   clutter_qdivx (x,y)
 
 /*< public >*/

Modified: projects/haf/trunk/clutter0.8/clutter/cogl/gles/cogl-gles2-wrapper.c
===================================================================
--- projects/haf/trunk/clutter0.8/clutter/cogl/gles/cogl-gles2-wrapper.c	2009-05-27 11:28:07 UTC (rev 18505)
+++ projects/haf/trunk/clutter0.8/clutter/cogl/gles/cogl-gles2-wrapper.c	2009-05-27 11:29:45 UTC (rev 18506)
@@ -664,15 +664,16 @@
 static void
 cogl_gles2_wrapper_mult_matrix (float *dst, const float *a, const float *b)
 {
-  int i, j, k;
+  int i, j;
 
-  for (i = 0; i < 4; i++)
+  for (i = 0; i < 16; i+=4)
     for (j = 0; j < 4; j++)
       {
-	float sum = 0.0f;
-	for (k = 0; k < 4; k++)
-	  sum += a[k * 4 + j] * b[i * 4 + k];
-	dst[i * 4 + j] = sum;
+        dst[i + j] =
+                    a[j] * b[i] +
+                    a[4 + j] * b[i + 1] +
+                    a[8 + j] * b[i + 2] +
+                    a[12 + j] * b[i + 3];
       }
 }
 
@@ -767,12 +768,7 @@
 void
 cogl_wrap_glTranslatex (GLfixed x, GLfixed y, GLfixed z)
 {
-  float matrix[16];
-
-  if (x==0 && y==0 && z==0)
-    return;
-
-  memset (matrix, 0, sizeof (matrix));
+  /*memset (matrix, 0, sizeof (matrix));
   matrix[0] = 1.0f;
   matrix[5] = 1.0f;
   matrix[10] = 1.0f;
@@ -781,7 +777,29 @@
   matrix[14] = CLUTTER_FIXED_TO_FLOAT (z);
   matrix[15] = 1.0f;
 
-  cogl_wrap_glMultMatrix (matrix);
+  cogl_wrap_glMultMatrix (matrix);*/
+
+
+  if (x!=0 || y!=0 || z!=0)
+    {
+      float *matrix;
+      float fx, fy, fz;
+
+      _COGL_GET_GLES2_WRAPPER (w, NO_RETVAL);
+
+      fx = CLUTTER_FIXED_TO_FLOAT (x);
+      fy = CLUTTER_FIXED_TO_FLOAT (y);
+      fz = CLUTTER_FIXED_TO_FLOAT (z);
+
+      matrix = cogl_gles2_get_matrix_stack_top (w);
+
+      matrix[12] +=  matrix[0]*fx + matrix[4]*fy + matrix[8]*fz;
+      matrix[13] +=  matrix[1]*fx + matrix[5]*fy + matrix[9]*fz;
+      matrix[14] +=  matrix[2]*fx + matrix[6]*fy + matrix[10]*fz;
+      matrix[15] +=  matrix[3]*fx + matrix[7]*fy + matrix[11]*fz;
+
+      cogl_gles2_wrapper_update_matrix (w, w->matrix_mode);
+    }
 }
 
 void

Modified: projects/haf/trunk/clutter0.8/clutter/cogl/gles/cogl-texture.c
===================================================================
--- projects/haf/trunk/clutter0.8/clutter/cogl/gles/cogl-texture.c	2009-05-27 11:28:07 UTC (rev 18505)
+++ projects/haf/trunk/clutter0.8/clutter/cogl/gles/cogl-texture.c	2009-05-27 11:29:45 UTC (rev 18506)
@@ -1385,8 +1385,7 @@
   CoglTexture *tex;
 
   /* Check if valid texture handle */
-  if (!cogl_is_texture (handle))
-    return;
+  g_return_if_fail( cogl_is_texture (handle) );
 
   tex = _cogl_texture_pointer_from_handle (handle);
 
@@ -1412,8 +1411,7 @@
 {
   CoglTexture *tex;
 
-  if (!cogl_is_texture (handle))
-    return 0;
+  g_return_val_if_fail( cogl_is_texture (handle), 0 );
 
   tex = _cogl_texture_pointer_from_handle (handle);
 
@@ -1425,8 +1423,7 @@
 {
   CoglTexture *tex;
 
-  if (!cogl_is_texture (handle))
-    return 0;
+  g_return_val_if_fail( cogl_is_texture (handle), 0 );
 
   tex = _cogl_texture_pointer_from_handle (handle);
 
@@ -1438,8 +1435,7 @@
 {
   CoglTexture *tex;
 
-  if (!cogl_is_texture (handle))
-    return COGL_PIXEL_FORMAT_ANY;
+  g_return_val_if_fail( cogl_is_texture (handle), COGL_PIXEL_FORMAT_ANY );
 
   tex = _cogl_texture_pointer_from_handle (handle);
 
@@ -1451,8 +1447,7 @@
 {
   CoglTexture *tex;
 
-  if (!cogl_is_texture (handle))
-    return 0;
+  g_return_val_if_fail( cogl_is_texture (handle), 0 );
 
   tex = _cogl_texture_pointer_from_handle (handle);
 
@@ -1464,8 +1459,7 @@
 {
   CoglTexture *tex;
 
-  if (!cogl_is_texture (handle))
-    return 0;
+  g_return_val_if_fail( cogl_is_texture (handle), 0 );
 
   tex = _cogl_texture_pointer_from_handle (handle);
 
@@ -1477,8 +1471,7 @@
 {
   CoglTexture *tex;
 
-  if (!cogl_is_texture (handle))
-    return FALSE;
+  g_return_val_if_fail( cogl_is_texture (handle), FALSE );
 
   tex = _cogl_texture_pointer_from_handle (handle);
 
@@ -1498,8 +1491,7 @@
 {
   CoglTexture *tex;
 
-  if (!cogl_is_texture (handle))
-    return FALSE;
+  g_return_val_if_fail( cogl_is_texture (handle), FALSE );
 
   tex = _cogl_texture_pointer_from_handle (handle);
 
@@ -1523,8 +1515,7 @@
 {
   CoglTexture *tex;
 
-  if (!cogl_is_texture (handle))
-    return 0;
+  g_return_val_if_fail( cogl_is_texture (handle), 0 );
 
   tex = _cogl_texture_pointer_from_handle (handle);
 
@@ -1536,8 +1527,7 @@
 {
   CoglTexture *tex;
 
-  if (!cogl_is_texture (handle))
-    return 0;
+  g_return_val_if_fail( cogl_is_texture (handle), 0 );
 
   tex = _cogl_texture_pointer_from_handle (handle);
 
@@ -1995,8 +1985,7 @@
   ClutterFixed       tempx;
 
   /* Check if valid texture */
-  if (!cogl_is_texture (handle))
-    return;
+  g_return_if_fail( cogl_is_texture (handle) );
 
   tex = _cogl_texture_pointer_from_handle (handle);
 
@@ -2072,8 +2061,7 @@
   _COGL_GET_CONTEXT (ctx, NO_RETVAL);
 
   /* Check if valid texture */
-  if (!cogl_is_texture (handle))
-    return;
+  g_return_if_fail( cogl_is_texture (handle) );
 
   tex = _cogl_texture_pointer_from_handle (handle);
 

Modified: projects/haf/trunk/clutter0.8/debian/changelog
===================================================================
--- projects/haf/trunk/clutter0.8/debian/changelog	2009-05-27 11:28:07 UTC (rev 18505)
+++ projects/haf/trunk/clutter0.8/debian/changelog	2009-05-27 11:29:45 UTC (rev 18506)
@@ -1,7 +1,18 @@
 clutter (0.8.2-0maemo33~unreleased) unstable; urgency=low
 
-  * foo
+  Speedups based on profiling
 
+  * clutter/clutter-actor.c: Disable visibility detection by default - we must
+    enable it explicitly for actors in hildon-desktop now
+  * clutter/clutter-fixed.h: Now use macro rather than inline asm function -
+    this produces much better assembler for cogl_util_mtx_transform
+  * clutter/cogl/gles/cogl-gles2-wrapper.c: slight unroll + big speedup for
+    cogl_gles2_wrapper_mult_matrix, also special case for cogl_translatex
+    which accounted for most of the cogl_gles2_wrapper_mult_matrix calls.
+  * clutter/cogl/gles/cogl-texture.c: changed 'if !cogl_is_texture' to
+    g_return_if_fail, as we don't want these runtime checks, and 
+    cogl_is_texture is *very* slow (linear search)
+
  -- Gordon Williams <gordon.williams at collabora.co.uk>  Wed, 27 May 2009 13:26:16 +0300
 
 clutter (0.8.2-0maemo32) unstable; urgency=low


More information about the maemo-commits mailing list