summaryrefslogtreecommitdiff
path: root/legacy/evas/src/modules/engines/software_generic
diff options
context:
space:
mode:
authorIván Briano <sachieru@gmail.com>2012-05-03 21:01:31 +0000
committerIván Briano <sachieru@gmail.com>2012-05-03 21:01:31 +0000
commit15328efb85bcf413025d787d1d58d812a407f25a (patch)
tree37c09205c159d8b9758ffdada5dff2248e632613 /legacy/evas/src/modules/engines/software_generic
parentb8ade6a7cfa99ca19c054bd6b0bf488e63accbf4 (diff)
evas/cserve2: fix typo that kept cserve2 disabled
now seriously... Introducing Cache Serve 2. This cache server will initially load images for clients connected to it. It starts slave processes to load these images, and share the loaded images through shm with the clients. All the connection done between clients and the server goes through sockets. The cserve2 build option is turned on by default, while the old cserve was disabled, but in order to make clients use it, the environment variable EVAS_CSERVE2 must be set, and a server must be running. Clients will try to find the socket on a specified location using the environment variable EVAS_CSERVE2_SOCKET. If it's not defined, then the XDG_RUNTIME_DIR path should be used, and finally HOME, TMPDIR and /tmp. SVN revision: 70699
Diffstat (limited to 'legacy/evas/src/modules/engines/software_generic')
-rw-r--r--legacy/evas/src/modules/engines/software_generic/Makefile.am1
-rw-r--r--legacy/evas/src/modules/engines/software_generic/evas_engine.c109
2 files changed, 105 insertions, 5 deletions
diff --git a/legacy/evas/src/modules/engines/software_generic/Makefile.am b/legacy/evas/src/modules/engines/software_generic/Makefile.am
index fa522f8587..f31810e6de 100644
--- a/legacy/evas/src/modules/engines/software_generic/Makefile.am
+++ b/legacy/evas/src/modules/engines/software_generic/Makefile.am
@@ -5,6 +5,7 @@ AM_CPPFLAGS = \
5-I. \ 5-I. \
6-I$(top_srcdir)/src/lib \ 6-I$(top_srcdir)/src/lib \
7-I$(top_srcdir)/src/lib/include \ 7-I$(top_srcdir)/src/lib/include \
8-I$(top_srcdir)/src/lib/cserve2 \
8-I$(top_srcdir)/src/modules/engines \ 9-I$(top_srcdir)/src/modules/engines \
9@EINA_CFLAGS@ \ 10@EINA_CFLAGS@ \
10@FREETYPE_CFLAGS@ \ 11@FREETYPE_CFLAGS@ \
diff --git a/legacy/evas/src/modules/engines/software_generic/evas_engine.c b/legacy/evas/src/modules/engines/software_generic/evas_engine.c
index cbc709d601..96ed50ca9e 100644
--- a/legacy/evas/src/modules/engines/software_generic/evas_engine.c
+++ b/legacy/evas/src/modules/engines/software_generic/evas_engine.c
@@ -1,5 +1,8 @@
1#include "evas_common.h" /* Also includes international specific stuff */ 1#include "evas_common.h" /* Also includes international specific stuff */
2#include "evas_private.h" 2#include "evas_private.h"
3#ifdef EVAS_CSERVE2
4#include "evas_cs2_private.h"
5#endif
3 6
4#ifdef HAVE_DLSYM 7#ifdef HAVE_DLSYM
5# include <dlfcn.h> /* dlopen,dlclose,etc */ 8# include <dlfcn.h> /* dlopen,dlclose,etc */
@@ -655,24 +658,58 @@ static void *
655eng_image_load(void *data __UNUSED__, const char *file, const char *key, int *error, Evas_Image_Load_Opts *lo) 658eng_image_load(void *data __UNUSED__, const char *file, const char *key, int *error, Evas_Image_Load_Opts *lo)
656{ 659{
657 *error = EVAS_LOAD_ERROR_NONE; 660 *error = EVAS_LOAD_ERROR_NONE;
661#ifdef EVAS_CSERVE2
662 if (evas_cserve2_use_get())
663 {
664 Image_Entry *ie;
665 ie = evas_cache2_image_open(evas_common_image_cache2_get(),
666 file, key, lo, error);
667 if (ie)
668 evas_cache2_image_open_wait(ie);
669
670 return ie;
671 }
672#endif
658 return evas_common_load_image_from_file(file, key, lo, error); 673 return evas_common_load_image_from_file(file, key, lo, error);
659} 674}
660 675
661static void * 676static void *
662eng_image_new_from_data(void *data __UNUSED__, int w, int h, DATA32 *image_data, int alpha, int cspace) 677eng_image_new_from_data(void *data __UNUSED__, int w, int h, DATA32 *image_data, int alpha, int cspace)
663{ 678{
679#ifdef EVAS_CSERVE2
680 if (evas_cserve2_use_get())
681 {
682 Evas_Cache2 *cache = evas_common_image_cache2_get();
683 return evas_cache2_image_data(cache, w, h, image_data, alpha, cspace);
684 }
685#endif
664 return evas_cache_image_data(evas_common_image_cache_get(), w, h, image_data, alpha, cspace); 686 return evas_cache_image_data(evas_common_image_cache_get(), w, h, image_data, alpha, cspace);
665} 687}
666 688
667static void * 689static void *
668eng_image_new_from_copied_data(void *data __UNUSED__, int w, int h, DATA32 *image_data, int alpha, int cspace) 690eng_image_new_from_copied_data(void *data __UNUSED__, int w, int h, DATA32 *image_data, int alpha, int cspace)
669{ 691{
692#ifdef EVAS_CSERVE2
693 if (evas_cserve2_use_get())
694 {
695 Evas_Cache2 *cache = evas_common_image_cache2_get();
696 return evas_cache2_image_copied_data(cache, w, h, image_data, alpha,
697 cspace);
698 }
699#endif
670 return evas_cache_image_copied_data(evas_common_image_cache_get(), w, h, image_data, alpha, cspace); 700 return evas_cache_image_copied_data(evas_common_image_cache_get(), w, h, image_data, alpha, cspace);
671} 701}
672 702
673static void 703static void
674eng_image_free(void *data __UNUSED__, void *image) 704eng_image_free(void *data __UNUSED__, void *image)
675{ 705{
706#ifdef EVAS_CSERVE2
707 if (evas_cserve2_use_get())
708 {
709 evas_cache2_image_close(image);
710 return;
711 }
712#endif
676 evas_cache_image_drop(image); 713 evas_cache_image_drop(image);
677} 714}
678 715
@@ -691,6 +728,10 @@ eng_image_size_set(void *data __UNUSED__, void *image, int w, int h)
691{ 728{
692 Image_Entry *im = image; 729 Image_Entry *im = image;
693 if (!im) return NULL; 730 if (!im) return NULL;
731#ifdef EVAS_CSERVE2
732 if (evas_cserve2_use_get())
733 return evas_cache2_image_size_set(im, w, h);
734#endif
694 return evas_cache_image_size_set(im, w, h); 735 return evas_cache_image_size_set(im, w, h);
695} 736}
696 737
@@ -699,6 +740,10 @@ eng_image_dirty_region(void *data __UNUSED__, void *image, int x, int y, int w,
699{ 740{
700 Image_Entry *im = image; 741 Image_Entry *im = image;
701 if (!im) return NULL; 742 if (!im) return NULL;
743#ifdef EVAS_CSERVE2
744 if (evas_cserve2_use_get())
745 return evas_cache2_image_dirty(im, x, y, w, h);
746#endif
702 return evas_cache_image_dirty(im, x, y, w, h); 747 return evas_cache_image_dirty(im, x, y, w, h);
703} 748}
704 749
@@ -706,7 +751,7 @@ static void *
706eng_image_data_get(void *data __UNUSED__, void *image, int to_write, DATA32 **image_data, int *err) 751eng_image_data_get(void *data __UNUSED__, void *image, int to_write, DATA32 **image_data, int *err)
707{ 752{
708 RGBA_Image *im; 753 RGBA_Image *im;
709 int error; 754 int error = EVAS_LOAD_ERROR_NONE;
710 755
711 if (!image) 756 if (!image)
712 { 757 {
@@ -714,6 +759,21 @@ eng_image_data_get(void *data __UNUSED__, void *image, int to_write, DATA32 **im
714 return NULL; 759 return NULL;
715 } 760 }
716 im = image; 761 im = image;
762
763#ifdef EVAS_CSERVE2
764 if (evas_cserve2_use_get())
765 {
766 error = evas_cache2_image_load_data(&im->cache_entry);
767 if (err) *err = error;
768
769 if (to_write)
770 im = evas_cache2_image_writable(&im->cache_entry);
771
772 *image_data = im->image.data;
773 return im;
774 }
775#endif
776
717 error = evas_cache_image_load_data(&im->cache_entry); 777 error = evas_cache_image_load_data(&im->cache_entry);
718 switch (im->cache_entry.space) 778 switch (im->cache_entry.space)
719 { 779 {
@@ -756,6 +816,14 @@ eng_image_data_put(void *data, void *image, DATA32 *image_data)
756 im2 = eng_image_new_from_data(data, w, h, image_data, 816 im2 = eng_image_new_from_data(data, w, h, image_data,
757 eng_image_alpha_get(data, image), 817 eng_image_alpha_get(data, image),
758 eng_image_colorspace_get(data, image)); 818 eng_image_colorspace_get(data, image));
819#ifdef EVAS_CSERVE2
820 if (evas_cserve2_use_get())
821 {
822 evas_cache2_image_close(&im->cache_entry);
823 im = im2;
824 break;
825 }
826#endif
759 evas_cache_image_drop(&im->cache_entry); 827 evas_cache_image_drop(&im->cache_entry);
760 im = im2; 828 im = im2;
761 } 829 }
@@ -786,8 +854,15 @@ static void
786eng_image_data_preload_request(void *data __UNUSED__, void *image, const void *target) 854eng_image_data_preload_request(void *data __UNUSED__, void *image, const void *target)
787{ 855{
788 RGBA_Image *im = image; 856 RGBA_Image *im = image;
789
790 if (!im) return ; 857 if (!im) return ;
858
859#ifdef EVAS_CSERVE2
860 if (evas_cserve2_use_get())
861 {
862 evas_cache2_image_preload_data(&im->cache_entry, target);
863 return;
864 }
865#endif
791 evas_cache_image_preload_data(&im->cache_entry, target); 866 evas_cache_image_preload_data(&im->cache_entry, target);
792} 867}
793 868
@@ -795,6 +870,10 @@ static void
795eng_image_data_preload_cancel(void *data __UNUSED__, void *image, const void *target) 870eng_image_data_preload_cancel(void *data __UNUSED__, void *image, const void *target)
796{ 871{
797 RGBA_Image *im = image; 872 RGBA_Image *im = image;
873#ifdef EVAS_CSERVE2
874 if (evas_cserve2_use_get())
875 return;
876#endif
798 877
799 if (!im) return ; 878 if (!im) return ;
800 evas_cache_image_preload_cancel(&im->cache_entry, target); 879 evas_cache_image_preload_cancel(&im->cache_entry, target);
@@ -810,6 +889,10 @@ eng_image_draw(void *data __UNUSED__, void *context, void *surface, void *image,
810#ifdef BUILD_PIPE_RENDER 889#ifdef BUILD_PIPE_RENDER
811 if ((cpunum > 1)) 890 if ((cpunum > 1))
812 { 891 {
892#ifdef EVAS_CSERVE2
893 if (evas_cserve2_use_get())
894 evas_cache2_image_load_data(&im->cache_entry);
895#endif
813 evas_common_rgba_image_scalecache_prepare((Image_Entry *)(im), 896 evas_common_rgba_image_scalecache_prepare((Image_Entry *)(im),
814 surface, context, smooth, 897 surface, context, smooth,
815 src_x, src_y, src_w, src_h, 898 src_x, src_y, src_w, src_h,
@@ -822,9 +905,18 @@ eng_image_draw(void *data __UNUSED__, void *context, void *surface, void *image,
822 else 905 else
823#endif 906#endif
824 { 907 {
825// if (im->cache_entry.space == EVAS_COLORSPACE_ARGB8888) 908#ifdef EVAS_CSERVE2
826// evas_cache_image_load_data(&im->cache_entry); 909 if (evas_cserve2_use_get())
827// evas_common_image_colorspace_normalize(im); 910 {
911 evas_cache2_image_load_data(&im->cache_entry);
912 goto image_loaded;
913 }
914#endif
915 if (im->cache_entry.space == EVAS_COLORSPACE_ARGB8888)
916 evas_cache_image_load_data(&im->cache_entry);
917 evas_common_image_colorspace_normalize(im);
918
919image_loaded:
828 evas_common_rgba_image_scalecache_prepare(&im->cache_entry, surface, context, smooth, 920 evas_common_rgba_image_scalecache_prepare(&im->cache_entry, surface, context, smooth,
829 src_x, src_y, src_w, src_h, 921 src_x, src_y, src_w, src_h,
830 dst_x, dst_y, dst_w, dst_h); 922 dst_x, dst_y, dst_w, dst_h);
@@ -916,6 +1008,13 @@ eng_image_map_surface_new(void *data __UNUSED__, int w, int h, int alpha)
916static void 1008static void
917eng_image_map_surface_free(void *data __UNUSED__, void *surface) 1009eng_image_map_surface_free(void *data __UNUSED__, void *surface)
918{ 1010{
1011#ifdef EVAS_CSERVE2
1012 if (evas_cserve2_use_get())
1013 {
1014 evas_cache2_image_unload_data(surface);
1015 return;
1016 }
1017#endif
919 evas_cache_image_drop(surface); 1018 evas_cache_image_drop(surface);
920} 1019}
921 1020