summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2013-10-11 17:18:42 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2013-10-28 15:47:16 +0900
commit15130078156d849f942fb00c4f37bd708bad0c7b (patch)
tree42603e5b79eb86c8b8154f0b4de8d24107ea9b26 /src/bin
parent7b62d77cf5441b89c17ff082204a6908259bd4c3 (diff)
evas/cserve2: Merge Glyph_Data and mempool index
Glyphs were previously using 3 shared buffers, now reduce to 2: - Memory pool (mempool) containing the glyph drawable data - Index table (Shared_Index / array) containing only the indexes of the buffers in the mempool - Glyph_Data table (array) containing the glyphs descriptors AS WELL as the buffer indexes. So, we just merge the two index tables into one by using directly objects of type Glyph_Data for the referencing of the mempool buffers.
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/evas/evas_cserve2.h3
-rw-r--r--src/bin/evas/evas_cserve2_cache.c111
-rw-r--r--src/bin/evas/evas_cserve2_fonts.c11
-rw-r--r--src/bin/evas/evas_cserve2_index.c26
-rw-r--r--src/bin/evas/evas_cserve2_shm_debug.c7
5 files changed, 88 insertions, 70 deletions
diff --git a/src/bin/evas/evas_cserve2.h b/src/bin/evas/evas_cserve2.h
index 219bb0d7f7..e49bfc451d 100644
--- a/src/bin/evas/evas_cserve2.h
+++ b/src/bin/evas/evas_cserve2.h
@@ -381,7 +381,7 @@ void *cserve2_shared_array_item_data_find(Shared_Array *sa, void *data,
381int cserve2_shared_array_foreach(Shared_Array *sa, Eina_Each_Cb cb, void *data); 381int cserve2_shared_array_foreach(Shared_Array *sa, Eina_Each_Cb cb, void *data);
382 382
383// Shared buffers and memory pools 383// Shared buffers and memory pools
384Shared_Mempool *cserve2_shared_mempool_new(int indextag, int generation_id, int initsize); 384Shared_Mempool *cserve2_shared_mempool_new(int indextag, int index_elemsize, int generation_id, int initsize);
385void cserve2_shared_mempool_del(Shared_Mempool *sm); 385void cserve2_shared_mempool_del(Shared_Mempool *sm);
386int cserve2_shared_mempool_buffer_new(Shared_Mempool *sm, int size); 386int cserve2_shared_mempool_buffer_new(Shared_Mempool *sm, int size);
387int cserve2_shared_mempool_buffer_ref(Shared_Mempool *sm, int bufferid); 387int cserve2_shared_mempool_buffer_ref(Shared_Mempool *sm, int bufferid);
@@ -392,6 +392,7 @@ size_t cserve2_shared_mempool_size_get(Shared_Mempool *sm);
392const char *cserve2_shared_mempool_name_get(Shared_Mempool *sm); 392const char *cserve2_shared_mempool_name_get(Shared_Mempool *sm);
393int cserve2_shared_mempool_generation_id_get(Shared_Mempool *sm); 393int cserve2_shared_mempool_generation_id_get(Shared_Mempool *sm);
394int cserve2_shared_mempool_generation_id_set(Shared_Mempool *sm, int generation_id); 394int cserve2_shared_mempool_generation_id_set(Shared_Mempool *sm, int generation_id);
395Shared_Array *cserve2_shared_mempool_index_get(Shared_Mempool *sm);
395 396
396// Shared strings 397// Shared strings
397const char *cserve2_shared_strings_table_name_get(); 398const char *cserve2_shared_strings_table_name_get();
diff --git a/src/bin/evas/evas_cserve2_cache.c b/src/bin/evas/evas_cserve2_cache.c
index 15ce2c36f4..9f92543919 100644
--- a/src/bin/evas/evas_cserve2_cache.c
+++ b/src/bin/evas/evas_cserve2_cache.c
@@ -90,7 +90,6 @@ struct _Font_Entry {
90 Font_Source *src; 90 Font_Source *src;
91 void *ft; // Font_Info 91 void *ft; // Font_Info
92 Fash_Glyph2 *glyph_entries[3]; // Fast access to the Glyph_Entry objects 92 Fash_Glyph2 *glyph_entries[3]; // Fast access to the Glyph_Entry objects
93 Shared_Array *glyph_datas; // Contains the Glyph_Data objects
94 unsigned int nglyphs; 93 unsigned int nglyphs;
95 Eina_Bool unused : 1; 94 Eina_Bool unused : 1;
96 Shared_Mempool *mempool; // Contains the rendered glyphs 95 Shared_Mempool *mempool; // Contains the rendered glyphs
@@ -139,7 +138,6 @@ struct _File_Watch {
139 138
140static unsigned int _generation_id = 0; 139static unsigned int _generation_id = 0;
141static unsigned int _entry_id = 0; 140static unsigned int _entry_id = 0;
142static unsigned int _glyph_id = 0;
143static unsigned int _font_data_id = 0; 141static unsigned int _font_data_id = 0;
144static unsigned int _freed_file_entry_count = 0; 142static unsigned int _freed_file_entry_count = 0;
145static unsigned int _freed_image_entry_count = 0; 143static unsigned int _freed_image_entry_count = 0;
@@ -318,10 +316,12 @@ _font_data_find(unsigned int fs_id)
318} 316}
319 317
320static Glyph_Data * 318static Glyph_Data *
321_glyph_data_find(Shared_Array *sa, unsigned int glyph_id) 319_glyph_data_find(Shared_Mempool *sm, unsigned int glyph_id)
322{ 320{
323 Glyph_Data *gldata; 321 Glyph_Data *gldata;
322 Shared_Array *sa;
324 323
324 sa = cserve2_shared_mempool_index_get(sm);
325 gldata = cserve2_shared_array_item_data_find(sa, &glyph_id, 325 gldata = cserve2_shared_array_item_data_find(sa, &glyph_id,
326 _shm_object_id_cmp_cb); 326 _shm_object_id_cmp_cb);
327 if (!gldata) 327 if (!gldata)
@@ -1214,14 +1214,13 @@ _font_entry_key_hash(const Font_Entry *key, int key_length EINA_UNUSED)
1214static int 1214static int
1215_font_entry_memory_usage_get(Font_Entry *fe) 1215_font_entry_memory_usage_get(Font_Entry *fe)
1216{ 1216{
1217 int size; 1217 int size = sizeof(Font_Entry);
1218 1218
1219 if (!fe) return 0; 1219 if (!fe) return 0;
1220 if (!fe->mempool && !fe->glyph_datas) 1220 if (!fe->mempool)
1221 return 0; 1221 return size;
1222 1222
1223 size = cserve2_shared_mempool_size_get(fe->mempool); 1223 size += cserve2_shared_mempool_size_get(fe->mempool);
1224 size += cserve2_shared_array_map_size_get(fe->glyph_datas);
1225 size += fe->nglyphs * sizeof(Glyph_Entry); 1224 size += fe->nglyphs * sizeof(Glyph_Entry);
1226 1225
1227 return size; 1226 return size;
@@ -1251,7 +1250,6 @@ _font_entry_free(Font_Entry *fe)
1251 1250
1252 for (k = 0; k < 3; k++) 1251 for (k = 0; k < 3; k++)
1253 fash_gl_free(fe->glyph_entries[k]); 1252 fash_gl_free(fe->glyph_entries[k]);
1254 cserve2_shared_array_del(fe->glyph_datas);
1255 cserve2_shared_mempool_del(fe->mempool); 1253 cserve2_shared_mempool_del(fe->mempool);
1256 cserve2_font_ft_free(fe->ft); 1254 cserve2_font_ft_free(fe->ft);
1257 fe->src->refcount--; 1255 fe->src->refcount--;
@@ -1274,10 +1272,10 @@ _glyph_free_cb(void *data)
1274 1272
1275 if (!gl || !gl->fe) return; 1273 if (!gl || !gl->fe) return;
1276 1274
1277 gldata = _glyph_data_find(gl->fe->glyph_datas, gl->gldata_id); 1275 gldata = _glyph_data_find(gl->fe->mempool, gl->gldata_id);
1278 if (gldata) 1276 if (gldata)
1279 { 1277 {
1280 cserve2_shared_string_del(gldata->shm_id); 1278 cserve2_shared_string_del(gldata->mempool_id);
1281 gldata->refcount--; 1279 gldata->refcount--;
1282 } 1280 }
1283 free(gl); 1281 free(gl);
@@ -1864,6 +1862,7 @@ static Msg_Font_Glyphs_Loaded *
1864_glyphs_loaded_msg_create(Glyphs_Request *req, int *resp_size) 1862_glyphs_loaded_msg_create(Glyphs_Request *req, int *resp_size)
1865{ 1863{
1866 Msg_Font_Glyphs_Loaded *msg; 1864 Msg_Font_Glyphs_Loaded *msg;
1865 Shared_Array *sa;
1867 unsigned int size; 1866 unsigned int size;
1868 const char *shmname, *idxname; 1867 const char *shmname, *idxname;
1869 unsigned int shmname_size, idxname_size; 1868 unsigned int shmname_size, idxname_size;
@@ -1871,9 +1870,12 @@ _glyphs_loaded_msg_create(Glyphs_Request *req, int *resp_size)
1871 char *response, *buf; 1870 char *response, *buf;
1872 1871
1873 shmname = cserve2_shared_mempool_name_get(req->fe->mempool); 1872 shmname = cserve2_shared_mempool_name_get(req->fe->mempool);
1873 if (!shmname) return NULL;
1874 shmname_size = strlen(shmname) + 1; 1874 shmname_size = strlen(shmname) + 1;
1875 1875
1876 idxname = cserve2_shared_array_name_get(req->fe->glyph_datas); 1876 sa = cserve2_shared_mempool_index_get(req->fe->mempool);
1877 idxname = cserve2_shared_array_name_get(sa);
1878 if (!idxname) return NULL;
1877 idxname_size = strlen(idxname) + 1; 1879 idxname_size = strlen(idxname) + 1;
1878 1880
1879 size = sizeof(Msg_Font_Glyphs_Loaded); 1881 size = sizeof(Msg_Font_Glyphs_Loaded);
@@ -1904,7 +1906,7 @@ _glyphs_loaded_msg_create(Glyphs_Request *req, int *resp_size)
1904 Glyph_Data *gldata; 1906 Glyph_Data *gldata;
1905 1907
1906 ge = req->answer[k]; 1908 ge = req->answer[k];
1907 gldata = _glyph_data_find(ge->fe->glyph_datas, ge->gldata_id); 1909 gldata = _glyph_data_find(ge->fe->mempool, ge->gldata_id);
1908 if (!gldata) 1910 if (!gldata)
1909 { 1911 {
1910 ERR("Glyph data not found for %d", ge->gldata_id); 1912 ERR("Glyph data not found for %d", ge->gldata_id);
@@ -1913,7 +1915,7 @@ _glyphs_loaded_msg_create(Glyphs_Request *req, int *resp_size)
1913 1915
1914 memcpy(buf, &gldata->index, sizeof(int)); 1916 memcpy(buf, &gldata->index, sizeof(int));
1915 buf += sizeof(int); 1917 buf += sizeof(int);
1916 memcpy(buf, &gldata->shm_id, sizeof(string_t)); 1918 memcpy(buf, &gldata->mempool_id, sizeof(string_t));
1917 buf += sizeof(string_t); 1919 buf += sizeof(string_t);
1918 memcpy(buf, &gldata->offset, sizeof(int)); 1920 memcpy(buf, &gldata->offset, sizeof(int));
1919 buf += sizeof(int); 1921 buf += sizeof(int);
@@ -2112,8 +2114,9 @@ _glyphs_load_request_response(Glyphs_Request *req,
2112{ 2114{
2113 Font_Entry *fe = req->fe; 2115 Font_Entry *fe = req->fe;
2114 Shared_Mempool *mempool = msg->mempool; 2116 Shared_Mempool *mempool = msg->mempool;
2117 Shared_Array *index;
2115 unsigned int j, hint; 2118 unsigned int j, hint;
2116 string_t shm_id = 0; 2119 string_t shm_id;
2117 Font_Data *fd; 2120 Font_Data *fd;
2118 2121
2119 if (!msg->nglyphs) 2122 if (!msg->nglyphs)
@@ -2131,14 +2134,12 @@ _glyphs_load_request_response(Glyphs_Request *req,
2131 DBG("Font memory usage [begin]: %d / %d", font_mem_usage, max_font_usage); 2134 DBG("Font memory usage [begin]: %d / %d", font_mem_usage, max_font_usage);
2132 2135
2133 cserve2_shared_mempool_generation_id_set(mempool, _generation_id); 2136 cserve2_shared_mempool_generation_id_set(mempool, _generation_id);
2134 if (!fe->glyph_datas) 2137 index = cserve2_shared_mempool_index_get(mempool);
2138
2139 if (!fd->glyph_index_shm)
2135 { 2140 {
2136 fe->glyph_datas = cserve2_shared_array_new(GLYPH_INDEX_ARRAY_TAG, 2141 fd->glyph_index_shm = cserve2_shared_string_add
2137 _generation_id, 2142 (cserve2_shared_array_name_get(index));
2138 sizeof(Glyph_Data), 0);
2139 font_mem_usage += cserve2_shared_array_map_size_get(fe->glyph_datas);
2140 fd->glyph_index_shm = cserve2_shared_string_add(
2141 cserve2_shared_array_name_get(fe->glyph_datas));
2142 } 2143 }
2143 2144
2144 shm_id = cserve2_shared_string_add(cserve2_shared_mempool_name_get(mempool)); 2145 shm_id = cserve2_shared_string_add(cserve2_shared_mempool_name_get(mempool));
@@ -2149,31 +2150,23 @@ _glyphs_load_request_response(Glyphs_Request *req,
2149 gl = fash_gl_find(fe->glyph_entries[hint], msg->glyphs[j].index); 2150 gl = fash_gl_find(fe->glyph_entries[hint], msg->glyphs[j].index);
2150 if (!gl) 2151 if (!gl)
2151 { 2152 {
2152 int glyph_id, orig_mapsize, new_mapsize;
2153 Glyph_Data *gldata; 2153 Glyph_Data *gldata;
2154 2154
2155 orig_mapsize = cserve2_shared_array_map_size_get(fe->glyph_datas); 2155 gldata = _glyph_data_find(mempool, msg->glyphs[j].buffer_id);
2156
2157 glyph_id = cserve2_shared_array_item_new(fe->glyph_datas);
2158 gldata = cserve2_shared_array_item_data_get(fe->glyph_datas,
2159 glyph_id);
2160 if (!gldata) 2156 if (!gldata)
2161 { 2157 {
2162 ERR("Could not create new Glyph_Data!"); 2158 ERR("Could not find Glyph_Data %d", msg->glyphs[j].buffer_id);
2163 // TODO: Return error? 2159 // TODO: Return error?
2164 continue; 2160 continue;
2165 } 2161 }
2166 2162
2167 gl = calloc(1, sizeof(*gl)); 2163 gl = calloc(1, sizeof(*gl));
2168 gl->fe = fe; 2164 gl->fe = fe;
2169 gl->gldata_id = ++_glyph_id; 2165 gl->gldata_id = gldata->id;
2170 2166
2171 gldata->refcount = 1; 2167 gldata->mempool_id = cserve2_shared_string_ref(shm_id);
2172 gldata->id = gl->gldata_id;
2173 gldata->index = msg->glyphs[j].index; 2168 gldata->index = msg->glyphs[j].index;
2174 gldata->shm_id = cserve2_shared_string_ref(shm_id); 2169 gldata->offset = msg->glyphs[j].offset;
2175 gldata->buffer_id = msg->glyphs[j].buffer_id;
2176 gldata->offset = msg->glyphs[j].offset; // TODO: Remove?
2177 gldata->size = msg->glyphs[j].size; 2170 gldata->size = msg->glyphs[j].size;
2178 gldata->rows = msg->glyphs[j].rows; 2171 gldata->rows = msg->glyphs[j].rows;
2179 gldata->width = msg->glyphs[j].width; 2172 gldata->width = msg->glyphs[j].width;
@@ -2185,13 +2178,10 @@ _glyphs_load_request_response(Glyphs_Request *req,
2185 fe->nglyphs++; 2178 fe->nglyphs++;
2186 fash_gl_add(fe->glyph_entries[hint], gldata->index, gl); 2179 fash_gl_add(fe->glyph_entries[hint], gldata->index, gl);
2187 2180
2188 new_mapsize = cserve2_shared_array_map_size_get(fe->glyph_datas);
2189 font_mem_usage += new_mapsize - orig_mapsize;
2190 font_mem_usage += sizeof(*gl); 2181 font_mem_usage += sizeof(*gl);
2191 } 2182 }
2192 req->answer[req->nanswer++] = gl; 2183 req->answer[req->nanswer++] = gl;
2193 } 2184 }
2194
2195 cserve2_shared_string_del(shm_id); 2185 cserve2_shared_string_del(shm_id);
2196 2186
2197#ifdef DEBUG_LOAD_TIME 2187#ifdef DEBUG_LOAD_TIME
@@ -2243,6 +2233,7 @@ _font_entry_stats_cb(const Eina_Hash *hash EINA_UNUSED,
2243 Font_Entry *fe = data; 2233 Font_Entry *fe = data;
2244 Msg_Stats *msg = fdata; 2234 Msg_Stats *msg = fdata;
2245 unsigned int shmsize; 2235 unsigned int shmsize;
2236 Shared_Array *sa;
2246 2237
2247 msg->fonts.fonts_loaded++; 2238 msg->fonts.fonts_loaded++;
2248 if (fe->unused) msg->fonts.fonts_unused++; 2239 if (fe->unused) msg->fonts.fonts_unused++;
@@ -2252,8 +2243,12 @@ _font_entry_stats_cb(const Eina_Hash *hash EINA_UNUSED,
2252 msg->fonts.real_size += shmsize; 2243 msg->fonts.real_size += shmsize;
2253 if (fe->unused) msg->fonts.unused_size += shmsize; 2244 if (fe->unused) msg->fonts.unused_size += shmsize;
2254 2245
2255 cserve2_shared_array_foreach(fe->glyph_datas, 2246 sa = cserve2_shared_mempool_index_get(fe->mempool);
2256 EINA_EACH_CB(_font_requested_size_cb), msg); 2247 if (sa)
2248 {
2249 cserve2_shared_array_foreach
2250 (sa, EINA_EACH_CB(_font_requested_size_cb), msg);
2251 }
2257 2252
2258#ifdef DEBUG_LOAD_TIME 2253#ifdef DEBUG_LOAD_TIME
2259 // accounting fonts load time 2254 // accounting fonts load time
@@ -2409,6 +2404,7 @@ _font_entry_debug_cb(const Eina_Hash *hash EINA_UNUSED,
2409 unsigned int len, k, nglyphs; 2404 unsigned int len, k, nglyphs;
2410 const char *str; 2405 const char *str;
2411 char *nglyphs_pos; 2406 char *nglyphs_pos;
2407 Shared_Array *index = NULL;
2412 2408
2413 // file 2409 // file
2414 str = cserve2_shared_string_get(fe->src->file); 2410 str = cserve2_shared_string_get(fe->src->file);
@@ -2449,31 +2445,36 @@ _font_entry_debug_cb(const Eina_Hash *hash EINA_UNUSED,
2449 buf += sizeof(int); 2445 buf += sizeof(int);
2450 2446
2451 // glyph shared index and mempool 2447 // glyph shared index and mempool
2452 if (fe->glyph_datas)
2453 eina_strlcpy(buf, cserve2_shared_array_name_get(fe->glyph_datas), 64);
2454 else
2455 memset(buf, 0, 64);
2456 buf += 64;
2457
2458 if (fe->mempool) 2448 if (fe->mempool)
2459 eina_strlcpy(buf, cserve2_shared_mempool_name_get(fe->mempool), 64); 2449 {
2450 index = cserve2_shared_mempool_index_get(fe->mempool);
2451 eina_strlcpy(buf, cserve2_shared_mempool_name_get(fe->mempool), 64);
2452 buf += 64;
2453 eina_strlcpy(buf, cserve2_shared_array_name_get(index), 64);
2454 buf += 64;
2455 }
2460 else 2456 else
2461 memset(buf, 0, 64); 2457 {
2462 buf += 64; 2458 memset(buf, 0, 128);
2459 buf += 128;
2460 }
2463 2461
2464 // skip nglyphs for now... 2462 // skip nglyphs for now...
2465 nglyphs_pos = buf; 2463 nglyphs_pos = buf;
2466 buf += sizeof(int); 2464 buf += sizeof(int);
2467 2465
2468 nglyphs = 0; 2466 nglyphs = 0;
2469 for (k = 0; k < fe->nglyphs; k++) 2467 if (index)
2470 { 2468 {
2471 Glyph_Data *gd = cserve2_shared_array_item_data_get(fe->glyph_datas, k); 2469 for (k = 0; k < fe->nglyphs; k++)
2472 if (!gd || !gd->id) break; 2470 {
2471 Glyph_Data *gd = cserve2_shared_array_item_data_get(index, k);
2472 if (!gd || !gd->id) break;
2473 2473
2474 nglyphs++; 2474 nglyphs++;
2475 memcpy(buf, gd, sizeof(*gd)); 2475 memcpy(buf, gd, sizeof(*gd));
2476 buf += sizeof(*gd); 2476 buf += sizeof(*gd);
2477 }
2477 } 2478 }
2478 2479
2479 // write real value of nglyphs 2480 // write real value of nglyphs
diff --git a/src/bin/evas/evas_cserve2_fonts.c b/src/bin/evas/evas_cserve2_fonts.c
index 51b87fe319..782a9d1ff6 100644
--- a/src/bin/evas/evas_cserve2_fonts.c
+++ b/src/bin/evas/evas_cserve2_fonts.c
@@ -365,9 +365,15 @@ _font_slave_glyph_render(Font_Info *fi, Slave_Msg_Font_Glyphs_Loaded *response,
365 return EINA_TRUE; 365 return EINA_TRUE;
366 366
367on_error: 367on_error:
368 // Create invalid entry for this index. 368 // Create invalid entry for this index. There will be an empty slot in
369 // the mempool (usually 8 bytes) because we need the Glyph_Data index entry.
370 ERR("Could not load glyph %d. Creating empty invalid entry.", idx);
369 memset(&response->glyphs[response->nglyphs], 0, sizeof(Slave_Msg_Glyph)); 371 memset(&response->glyphs[response->nglyphs], 0, sizeof(Slave_Msg_Glyph));
372 if (buffer_id > 0)
373 cserve2_shared_mempool_buffer_del(response->mempool, buffer_id);
374 buffer_id = cserve2_shared_mempool_buffer_new(response->mempool, 1);
370 response->glyphs[response->nglyphs].index = idx; 375 response->glyphs[response->nglyphs].index = idx;
376 response->glyphs[response->nglyphs].buffer_id = buffer_id;
371 response->nglyphs++; 377 response->nglyphs++;
372 return EINA_FALSE; 378 return EINA_FALSE;
373} 379}
@@ -480,7 +486,8 @@ _font_slave_glyphs_load(const void *cmddata, void *data EINA_UNUSED)
480 { 486 {
481 unsigned shmsize = _font_slave_int_shm_calculate(fi, msg->font.hint); 487 unsigned shmsize = _font_slave_int_shm_calculate(fi, msg->font.hint);
482 response->mempool = cserve2_shared_mempool_new(GLYPH_DATA_ARRAY_TAG, 488 response->mempool = cserve2_shared_mempool_new(GLYPH_DATA_ARRAY_TAG,
483 0, shmsize); 489 sizeof(Glyph_Data), 0,
490 shmsize);
484 if (!response->mempool) return NULL; 491 if (!response->mempool) return NULL;
485 } 492 }
486 493
diff --git a/src/bin/evas/evas_cserve2_index.c b/src/bin/evas/evas_cserve2_index.c
index 0a3a6299c6..e6b13ce93e 100644
--- a/src/bin/evas/evas_cserve2_index.c
+++ b/src/bin/evas/evas_cserve2_index.c
@@ -593,15 +593,20 @@ _shared_index_entry_get_by_id(Shared_Index *si, unsigned int id)
593} 593}
594 594
595static Shared_Index * 595static Shared_Index *
596_shared_index_new(int tag, int generation_id) 596_shared_index_new(int tag, int index_elemsize, int generation_id)
597{ 597{
598 Shared_Index *si; 598 Shared_Index *si;
599 Index_Entry *ie; 599 Index_Entry *ie;
600 600
601 EINA_SAFETY_ON_FALSE_RETURN_VAL(index_elemsize >= 0, NULL);
602
601 si = calloc(1, sizeof(Shared_Index)); 603 si = calloc(1, sizeof(Shared_Index));
602 if (!si) return NULL; 604 if (!si) return NULL;
603 605
604 si->sa = cserve2_shared_array_new(tag, generation_id, sizeof(Index_Entry), 0); 606 if (!index_elemsize)
607 index_elemsize = sizeof(Index_Entry);
608
609 si->sa = cserve2_shared_array_new(tag, generation_id, index_elemsize, 0);
605 if (!si->sa) 610 if (!si->sa)
606 { 611 {
607 free(si); 612 free(si);
@@ -632,12 +637,14 @@ _shared_index_del(Shared_Index *si)
632// Shared memory pool 637// Shared memory pool
633 638
634Shared_Mempool * 639Shared_Mempool *
635cserve2_shared_mempool_new(int indextag, int generation_id, int initsize) 640cserve2_shared_mempool_new(int indextag, int index_elemsize,
641 int generation_id, int initsize)
636{ 642{
637 Shared_Mempool *sm; 643 Shared_Mempool *sm;
638 size_t mapping_size; 644 size_t mapping_size;
639 645
640 if (initsize < 0) return NULL; 646 EINA_SAFETY_ON_FALSE_RETURN_VAL(initsize >= 0, NULL);
647 EINA_SAFETY_ON_FALSE_RETURN_VAL(index_elemsize >= 0, NULL);
641 648
642 sm = calloc(1, sizeof(Shared_Mempool)); 649 sm = calloc(1, sizeof(Shared_Mempool));
643 if (!sm) return NULL; 650 if (!sm) return NULL;
@@ -652,7 +659,7 @@ cserve2_shared_mempool_new(int indextag, int generation_id, int initsize)
652 return NULL; 659 return NULL;
653 } 660 }
654 661
655 sm->index = _shared_index_new(indextag, generation_id); 662 sm->index = _shared_index_new(indextag, index_elemsize, generation_id);
656 if (!sm->index) 663 if (!sm->index)
657 { 664 {
658 _shared_data_shm_del(sm->ds); 665 _shared_data_shm_del(sm->ds);
@@ -664,6 +671,13 @@ cserve2_shared_mempool_new(int indextag, int generation_id, int initsize)
664 return sm; 671 return sm;
665} 672}
666 673
674Shared_Array *
675cserve2_shared_mempool_index_get(Shared_Mempool *sm)
676{
677 EINA_SAFETY_ON_NULL_RETURN_VAL(sm, NULL);
678 return sm->index->sa;
679}
680
667static void 681static void
668_shared_mempool_block_del(Eina_Rbtree *node, void *data EINA_UNUSED) 682_shared_mempool_block_del(Eina_Rbtree *node, void *data EINA_UNUSED)
669{ 683{
@@ -1043,7 +1057,7 @@ cserve2_shared_index_init(void)
1043 int ifaketag = STRING_MEMPOOL_FAKETAG; 1057 int ifaketag = STRING_MEMPOOL_FAKETAG;
1044 1058
1045 DBG("Initializing shared index"); 1059 DBG("Initializing shared index");
1046 _string_mempool = cserve2_shared_mempool_new(STRING_INDEX_ARRAY_TAG, 0, 0); 1060 _string_mempool = cserve2_shared_mempool_new(STRING_INDEX_ARRAY_TAG, 0, 0, 0);
1047 _string_entries = eina_hash_string_djb2_new(NULL); 1061 _string_entries = eina_hash_string_djb2_new(NULL);
1048 1062
1049 memcpy(faketag, &ifaketag, sizeof(int)); 1063 memcpy(faketag, &ifaketag, sizeof(int));
diff --git a/src/bin/evas/evas_cserve2_shm_debug.c b/src/bin/evas/evas_cserve2_shm_debug.c
index 8535af45cd..10bb48453e 100644
--- a/src/bin/evas/evas_cserve2_shm_debug.c
+++ b/src/bin/evas/evas_cserve2_shm_debug.c
@@ -152,11 +152,6 @@ _shm_file_probe(Shm_File *sf)
152 sf_fonts = sf; 152 sf_fonts = sf;
153 break; 153 break;
154 154
155 case GLYPH_INDEX_ARRAY_TAG:
156 DBG("Found index table with tag '%4.4s'", (char *) &sf->header->tag);
157 sf->tag = sf->header->tag;
158 break;
159
160 case GLYPH_DATA_ARRAY_TAG: 155 case GLYPH_DATA_ARRAY_TAG:
161 DBG("Found index table with tag '%4.4s'", (char *) &sf->header->tag); 156 DBG("Found index table with tag '%4.4s'", (char *) &sf->header->tag);
162 sf->tag = sf->header->tag; 157 sf->tag = sf->header->tag;
@@ -647,7 +642,7 @@ _glyphs_all_print(Shm_File *sf)
647 printf(" %8u %6u %6u %5u %5u %5u %5u %5u %1u %1u %6u %6u '%s'\n", 642 printf(" %8u %6u %6u %5u %5u %5u %5u %5u %1u %1u %6u %6u '%s'\n",
648 gd->id, gd->refcount, gd->index, gd->size, gd->rows, gd->width, 643 gd->id, gd->refcount, gd->index, gd->size, gd->rows, gd->width,
649 gd->pitch, gd->num_grays, gd->hint, gd->pixel_mode, gd->buffer_id, 644 gd->pitch, gd->num_grays, gd->hint, gd->pixel_mode, gd->buffer_id,
650 gd->offset, _shared_string_get(gd->shm_id)); 645 gd->offset, _shared_string_get(gd->mempool_id));
651 646
652 nglyphs++; 647 nglyphs++;
653 mem_used += gd->size; 648 mem_used += gd->size;