2008-05-01 Matthew Allum <mallum@openedhand.com>
* clutter/glx/clutter-glx-texture-pixmap.c: * tests/test-pixmap.c: Fix up texture-pixmap, now works. Thanks to Neil for spotting we were actually using wrong texture type in fbconfig (COGL change).
This commit is contained in:
parent
98f5b6a0c9
commit
f72af9926d
@ -1,3 +1,11 @@
|
|||||||
|
2008-05-01 Matthew Allum <mallum@openedhand.com>
|
||||||
|
|
||||||
|
* clutter/glx/clutter-glx-texture-pixmap.c:
|
||||||
|
* tests/test-pixmap.c:
|
||||||
|
Fix up texture-pixmap, now works.
|
||||||
|
Thanks to Neil for spotting we were actually using
|
||||||
|
wrong texture type in fbconfig (COGL change).
|
||||||
|
|
||||||
2008-04-30 Øyvind Kolås <pippin@o-hand.com>
|
2008-04-30 Øyvind Kolås <pippin@o-hand.com>
|
||||||
|
|
||||||
* clutter/cogl/gles/cogl-primitives.c: (_cogl_path_fill_nodes):
|
* clutter/cogl/gles/cogl-primitives.c: (_cogl_path_fill_nodes):
|
||||||
|
@ -25,6 +25,13 @@
|
|||||||
* Boston, MA 02111-1307, USA.
|
* Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* TODO:
|
||||||
|
* - Automagically handle named pixmaps, and window resizes (i.e
|
||||||
|
* essentially handle window id's being passed in)
|
||||||
|
* - Dont bomb out when an invalid pixmap is passed (trap damage handling)
|
||||||
|
* - track and trap referenced pixmap/win getting destroyed
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SECTION:clutter-glx-texture-pixmap
|
* SECTION:clutter-glx-texture-pixmap
|
||||||
* @short_description: A texture which displays the content of an X Pixmap.
|
* @short_description: A texture which displays the content of an X Pixmap.
|
||||||
@ -37,6 +44,8 @@
|
|||||||
* (http://people.freedesktop.org/~davidr/GLX_EXT_texture_from_pixmap.txt)
|
* (http://people.freedesktop.org/~davidr/GLX_EXT_texture_from_pixmap.txt)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
@ -47,6 +56,7 @@
|
|||||||
#include "clutter-backend-glx.h"
|
#include "clutter-backend-glx.h"
|
||||||
|
|
||||||
#include "../clutter-util.h"
|
#include "../clutter-util.h"
|
||||||
|
#include "../clutter-debug.h"
|
||||||
|
|
||||||
#include "cogl/cogl.h"
|
#include "cogl/cogl.h"
|
||||||
|
|
||||||
@ -148,8 +158,6 @@ clutter_glx_texture_pixmap_notify (GObject *object, GParamSpec *pspec)
|
|||||||
if (g_str_equal (pspec->name, "pixmap"))
|
if (g_str_equal (pspec->name, "pixmap"))
|
||||||
{
|
{
|
||||||
ClutterGLXTexturePixmap *texture = CLUTTER_GLX_TEXTURE_PIXMAP (object);
|
ClutterGLXTexturePixmap *texture = CLUTTER_GLX_TEXTURE_PIXMAP (object);
|
||||||
printf("notify\n");
|
|
||||||
|
|
||||||
clutter_glx_texture_pixmap_create_glx_pixmap (texture);
|
clutter_glx_texture_pixmap_create_glx_pixmap (texture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -161,21 +169,17 @@ create_cogl_texture (ClutterTexture *texture,
|
|||||||
{
|
{
|
||||||
CoglHandle handle;
|
CoglHandle handle;
|
||||||
|
|
||||||
handle = cogl_texture_new_with_size (width, height,
|
handle
|
||||||
64,
|
= cogl_texture_new_with_size (width, height,
|
||||||
|
-1,
|
||||||
COGL_PIXEL_FORMAT_RGBA_8888|COGL_BGR_BIT);
|
COGL_PIXEL_FORMAT_RGBA_8888|COGL_BGR_BIT);
|
||||||
|
|
||||||
printf("handle: %i, width: %i, height: %i\n",
|
|
||||||
(int)handle, width, height);
|
|
||||||
|
|
||||||
if (handle)
|
if (handle)
|
||||||
{
|
{
|
||||||
clutter_texture_set_cogl_texture (texture, handle);
|
clutter_texture_set_cogl_texture (texture, handle);
|
||||||
|
|
||||||
CLUTTER_ACTOR_SET_FLAGS (texture, CLUTTER_ACTOR_REALIZED);
|
CLUTTER_ACTOR_SET_FLAGS (texture, CLUTTER_ACTOR_REALIZED);
|
||||||
|
|
||||||
printf("realised, updating\n");
|
|
||||||
|
|
||||||
clutter_glx_texture_pixmap_update_area
|
clutter_glx_texture_pixmap_update_area
|
||||||
(CLUTTER_X11_TEXTURE_PIXMAP (texture),
|
(CLUTTER_X11_TEXTURE_PIXMAP (texture),
|
||||||
0, 0,
|
0, 0,
|
||||||
@ -191,17 +195,16 @@ clutter_glx_texture_pixmap_realize (ClutterActor *actor)
|
|||||||
ClutterGLXTexturePixmapPrivate *priv;
|
ClutterGLXTexturePixmapPrivate *priv;
|
||||||
Pixmap pixmap;
|
Pixmap pixmap;
|
||||||
guint pixmap_width, pixmap_height;
|
guint pixmap_width, pixmap_height;
|
||||||
printf("realise\n");
|
|
||||||
|
|
||||||
priv = CLUTTER_GLX_TEXTURE_PIXMAP (actor)->priv;
|
priv = CLUTTER_GLX_TEXTURE_PIXMAP (actor)->priv;
|
||||||
|
|
||||||
if (!_have_tex_from_pixmap_ext
|
if (!_have_tex_from_pixmap_ext
|
||||||
|| !clutter_feature_available (CLUTTER_FEATURE_TEXTURE_RECTANGLE))
|
|| !clutter_feature_available (COGL_FEATURE_TEXTURE_NPOT))
|
||||||
{
|
{
|
||||||
/* Fall back */
|
/* Fall back */
|
||||||
|
CLUTTER_NOTE (TEXTURE, "texture from pixmap appears unsupported");
|
||||||
|
CLUTTER_NOTE (TEXTURE, "Falling back to X11 manual mechansim");
|
||||||
/* FIXME: Also check for sliced npots ? */
|
/* FIXME: Also check for sliced npots ? */
|
||||||
|
|
||||||
g_warning("Falling back....");
|
|
||||||
CLUTTER_ACTOR_CLASS (clutter_glx_texture_pixmap_parent_class)->
|
CLUTTER_ACTOR_CLASS (clutter_glx_texture_pixmap_parent_class)->
|
||||||
realize (actor);
|
realize (actor);
|
||||||
return;
|
return;
|
||||||
@ -217,6 +220,8 @@ clutter_glx_texture_pixmap_realize (ClutterActor *actor)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
create_cogl_texture (CLUTTER_TEXTURE (actor), pixmap_width, pixmap_height);
|
create_cogl_texture (CLUTTER_TEXTURE (actor), pixmap_width, pixmap_height);
|
||||||
|
|
||||||
|
CLUTTER_NOTE (TEXTURE, "texture pixmap realised");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -225,8 +230,6 @@ clutter_glx_texture_pixmap_unrealize (ClutterActor *actor)
|
|||||||
ClutterGLXTexturePixmapPrivate *priv;
|
ClutterGLXTexturePixmapPrivate *priv;
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
|
|
||||||
printf("unrealise\n");
|
|
||||||
|
|
||||||
priv = CLUTTER_GLX_TEXTURE_PIXMAP (actor)->priv;
|
priv = CLUTTER_GLX_TEXTURE_PIXMAP (actor)->priv;
|
||||||
dpy = clutter_x11_get_default_display();
|
dpy = clutter_x11_get_default_display();
|
||||||
|
|
||||||
@ -385,10 +388,9 @@ clutter_glx_texture_pixmap_free_glx_pixmap (ClutterGLXTexturePixmap *texture)
|
|||||||
XSync (clutter_x11_get_default_display(), FALSE);
|
XSync (clutter_x11_get_default_display(), FALSE);
|
||||||
|
|
||||||
if (clutter_x11_untrap_x_errors ())
|
if (clutter_x11_untrap_x_errors ())
|
||||||
g_warning ("Failed to unbind texture pixmap");
|
CLUTTER_NOTE (TEXTURE, "Failed to release?");
|
||||||
|
|
||||||
|
CLUTTER_NOTE (TEXTURE, "Destroyed pxm: %li", priv->glx_pixmap);
|
||||||
printf("Destroyed pxm: %li\n", priv->glx_pixmap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
clutter_x11_trap_x_errors ();
|
clutter_x11_trap_x_errors ();
|
||||||
@ -410,7 +412,7 @@ clutter_glx_texture_pixmap_create_glx_pixmap (ClutterGLXTexturePixmap *texture)
|
|||||||
guint pixmap_width, pixmap_height;
|
guint pixmap_width, pixmap_height;
|
||||||
ClutterBackendGLX *backend_glx;
|
ClutterBackendGLX *backend_glx;
|
||||||
|
|
||||||
printf("create\n");
|
CLUTTER_NOTE (TEXTURE, "Creating GLXPixmap");
|
||||||
|
|
||||||
backend_glx = CLUTTER_BACKEND_GLX(clutter_get_default_backend ());
|
backend_glx = CLUTTER_BACKEND_GLX(clutter_get_default_backend ());
|
||||||
|
|
||||||
@ -429,7 +431,7 @@ clutter_glx_texture_pixmap_create_glx_pixmap (ClutterGLXTexturePixmap *texture)
|
|||||||
|
|
||||||
if (!fbconfig)
|
if (!fbconfig)
|
||||||
{
|
{
|
||||||
g_critical ("Could not find an FBConfig for selected pixmap");
|
g_warning ("Could not find an FBConfig for selected pixmap");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -438,16 +440,14 @@ clutter_glx_texture_pixmap_create_glx_pixmap (ClutterGLXTexturePixmap *texture)
|
|||||||
if (depth == 24)
|
if (depth == 24)
|
||||||
{
|
{
|
||||||
attribs[i++] = GLX_TEXTURE_FORMAT_RGB_EXT;
|
attribs[i++] = GLX_TEXTURE_FORMAT_RGB_EXT;
|
||||||
printf("depth: %i\n", 24);
|
|
||||||
}
|
}
|
||||||
else if (depth == 32)
|
else if (depth == 32)
|
||||||
{
|
{
|
||||||
attribs[i++] = GLX_TEXTURE_FORMAT_RGBA_EXT;
|
attribs[i++] = GLX_TEXTURE_FORMAT_RGBA_EXT;
|
||||||
printf("depth: %i\n", 32);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_critical ("Pixmap with depth bellow 24 are not supported");
|
g_warning ("Pixmap with depth bellow 24 are not supported");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -455,7 +455,7 @@ clutter_glx_texture_pixmap_create_glx_pixmap (ClutterGLXTexturePixmap *texture)
|
|||||||
attribs[i++] = 0;
|
attribs[i++] = 0;
|
||||||
|
|
||||||
attribs[i++] = GLX_TEXTURE_TARGET_EXT;
|
attribs[i++] = GLX_TEXTURE_TARGET_EXT;
|
||||||
attribs[i++] = GLX_TEXTURE_RECTANGLE_EXT;
|
attribs[i++] = GLX_TEXTURE_2D_EXT;
|
||||||
|
|
||||||
attribs[i++] = None;
|
attribs[i++] = None;
|
||||||
|
|
||||||
@ -466,7 +466,7 @@ clutter_glx_texture_pixmap_create_glx_pixmap (ClutterGLXTexturePixmap *texture)
|
|||||||
attribs);
|
attribs);
|
||||||
XSync (dpy, FALSE);
|
XSync (dpy, FALSE);
|
||||||
if (clutter_x11_untrap_x_errors ())
|
if (clutter_x11_untrap_x_errors ())
|
||||||
g_warning ("glx pixmap creation failed");
|
CLUTTER_NOTE (TEXTURE, "Failed to create GLXPixmap");
|
||||||
|
|
||||||
g_free (fbconfig);
|
g_free (fbconfig);
|
||||||
|
|
||||||
@ -477,16 +477,17 @@ clutter_glx_texture_pixmap_create_glx_pixmap (ClutterGLXTexturePixmap *texture)
|
|||||||
|
|
||||||
priv->glx_pixmap = glx_pixmap;
|
priv->glx_pixmap = glx_pixmap;
|
||||||
|
|
||||||
|
|
||||||
if (!clutter_texture_get_cogl_texture (CLUTTER_TEXTURE (texture)))
|
if (!clutter_texture_get_cogl_texture (CLUTTER_TEXTURE (texture)))
|
||||||
{
|
{
|
||||||
create_cogl_texture (texture,
|
create_cogl_texture (texture,
|
||||||
pixmap_width,
|
pixmap_width,
|
||||||
pixmap_height);
|
pixmap_height);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
printf("Created pxm: %li\n", priv->glx_pixmap);
|
CLUTTER_NOTE (TEXTURE, "Created GLXPixmap");
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -499,7 +500,8 @@ clutter_glx_texture_pixmap_update_area (ClutterX11TexturePixmap *texture,
|
|||||||
ClutterGLXTexturePixmapPrivate *priv;
|
ClutterGLXTexturePixmapPrivate *priv;
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
|
|
||||||
printf("update area\n");
|
|
||||||
|
CLUTTER_NOTE (TEXTURE, "Updaing texture pixmap");
|
||||||
|
|
||||||
priv = CLUTTER_GLX_TEXTURE_PIXMAP (texture)->priv;
|
priv = CLUTTER_GLX_TEXTURE_PIXMAP (texture)->priv;
|
||||||
dpy = clutter_x11_get_default_display();
|
dpy = clutter_x11_get_default_display();
|
||||||
@ -515,14 +517,6 @@ clutter_glx_texture_pixmap_update_area (ClutterX11TexturePixmap *texture,
|
|||||||
width, height);
|
width, height);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
clutter_glx_texture_pixmap_paint (ClutterActor *self)
|
|
||||||
{
|
|
||||||
ClutterGLXTexturePixmapPrivate *priv;
|
|
||||||
|
|
||||||
priv = CLUTTER_GLX_TEXTURE_PIXMAP (self)->priv;
|
|
||||||
|
|
||||||
if (_have_tex_from_pixmap_ext)
|
if (_have_tex_from_pixmap_ext)
|
||||||
{
|
{
|
||||||
@ -530,10 +524,8 @@ clutter_glx_texture_pixmap_paint (ClutterActor *self)
|
|||||||
|
|
||||||
dpy = clutter_x11_get_default_display();
|
dpy = clutter_x11_get_default_display();
|
||||||
|
|
||||||
if (texture_bind (CLUTTER_GLX_TEXTURE_PIXMAP(self)))
|
if (texture_bind (CLUTTER_GLX_TEXTURE_PIXMAP(texture)))
|
||||||
{
|
{
|
||||||
printf("no fallback pxm: %li\n", priv->glx_pixmap);
|
|
||||||
|
|
||||||
clutter_x11_trap_x_errors ();
|
clutter_x11_trap_x_errors ();
|
||||||
|
|
||||||
(_gl_bind_tex_image) (dpy,
|
(_gl_bind_tex_image) (dpy,
|
||||||
@ -543,17 +535,21 @@ clutter_glx_texture_pixmap_paint (ClutterActor *self)
|
|||||||
|
|
||||||
XSync (clutter_x11_get_default_display(), FALSE);
|
XSync (clutter_x11_get_default_display(), FALSE);
|
||||||
|
|
||||||
|
/* Note above fires X error for non name pixmaps - but
|
||||||
|
* things still seem to work - i.e pixmap updated
|
||||||
|
*/
|
||||||
if (clutter_x11_untrap_x_errors ())
|
if (clutter_x11_untrap_x_errors ())
|
||||||
g_warning ("Failed to bind texture pixmap");
|
CLUTTER_NOTE (TEXTURE, "Update bind_tex_image failed");
|
||||||
|
|
||||||
priv->bound = TRUE;
|
priv->bound = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
g_warning ("Failed to bind initial tex");
|
g_warning ("Failed to bind initial tex");
|
||||||
|
|
||||||
|
if (CLUTTER_ACTOR_IS_VISIBLE (CLUTTER_ACTOR(texture)))
|
||||||
|
clutter_actor_queue_redraw (CLUTTER_ACTOR(texture));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CLUTTER_ACTOR_CLASS (clutter_glx_texture_pixmap_parent_class)->paint(self);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -573,7 +569,6 @@ clutter_glx_texture_pixmap_class_init (ClutterGLXTexturePixmapClass *klass)
|
|||||||
|
|
||||||
actor_class->realize = clutter_glx_texture_pixmap_realize;
|
actor_class->realize = clutter_glx_texture_pixmap_realize;
|
||||||
actor_class->unrealize = clutter_glx_texture_pixmap_unrealize;
|
actor_class->unrealize = clutter_glx_texture_pixmap_unrealize;
|
||||||
actor_class->paint = clutter_glx_texture_pixmap_paint;
|
|
||||||
|
|
||||||
x11_texture_class->update_area = clutter_glx_texture_pixmap_update_area;
|
x11_texture_class->update_area = clutter_glx_texture_pixmap_update_area;
|
||||||
|
|
||||||
@ -584,7 +579,6 @@ clutter_glx_texture_pixmap_class_init (ClutterGLXTexturePixmapClass *klass)
|
|||||||
glx_extensions =
|
glx_extensions =
|
||||||
glXQueryExtensionsString (clutter_x11_get_default_display (),
|
glXQueryExtensionsString (clutter_x11_get_default_display (),
|
||||||
clutter_x11_get_default_screen ());
|
clutter_x11_get_default_screen ());
|
||||||
printf("GLX extension string:%s\n", glx_extensions);
|
|
||||||
|
|
||||||
/* Check for the texture from pixmap extension */
|
/* Check for the texture from pixmap extension */
|
||||||
if (cogl_check_extension ("GLX_EXT_texture_from_pixmap", glx_extensions))
|
if (cogl_check_extension ("GLX_EXT_texture_from_pixmap", glx_extensions))
|
||||||
|
@ -158,15 +158,9 @@ main (int argc, char **argv)
|
|||||||
stage = clutter_stage_get_default ();
|
stage = clutter_stage_get_default ();
|
||||||
clutter_stage_set_color (CLUTTER_STAGE (stage), &gry);
|
clutter_stage_set_color (CLUTTER_STAGE (stage), &gry);
|
||||||
|
|
||||||
|
/* Note this seemingly just works.. */
|
||||||
pixmap = win_remote;
|
pixmap = win_remote;
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
XCompositeRedirectWindow(clutter_x11_get_default_display(),
|
|
||||||
win_remote,
|
|
||||||
CompositeRedirectAutomatic);
|
|
||||||
*/
|
|
||||||
|
|
||||||
tex = clutter_x11_texture_pixmap_new_with_pixmap (pixmap);
|
tex = clutter_x11_texture_pixmap_new_with_pixmap (pixmap);
|
||||||
|
|
||||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), tex);
|
clutter_container_add_actor (CLUTTER_CONTAINER (stage), tex);
|
||||||
@ -176,11 +170,7 @@ main (int argc, char **argv)
|
|||||||
|
|
||||||
#ifdef HAVE_CLUTTER_GLX
|
#ifdef HAVE_CLUTTER_GLX
|
||||||
|
|
||||||
pixmap = create_pixmap (&w, &h, &d);
|
/* pixmap = create_pixmap (&w, &h, &d); */
|
||||||
|
|
||||||
#if 0
|
|
||||||
// pixmap = win_remote;
|
|
||||||
|
|
||||||
|
|
||||||
XCompositeRedirectWindow(clutter_x11_get_default_display(),
|
XCompositeRedirectWindow(clutter_x11_get_default_display(),
|
||||||
win_remote,
|
win_remote,
|
||||||
@ -188,7 +178,6 @@ main (int argc, char **argv)
|
|||||||
|
|
||||||
pixmap = XCompositeNameWindowPixmap (clutter_x11_get_default_display(),
|
pixmap = XCompositeNameWindowPixmap (clutter_x11_get_default_display(),
|
||||||
win_remote);
|
win_remote);
|
||||||
#endif
|
|
||||||
|
|
||||||
tex = clutter_glx_texture_pixmap_new_with_pixmap (pixmap);
|
tex = clutter_glx_texture_pixmap_new_with_pixmap (pixmap);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user