summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2016-07-26 13:59:54 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2016-07-26 13:59:54 +0900
commited2e78286b351cd8c3e85e1f6b92f25a54fab027 (patch)
tree89ef340d5168ab788af42f59968b6e13b6b83e72
parent93a683daad30bdf4440efaa0a1c5bffcb81f53ef (diff)
evas software x11 - be agressive with shm cache and keep it low
shm cache size is now 1.5x the total number of pixels in sw x11 outbutf's and that's it. 32 segment max limit too. this should keep things down @opt
-rw-r--r--src/modules/evas/engines/software_x11/evas_xcb_outbuf.c14
-rw-r--r--src/modules/evas/engines/software_x11/evas_xlib_outbuf.c16
2 files changed, 25 insertions, 5 deletions
diff --git a/src/modules/evas/engines/software_x11/evas_xcb_outbuf.c b/src/modules/evas/engines/software_x11/evas_xcb_outbuf.c
index cee38e9..7021982 100644
--- a/src/modules/evas/engines/software_x11/evas_xcb_outbuf.c
+++ b/src/modules/evas/engines/software_x11/evas_xcb_outbuf.c
@@ -30,8 +30,8 @@ static void _xcbob_sync(xcb_connection_t *conn);
30/* local variables */ 30/* local variables */
31static Eina_List *_shmpool = NULL; 31static Eina_List *_shmpool = NULL;
32static int _shmsize = 0; 32static int _shmsize = 0;
33static int _shmlimit = (20 * 1024 * 1024); 33static int _shmlimit = 0;
34static const unsigned int _shmcountlimit = 128; 34static const unsigned int _shmcountlimit = 32;
35 35
36static Eina_Spinlock shmpool_lock; 36static Eina_Spinlock shmpool_lock;
37#define SHMPOOL_LOCK() eina_spinlock_take(&shmpool_lock) 37#define SHMPOOL_LOCK() eina_spinlock_take(&shmpool_lock)
@@ -46,6 +46,9 @@ evas_software_xcb_outbuf_init(void)
46void 46void
47evas_software_xcb_outbuf_free(Outbuf *buf) 47evas_software_xcb_outbuf_free(Outbuf *buf)
48{ 48{
49 SHMPOOL_LOCK();
50 shmmemlimit -= ((buf->w * buf->h * (buf->depth / 8)) * 3) / 2;
51 SHMPOOL_UNLOCK();
49 eina_spinlock_take(&(buf->priv.lock)); 52 eina_spinlock_take(&(buf->priv.lock));
50 while (buf->priv.pending_writes) 53 while (buf->priv.pending_writes)
51 { 54 {
@@ -263,6 +266,9 @@ evas_software_xcb_outbuf_setup(int w, int h, int rot, Outbuf_Depth depth, xcb_co
263 evas_software_xcb_outbuf_mask_set(buf, mask); 266 evas_software_xcb_outbuf_mask_set(buf, mask);
264 eina_spinlock_new(&(buf->priv.lock)); 267 eina_spinlock_new(&(buf->priv.lock));
265 268
269 SHMPOOL_LOCK();
270 shmmemlimit += ((buf->w * buf->h * (buf->depth / 8)) * 3) / 2;
271 SHMPOOL_UNLOCK();
266 return buf; 272 return buf;
267} 273}
268 274
@@ -1012,9 +1018,13 @@ evas_software_xcb_outbuf_reconfigure(Outbuf *buf, int w, int h, int rot, Outbuf_
1012{ 1018{
1013 if ((w == buf->w) && (h == buf->h) && (rot == buf->rot) && 1019 if ((w == buf->w) && (h == buf->h) && (rot == buf->rot) &&
1014 (depth == buf->depth)) return; 1020 (depth == buf->depth)) return;
1021 SHMPOOL_LOCK();
1022 shmmemlimit -= ((buf->w * buf->h * (buf->depth / 8)) * 3) / 2;
1015 buf->w = w; 1023 buf->w = w;
1016 buf->h = h; 1024 buf->h = h;
1017 buf->rot = rot; 1025 buf->rot = rot;
1026 shmmemlimit += ((buf->w * buf->h * (buf->depth / 8)) * 3) / 2;
1027 SHMPOOL_UNLOCK();
1018 evas_software_xcb_outbuf_idle_flush(buf); 1028 evas_software_xcb_outbuf_idle_flush(buf);
1019} 1029}
1020 1030
diff --git a/src/modules/evas/engines/software_x11/evas_xlib_outbuf.c b/src/modules/evas/engines/software_x11/evas_xlib_outbuf.c
index 63b55c4..3827091 100644
--- a/src/modules/evas/engines/software_x11/evas_xlib_outbuf.c
+++ b/src/modules/evas/engines/software_x11/evas_xlib_outbuf.c
@@ -29,8 +29,8 @@ struct _Outbuf_Region
29static Eina_Bool shmpool_initted = EINA_FALSE; 29static Eina_Bool shmpool_initted = EINA_FALSE;
30static Eina_List *shmpool = NULL; 30static Eina_List *shmpool = NULL;
31static int shmsize = 0; 31static int shmsize = 0;
32static int shmmemlimit = 20 * 1024 * 1024; 32static int shmmemlimit = 0;
33static const unsigned int shmcountlimit = 128; 33static const unsigned int shmcountlimit = 32;
34 34
35static Eina_Spinlock shmpool_lock; 35static Eina_Spinlock shmpool_lock;
36#define SHMPOOL_LOCK() eina_spinlock_take(&shmpool_lock) 36#define SHMPOOL_LOCK() eina_spinlock_take(&shmpool_lock)
@@ -161,6 +161,9 @@ evas_software_xlib_outbuf_init(void)
161void 161void
162evas_software_xlib_outbuf_free(Outbuf *buf) 162evas_software_xlib_outbuf_free(Outbuf *buf)
163{ 163{
164 SHMPOOL_LOCK();
165 shmmemlimit -= ((buf->w * buf->h * (buf->depth / 8)) * 3) / 2;
166 SHMPOOL_UNLOCK();
164 eina_spinlock_take(&(buf->priv.lock)); 167 eina_spinlock_take(&(buf->priv.lock));
165 while (buf->priv.pending_writes) 168 while (buf->priv.pending_writes)
166 { 169 {
@@ -216,7 +219,7 @@ evas_software_xlib_outbuf_setup_x(int w, int h, int rot, Outbuf_Depth depth,
216 return NULL; 219 return NULL;
217 220
218 if (x_depth < 15) rot = 0; 221 if (x_depth < 15) rot = 0;
219 222
220 buf->w = w; 223 buf->w = w;
221 buf->h = h; 224 buf->h = h;
222 buf->depth = depth; 225 buf->depth = depth;
@@ -376,6 +379,9 @@ evas_software_xlib_outbuf_setup_x(int w, int h, int rot, Outbuf_Depth depth,
376 evas_software_xlib_outbuf_mask_set(buf, mask); 379 evas_software_xlib_outbuf_mask_set(buf, mask);
377 } 380 }
378 eina_spinlock_new(&(buf->priv.lock)); 381 eina_spinlock_new(&(buf->priv.lock));
382 SHMPOOL_LOCK();
383 shmmemlimit += ((buf->w * buf->h * (buf->depth / 8)) * 3) / 2;
384 SHMPOOL_UNLOCK();
379 return buf; 385 return buf;
380} 386}
381 387
@@ -1185,9 +1191,13 @@ evas_software_xlib_outbuf_reconfigure(Outbuf * buf, int w, int h, int rot,
1185 (h == buf->h) && 1191 (h == buf->h) &&
1186 (rot == buf->rot) && 1192 (rot == buf->rot) &&
1187 (depth == buf->depth)) return; 1193 (depth == buf->depth)) return;
1194 SHMPOOL_LOCK();
1195 shmmemlimit -= ((buf->w * buf->h * (buf->depth / 8)) * 3) / 2;
1188 buf->w = w; 1196 buf->w = w;
1189 buf->h = h; 1197 buf->h = h;
1190 buf->rot = rot; 1198 buf->rot = rot;
1199 shmmemlimit += ((buf->w * buf->h * (buf->depth / 8)) * 3) / 2;
1200 SHMPOOL_UNLOCK();
1191 evas_software_xlib_outbuf_idle_flush(buf); 1201 evas_software_xlib_outbuf_idle_flush(buf);
1192} 1202}
1193 1203