summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bin/evas/evas_cserve2.h2
-rw-r--r--src/bin/evas/evas_cserve2_cache.c21
-rw-r--r--src/bin/evas/evas_cserve2_requests.c32
-rw-r--r--src/bin/evas/evas_cserve2_shm_debug.c7
4 files changed, 59 insertions, 3 deletions
diff --git a/src/bin/evas/evas_cserve2.h b/src/bin/evas/evas_cserve2.h
index fda088fbce..3b0ec1544c 100644
--- a/src/bin/evas/evas_cserve2.h
+++ b/src/bin/evas/evas_cserve2.h
@@ -331,6 +331,8 @@ void cserve2_request_cancel(Slave_Request *req, Client *client, Error_Type err);
331void cserve2_request_cancel_all(Slave_Request *req, Error_Type err); 331void cserve2_request_cancel_all(Slave_Request *req, Error_Type err);
332void cserve2_requests_init(void); 332void cserve2_requests_init(void);
333void cserve2_requests_shutdown(void); 333void cserve2_requests_shutdown(void);
334void cserve2_request_dependents_drop(Slave_Request *req, Slave_Request_Type type);
335void cserve2_entry_request_drop(void *data, Slave_Request_Type type);
334 336
335void cserve2_font_init(void); 337void cserve2_font_init(void);
336void cserve2_font_shutdown(void); 338void cserve2_font_shutdown(void);
diff --git a/src/bin/evas/evas_cserve2_cache.c b/src/bin/evas/evas_cserve2_cache.c
index 83923d48c9..30f4cf530f 100644
--- a/src/bin/evas/evas_cserve2_cache.c
+++ b/src/bin/evas/evas_cserve2_cache.c
@@ -154,6 +154,8 @@ static int unused_mem_usage = 0;
154static int max_font_usage = 10 * 4 * 1024; /* in kbytes */ 154static int max_font_usage = 10 * 4 * 1024; /* in kbytes */
155static int font_mem_usage = 0; 155static int font_mem_usage = 0;
156 156
157#define MAX_PREEMPTIVE_LOAD_SIZE (320*320*4)
158
157#ifdef DEBUG_LOAD_TIME 159#ifdef DEBUG_LOAD_TIME
158static int 160static int
159_timeval_sub(const struct timeval *tv2, const struct timeval *tv1) 161_timeval_sub(const struct timeval *tv2, const struct timeval *tv1)
@@ -603,8 +605,10 @@ static Msg_Opened *
603_open_request_response(Entry *entry, Slave_Msg_Image_Opened *resp, int *size) 605_open_request_response(Entry *entry, Slave_Msg_Image_Opened *resp, int *size)
604{ 606{
605 File_Data *fd; 607 File_Data *fd;
608 Slave_Request *req;
606 609
607 _entry_load_finish(entry); 610 _entry_load_finish(entry);
611 req = entry->request;
608 entry->request = NULL; 612 entry->request = NULL;
609 613
610 fd = _file_data_find(entry->id); 614 fd = _file_data_find(entry->id);
@@ -629,9 +633,26 @@ _open_request_response(Entry *entry, Slave_Msg_Image_Opened *resp, int *size)
629 } 633 }
630 634
631 fd->valid = EINA_TRUE; 635 fd->valid = EINA_TRUE;
636
637 // If the image is too large, cancel pre-emptive load.
638 if (fd->w * fd->h * 4 >= MAX_PREEMPTIVE_LOAD_SIZE)
639 {
640 DBG("Not pre-loading this image ");
641 cserve2_request_dependents_drop(req, CSERVE2_REQ_IMAGE_SPEC_LOAD);
642 }
643
632 return _image_opened_msg_create(fd, size); 644 return _image_opened_msg_create(fd, size);
633} 645}
634 646
647void
648cserve2_entry_request_drop(void *data, Slave_Request_Type type EINA_UNUSED)
649{
650 Entry *e = data;
651
652 if (!e) return;
653 e->request = NULL;
654}
655
635static void 656static void
636_request_failed(Entry *e, Error_Type type EINA_UNUSED) 657_request_failed(Entry *e, Error_Type type EINA_UNUSED)
637{ 658{
diff --git a/src/bin/evas/evas_cserve2_requests.c b/src/bin/evas/evas_cserve2_requests.c
index ab63db88f5..9a8eb2f4c0 100644
--- a/src/bin/evas/evas_cserve2_requests.c
+++ b/src/bin/evas/evas_cserve2_requests.c
@@ -289,6 +289,38 @@ cserve2_request_cancel_all(Slave_Request *req, Error_Type err)
289} 289}
290 290
291void 291void
292cserve2_request_dependents_drop(Slave_Request *req, Slave_Request_Type type)
293{
294 Slave_Request *dep;
295 Eina_List *l, *l_next;
296
297 if (type != CSERVE2_REQ_IMAGE_SPEC_LOAD)
298 {
299 CRIT("Only CSERVE2_REQ_IMAGE_SPEC_LOAD is supported.");
300 return;
301 }
302
303 EINA_LIST_FOREACH_SAFE(req->dependents, l, l_next, dep)
304 {
305 if (dep->type == type)
306 {
307 req->dependents = eina_list_remove_list(req->dependents, l);
308
309 if (dep->processing)
310 dep->cancelled = EINA_TRUE;
311 else
312 {
313 cserve2_entry_request_drop(dep->data, type);
314 requests[type].waiting = eina_inlist_remove(
315 requests[type].waiting, EINA_INLIST_GET(dep));
316 dep->funcs->msg_free(dep->msg, dep->data);
317 free(dep);
318 }
319 }
320 }
321}
322
323void
292cserve2_requests_init(void) 324cserve2_requests_init(void)
293{ 325{
294 DBG("Initializing requests."); 326 DBG("Initializing requests.");
diff --git a/src/bin/evas/evas_cserve2_shm_debug.c b/src/bin/evas/evas_cserve2_shm_debug.c
index 49bae201f0..882864618e 100644
--- a/src/bin/evas/evas_cserve2_shm_debug.c
+++ b/src/bin/evas/evas_cserve2_shm_debug.c
@@ -467,13 +467,14 @@ _images_all_print_full(void)
467 printf("Refcount %d\n", id->refcount); 467 printf("Refcount %d\n", id->refcount);
468 printf("Sparse alpha %s\n" 468 printf("Sparse alpha %s\n"
469 "Unused: %s\n" 469 "Unused: %s\n"
470 "Load requested: %s\n", 470 "Load requested: %s\n"
471 "Valid: %s\n",
471 id->alpha_sparse ? "YES" : "NO", 472 id->alpha_sparse ? "YES" : "NO",
472 id->unused ? "YES" : "NO", 473 id->unused ? "YES" : "NO",
473 id->doload ? "YES" : "NO"); 474 id->doload ? "YES" : "NO",
475 id->valid ? "YES" : "NO");
474 printf("Shm Path: '%s'\n", 476 printf("Shm Path: '%s'\n",
475 id->shm_id ? _shared_string_get(id->shm_id) : ""); 477 id->shm_id ? _shared_string_get(id->shm_id) : "");
476
477 printf("LoadOpts: width %d\n", id->opts.w); 478 printf("LoadOpts: width %d\n", id->opts.w);
478 printf(" height %d\n", id->opts.h); 479 printf(" height %d\n", id->opts.h);
479 printf(" degree %d\n", id->opts.degree); 480 printf(" degree %d\n", id->opts.degree);