mirror of
https://github.com/brl/mutter.git
synced 2024-11-13 01:36:10 -05:00
Straighten out 'realize' handling for ClutterGLXTexturePixmap
Setting the pixmap for an unrealized ClutterGLXTexturePixmap should not cause it to be realized, and certainly shouldn't cause the the REALIZED flag to be set without using clutter_actor_realize(). This patch uses the simple approach that; - pixmap changes on an unrealized ClutterGLXTexturePixmap are ignored - when the ClutterGLXTexturePixmap is realized, we then create the GLXPixmap and the corresponding texture. The call to clutter_glx_texture_pixmap_update_area() is moved from create_cogl_texture() to clutter_glx_texture_pixmap_create_glx_pixmap() since create_cogl_texture() is only called from one place, and updating the area is really something we do *after* creating the texture, not part of creating the texture. clutter_glx_texture_pixmap_create_glx_pixmap() is reorganized a bit to avoid debug-logging confusingly if it's called before a pixmap has been set, and for readability. http://bugzilla.openedhand.com/show_bug.cgi?id=1635 Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
This commit is contained in:
parent
d28c9e5db1
commit
1e6e41190b
@ -288,7 +288,8 @@ clutter_glx_texture_pixmap_notify (GObject *object, GParamSpec *pspec)
|
||||
if (g_str_equal (pspec->name, "pixmap"))
|
||||
{
|
||||
ClutterGLXTexturePixmap *texture = CLUTTER_GLX_TEXTURE_PIXMAP (object);
|
||||
clutter_glx_texture_pixmap_create_glx_pixmap (texture);
|
||||
if (CLUTTER_ACTOR_IS_REALIZED (texture))
|
||||
clutter_glx_texture_pixmap_create_glx_pixmap (texture);
|
||||
}
|
||||
}
|
||||
|
||||
@ -377,12 +378,6 @@ create_cogl_texture (ClutterTexture *texture,
|
||||
|
||||
clutter_texture_set_cogl_texture (texture, handle);
|
||||
|
||||
CLUTTER_ACTOR_SET_FLAGS (texture, CLUTTER_ACTOR_REALIZED);
|
||||
|
||||
clutter_glx_texture_pixmap_update_area
|
||||
(CLUTTER_X11_TEXTURE_PIXMAP (texture),
|
||||
0, 0,
|
||||
width, height);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -392,37 +387,16 @@ create_cogl_texture (ClutterTexture *texture,
|
||||
static void
|
||||
clutter_glx_texture_pixmap_realize (ClutterActor *actor)
|
||||
{
|
||||
ClutterGLXTexturePixmap *texture;
|
||||
ClutterGLXTexturePixmapPrivate *priv;
|
||||
Pixmap pixmap;
|
||||
guint pixmap_width, pixmap_height;
|
||||
|
||||
priv = CLUTTER_GLX_TEXTURE_PIXMAP (actor)->priv;
|
||||
texture = CLUTTER_GLX_TEXTURE_PIXMAP (actor);
|
||||
priv = texture->priv;
|
||||
|
||||
clutter_glx_texture_pixmap_create_glx_pixmap (texture);
|
||||
|
||||
if (priv->use_fallback)
|
||||
{
|
||||
CLUTTER_NOTE (TEXTURE, "texture from pixmap appears unsupported");
|
||||
CLUTTER_NOTE (TEXTURE, "Falling back to X11 manual mechansim");
|
||||
|
||||
CLUTTER_ACTOR_CLASS (clutter_glx_texture_pixmap_parent_class)->
|
||||
realize (actor);
|
||||
return;
|
||||
}
|
||||
|
||||
g_object_get (actor,
|
||||
"pixmap", &pixmap,
|
||||
"pixmap-width", &pixmap_width,
|
||||
"pixmap-height", &pixmap_height,
|
||||
NULL);
|
||||
|
||||
if (!pixmap)
|
||||
return;
|
||||
|
||||
if (!create_cogl_texture (CLUTTER_TEXTURE (actor),
|
||||
pixmap_width, pixmap_height))
|
||||
{
|
||||
CLUTTER_NOTE (TEXTURE, "Unable to create a valid pixmap");
|
||||
CLUTTER_NOTE (TEXTURE, "Falling back to X11 manual mechanism");
|
||||
priv->use_fallback = TRUE;
|
||||
CLUTTER_ACTOR_CLASS (clutter_glx_texture_pixmap_parent_class)->
|
||||
realize (actor);
|
||||
return;
|
||||
@ -648,22 +622,18 @@ clutter_glx_texture_pixmap_create_glx_pixmap (ClutterGLXTexturePixmap *texture)
|
||||
GLXFBConfig *fbconfig;
|
||||
Display *dpy;
|
||||
guint depth;
|
||||
Pixmap pixmap;
|
||||
guint pixmap_width, pixmap_height;
|
||||
Pixmap pixmap = None;
|
||||
guint pixmap_width = 0, pixmap_height = 0;
|
||||
ClutterBackendGLX *backend_glx;
|
||||
ClutterTextureQuality quality;
|
||||
|
||||
CLUTTER_NOTE (TEXTURE, "Creating GLXPixmap");
|
||||
|
||||
backend_glx = CLUTTER_BACKEND_GLX(clutter_get_default_backend ());
|
||||
|
||||
dpy = clutter_x11_get_default_display ();
|
||||
|
||||
if (!clutter_glx_texture_pixmap_using_extension (texture))
|
||||
if (!_have_tex_from_pixmap_ext)
|
||||
goto cleanup;
|
||||
|
||||
priv->use_fallback = FALSE;
|
||||
|
||||
g_object_get (texture,
|
||||
"pixmap-width", &pixmap_width,
|
||||
"pixmap-height", &pixmap_height,
|
||||
@ -676,6 +646,8 @@ clutter_glx_texture_pixmap_create_glx_pixmap (ClutterGLXTexturePixmap *texture)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
CLUTTER_NOTE (TEXTURE, "Creating GLXPixmap");
|
||||
|
||||
fbconfig = get_fbconfig_for_depth (texture, depth);
|
||||
|
||||
if (!fbconfig)
|
||||
@ -696,7 +668,7 @@ clutter_glx_texture_pixmap_create_glx_pixmap (ClutterGLXTexturePixmap *texture)
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning ("Pixmap with depth bellow 24 are not supported");
|
||||
g_warning ("Pixmap with depth below 24 are not supported");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -736,6 +708,16 @@ clutter_glx_texture_pixmap_create_glx_pixmap (ClutterGLXTexturePixmap *texture)
|
||||
glx_pixmap = None;
|
||||
}
|
||||
|
||||
if (!create_cogl_texture (CLUTTER_TEXTURE (texture),
|
||||
pixmap_width, pixmap_height))
|
||||
{
|
||||
CLUTTER_NOTE (TEXTURE, "Unable to create texture for pixmap");
|
||||
|
||||
glXDestroyGLXPixmap (dpy, glx_pixmap);
|
||||
glx_pixmap = None;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
cleanup:
|
||||
|
||||
if (priv->glx_pixmap)
|
||||
@ -743,13 +725,15 @@ clutter_glx_texture_pixmap_create_glx_pixmap (ClutterGLXTexturePixmap *texture)
|
||||
|
||||
if (glx_pixmap != None)
|
||||
{
|
||||
priv->use_fallback = FALSE;
|
||||
priv->glx_pixmap = glx_pixmap;
|
||||
|
||||
create_cogl_texture (CLUTTER_TEXTURE (texture),
|
||||
pixmap_width, pixmap_height);
|
||||
|
||||
CLUTTER_NOTE (TEXTURE, "Created GLXPixmap");
|
||||
|
||||
clutter_glx_texture_pixmap_update_area (CLUTTER_X11_TEXTURE_PIXMAP (texture),
|
||||
0, 0,
|
||||
pixmap_width, pixmap_height);
|
||||
|
||||
/* Get ready to queue initial mipmap generation */
|
||||
if (_gl_generate_mipmap
|
||||
&& priv->can_mipmap
|
||||
@ -763,13 +747,11 @@ clutter_glx_texture_pixmap_create_glx_pixmap (ClutterGLXTexturePixmap *texture)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pixmap)
|
||||
CLUTTER_NOTE (TEXTURE, "Falling back to X11 manual mechansim");
|
||||
|
||||
priv->use_fallback = TRUE;
|
||||
priv->glx_pixmap = None;
|
||||
|
||||
/* Some fucky logic here - we've fallen back and need to make sure
|
||||
* we realize here..
|
||||
*/
|
||||
clutter_actor_realize (CLUTTER_ACTOR (texture));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user