aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Antognolli <rafael.antognolli@linux.intel.com>2013-02-27 12:12:22 -0300
committerRafael Antognolli <rafael.antognolli@linux.intel.com>2013-02-28 12:48:41 -0300
commit3d0bd026ba3dec800e5d5cc1332656d9b66c6cf2 (patch)
treea4acc75ae342b5e0db6168e3f1da407b754df533
parenta4026762f94b7e4597743fb670daa8dbf488da5e (diff)
downloadefl-3d0bd026ba3dec800e5d5cc1332656d9b66c6cf2.tar.gz
efl-3d0bd026ba3dec800e5d5cc1332656d9b66c6cf2.tar.xz
efl-3d0bd026ba3dec800e5d5cc1332656d9b66c6cf2.zip
evas/wayland_shm: Add evas_swapper_reconfigure().
This can be used to reconfigure a swapper to another size, without the need to destroy the swapper itself. Although the shm pool is not being reused even when reconfiguring to a smaller size, it could easily be. This change is done right now only to keep the dx and dy offsets of a previously requested swapper, which were not still used.
-rw-r--r--src/modules/evas/engines/wayland_shm/evas_swapbuf.c11
-rw-r--r--src/modules/evas/engines/wayland_shm/evas_swapper.c52
-rw-r--r--src/modules/evas/engines/wayland_shm/evas_swapper.h1
3 files changed, 62 insertions, 2 deletions
diff --git a/src/modules/evas/engines/wayland_shm/evas_swapbuf.c b/src/modules/evas/engines/wayland_shm/evas_swapbuf.c
index da82623b8..443b45f28 100644
--- a/src/modules/evas/engines/wayland_shm/evas_swapbuf.c
+++ b/src/modules/evas/engines/wayland_shm/evas_swapbuf.c
@@ -110,8 +110,15 @@ evas_swapbuf_reconfigure(Outbuf *ob, int x, int y, int w, int h, unsigned int ro
/* check for valid swapper */
if (ob->priv.swapper)
{
- /* free existing swapper */
- evas_swapper_free(ob->priv.swapper);
+ if ((ob->rotation == 0) || (ob->rotation == 180))
+ ob->priv.swapper = evas_swapper_reconfigure(ob->priv.swapper,
+ x, y, w, h, depth,
+ alpha);
+ else if ((ob->rotation == 90) || (ob->rotation == 270))
+ ob->priv.swapper = evas_swapper_reconfigure(ob->priv.swapper,
+ x, y, h, w, depth,
+ alpha);
+ return;
}
/* create new swapper */
diff --git a/src/modules/evas/engines/wayland_shm/evas_swapper.c b/src/modules/evas/engines/wayland_shm/evas_swapper.c
index 2c77a9ba9..d7cf6e632 100644
--- a/src/modules/evas/engines/wayland_shm/evas_swapper.c
+++ b/src/modules/evas/engines/wayland_shm/evas_swapper.c
@@ -116,6 +116,56 @@ evas_swapper_setup(int dx, int dy, int w, int h, Outbuf_Depth depth, Eina_Bool a
return ws;
}
+Wl_Swapper *
+evas_swapper_reconfigure(Wl_Swapper *ws, int dx, int dy, int w, int h, Outbuf_Depth depth, Eina_Bool alpha)
+{
+ int i = 0;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!ws)
+ {
+ ERR("No swapper to reconfigure.");
+ return NULL;
+ }
+
+ /* loop the swapper's buffers and free them */
+ for (i = 0; i < ws->buff_num; i++)
+ _evas_swapper_buffer_free(&(ws->buff[i]));
+
+ /* free the shm pool */
+ _evas_swapper_shm_pool_free(ws);
+
+ ws->dx += dx;
+ ws->dy += dy;
+ ws->w = w;
+ ws->h = h;
+ ws->depth = depth;
+ ws->alpha = alpha;
+
+ /* create the shm pool */
+ if (!_evas_swapper_shm_pool_new(ws))
+ {
+ ERR("Could not allocate new shm pool.");
+ evas_swapper_free(ws);
+ return NULL;
+ }
+
+ for (i = 0; i < ws->buff_num; i++)
+ {
+ /* try to create new internal Wl_Buffer */
+ if (!_evas_swapper_buffer_new(ws, &(ws->buff[i])))
+ {
+ ERR("failed to create wl_buffer. free the swapper.");
+ evas_swapper_free(ws);
+ return NULL;
+ }
+ }
+
+ /* return reconfigured swapper */
+ return ws;
+}
+
void
evas_swapper_swap(Wl_Swapper *ws, Eina_Rectangle *rects, unsigned int count)
{
@@ -307,6 +357,8 @@ _evas_swapper_shm_pool_free(Wl_Swapper *ws)
/* destroy the shm pool */
wl_shm_pool_destroy(ws->pool);
+
+ ws->pool_size = 0;
}
static Eina_Bool
diff --git a/src/modules/evas/engines/wayland_shm/evas_swapper.h b/src/modules/evas/engines/wayland_shm/evas_swapper.h
index 7506793eb..8c21cc82c 100644
--- a/src/modules/evas/engines/wayland_shm/evas_swapper.h
+++ b/src/modules/evas/engines/wayland_shm/evas_swapper.h
@@ -6,6 +6,7 @@
typedef struct _Wl_Swapper Wl_Swapper;
Wl_Swapper *evas_swapper_setup(int dx, int dy, int w, int h, Outbuf_Depth depth, Eina_Bool alpha, struct wl_shm *shm, struct wl_surface *surface);
+Wl_Swapper *evas_swapper_reconfigure(Wl_Swapper *ws, int dx, int dy, int w, int h, Outbuf_Depth depth, Eina_Bool alpha);
void evas_swapper_swap(Wl_Swapper *ws, Eina_Rectangle *rects, unsigned int count);
void evas_swapper_free(Wl_Swapper *ws);
void *evas_swapper_buffer_map(Wl_Swapper *ws);