Accepting request 123099 from home:fcrozat:branches:GNOME:Factory
- Add mutter-never-slice-shape-mask.patch, mutter-use-cogl-texrect-api.patch: Fix window texturing on hardware without ARB_texture_non_power_of_two (rh#813648, bgo#674731, bgo#672711). OBS-URL: https://build.opensuse.org/request/show/123099 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/mutter?expand=0&rev=96
This commit is contained in:
parent
1cd3e878d3
commit
5c20421cdb
43
mutter-never-slice-shape-mask.patch
Normal file
43
mutter-never-slice-shape-mask.patch
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
From a22859a64a60b38346ce7faabad6a9a48d7a8d9f Mon Sep 17 00:00:00 2001
|
||||||
|
From: Robert Bragg <robert@linux.intel.com>
|
||||||
|
Date: Wed, 25 Apr 2012 00:48:19 +0000
|
||||||
|
Subject: shaped-texture: never slice shape mask texture
|
||||||
|
|
||||||
|
Since Cogl doesn't support multi-texturing with sliced textures and the
|
||||||
|
shape texture is combined with the texture-from-pixmap texture we need
|
||||||
|
to make sure we never construct a sliced mask texture. This patch simply
|
||||||
|
passes the COGL_TEXTURE_NO_SLICE flag to cogl_texture_from_data when
|
||||||
|
creating the shape mask texture.
|
||||||
|
|
||||||
|
https://bugzilla.gnome.org/show_bug.cgi?id=674731
|
||||||
|
---
|
||||||
|
diff --git a/src/compositor/meta-shaped-texture.c b/src/compositor/meta-shaped-texture.c
|
||||||
|
index 07bd93c..182d23b 100644
|
||||||
|
--- a/src/compositor/meta-shaped-texture.c
|
||||||
|
+++ b/src/compositor/meta-shaped-texture.c
|
||||||
|
@@ -313,12 +313,17 @@ meta_shaped_texture_ensure_mask (MetaShapedTexture *stex)
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif /* GL_TEXTURE_RECTANGLE_ARB */
|
||||||
|
- priv->mask_texture = cogl_texture_new_from_data (tex_width, tex_height,
|
||||||
|
- COGL_TEXTURE_NONE,
|
||||||
|
- COGL_PIXEL_FORMAT_A_8,
|
||||||
|
- COGL_PIXEL_FORMAT_ANY,
|
||||||
|
- stride,
|
||||||
|
- mask_data);
|
||||||
|
+ {
|
||||||
|
+ /* Note: we don't allow slicing for this texture because we
|
||||||
|
+ * need to use it with multi-texturing which doesn't support
|
||||||
|
+ * sliced textures */
|
||||||
|
+ priv->mask_texture = cogl_texture_new_from_data (tex_width, tex_height,
|
||||||
|
+ COGL_TEXTURE_NO_SLICING,
|
||||||
|
+ COGL_PIXEL_FORMAT_A_8,
|
||||||
|
+ COGL_PIXEL_FORMAT_ANY,
|
||||||
|
+ stride,
|
||||||
|
+ mask_data);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
g_free (mask_data);
|
||||||
|
|
||||||
|
--
|
||||||
|
cgit v0.9.0.2
|
321
mutter-use-cogl-texrect-api.patch
Normal file
321
mutter-use-cogl-texrect-api.patch
Normal file
@ -0,0 +1,321 @@
|
|||||||
|
From ed358c8f4b1200e8532dcc0b249f51752d2695eb Mon Sep 17 00:00:00 2001
|
||||||
|
From: Neil Roberts <neil@linux.intel.com>
|
||||||
|
Date: Fri, 23 Mar 2012 18:51:25 +0000
|
||||||
|
Subject: meta-texture-rectangle: Use Cogl's API to create a rectangle texture
|
||||||
|
|
||||||
|
Cogl now has public experimental API to create a rectangle texture
|
||||||
|
which we can use instead of creating a foreign texture with GL. This
|
||||||
|
avoids Mutter depending on Cogl including a GL header from its public
|
||||||
|
headers which it might not do in future.
|
||||||
|
|
||||||
|
https://bugzilla.gnome.org/show_bug.cgi?id=672711
|
||||||
|
---
|
||||||
|
diff --git a/src/compositor/meta-shaped-texture.c b/src/compositor/meta-shaped-texture.c
|
||||||
|
index 182d23b..ae21945 100644
|
||||||
|
--- a/src/compositor/meta-shaped-texture.c
|
||||||
|
+++ b/src/compositor/meta-shaped-texture.c
|
||||||
|
@@ -250,7 +250,6 @@ meta_shaped_texture_ensure_mask (MetaShapedTexture *stex)
|
||||||
|
int i;
|
||||||
|
int n_rects;
|
||||||
|
int stride;
|
||||||
|
- GLenum paint_gl_target;
|
||||||
|
|
||||||
|
/* If we have no shape region and no (or an empty) overlay region, we
|
||||||
|
* don't need to create a full mask texture, so quit early. */
|
||||||
|
@@ -293,26 +292,14 @@ meta_shaped_texture_ensure_mask (MetaShapedTexture *stex)
|
||||||
|
|
||||||
|
install_overlay_path (stex, mask_data, tex_width, tex_height, stride);
|
||||||
|
|
||||||
|
- cogl_texture_get_gl_texture (paint_tex, NULL, &paint_gl_target);
|
||||||
|
-
|
||||||
|
-#ifdef GL_TEXTURE_RECTANGLE_ARB
|
||||||
|
- if (paint_gl_target == GL_TEXTURE_RECTANGLE_ARB)
|
||||||
|
- {
|
||||||
|
- priv->mask_texture
|
||||||
|
- = meta_texture_rectangle_new (tex_width, tex_height,
|
||||||
|
- 0, /* flags */
|
||||||
|
- /* data format */
|
||||||
|
- COGL_PIXEL_FORMAT_A_8,
|
||||||
|
- /* internal GL format */
|
||||||
|
- GL_ALPHA,
|
||||||
|
- /* internal cogl format */
|
||||||
|
- COGL_PIXEL_FORMAT_A_8,
|
||||||
|
- /* rowstride */
|
||||||
|
- stride,
|
||||||
|
- mask_data);
|
||||||
|
- }
|
||||||
|
+ if (meta_texture_rectangle_check (paint_tex))
|
||||||
|
+ priv->mask_texture = meta_texture_rectangle_new (tex_width, tex_height,
|
||||||
|
+ COGL_PIXEL_FORMAT_A_8,
|
||||||
|
+ COGL_PIXEL_FORMAT_A_8,
|
||||||
|
+ stride,
|
||||||
|
+ mask_data,
|
||||||
|
+ NULL /* error */);
|
||||||
|
else
|
||||||
|
-#endif /* GL_TEXTURE_RECTANGLE_ARB */
|
||||||
|
{
|
||||||
|
/* Note: we don't allow slicing for this texture because we
|
||||||
|
* need to use it with multi-texturing which doesn't support
|
||||||
|
diff --git a/src/compositor/meta-texture-rectangle.c b/src/compositor/meta-texture-rectangle.c
|
||||||
|
index d699729..af6817f 100644
|
||||||
|
--- a/src/compositor/meta-texture-rectangle.c
|
||||||
|
+++ b/src/compositor/meta-texture-rectangle.c
|
||||||
|
@@ -5,7 +5,7 @@
|
||||||
|
*
|
||||||
|
* Authored By Neil Roberts <neil@linux.intel.com>
|
||||||
|
*
|
||||||
|
- * Copyright (C) 2011 Intel Corporation
|
||||||
|
+ * Copyright (C) 2011, 2012 Intel Corporation
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License as
|
||||||
|
@@ -25,94 +25,77 @@
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
-#include "meta-texture-rectangle.h"
|
||||||
|
-
|
||||||
|
-#ifdef GL_TEXTURE_RECTANGLE_ARB
|
||||||
|
+#define CLUTTER_ENABLE_EXPERIMENTAL_API
|
||||||
|
+#define COGL_ENABLE_EXPERIMENTAL_API
|
||||||
|
|
||||||
|
-static void (* pf_glGetIntegerv) (GLenum pname, GLint *params);
|
||||||
|
-static void (* pf_glTexImage2D) (GLenum target, GLint level,
|
||||||
|
- GLint internalFormat,
|
||||||
|
- GLsizei width, GLsizei height,
|
||||||
|
- GLint border, GLenum format, GLenum type,
|
||||||
|
- const GLvoid *pixels);
|
||||||
|
-static void (* pf_glGenTextures) (GLsizei n, GLuint *textures);
|
||||||
|
-static void (* pf_glDeleteTextures) (GLsizei n, const GLuint *texture);
|
||||||
|
-static void (* pf_glBindTexture) (GLenum target, GLuint texture);
|
||||||
|
-
|
||||||
|
-static void
|
||||||
|
-rectangle_texture_destroy_cb (void *user_data)
|
||||||
|
-{
|
||||||
|
- GLuint tex = GPOINTER_TO_UINT (user_data);
|
||||||
|
-
|
||||||
|
- pf_glDeleteTextures (1, &tex);
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-#endif /* GL_TEXTURE_RECTANGLE_ARB */
|
||||||
|
+#include <clutter/clutter.h>
|
||||||
|
+#include "meta-texture-rectangle.h"
|
||||||
|
|
||||||
|
-CoglHandle
|
||||||
|
+CoglTexture *
|
||||||
|
meta_texture_rectangle_new (unsigned int width,
|
||||||
|
unsigned int height,
|
||||||
|
- CoglTextureFlags flags,
|
||||||
|
CoglPixelFormat format,
|
||||||
|
- GLenum internal_gl_format,
|
||||||
|
- GLenum internal_format,
|
||||||
|
+ CoglPixelFormat internal_format,
|
||||||
|
unsigned int rowstride,
|
||||||
|
- const guint8 *data)
|
||||||
|
+ const guint8 *data,
|
||||||
|
+ GError **error)
|
||||||
|
{
|
||||||
|
- CoglHandle cogl_tex = COGL_INVALID_HANDLE;
|
||||||
|
-
|
||||||
|
-#ifdef GL_TEXTURE_RECTANGLE_ARB
|
||||||
|
-
|
||||||
|
- static CoglUserDataKey user_data_key;
|
||||||
|
- GLint old_binding;
|
||||||
|
- GLuint tex;
|
||||||
|
-
|
||||||
|
- if (pf_glGenTextures == NULL)
|
||||||
|
- {
|
||||||
|
- pf_glGetIntegerv = (void *) cogl_get_proc_address ("glGetIntegerv");
|
||||||
|
- pf_glTexImage2D = (void *) cogl_get_proc_address ("glTexImage2D");
|
||||||
|
- pf_glGenTextures = (void *) cogl_get_proc_address ("glGenTextures");
|
||||||
|
- pf_glDeleteTextures = (void *) cogl_get_proc_address ("glDeleteTextures");
|
||||||
|
- pf_glBindTexture = (void *) cogl_get_proc_address ("glBindTexture");
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- pf_glGenTextures (1, &tex);
|
||||||
|
- pf_glGetIntegerv (GL_TEXTURE_BINDING_RECTANGLE_ARB, &old_binding);
|
||||||
|
- pf_glBindTexture (GL_TEXTURE_RECTANGLE_ARB, tex);
|
||||||
|
- pf_glTexImage2D (GL_TEXTURE_RECTANGLE_ARB, 0,
|
||||||
|
- internal_gl_format, width, height,
|
||||||
|
- 0, internal_gl_format,
|
||||||
|
- GL_UNSIGNED_BYTE, NULL);
|
||||||
|
- pf_glBindTexture (GL_TEXTURE_RECTANGLE_ARB, old_binding);
|
||||||
|
+ ClutterBackend *backend =
|
||||||
|
+ clutter_get_default_backend ();
|
||||||
|
+ CoglContext *context =
|
||||||
|
+ clutter_backend_get_cogl_context (backend);
|
||||||
|
+ CoglTextureRectangle *tex_rect;
|
||||||
|
+
|
||||||
|
+ tex_rect = cogl_texture_rectangle_new_with_size (context,
|
||||||
|
+ width, height,
|
||||||
|
+ internal_format,
|
||||||
|
+ error);
|
||||||
|
+ if (tex_rect == NULL)
|
||||||
|
+ return NULL;
|
||||||
|
|
||||||
|
- cogl_tex = cogl_texture_new_from_foreign (tex,
|
||||||
|
- GL_TEXTURE_RECTANGLE_ARB,
|
||||||
|
- width, height,
|
||||||
|
- 0, 0, /* no waste */
|
||||||
|
- internal_format);
|
||||||
|
-
|
||||||
|
- /* Cogl won't destroy the GL texture when a foreign texture is used
|
||||||
|
- so we need to destroy it manually. We can set a destroy
|
||||||
|
- notification callback to do this transparently */
|
||||||
|
- cogl_object_set_user_data (cogl_tex,
|
||||||
|
- &user_data_key,
|
||||||
|
- GUINT_TO_POINTER (tex),
|
||||||
|
- rectangle_texture_destroy_cb);
|
||||||
|
-
|
||||||
|
- /* Use cogl_texture_set_region instead of uploading the data
|
||||||
|
- directly with GL calls so that we can let Cogl deal with setting
|
||||||
|
- the pixel store parameters and handling format conversion */
|
||||||
|
if (data)
|
||||||
|
- cogl_texture_set_region (cogl_tex,
|
||||||
|
- 0, 0, /* src x/y */
|
||||||
|
- 0, 0, /* dst x/y */
|
||||||
|
- width, height, /* dst width/height */
|
||||||
|
- width, height, /* src width/height */
|
||||||
|
+ cogl_texture_set_region (COGL_TEXTURE (tex_rect),
|
||||||
|
+ 0, 0, /* src_x/y */
|
||||||
|
+ 0, 0, /* dst_x/y */
|
||||||
|
+ width, height, /* dst_width/height */
|
||||||
|
+ width, height, /* width/height */
|
||||||
|
format,
|
||||||
|
rowstride,
|
||||||
|
data);
|
||||||
|
|
||||||
|
-#endif /* GL_TEXTURE_RECTANGLE_ARB */
|
||||||
|
+ return COGL_TEXTURE (tex_rect);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+texture_rectangle_check_cb (CoglTexture *sub_texture,
|
||||||
|
+ const float *sub_texture_coords,
|
||||||
|
+ const float *meta_coords,
|
||||||
|
+ void *user_data)
|
||||||
|
+{
|
||||||
|
+ gboolean *result = user_data;
|
||||||
|
+
|
||||||
|
+ if (cogl_is_texture_rectangle (sub_texture))
|
||||||
|
+ *result = TRUE;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/* Determines if the given texture is using a rectangle texture as its
|
||||||
|
+ * primitive texture type. Eventually this function could be replaced
|
||||||
|
+ * with cogl_texture_get_type if Cogl makes that public.
|
||||||
|
+ *
|
||||||
|
+ * http://git.gnome.org/browse/cogl/commit/?h=8012eee31
|
||||||
|
+ */
|
||||||
|
+gboolean
|
||||||
|
+meta_texture_rectangle_check (CoglTexture *texture)
|
||||||
|
+{
|
||||||
|
+ gboolean result = FALSE;
|
||||||
|
+
|
||||||
|
+ cogl_meta_texture_foreach_in_region (COGL_META_TEXTURE (texture),
|
||||||
|
+ 0.0f, 0.0f, /* tx_1 / ty_1 */
|
||||||
|
+ 1.0f, 1.0f, /* tx_2 / ty_2 */
|
||||||
|
+ COGL_PIPELINE_WRAP_MODE_REPEAT,
|
||||||
|
+ COGL_PIPELINE_WRAP_MODE_REPEAT,
|
||||||
|
+ texture_rectangle_check_cb,
|
||||||
|
+ &result);
|
||||||
|
|
||||||
|
- return cogl_tex;
|
||||||
|
+ return result;
|
||||||
|
}
|
||||||
|
diff --git a/src/compositor/meta-texture-rectangle.h b/src/compositor/meta-texture-rectangle.h
|
||||||
|
index b777316..7372b29 100644
|
||||||
|
--- a/src/compositor/meta-texture-rectangle.h
|
||||||
|
+++ b/src/compositor/meta-texture-rectangle.h
|
||||||
|
@@ -30,15 +30,17 @@
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
-CoglHandle
|
||||||
|
+CoglTexture *
|
||||||
|
meta_texture_rectangle_new (unsigned int width,
|
||||||
|
unsigned int height,
|
||||||
|
- CoglTextureFlags flags,
|
||||||
|
CoglPixelFormat format,
|
||||||
|
- GLenum internal_gl_format,
|
||||||
|
- GLenum internal_format,
|
||||||
|
+ CoglPixelFormat internal_format,
|
||||||
|
unsigned int rowstride,
|
||||||
|
- const guint8 *data);
|
||||||
|
+ const guint8 *data,
|
||||||
|
+ GError **error);
|
||||||
|
+
|
||||||
|
+gboolean
|
||||||
|
+meta_texture_rectangle_check (CoglTexture *texture);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
diff --git a/src/compositor/meta-texture-tower.c b/src/compositor/meta-texture-tower.c
|
||||||
|
index 0025472..2dee777 100644
|
||||||
|
--- a/src/compositor/meta-texture-tower.c
|
||||||
|
+++ b/src/compositor/meta-texture-tower.c
|
||||||
|
@@ -98,18 +98,6 @@ meta_texture_tower_free (MetaTextureTower *tower)
|
||||||
|
g_slice_free (MetaTextureTower, tower);
|
||||||
|
}
|
||||||
|
|
||||||
|
-#ifdef GL_TEXTURE_RECTANGLE_ARB
|
||||||
|
-static gboolean
|
||||||
|
-texture_is_rectangle (CoglHandle texture)
|
||||||
|
-{
|
||||||
|
- GLuint gl_tex;
|
||||||
|
- GLenum gl_target;
|
||||||
|
-
|
||||||
|
- cogl_texture_get_gl_texture (texture, &gl_tex, &gl_target);
|
||||||
|
- return gl_target == GL_TEXTURE_RECTANGLE_ARB;
|
||||||
|
-}
|
||||||
|
-#endif /* GL_TEXTURE_RECTANGLE_ARB */
|
||||||
|
-
|
||||||
|
/**
|
||||||
|
* meta_texture_tower_set_base_texture:
|
||||||
|
* @tower: a #MetaTextureTower
|
||||||
|
@@ -354,13 +342,11 @@ get_paint_level (int width, int height)
|
||||||
|
return (int)(0.5 + lambda);
|
||||||
|
}
|
||||||
|
|
||||||
|
-#ifdef GL_TEXTURE_RECTANGLE_ARB
|
||||||
|
static gboolean
|
||||||
|
is_power_of_two (int x)
|
||||||
|
{
|
||||||
|
return (x & (x - 1)) == 0;
|
||||||
|
}
|
||||||
|
-#endif /* GL_TEXTURE_RECTANGLE_ARB */
|
||||||
|
|
||||||
|
static void
|
||||||
|
texture_tower_create_texture (MetaTextureTower *tower,
|
||||||
|
@@ -368,25 +354,23 @@ texture_tower_create_texture (MetaTextureTower *tower,
|
||||||
|
int width,
|
||||||
|
int height)
|
||||||
|
{
|
||||||
|
-#ifdef GL_TEXTURE_RECTANGLE_ARB
|
||||||
|
if ((!is_power_of_two (width) || !is_power_of_two (height)) &&
|
||||||
|
- texture_is_rectangle (tower->textures[level - 1]))
|
||||||
|
+ meta_texture_rectangle_check (tower->textures[level - 1]))
|
||||||
|
{
|
||||||
|
tower->textures[level] =
|
||||||
|
meta_texture_rectangle_new (width, height,
|
||||||
|
- 0, /* flags */
|
||||||
|
/* data format */
|
||||||
|
TEXTURE_FORMAT,
|
||||||
|
- /* internal GL format */
|
||||||
|
- GL_RGBA,
|
||||||
|
/* internal cogl format */
|
||||||
|
TEXTURE_FORMAT,
|
||||||
|
/* rowstride */
|
||||||
|
width * 4,
|
||||||
|
+ /* data */
|
||||||
|
+ NULL,
|
||||||
|
+ /* error */
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
-#endif /* GL_TEXTURE_RECTANGLE_ARB */
|
||||||
|
{
|
||||||
|
tower->textures[level] = cogl_texture_new_with_size (width, height,
|
||||||
|
COGL_TEXTURE_NO_AUTO_MIPMAP,
|
||||||
|
--
|
||||||
|
cgit v0.9.0.2
|
@ -1,3 +1,11 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu May 31 14:25:43 UTC 2012 - fcrozat@suse.com
|
||||||
|
|
||||||
|
- Add mutter-never-slice-shape-mask.patch,
|
||||||
|
mutter-use-cogl-texrect-api.patch: Fix window texturing on
|
||||||
|
hardware without ARB_texture_non_power_of_two (rh#813648,
|
||||||
|
bgo#674731, bgo#672711).
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Sat May 5 07:50:00 UTC 2012 - zaitor@opensuse.org
|
Sat May 5 07:50:00 UTC 2012 - zaitor@opensuse.org
|
||||||
|
|
||||||
|
@ -26,6 +26,10 @@ Url: http://www.gnome.org
|
|||||||
Source: http://download.gnome.org/sources/mutter/3.4/%{name}-%{version}.tar.xz
|
Source: http://download.gnome.org/sources/mutter/3.4/%{name}-%{version}.tar.xz
|
||||||
# PATCH-FIX-UPSTREAM mutter-fix-crash-when-frame-is-NULL.patch bgo#675254 zaitor@opensuse.org -- fixes crashes in extensions.
|
# PATCH-FIX-UPSTREAM mutter-fix-crash-when-frame-is-NULL.patch bgo#675254 zaitor@opensuse.org -- fixes crashes in extensions.
|
||||||
Patch0: mutter-fix-crash-when-frame-is-NULL.patch
|
Patch0: mutter-fix-crash-when-frame-is-NULL.patch
|
||||||
|
# PATCH-FIX-UPSTREAM mutter-never-slice-shape-mask.patch bgo#674731 rh#813648 fcrozat@suse.com -- Fix window texturing on hardware without ARB_texture_non_power_of_two
|
||||||
|
Patch1: mutter-never-slice-shape-mask.patch
|
||||||
|
# PATCH-FIX-UPSTREAM mutter-use-cogl-texrect-api.patch bgo#672711 rh#813648 fcrozat@suse.com -- Fix window texturing on hardware without ARB_texture_non_power_of_two
|
||||||
|
Patch2: mutter-use-cogl-texrect-api.patch
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: gnome-doc-utils-devel
|
BuildRequires: gnome-doc-utils-devel
|
||||||
BuildRequires: gobject-introspection-devel >= 0.9.5
|
BuildRequires: gobject-introspection-devel >= 0.9.5
|
||||||
@ -91,6 +95,8 @@ to develop applications that require these.
|
|||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
%patch0 -p1
|
%patch0 -p1
|
||||||
|
%patch1 -p1
|
||||||
|
%patch2 -p1
|
||||||
translation-update-upstream
|
translation-update-upstream
|
||||||
|
|
||||||
%if 0%{?BUILD_FROM_VCS}
|
%if 0%{?BUILD_FROM_VCS}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user