Update weston recipes
authorRonan Le Martret <ronan@fridu.net>
Tue, 17 Jun 2014 12:45:22 +0000 (14:45 +0200)
committerRonan Le Martret <ronan@fridu.net>
Tue, 17 Jun 2014 12:45:22 +0000 (14:45 +0200)
Change-Id: I631b27cdefe12a173ff52c634ce7b8cea6b2382c

recipes-graphics/wayland/weston/0001-comp-wayland-use-safe-foreach-when-destroying-output.patch [new file with mode: 0644]
recipes-graphics/wayland/weston/0002-This-vfunc-lets-us-read-out-a-rectangle-of-pixels-fr.patch [new file with mode: 0644]
recipes-graphics/wayland/weston/0003-downstream-allow-to-start-for-system-users.patch [moved from recipes-graphics/wayland/weston/0001-downstream-allow-to-start-for-system-users.patch with 100% similarity]
recipes-graphics/wayland/weston/0004-downstream-shell-make-panel-optional-panel-false-in-.patch [moved from recipes-graphics/wayland/weston/0002-downstream-shell-make-panel-optional-panel-false-in-.patch with 100% similarity]
recipes-graphics/wayland/weston/0005-downstream-Hack-to-allow-selecting-a-default-output.patch [moved from recipes-graphics/wayland/weston/0003-downstream-Hack-to-allow-selecting-a-default-output.patch with 98% similarity]
recipes-graphics/wayland/weston/0006-downstream-accept-the-new-enable-sys-uid-configure-o.patch [new file with mode: 0644]
recipes-graphics/wayland/weston_1.5.0.bbappend

