forked from enlightenment/efl
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
This commit is contained in:
parent
93a683daad
commit
ed2e78286b
|
@ -30,8 +30,8 @@ static void _xcbob_sync(xcb_connection_t *conn);
|
|||
/* local variables */
|
||||
static Eina_List *_shmpool = NULL;
|
||||
static int _shmsize = 0;
|
||||
static int _shmlimit = (20 * 1024 * 1024);
|
||||
static const unsigned int _shmcountlimit = 128;
|
||||
static int _shmlimit = 0;
|
||||
static const unsigned int _shmcountlimit = 32;
|
||||
|
||||
static Eina_Spinlock shmpool_lock;
|
||||
#define SHMPOOL_LOCK() eina_spinlock_take(&shmpool_lock)
|
||||
|
@ -46,6 +46,9 @@ evas_software_xcb_outbuf_init(void)
|
|||
void
|
||||
evas_software_xcb_outbuf_free(Outbuf *buf)
|
||||
{
|
||||
SHMPOOL_LOCK();
|
||||
shmmemlimit -= ((buf->w * buf->h * (buf->depth / 8)) * 3) / 2;
|
||||
SHMPOOL_UNLOCK();
|
||||
eina_spinlock_take(&(buf->priv.lock));
|
||||
while (buf->priv.pending_writes)
|
||||
{
|
||||
|
@ -263,6 +266,9 @@ evas_software_xcb_outbuf_setup(int w, int h, int rot, Outbuf_Depth depth, xcb_co
|
|||
evas_software_xcb_outbuf_mask_set(buf, mask);
|
||||
eina_spinlock_new(&(buf->priv.lock));
|
||||
|
||||
SHMPOOL_LOCK();
|
||||
shmmemlimit += ((buf->w * buf->h * (buf->depth / 8)) * 3) / 2;
|
||||
SHMPOOL_UNLOCK();
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
@ -1012,9 +1018,13 @@ evas_software_xcb_outbuf_reconfigure(Outbuf *buf, int w, int h, int rot, Outbuf_
|
|||
{
|
||||
if ((w == buf->w) && (h == buf->h) && (rot == buf->rot) &&
|
||||
(depth == buf->depth)) return;
|
||||
SHMPOOL_LOCK();
|
||||
shmmemlimit -= ((buf->w * buf->h * (buf->depth / 8)) * 3) / 2;
|
||||
buf->w = w;
|
||||
buf->h = h;
|
||||
buf->rot = rot;
|
||||
shmmemlimit += ((buf->w * buf->h * (buf->depth / 8)) * 3) / 2;
|
||||
SHMPOOL_UNLOCK();
|
||||
evas_software_xcb_outbuf_idle_flush(buf);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,8 @@ struct _Outbuf_Region
|
|||
static Eina_Bool shmpool_initted = EINA_FALSE;
|
||||
static Eina_List *shmpool = NULL;
|
||||
static int shmsize = 0;
|
||||
static int shmmemlimit = 20 * 1024 * 1024;
|
||||
static const unsigned int shmcountlimit = 128;
|
||||
static int shmmemlimit = 0;
|
||||
static const unsigned int shmcountlimit = 32;
|
||||
|
||||
static Eina_Spinlock shmpool_lock;
|
||||
#define SHMPOOL_LOCK() eina_spinlock_take(&shmpool_lock)
|
||||
|
@ -161,6 +161,9 @@ evas_software_xlib_outbuf_init(void)
|
|||
void
|
||||
evas_software_xlib_outbuf_free(Outbuf *buf)
|
||||
{
|
||||
SHMPOOL_LOCK();
|
||||
shmmemlimit -= ((buf->w * buf->h * (buf->depth / 8)) * 3) / 2;
|
||||
SHMPOOL_UNLOCK();
|
||||
eina_spinlock_take(&(buf->priv.lock));
|
||||
while (buf->priv.pending_writes)
|
||||
{
|
||||
|
@ -216,7 +219,7 @@ evas_software_xlib_outbuf_setup_x(int w, int h, int rot, Outbuf_Depth depth,
|
|||
return NULL;
|
||||
|
||||
if (x_depth < 15) rot = 0;
|
||||
|
||||
|
||||
buf->w = w;
|
||||
buf->h = h;
|
||||
buf->depth = depth;
|
||||
|
@ -376,6 +379,9 @@ evas_software_xlib_outbuf_setup_x(int w, int h, int rot, Outbuf_Depth depth,
|
|||
evas_software_xlib_outbuf_mask_set(buf, mask);
|
||||
}
|
||||
eina_spinlock_new(&(buf->priv.lock));
|
||||
SHMPOOL_LOCK();
|
||||
shmmemlimit += ((buf->w * buf->h * (buf->depth / 8)) * 3) / 2;
|
||||
SHMPOOL_UNLOCK();
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
@ -1185,9 +1191,13 @@ evas_software_xlib_outbuf_reconfigure(Outbuf * buf, int w, int h, int rot,
|
|||
(h == buf->h) &&
|
||||
(rot == buf->rot) &&
|
||||
(depth == buf->depth)) return;
|
||||
SHMPOOL_LOCK();
|
||||
shmmemlimit -= ((buf->w * buf->h * (buf->depth / 8)) * 3) / 2;
|
||||
buf->w = w;
|
||||
buf->h = h;
|
||||
buf->rot = rot;
|
||||
shmmemlimit += ((buf->w * buf->h * (buf->depth / 8)) * 3) / 2;
|
||||
SHMPOOL_UNLOCK();
|
||||
evas_software_xlib_outbuf_idle_flush(buf);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue