summaryrefslogtreecommitdiff
path: root/src/modules/evas/engines/wayland_shm/evas_shm.c
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2016-04-04 16:57:30 -0500
committerMike Blumenkrantz <zmike@osg.samsung.com>2016-04-04 18:00:40 -0400
commit406c2343467ce986e0b313e8aa26b25bb235525c (patch)
treebdb343c2f83c56b89c3d957267b5221c2e5c7636 /src/modules/evas/engines/wayland_shm/evas_shm.c
parent3121ea07c2e78b171b7656fc7cc71e031e0d141b (diff)
wayland_shm: Fix resize optimization
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.
Diffstat (limited to 'src/modules/evas/engines/wayland_shm/evas_shm.c')
-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 @@
5 5
6static Eina_Bool _shm_leaf_create(Shm_Surface *surface, Shm_Leaf *leaf, int w, int h); 6static Eina_Bool _shm_leaf_create(Shm_Surface *surface, Shm_Leaf *leaf, int w, int h);
7static void _shm_leaf_release(Shm_Leaf *leaf); 7static void _shm_leaf_release(Shm_Leaf *leaf);
8static void _shm_leaf_destroy(Shm_Leaf *leaf);
8 9
9static struct wl_shm_pool * 10static struct wl_shm_pool *
10_shm_pool_make(struct wl_shm *shm, int size, void **data) 11_shm_pool_make(struct wl_shm *shm, int size, void **data)
@@ -301,11 +302,25 @@ static void
301_shm_leaf_release(Shm_Leaf *leaf) 302_shm_leaf_release(Shm_Leaf *leaf)
302{ 303{
303 LOGFN(__FILE__, __LINE__, __FUNCTION__); 304 LOGFN(__FILE__, __LINE__, __FUNCTION__);
305 Shm_Pool *resize_pool;
304 306
307 /* if we delete resize_pool here we blow away the clever optimization
308 * it provides (and end up doing two allocations per resize when we
309 * might have done none at all).
310 */
311 resize_pool = leaf->resize_pool;
305 if (leaf->data) _shm_data_destroy(leaf->data); 312 if (leaf->data) _shm_data_destroy(leaf->data);
306 if (leaf->resize_pool) _shm_pool_destroy(leaf->resize_pool);
307 memset(leaf, 0, sizeof(*leaf)); 313 memset(leaf, 0, sizeof(*leaf));
308 leaf->valid = EINA_FALSE; 314 leaf->valid = EINA_FALSE;
315 leaf->resize_pool = resize_pool;
316}
317
318static void
319_shm_leaf_destroy(Shm_Leaf *leaf)
320{
321 _shm_leaf_release(leaf);
322 if (leaf->resize_pool) _shm_pool_destroy(leaf->resize_pool);
323 leaf->resize_pool = NULL;
309} 324}
310 325
311Shm_Surface * 326Shm_Surface *
@@ -355,7 +370,7 @@ _evas_shm_surface_destroy(Shm_Surface *surface)
355 LOGFN(__FILE__, __LINE__, __FUNCTION__); 370 LOGFN(__FILE__, __LINE__, __FUNCTION__);
356 371
357 for (; i < surface->num_buff; i++) 372 for (; i < surface->num_buff; i++)
358 _shm_leaf_release(&surface->leaf[i]); 373 _shm_leaf_destroy(&surface->leaf[i]);
359 374
360 free(surface); 375 free(surface);
361} 376}