diff --git a/recipes-graphics/wayland/weston/0001-comp-wayland-use-safe-foreach-when-destroying-output.patch b/recipes-graphics/wayland/weston/0001-comp-wayland-use-safe-foreach-when-destroying-output.patch
new file mode 100644 (file)
index 0000000..19d583d
--- /dev/null
@@ -0,0 +1,35 @@
+From: "U. Artie Eoff" <ullysses.a.eoff@intel.com>
+Date: Wed, 21 May 2014 09:20:02 -0700
+Subject: comp-wayland: use safe foreach when destroying outputs
+
+wl_list_for_each dereference's output to increment the
+next iteration of the loop.  However, output is free'd
+inside the loop resulting in a dereference to free'd
+memory.
+
+Use wl_list_for_each_safe instead, which is designed to
+handle this kind of pattern.
+
+Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
+Reviewed-by: Thierry Reding <thierry.reding@gmail.com>
+Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
+---
+ src/compositor-wayland.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
+index a08b71a..76e5396 100644
+--- a/src/compositor-wayland.c
++++ b/src/compositor-wayland.c
+@@ -1997,9 +1997,9 @@ err_free:
+ static void
+ wayland_compositor_destroy(struct wayland_compositor *c)
+ {
+-      struct weston_output *output;
++      struct weston_output *output, *next;
+-      wl_list_for_each(output, &c->base.output_list, link)
++      wl_list_for_each_safe(output, next, &c->base.output_list, link)
+               wayland_output_destroy(output);
+       c->base.renderer->destroy(&c->base);
diff --git a/recipes-graphics/wayland/weston/0002-This-vfunc-lets-us-read-out-a-rectangle-of-pixels-fr.patch b/recipes-graphics/wayland/weston/0002-This-vfunc-lets-us-read-out-a-rectangle-of-pixels-fr.patch
new file mode 100644 (file)
index 0000000..320ee1f
--- /dev/null
@@ -0,0 +1,111 @@
+From: =?utf-8?q?Kristian_H=C3=B8gsberg?= <krh@bitplanet.net>
+Date: Wed, 29 Jan 2014 15:55:09 +0900
+Subject: This vfunc lets us read out a rectangle of pixels from the currently
+ attached surface buffer.
+
+Change-Id: Ia12d01fd0d157654602a2c46dd5874218252dd2f
+---
+ src/compositor.h  |  3 +++
+ src/gl-renderer.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 57 insertions(+)
+
+diff --git a/src/compositor.h b/src/compositor.h
+index 057f8be..d646ebe 100644
+--- a/src/compositor.h
++++ b/src/compositor.h
+@@ -544,6 +544,9 @@ struct weston_renderer {
+                              pixman_format_code_t format, void *pixels,
+                              uint32_t x, uint32_t y,
+                              uint32_t width, uint32_t height);
++      int (*read_surface_pixels)(struct weston_surface *es,
++                                 pixman_format_code_t format, void *pixels,
++                                 int x, int y, int width, int height);
+       void (*repaint_output)(struct weston_output *output,
+                              pixman_region32_t *output_damage);
+       void (*flush_damage)(struct weston_surface *surface);
+diff --git a/src/gl-renderer.c b/src/gl-renderer.c
+index 63af75d..19e2c53 100644
+--- a/src/gl-renderer.c
++++ b/src/gl-renderer.c
+@@ -123,6 +123,8 @@ struct gl_renderer {
+       EGLContext egl_context;
+       EGLConfig egl_config;
++      GLuint fbo;
++
+       struct wl_array vertices;
+       struct wl_array vtxcnt;
+@@ -608,6 +610,54 @@ out:
+       pixman_region32_fini(&repaint);
+ }
++static int
++gl_renderer_read_surface_pixels(struct weston_surface *es,
++                              pixman_format_code_t format, void *pixels,
++                              int x, int y, int width, int height)
++{
++      struct weston_buffer *buffer = es->buffer_ref.buffer;
++      struct weston_compositor *ec = es->compositor;
++      struct gl_renderer *gr = get_renderer(ec);
++      struct gl_surface_state *gs = get_surface_state(es);
++      GLenum gl_format;
++      int size;
++      struct wl_shm_buffer *shm_buffer = NULL;
++
++      switch (format) {
++      case PIXMAN_a8r8g8b8:
++              gl_format = GL_BGRA_EXT;
++              break;
++      case PIXMAN_a8b8g8r8:
++              gl_format = GL_RGBA;
++              break;
++      default:
++              return -1;
++      }
++
++        if (buffer) {
++              shm_buffer = wl_shm_buffer_get(buffer->resource);
++      }
++      if (shm_buffer) {
++              size = buffer->width * 4 * buffer->height;
++              memcpy(pixels, wl_shm_buffer_get_data(shm_buffer), size);
++      } else {
++              if (gr->fbo == 0)
++                      glGenFramebuffers(1, &gr->fbo);
++              glBindFramebuffer(GL_FRAMEBUFFER, gr->fbo);
++              glFramebufferTexture2D(GL_FRAMEBUFFER,
++                                     GL_COLOR_ATTACHMENT0,
++                                     GL_TEXTURE_2D,
++                                     gs->textures[0], 0);
++
++              glReadPixels(x, y, width, height,
++                           gl_format, GL_UNSIGNED_BYTE, pixels);
++
++              glBindFramebuffer(GL_FRAMEBUFFER, 0);
++      }
++
++      return 0;
++}
++
+ static void
+ repaint_views(struct weston_output *output, pixman_region32_t *damage)
+ {
+@@ -1818,6 +1868,9 @@ gl_renderer_destroy(struct weston_compositor *ec)
+       wl_signal_emit(&gr->destroy_signal, gr);
++      if (gr->fbo)
++              glDeleteFramebuffers(1, &gr->fbo);
++
+       if (gr->has_bind_display)
+               gr->unbind_display(gr->egl_display, ec->wl_display);
+@@ -1927,6 +1980,7 @@ gl_renderer_create(struct weston_compositor *ec, EGLNativeDisplayType display,
+               return -1;
+       gr->base.read_pixels = gl_renderer_read_pixels;
++      gr->base.read_surface_pixels = gl_renderer_read_surface_pixels;
+       gr->base.repaint_output = gl_renderer_repaint_output;
+       gr->base.flush_damage = gl_renderer_flush_damage;
+       gr->base.attach = gl_renderer_attach;
@@ -117,7 +117,7 @@ index 56b3228..bf32e1a 100644
                        goto err_x11_input;
                x = pixman_region32_extents(&output->base.region)->x2;
 diff --git a/src/compositor.h b/src/compositor.h
-index 057f8be..4fb8adc 100644
+index d646ebe..f1e2e02 100644
 --- a/src/compositor.h
 +++ b/src/compositor.h
 @@ -199,6 +199,7 @@ struct weston_output {
@@ -128,7 +128,7 @@ index 057f8be..4fb8adc 100644
        int destroying;
  
        char *make, *model, *serial_number;
-@@ -614,6 +615,8 @@ struct weston_compositor {
+@@ -617,6 +618,8 @@ struct weston_compositor {
        struct wl_list axis_binding_list;
        struct wl_list debug_binding_list;
  
diff --git a/recipes-graphics/wayland/weston/0006-downstream-accept-the-new-enable-sys-uid-configure-o.patch b/recipes-graphics/wayland/weston/0006-downstream-accept-the-new-enable-sys-uid-configure-o.patch
new file mode 100644 (file)
index 0000000..958ad96
--- /dev/null
@@ -0,0 +1,47 @@
+From: Manuel Bachmann <manuel.bachmann@open.eurogiciel.org>
+Date: Thu, 12 Jun 2014 15:51:27 +0200
+Subject: downstream: accept the new "--enable-sys-uid" configure option
+
+This configure option activates the code allowing non-root users
+(such as "display") to launch Weston directly.
+
+Change-Id: I844ce7aaba717d1453092e62885b704e9473c4f7
+Signed-off-by: Manuel Bachmann <manuel.bachmann@open.eurogiciel.org>
+---
+ Makefile.am  | 4 ++++
+ configure.ac | 7 +++++++
+ 2 files changed, 11 insertions(+)
+
+diff --git a/Makefile.am b/Makefile.am
+index 343adc6..239a27a 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -33,6 +33,10 @@ AM_CPPFLAGS =                                       \
+       -DLIBEXECDIR='"$(libexecdir)"'          \
+       -DBINDIR='"$(bindir)"'
++if ENABLE_SYS_UID
++AM_CPPFLAGS += -DLOCAL_CONFIG_WESTON_ALLOW_SYS_UID=1
++endif
++
+ CLEANFILES = weston.ini $(BUILT_SOURCES)
+ bin_PROGRAMS += weston
+diff --git a/configure.ac b/configure.ac
+index f55cea8..d7bb414 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -69,6 +69,13 @@ if test x$enable_egl = xyes; then
+         PKG_CHECK_MODULES([EGL_TESTS], [egl >= 7.10 glesv2 wayland-client wayland-egl])
+ fi
++AC_ARG_ENABLE(sys_uid, [  --enable-sys-uid],,
++              enable_sys_uid=no)
++AM_CONDITIONAL(ENABLE_SYS_UID, test x$enable_sys_uid = xyes)
++if test x$enable_sys_uid = xyes; then
++      AC_DEFINE([ENABLE_SYS_UID], [1], [Allow system users to launch Weston without weston-launch])
++fi
++
+ AC_ARG_ENABLE(xkbcommon,
+             AS_HELP_STRING([--disable-xkbcommon], [Disable libxkbcommon
+                             support: This is only useful in environments
index 8bed922..3eefbbf 100644 (file)
@@ -1,9 +1,12 @@
 FILESEXTRAPATHS_prepend := "${THISDIR}/weston"
 
 SRC_URI += "file://weston.target \
-            file://0001-downstream-allow-to-start-for-system-users.patch \
-            file://0002-downstream-shell-make-panel-optional-panel-false-in-.patch \
-            file://0003-downstream-Hack-to-allow-selecting-a-default-output.patch \
+            file://0001-comp-wayland-use-safe-foreach-when-destroying-output.patch \
+            file://0002-This-vfunc-lets-us-read-out-a-rectangle-of-pixels-fr.patch \
+            file://0003-downstream-allow-to-start-for-system-users.patch \
+            file://0004-downstream-shell-make-panel-optional-panel-false-in-.patch \
+            file://0005-downstream-Hack-to-allow-selecting-a-default-output.patch \
+            file://0006-downstream-accept-the-new-enable-sys-uid-configure-o.patch \
             "
 
 do_install_append() {