summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2016-04-04 16:57:30 -0500
committerDerek Foreman <derekf@osg.samsung.com>2016-04-04 16:57:30 -0500
commit1e16bf2af23bbdaa2c9664289f7ed3ce1b80e5e3 (patch)
tree0405735af6d4f04a48295a52f6f0ce5a1de2a654
parent2760afbb0e8c8adfb35b1dee016be7883fa07323 (diff)
downloadefl-devs/derekf/small_fixes.tar.gz
wayland_shm: Fix resize optimizationdevs/derekf/small_fixes
We're supposed to allocate a large pool at startup and use it for resizing to save pool allocations. However, this was broken and we ended up allocating both a large pool and a proper sized pool every resize. This restores correct behaviour.
-rw-r--r--src/modules/evas/engines/wayland_shm/evas_shm.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/modules/evas/engines/wayland_shm/evas_shm.c b/src/modules/evas/engines/wayland_shm/evas_shm.c
index f54e7d11a1..22924e053f 100644
--- a/src/modules/evas/engines/wayland_shm/evas_shm.c
+++ b/src/modules/evas/engines/wayland_shm/evas_shm.c
@@ -5,6 +5,7 @@
static Eina_Bool _shm_leaf_create(Shm_Surface *surface, Shm_Leaf *leaf, int w, int h);
static void _shm_leaf_release(Shm_Leaf *leaf);
+static void _shm_leaf_destroy(Shm_Leaf *leaf);
static struct wl_shm_pool *
_shm_pool_make(struct wl_shm *shm, int size, void **data)
@@ -301,11 +302,25 @@ static void
_shm_leaf_release(Shm_Leaf *leaf)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ Shm_Pool *resize_pool;
+ /* if we delete resize_pool here we blow away the clever optimization
+ * it provides (and end up doing two allocations per resize when we
+ * might have done none at all).
+ */
+ resize_pool = leaf->resize_pool;
if (leaf->data) _shm_data_destroy(leaf->data);
- if (leaf->resize_pool) _shm_pool_destroy(leaf->resize_pool);
memset(leaf, 0, sizeof(*leaf));
leaf->valid = EINA_FALSE;
+ leaf->resize_pool = resize_pool;
+}
+
+static void
+_shm_leaf_destroy(Shm_Leaf *leaf)
+{
+ _shm_leaf_release(leaf);
+ if (leaf->resize_pool) _shm_pool_destroy(leaf->resize_pool);
+ leaf->resize_pool = NULL;
}
Shm_Surface *
@@ -355,7 +370,7 @@ _evas_shm_surface_destroy(Shm_Surface *surface)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
for (; i < surface->num_buff; i++)
- _shm_leaf_release(&surface->leaf[i]);
+ _shm_leaf_destroy(&surface->leaf[i]);
free(surface);
}