[PATCH] ecore-wayland: Improve opaque setting logic.

Alex Wu zhiwen.wu at linux.intel.com
Fri Jan 4 19:00:57 PST 2013


Hi,
I cooked the patch to improve the opaque setting logic in ecore_wayland.
It can significantly help the weston to do more efficient compositing.
Modifications including:
1. Update win->region.opaque in ecore_wl_window_update_size, so that
the opaque info is synced with the geometry.

2. Add win->surface checking in ecore_wl_window_buffer_attach
before send any wl_surface related request, it will avoid segfault
in case that calling ecore_wl_window_buffer_attach() before
ecore_wl_window_show().
-------------- next part --------------
From 40ed108f3fc16c87d93c49aee4961a53e01a78a2 Mon Sep 17 00:00:00 2001
From: Alex Wu <zhiwen.wu at linux.intel.com>
Date: Sat, 5 Jan 2013 10:50:19 +0800
Subject: [PATCH] ecore-wayland: Improve opaque setting logic.

1. Update win->region.opaque in ecore_wl_window_update_size, so that
the opaque info is synced with the geometry.

2. Add win->surface checking in ecore_wl_window_buffer_attach
before send any wl_surface related request, it will avoid segfault
in case that calling ecore_wl_window_buffer_attach() before
ecore_wl_window_show().
---
 trunk/efl/src/lib/ecore_wayland/ecore_wl_window.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/trunk/efl/src/lib/ecore_wayland/ecore_wl_window.c b/trunk/efl/src/lib/ecore_wayland/ecore_wl_window.c
index 13ea38f..f20b3c6 100644
--- a/trunk/efl/src/lib/ecore_wayland/ecore_wl_window.c
+++ b/trunk/efl/src/lib/ecore_wayland/ecore_wl_window.c
@@ -241,6 +241,9 @@ ecore_wl_window_buffer_attach(Ecore_Wl_Window *win, struct wl_buffer *buffer, in
         return;
      }
 
+   if (!win->surface)
+      return;
+
    if (win->region.input)
      {
         wl_surface_set_input_region(win->surface, win->region.input);
@@ -421,6 +424,15 @@ ecore_wl_window_update_size(Ecore_Wl_Window *win, int w, int h)
    if (!win) return;
    win->allocation.w = w;
    win->allocation.h = h;
+
+   if (!win->transparent || !win->alpha)
+     {
+        if (win->region.opaque) wl_region_destroy(win->region.opaque);
+        win->region.opaque = 
+          wl_compositor_create_region(_ecore_wl_disp->wl.compositor);
+        wl_region_add(win->region.opaque, win->allocation.x, win->allocation.y, 
+                      win->allocation.w, win->allocation.h);
+     }
 }
 
 EAPI void 
-- 
1.7.9.5


More information about the wayland-devel mailing list