[maemo-commits] [maemo-commits] r19032 - in projects/haf/trunk/clutter0.8: clutter/eglx debian
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Tue Aug 4 16:00:26 EEST 2009
- Previous message: [maemo-commits] r19031 - projects/haf/tags/hildon-welcome
- Next message: [maemo-commits] r19033 - projects/haf/trunk/clutter0.8/debian
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: gw
Date: 2009-08-04 16:00:22 +0300 (Tue, 04 Aug 2009)
New Revision: 19032
Modified:
projects/haf/trunk/clutter0.8/clutter/eglx/clutter-eglx-texture-pixmap.c
projects/haf/trunk/clutter0.8/debian/changelog
Log:
* Speed improvements to help fix 130870
clutter/eglx/clutter-eglx-texture-pixmap.c: Speed improvements for pixmap
create/destroy (70ms -> 26ms). Remove calls to eglQuerySurface that aren't
actually required, remove un-needed XSync, only re-allocate pixmap texture
just before rendering - which means we will do it less, but alse when
XServer is less busy and we will stall less.
Modified: projects/haf/trunk/clutter0.8/clutter/eglx/clutter-eglx-texture-pixmap.c
===================================================================
--- projects/haf/trunk/clutter0.8/clutter/eglx/clutter-eglx-texture-pixmap.c 2009-08-04 12:10:33 UTC (rev 19031)
+++ projects/haf/trunk/clutter0.8/clutter/eglx/clutter-eglx-texture-pixmap.c 2009-08-04 13:00:22 UTC (rev 19032)
@@ -45,6 +45,8 @@
/* Whether to draw a red-bordered window when there is no valid pixmap
* (If we don't, we just draw nothing) */
#define DEBUG_RED_RECT 0
+/* We don't want to print configs in most cases, as this can take around 30ms or so */
+#define DEBUG_PRINT_CONFIGS 0
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -90,6 +92,9 @@
guint current_pixmap_depth;
guint current_pixmap_width;
guint current_pixmap_height;
+
+ /* If the pixmap has changed, we'll want to try and recreate the surface */
+ gboolean pixmap_changed;
};
void
@@ -122,6 +127,7 @@
static void
print_config_info (EGLConfig conf)
{
+#if DEBUG_PRINT_CONFIGS
EGLint red = -1, green = -1, blue = -1, alpha = -1, stencil = -1;
EGLint rgba_bindable = -1, rgb_bindable = -1, tex_target = -1;
@@ -155,6 +161,7 @@
__FUNCTION__,
red, green, blue, alpha, stencil,
rgb_bindable, rgba_bindable, tex_target);
+#endif
}
static void
@@ -244,9 +251,7 @@
guint pixmap_depth;
gboolean has_alpha;
CoglPixelFormat format;
- EGLint value;
ClutterBackendEGL *backend;
- guint width, height;
backend = CLUTTER_BACKEND_EGL (clutter_get_default_backend ());
priv = CLUTTER_EGLX_TEXTURE_PIXMAP (actor)->priv;
@@ -280,15 +285,6 @@
return;
}
- /*
- if (pixmap && window)
- {
- g_warning ("%s: Pixmap AND Window defined, using pixmap", __FUNCTION__);
- }
- */
-
- /*g_debug("%s: Pixmap depth %d", __FUNCTION__, pixmap_depth);*/
-
has_alpha = pixmap_depth==32;
if (!clutter_x11_texture_pixmap_get_allow_alpha(
CLUTTER_X11_TEXTURE_PIXMAP(actor)))
@@ -332,22 +328,6 @@
return;
}
- /* get size and format */
- if (eglQuerySurface (backend->edpy, priv->egl_surface, EGL_WIDTH, &value)
- == EGL_FALSE)
- return;
- width = value;
-
- if (eglQuerySurface (backend->edpy, priv->egl_surface, EGL_HEIGHT, &value)
- == EGL_FALSE)
- return;
- height = value;
- /*
- g_debug ("%s: got width %u, height %u (X says %u, %u)", __FUNCTION__,
- width, height,
- priv->current_pixmap_width, priv->current_pixmap_height);
- */
-
/* bind the surface to a GL texture */
glGenTextures (1, &priv->texture_id);
glBindTexture (GL_TEXTURE_2D, priv->texture_id);
@@ -361,39 +341,21 @@
return;
}
- if (eglQuerySurface (backend->edpy, priv->egl_surface,
- EGL_TEXTURE_FORMAT, &value) == EGL_FALSE)
+ if (!has_alpha)
{
- g_warning ("%s: eglQuerySurface EGL_TEXTURE_FORMAT failed", __FUNCTION__);
- return;
- }
-
- if (value == EGL_TEXTURE_RGB)
- {
- /*
- g_debug ("%s: surface format is EGL_TEXTURE_RGB", __FUNCTION__);
- */
if (priv->current_pixmap_depth == 16)
format = COGL_PIXEL_FORMAT_RGB_565;
else
format = COGL_PIXEL_FORMAT_RGB_888;
}
- else if (value == EGL_TEXTURE_RGBA)
+ else
{
g_debug ("%s: surface format is EGL_TEXTURE_RGBA", __FUNCTION__);
format = COGL_PIXEL_FORMAT_RGBA_8888;
}
- else
- {
- g_debug ("%s: surface format is EGL_NO_TEXTURE", __FUNCTION__);
- return;
- }
- /*g_debug ("%s: GL texture %u corresponds to surface %p", __FUNCTION__,
- priv->texture_id, priv->egl_surface);*/
-
if (!create_cogl_texture (CLUTTER_TEXTURE (actor), priv->texture_id,
- width, height, format))
+ priv->current_pixmap_width, priv->current_pixmap_height, format))
{
g_debug ("%s: Unable to create cogl texture", __FUNCTION__);
@@ -403,8 +365,6 @@
priv->use_fallback = TRUE;
return;
}
-
- /*g_debug ("%s: texture pixmap created", __FUNCTION__);*/
}
static void
@@ -426,7 +386,6 @@
*/
clutter_x11_trap_x_errors ();
eglDestroySurface (backend->edpy, priv->egl_surface);
- XSync (dpy, FALSE);
if (clutter_x11_untrap_x_errors ())
g_debug ("%s: X errors", __FUNCTION__);
priv->egl_surface = EGL_NO_SURFACE;
@@ -505,10 +464,10 @@
static void
clutter_eglx_texture_pixmap_update_area (ClutterX11TexturePixmap *texture,
- gint x,
- gint y,
- gint width,
- gint height)
+ gint x,
+ gint y,
+ gint width,
+ gint height)
{
guint pixmap, pixmap_depth, pixmap_width, pixmap_height;
ClutterEGLXTexturePixmapPrivate *priv;
@@ -540,26 +499,17 @@
"pixmap-height", &pixmap_height,
NULL);
- if ((pixmap != priv->current_pixmap ||
- pixmap_depth != priv->current_pixmap_depth ||
- pixmap_width != priv->current_pixmap_width ||
- pixmap_height != priv->current_pixmap_height) &&
- priv->egl_surface != EGL_NO_SURFACE)
+ if (pixmap != priv->current_pixmap ||
+ pixmap_depth != priv->current_pixmap_depth ||
+ pixmap_width != priv->current_pixmap_width ||
+ pixmap_height != priv->current_pixmap_height ||
+ priv->egl_surface == EGL_NO_SURFACE)
{
- g_debug ("%s: Pixmap has changed, destroying surface", __FUNCTION__);
- clutter_eglx_texture_pixmap_surface_destroy(CLUTTER_ACTOR(texture));
+ priv->pixmap_changed = TRUE;
}
- if (priv->egl_surface == EGL_NO_SURFACE)
- {
- /*
- g_debug ("%s: Surface not previously created, creating", __FUNCTION__);
- */
- clutter_eglx_texture_pixmap_surface_create(CLUTTER_ACTOR(texture));
- }
-
- if (priv->egl_surface != EGL_NO_SURFACE
- && CLUTTER_ACTOR_IS_VISIBLE (CLUTTER_ACTOR (texture)))
+ if (/*priv->egl_surface != EGL_NO_SURFACE
+ && */CLUTTER_ACTOR_IS_VISIBLE (CLUTTER_ACTOR (texture)))
clutter_actor_queue_redraw (CLUTTER_ACTOR (texture));
}
@@ -700,6 +650,13 @@
priv = CLUTTER_EGLX_TEXTURE_PIXMAP (actor)->priv;
+ if (priv->pixmap_changed) {
+ priv->pixmap_changed = FALSE;
+ g_debug ("%s: Pixmap has changed, destroying surface", __FUNCTION__);
+ clutter_eglx_texture_pixmap_surface_destroy(actor);
+ clutter_eglx_texture_pixmap_surface_create(actor);
+ }
+
if (priv->use_fallback)
{
CLUTTER_EGLX_TEXTURE_PIXMAP_GET_CLASS(actor)->overridden_paint(actor);
Modified: projects/haf/trunk/clutter0.8/debian/changelog
===================================================================
--- projects/haf/trunk/clutter0.8/debian/changelog 2009-08-04 12:10:33 UTC (rev 19031)
+++ projects/haf/trunk/clutter0.8/debian/changelog 2009-08-04 13:00:22 UTC (rev 19032)
@@ -1,8 +1,13 @@
clutter (0.8.2-0maemo42~unreleased) unstable; urgency=low
- * foo
+ * Speed improvements to help fix 130870
+ clutter/eglx/clutter-eglx-texture-pixmap.c: Speed improvements for pixmap
+ create/destroy (70ms -> 26ms). Remove calls to eglQuerySurface that aren't
+ actually required, remove un-needed XSync, only re-allocate pixmap texture
+ just before rendering - which means we will do it less, but alse when
+ XServer is less busy and we will stall less.
- -- Kimmo Hämäläinen <kimmo.hamalainen at nokia.com> Mon, 27 Jul 2009 15:34:27 +0300
+ -- Gordon Williams <gordon.williams at collabora.co.uk> Tue, 4 Aug 2009 15:34:27 +0100
clutter (0.8.2-0maemo41) unstable; urgency=low
- Previous message: [maemo-commits] r19031 - projects/haf/tags/hildon-welcome
- Next message: [maemo-commits] r19033 - projects/haf/trunk/clutter0.8/debian
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
