summaryrefslogtreecommitdiff
path: root/src/bin/evas
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2013-09-23 17:51:06 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2013-10-28 15:47:15 +0900
commit1e82480c9a074163ec6788a8a60ead403f7b0658 (patch)
tree0c1458c5a0a0149c0f4a16e11f4d3523934cdb74 /src/bin/evas
parentfc73405c40653a5fc0166690e3657ffd87069efc (diff)
evas/cserve2: Use scalecache with cserve2
Let's reuse the logic from scalecache and call cserve2 functions when the scalecache should be used. So, now, cserve2 server will not scale any image... This is too computationally intensive for the server's main thread. This is not optimal but makes a hell of a lot more sense for the moment. (since cserve2 manages the SHM segments)
Diffstat (limited to 'src/bin/evas')
-rw-r--r--src/bin/evas/evas_cserve2.h2
-rw-r--r--src/bin/evas/evas_cserve2_cache.c24
-rw-r--r--src/bin/evas/evas_cserve2_scale.c6
3 files changed, 25 insertions, 7 deletions
diff --git a/src/bin/evas/evas_cserve2.h b/src/bin/evas/evas_cserve2.h
index b1b6d6882e..2a3a40eb67 100644
--- a/src/bin/evas/evas_cserve2.h
+++ b/src/bin/evas/evas_cserve2.h
@@ -320,7 +320,7 @@ void cserve2_cache_client_del(Client *client);
320int cserve2_cache_file_open(Client *client, unsigned int client_file_id, const char *path, const char *key, unsigned int rid, Evas_Image_Load_Opts *lo); 320int cserve2_cache_file_open(Client *client, unsigned int client_file_id, const char *path, const char *key, unsigned int rid, Evas_Image_Load_Opts *lo);
321void cserve2_cache_file_close(Client *client, unsigned int client_file_id); 321void cserve2_cache_file_close(Client *client, unsigned int client_file_id);
322int cserve2_cache_image_entry_create(Client *client, int rid, unsigned int client_file_id, unsigned int image_id, Evas_Image_Load_Opts *opts); 322int cserve2_cache_image_entry_create(Client *client, int rid, unsigned int client_file_id, unsigned int image_id, Evas_Image_Load_Opts *opts);
323void cserve2_rgba_image_scale_do(void *src_data, void *dst_data, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int alpha, int smooth); 323void cserve2_rgba_image_scale_do(void *src_data, int src_full_w, int src_full_h, void *dst_data, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int alpha, int smooth);
324void cserve2_cache_image_load(Client *client, unsigned int client_image_id, unsigned int rid); 324void cserve2_cache_image_load(Client *client, unsigned int client_image_id, unsigned int rid);
325void cserve2_cache_image_preload(Client *client, unsigned int client_image_id, unsigned int rid); 325void cserve2_cache_image_preload(Client *client, unsigned int client_image_id, unsigned int rid);
326void cserve2_cache_image_unload(Client *client, unsigned int client_image_id); 326void cserve2_cache_image_unload(Client *client, unsigned int client_image_id);
diff --git a/src/bin/evas/evas_cserve2_cache.c b/src/bin/evas/evas_cserve2_cache.c
index 5361c137a1..e86643df54 100644
--- a/src/bin/evas/evas_cserve2_cache.c
+++ b/src/bin/evas/evas_cserve2_cache.c
@@ -506,6 +506,8 @@ _image_loaded_msg_create(Image_Entry *ientry, Image_Data *idata, int *size)
506 msg->shm.mmap_size = cserve2_shm_map_size_get(ientry->shm); 506 msg->shm.mmap_size = cserve2_shm_map_size_get(ientry->shm);
507 msg->shm.image_size = cserve2_shm_size_get(ientry->shm); 507 msg->shm.image_size = cserve2_shm_size_get(ientry->shm);
508 msg->alpha_sparse = idata->alpha_sparse; 508 msg->alpha_sparse = idata->alpha_sparse;
509 msg->image.w = idata->w;
510 msg->image.h = idata->h;
509 511
510 if (idata->shm_id) 512 if (idata->shm_id)
511 { 513 {
@@ -805,7 +807,9 @@ _scaling_do(Shm_Handle *scale_shm, Image_Data *idata, Image_Entry *original)
805 char *scale_map, *orig_map; 807 char *scale_map, *orig_map;
806 void *src_data, *dst_data; 808 void *src_data, *dst_data;
807 File_Data *fd; 809 File_Data *fd;
810 Image_Data *orig_idata;
808 811
812#warning FIXME Remove this call, add alpha flag to Image_Data
809 fd = _file_data_find(idata->file_id); 813 fd = _file_data_find(idata->file_id);
810 if (!fd) 814 if (!fd)
811 { 815 {
@@ -814,6 +818,13 @@ _scaling_do(Shm_Handle *scale_shm, Image_Data *idata, Image_Entry *original)
814 return -1; 818 return -1;
815 } 819 }
816 820
821 orig_idata = _image_data_find(original->base.id);
822 if (!orig_idata)
823 {
824 ERR("Could not find image %u", original->base.id);
825 return -1;
826 }
827
817 scale_map = cserve2_shm_map(scale_shm); 828 scale_map = cserve2_shm_map(scale_shm);
818 if (scale_map == MAP_FAILED) 829 if (scale_map == MAP_FAILED)
819 { 830 {
@@ -833,14 +844,16 @@ _scaling_do(Shm_Handle *scale_shm, Image_Data *idata, Image_Entry *original)
833 src_data = orig_map + cserve2_shm_map_offset_get(original->shm); 844 src_data = orig_map + cserve2_shm_map_offset_get(original->shm);
834 dst_data = scale_map + cserve2_shm_map_offset_get(scale_shm); 845 dst_data = scale_map + cserve2_shm_map_offset_get(scale_shm);
835 846
836 DBG("Scaling image ([%d,%d:%dx%d] --> [%d,%d:%dx%d])", 847 DBG("Scaling image ([%dx%d]:[%d,%d:%dx%d] --> [%d,%d:%dx%d])",
848 orig_idata->w, orig_idata->h,
837 idata->opts.scale_load.src_x, idata->opts.scale_load.src_y, 849 idata->opts.scale_load.src_x, idata->opts.scale_load.src_y,
838 idata->opts.scale_load.src_w, idata->opts.scale_load.src_h, 850 idata->opts.scale_load.src_w, idata->opts.scale_load.src_h,
839 0, 0, 851 0, 0,
840 idata->opts.scale_load.dst_w, idata->opts.scale_load.dst_h); 852 idata->opts.scale_load.dst_w, idata->opts.scale_load.dst_h);
841 853
842 cserve2_rgba_image_scale_do( 854 cserve2_rgba_image_scale_do(
843 src_data, dst_data, 855 src_data, orig_idata->w, orig_idata->h,
856 dst_data,
844 idata->opts.scale_load.src_x, idata->opts.scale_load.src_y, 857 idata->opts.scale_load.src_x, idata->opts.scale_load.src_y,
845 idata->opts.scale_load.src_w, idata->opts.scale_load.src_h, 858 idata->opts.scale_load.src_w, idata->opts.scale_load.src_h,
846 0, 0, 859 0, 0,
@@ -875,6 +888,8 @@ _scaling_prepare_and_do(Image_Entry *ientry, Image_Data *idata)
875 cserve2_shared_string_del(idata->shm_id); 888 cserve2_shared_string_del(idata->shm_id);
876 ientry->shm = scale_shm; 889 ientry->shm = scale_shm;
877 idata->shm_id = 0; 890 idata->shm_id = 0;
891 idata->w = idata->opts.scale_load.dst_w;
892 idata->h = idata->opts.scale_load.dst_h;
878 893
879 return 0; 894 return 0;
880} 895}
@@ -895,6 +910,9 @@ _load_request_response(Image_Entry *ientry,
895 if (!idata->doload) 910 if (!idata->doload)
896 DBG("Entry %d loaded by speculative preload.", idata->id); 911 DBG("Entry %d loaded by speculative preload.", idata->id);
897 912
913 idata->w = resp->w;
914 idata->h = resp->h;
915
898 if (_scaling_needed(idata, resp)) 916 if (_scaling_needed(idata, resp))
899 { 917 {
900 DBG("About to scale image %u", idata->id); 918 DBG("About to scale image %u", idata->id);
@@ -2781,7 +2799,7 @@ do_scaling:
2781 CSERVE2_REQ_IMAGE_LOAD, 2799 CSERVE2_REQ_IMAGE_LOAD,
2782 0, NULL, 0, &_load_funcs, orig_entry); 2800 0, NULL, 0, &_load_funcs, orig_entry);
2783 } 2801 }
2784 if (orig_entry->base.request || !orig_entry->shm) 2802 if (orig_entry->base.request || !orig_entry->shm || !orig_data->valid)
2785 return -1; // Not loaded yet 2803 return -1; // Not loaded yet
2786 2804
2787 if (ientry->shm) 2805 if (ientry->shm)
diff --git a/src/bin/evas/evas_cserve2_scale.c b/src/bin/evas/evas_cserve2_scale.c
index 9324432f13..dd909db235 100644
--- a/src/bin/evas/evas_cserve2_scale.c
+++ b/src/bin/evas/evas_cserve2_scale.c
@@ -32,7 +32,8 @@ _cserve2_rgba_image_set(RGBA_Image *im, void *data, int w, int h, int alpha)
32} 32}
33 33
34void 34void
35cserve2_rgba_image_scale_do(void *src_data, void *dst_data, 35cserve2_rgba_image_scale_do(void *src_data, int src_full_w, int src_full_h,
36 void *dst_data,
36 int src_x, int src_y, int src_w, int src_h, 37 int src_x, int src_y, int src_w, int src_h,
37 int dst_x, int dst_y, int dst_w, int dst_h, 38 int dst_x, int dst_y, int dst_w, int dst_h,
38 int alpha, int smooth) 39 int alpha, int smooth)
@@ -40,8 +41,7 @@ cserve2_rgba_image_scale_do(void *src_data, void *dst_data,
40 RGBA_Image src, dst; 41 RGBA_Image src, dst;
41 RGBA_Draw_Context ct; 42 RGBA_Draw_Context ct;
42 43
43 _cserve2_rgba_image_set(&src, src_data, src_w, src_h, alpha); 44 _cserve2_rgba_image_set(&src, src_data, src_full_w, src_full_h, alpha);
44
45 _cserve2_rgba_image_set(&dst, dst_data, dst_w, dst_h, alpha); 45 _cserve2_rgba_image_set(&dst, dst_data, dst_w, dst_h, alpha);
46 dst.flags = RGBA_IMAGE_NOTHING; 46 dst.flags = RGBA_IMAGE_NOTHING;
47 47