summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2012-10-12 06:36:06 +0000
committerCarsten Haitzler <raster@rasterman.com>2012-10-12 06:36:06 +0000
commit2da956caa0bee5da4d16d912a7ff976da5aec5cb (patch)
tree2be6a9f6602eefc7a48dfab192f628265e6a0c5b /legacy
parent3dbe715a795fb7f564feed3e2ef77197dd8f0902 (diff)
first stage of simplifying evas configure/build options. much more
still to do. SVN revision: 77932
Diffstat (limited to 'legacy')
-rw-r--r--legacy/evas/configure.ac1016
-rw-r--r--legacy/evas/m4/evas_check_loader.m4361
-rw-r--r--legacy/evas/m4/evas_converter.m483
-rw-r--r--legacy/evas/m4/evas_scaler.m444
-rw-r--r--legacy/evas/src/bin/Makefile.am40
-rw-r--r--legacy/evas/src/bin/evas_cserve_main.c1683
-rw-r--r--legacy/evas/src/bin/evas_cserve_tool.c160
-rw-r--r--legacy/evas/src/lib/Makefile.am24
-rw-r--r--legacy/evas/src/lib/canvas/evas_main.c2
-rw-r--r--legacy/evas/src/lib/canvas/evas_stats.c2
-rw-r--r--legacy/evas/src/lib/cserve/Makefile.am32
-rw-r--r--legacy/evas/src/lib/cserve/evas_cs.h285
-rw-r--r--legacy/evas/src/lib/cserve/evas_cs_client.c528
-rw-r--r--legacy/evas/src/lib/cserve/evas_cs_main.c9
-rw-r--r--legacy/evas/src/lib/cserve/evas_cs_mem.c168
-rw-r--r--legacy/evas/src/lib/cserve/evas_cs_server.c380
-rw-r--r--legacy/evas/src/lib/engines/common/evas_image_load.c2
-rw-r--r--legacy/evas/src/lib/engines/common/evas_image_main.c2
-rw-r--r--legacy/evas/src/modules/loaders/Makefile.am6
-rw-r--r--legacy/evas/src/modules/loaders/edb/Makefile.am35
-rw-r--r--legacy/evas/src/modules/loaders/edb/evas_image_load_edb.c251
-rw-r--r--legacy/evas/src/modules/savers/Makefile.am6
-rw-r--r--legacy/evas/src/modules/savers/edb/Makefile.am33
-rw-r--r--legacy/evas/src/modules/savers/edb/evas_image_save_edb.c48
24 files changed, 277 insertions, 4923 deletions
diff --git a/legacy/evas/configure.ac b/legacy/evas/configure.ac
index 85d5e142c3..0732c48c07 100644
--- a/legacy/evas/configure.ac
+++ b/legacy/evas/configure.ac
@@ -87,11 +87,10 @@ esac
87AC_SUBST(MODULE_ARCH) 87AC_SUBST(MODULE_ARCH)
88AC_DEFINE_UNQUOTED(MODULE_ARCH, "$MODULE_ARCH", "Module architecture") 88AC_DEFINE_UNQUOTED(MODULE_ARCH, "$MODULE_ARCH", "Module architecture")
89 89
90want_fontconfig="auto" 90want_fontconfig="yes"
91want_fribidi="auto" 91want_fribidi="yes"
92want_harfbuzz="auto" 92want_harfbuzz="auto"
93want_pixman="no" 93want_pixman="no"
94want_evas_cserve="yes"
95want_evas_cserve2="yes" 94want_evas_cserve2="yes"
96 95
97want_evas_engine_buffer="yes" 96want_evas_engine_buffer="yes"
@@ -111,38 +110,22 @@ want_evas_engine_psl1ght="no"
111want_evas_engine_wayland_shm="no" 110want_evas_engine_wayland_shm="no"
112want_evas_engine_wayland_egl="no" 111want_evas_engine_wayland_egl="no"
113 112
114want_evas_image_loader_edb="yes" 113want_evas_image_loader_webp="yes"
115want_evas_image_loader_eet="yes"
116want_evas_image_loader_gif="yes" 114want_evas_image_loader_gif="yes"
117want_evas_image_loader_jpeg="yes"
118want_evas_image_loader_pmaps="yes"
119want_evas_image_loader_png="yes"
120want_evas_image_loader_svg="yes"
121want_evas_image_loader_tiff="yes" 115want_evas_image_loader_tiff="yes"
122want_evas_image_loader_xpm="yes" 116want_evas_image_loader_svg="yes"
123want_evas_image_loader_bmp="yes"
124want_evas_image_loader_tga="yes"
125want_evas_image_loader_wbmp="yes"
126want_evas_image_loader_webp="yes"
127want_evas_image_loader_ico="yes"
128want_evas_image_loader_psd="yes"
129want_evas_image_loader_generic="yes"
130
131want_evas_font_loader_eet="yes"
132 117
133case "$host_os" in 118case "$host_os" in
134 mingw32ce*) 119 mingw32ce*)
135 want_fontconfig="no" 120 want_fontconfig="no"
136 want_evas_image_loader_edb="no"
137 want_evas_image_loader_gif="no" 121 want_evas_image_loader_gif="no"
138 want_evas_image_loader_svg="no"
139 want_evas_image_loader_tiff="no" 122 want_evas_image_loader_tiff="no"
123 want_evas_image_loader_svg="no"
140 ;; 124 ;;
141 mingw*) 125 mingw*)
142 want_evas_engine_software_gdi="yes" 126 want_evas_engine_software_gdi="yes"
143 want_evas_engine_software_ddraw="yes" 127 want_evas_engine_software_ddraw="yes"
144 want_evas_engine_direct3d="yes" 128 want_evas_engine_direct3d="yes"
145 want_evas_image_loader_edb="no"
146 want_evas_image_loader_svg="yes" 129 want_evas_image_loader_svg="yes"
147 ;; 130 ;;
148 darwin*) 131 darwin*)
@@ -286,8 +269,7 @@ AC_ARG_ENABLE([fontconfig],
286 fi 269 fi
287 ]) 270 ])
288 271
289 272if test "x${want_fontconfig}" = "xyes"; then
290if test "x${want_fontconfig}" = "xyes" -o "x${want_fontconfig}" = "xauto" ; then
291 PKG_CHECK_MODULES([FONTCONFIG], 273 PKG_CHECK_MODULES([FONTCONFIG],
292 [fontconfig >= 2.5.0], 274 [fontconfig >= 2.5.0],
293 [ 275 [
@@ -295,11 +277,7 @@ if test "x${want_fontconfig}" = "xyes" -o "x${want_fontconfig}" = "xauto" ; then
295 AC_DEFINE(HAVE_FONTCONFIG, 1, [have fontconfig searching capabilities]) 277 AC_DEFINE(HAVE_FONTCONFIG, 1, [have fontconfig searching capabilities])
296 requirement_evas="fontconfig ${requirement_evas}" 278 requirement_evas="fontconfig ${requirement_evas}"
297 ], 279 ],
298 [ 280 [AC_MSG_ERROR([Fontconfig not found])])
299 if test "x${want_fontconfig}" = "xyes" -a "x${use_strict}" = "xyes" ; then
300 AC_MSG_ERROR([Fontconfig not found (strict dependencies checking)])
301 fi
302 ])
303fi 281fi
304 282
305# linebreak 283# linebreak
@@ -342,7 +320,7 @@ AC_ARG_ENABLE([fribidi],
342 fi 320 fi
343 ]) 321 ])
344 322
345if test "x${want_fribidi}" = "xyes" -o "x${want_fribidi}" = "xauto" ; then 323if test "x${want_fribidi}" = "xyes"; then
346 PKG_CHECK_MODULES([FRIBIDI], 324 PKG_CHECK_MODULES([FRIBIDI],
347 [fribidi >= 0.19.2], 325 [fribidi >= 0.19.2],
348 [ 326 [
@@ -355,16 +333,10 @@ if test "x${want_fribidi}" = "xyes" -o "x${want_fribidi}" = "xauto" ; then
355 CPPFLAGS="$CPPFLAGS_SAVE" 333 CPPFLAGS="$CPPFLAGS_SAVE"
356 ], 334 ],
357 [ 335 [
358 if test "x$want_fribidi" = "xyes" -a "x$use_strict" = "xyes" ; then 336 AC_MSG_ERROR([Fribidi not found])
359 AC_MSG_ERROR([Fribidi not found (strict dependencies checking)])
360 fi
361 ]) 337 ])
362fi 338fi
363 339
364if test "x${have_fribidi}" = "xno"; then
365 HAS_BIDI=0
366fi
367
368# harfbuzz support 340# harfbuzz support
369have_harfbuzz="no" 341have_harfbuzz="no"
370have_harfbuzz_ft="no" 342have_harfbuzz_ft="no"
@@ -430,7 +402,6 @@ AC_ARG_ENABLE([pixman],
430 fi 402 fi
431 ]) 403 ])
432 404
433
434if test "x${want_pixman}" = "xyes" -o "x${want_pixman}" = "xauto" ; then 405if test "x${want_pixman}" = "xyes" -o "x${want_pixman}" = "xauto" ; then
435 PKG_CHECK_MODULES([PIXMAN], 406 PKG_CHECK_MODULES([PIXMAN],
436 [pixman-1], 407 [pixman-1],
@@ -591,76 +562,29 @@ if test "x${want_evas_image_loader_generic}" = "xyes" ; then
591 EFL_CHECK_SHM_OPEN 562 EFL_CHECK_SHM_OPEN
592fi 563fi
593 564
594# (shm_open (for cache server) 565want_evas_cserve2="yes"
595AC_ARG_ENABLE([evas-cserve],
596 AC_HELP_STRING([--disable-evas-cserve],
597 [disable shared cache server support. @<:@default=enabled@:>@]),
598 [
599 if test "x${enableval}" = "xyes" ; then
600 want_evas_cserve="yes"
601 else
602 want_evas_cserve="no"
603 fi
604 ])
605AC_MSG_CHECKING(whether to build shared cache server and support)
606AC_MSG_RESULT(${want_evas_cserve})
607
608# (shm_open (for cache server)
609AC_ARG_ENABLE([evas-cserve2],
610 AC_HELP_STRING([--disable-evas-cserve2],
611 [disable shared cache server 2 support. @<:@default=enabled@:>@]),
612 [
613 if test "x${enableval}" = "xyes" ; then
614 want_evas_cserve2="yes"
615 else
616 want_evas_cserve2="no"
617 fi
618 ])
619AC_MSG_CHECKING(whether to build shared cache server 2 and support)
620AC_MSG_RESULT(${want_evas_cserve2})
621
622# cserve2 only works on Linux so far. 566# cserve2 only works on Linux so far.
623if test "x${want_evas_cserve2}" = "xyes" ; then 567if test "x${want_evas_cserve2}" = "xyes" ; then
624 AC_CHECK_HEADERS( 568 AC_CHECK_HEADERS(
625 [sys/epoll.h sys/inotify.h sys/signalfd.h], 569 [sys/epoll.h sys/inotify.h sys/signalfd.h],
626 [], 570 [],
627 [ 571 [ want_evas_cserve2="no" ]
628 want_evas_cserve2="no"
629 ]
630 ) 572 )
631fi 573fi
632 574
633if test "x${want_evas_cserve2}" = "xyes"; then
634 want_evas_cserve="no"
635fi
636
637shm_open_libs="" 575shm_open_libs=""
638if test "x${want_evas_cserve}" = "xyes" -o "x${want_evas_cserve2}" = "xyes" ; then 576if test "x${want_evas_cserve2}" = "xyes" ; then
639 EFL_CHECK_SHM_OPEN( 577 EFL_CHECK_SHM_OPEN(
640 [ 578 [ shm_open_libs=${EFL_SHM_OPEN_LIBS} ],
641 shm_open_libs=${EFL_SHM_OPEN_LIBS} 579 [ want_evas_cserve2="no" ])
642 ],
643 [
644 want_evas_cserve="no"
645 want_evas_cserve2="no"
646 ])
647fi 580fi
648AC_SUBST([shm_open_libs]) 581AC_SUBST([shm_open_libs])
649 582
650if test "x${want_evas_cserve}" = "xyes" ; then
651 AC_DEFINE(EVAS_CSERVE, 1, [Shared cache server.])
652fi
653
654AM_CONDITIONAL([EVAS_CSERVE], [test "x${want_evas_cserve}" = "xyes"])
655
656if test "x${want_evas_cserve2}" = "xyes" ; then 583if test "x${want_evas_cserve2}" = "xyes" ; then
657 AC_DEFINE(EVAS_CSERVE2, 1, [Shared cache server.]) 584 AC_DEFINE(EVAS_CSERVE2, 1, [Shared cache server.])
658fi 585fi
659
660AM_CONDITIONAL([EVAS_CSERVE2], [test "x${want_evas_cserve2}" = "xyes"]) 586AM_CONDITIONAL([EVAS_CSERVE2], [test "x${want_evas_cserve2}" = "xyes"])
661 587
662
663
664####################################### 588#######################################
665## GL force flavor gles 589## GL force flavor gles
666gl_flavor_gles="no" 590gl_flavor_gles="no"
@@ -687,27 +611,16 @@ AC_ARG_ENABLE(gl-flavor-gles,
687## Engines 611## Engines
688 612
689EVAS_CHECK_ENGINE([buffer], [${want_evas_engine_buffer}], [yes], [Buffer]) 613EVAS_CHECK_ENGINE([buffer], [${want_evas_engine_buffer}], [yes], [Buffer])
690
691EVAS_CHECK_ENGINE([software-gdi], [${want_evas_engine_software_gdi}], [no], [Software GDI]) 614EVAS_CHECK_ENGINE([software-gdi], [${want_evas_engine_software_gdi}], [no], [Software GDI])
692
693EVAS_CHECK_ENGINE([software-ddraw], [${want_evas_engine_software_ddraw}], [no], [Software DirectDraw]) 615EVAS_CHECK_ENGINE([software-ddraw], [${want_evas_engine_software_ddraw}], [no], [Software DirectDraw])
694
695EVAS_CHECK_ENGINE([direct3d], [${want_evas_engine_direct3d}], [no], [Direct3D]) 616EVAS_CHECK_ENGINE([direct3d], [${want_evas_engine_direct3d}], [no], [Direct3D])
696
697EVAS_CHECK_ENGINE([psl1ght], [${want_evas_engine_psl1ght}], [no], [PSL1GHT]) 617EVAS_CHECK_ENGINE([psl1ght], [${want_evas_engine_psl1ght}], [no], [PSL1GHT])
698
699EVAS_CHECK_ENGINE([gl-sdl], [${want_evas_engine_gl_sdl}], [no], [OpenGL SDL]) 618EVAS_CHECK_ENGINE([gl-sdl], [${want_evas_engine_gl_sdl}], [no], [OpenGL SDL])
700
701EVAS_CHECK_ENGINE([gl-cocoa], [${want_evas_engine_gl_cocoa}], [no], [OpenGL Cocoa]) 619EVAS_CHECK_ENGINE([gl-cocoa], [${want_evas_engine_gl_cocoa}], [no], [OpenGL Cocoa])
702
703EVAS_CHECK_ENGINE([fb], [${want_evas_engine_fb}], [no], [Framebuffer]) 620EVAS_CHECK_ENGINE([fb], [${want_evas_engine_fb}], [no], [Framebuffer])
704
705EVAS_CHECK_ENGINE([directfb], [${want_evas_engine_directfb}], [no], [DirectFB]) 621EVAS_CHECK_ENGINE([directfb], [${want_evas_engine_directfb}], [no], [DirectFB])
706
707EVAS_CHECK_ENGINE([software-8-x11], [${want_evas_engine_software_8_x11}], [no], [Software X11 8 bits grayscale]) 622EVAS_CHECK_ENGINE([software-8-x11], [${want_evas_engine_software_8_x11}], [no], [Software X11 8 bits grayscale])
708
709EVAS_CHECK_ENGINE([wayland-shm], [${want_evas_engine_wayland_shm}], [no], [Wayland Shm]) 623EVAS_CHECK_ENGINE([wayland-shm], [${want_evas_engine_wayland_shm}], [no], [Wayland Shm])
710
711EVAS_CHECK_ENGINE([wayland-egl], [${want_evas_engine_wayland_egl}], [no], [Wayland Egl]) 624EVAS_CHECK_ENGINE([wayland-egl], [${want_evas_engine_wayland_egl}], [no], [Wayland Egl])
712 625
713# SDL primitive 626# SDL primitive
@@ -925,77 +838,168 @@ if test "x${have_static_software_8}" = "xyes"; then
925fi 838fi
926 839
927##################################################################### 840#####################################################################
928## Image loaders 841## Font Loaders
929
930EVAS_CHECK_IMAGE_LOADER([Edb], [${want_evas_image_loader_edb}])
931 842
932EVAS_CHECK_IMAGE_LOADER([Eet], [${want_evas_image_loader_eet}]) 843PKG_CHECK_MODULES([EET], [eet >= 1.7.0], [], [AC_MSG_ERROR([EET not found])])
933EVAS_CHECK_FONT_LOADER([${want_evas_font_loader_eet}]) 844AC_DEFINE([BUILD_FONT_LOADER_EET], [1], [EET Font Loader Support])
845requirement_evas="eet >= 1.7.0 ${requirement_evas}"
934 846
935EVAS_CHECK_IMAGE_LOADER([Gif], [${want_evas_image_loader_gif}]) 847#####################################################################
848## Image loaders
936 849
937have_evas_image_saver_jpeg="no" 850#have_static_module="yes"
938EVAS_CHECK_IMAGE_LOADER([Jpeg], [${want_evas_image_loader_jpeg}]) 851do_module="true"
852do_static="false"
939 853
940dnl Windows has no sigsetjmp function, nor equivalent. 854#####################################################################
941dnl So we disable the jpeg saver. 855evas_image_loader_generic_cflags=""
942dnl TODO: must find a workaround 856evas_image_loader_generic_libs=""
943case "$host_os" in 857AC_SUBST([evas_image_loader_generic_cflags])
944 mingw*) 858AC_SUBST([evas_image_loader_generic_libs])
945 ;; 859AM_CONDITIONAL(BUILD_LOADER_GENERIC, [${do_module}])
946 *) 860AM_CONDITIONAL(EVAS_STATIC_BUILD_GENERIC, [${do_static}])
947 if test "x${have_evas_image_loader_jpeg}" = "xyes" ; then 861AC_DEFINE(BUILD_LOADER_GENERIC, [1], [Generic Loader])
948 AC_DEFINE(EVAS_BUILD_SAVER_JPEG, [1], [Build JPEG saver])
949 have_evas_image_saver_jpeg="yes"
950 fi
951 ;;
952esac
953AM_CONDITIONAL([BUILD_SAVER_JPEG], [test "x${have_evas_image_saver_jpeg}" = "xyes"])
954
955EVAS_CHECK_IMAGE_LOADER([PMAPS], [${want_evas_image_loader_pmaps}])
956 862
957EVAS_CHECK_IMAGE_LOADER([PNG], [${want_evas_image_loader_png}]) 863#####################################################################
864evas_image_loader_xpm_cflags=""
865evas_image_loader_xpm_libs=""
866AC_SUBST([evas_image_loader_xpm_cflags])
867AC_SUBST([evas_image_loader_xpm_libs])
868AM_CONDITIONAL(BUILD_LOADER_XPM, [${do_module}])
869AM_CONDITIONAL(EVAS_STATIC_BUILD_XPM, [${do_static}])
870AC_DEFINE(BUILD_LOADER_XPM, [1], [XPM Loader])
958 871
959EVAS_CHECK_IMAGE_LOADER([SVG], [${want_evas_image_loader_svg}]) 872#####################################################################
873evas_image_loader_bmp_cflags=""
874evas_image_loader_bmp_libs=""
875AC_SUBST([evas_image_loader_bmp_cflags])
876AC_SUBST([evas_image_loader_bmp_libs])
877AM_CONDITIONAL(BUILD_LOADER_BMP, [${do_module}])
878AM_CONDITIONAL(EVAS_STATIC_BUILD_BMP, [${do_static}])
879AC_DEFINE(BUILD_LOADER_BMP, [1], [BMP Loader])
960 880
961EVAS_CHECK_IMAGE_LOADER([Tiff], [${want_evas_image_loader_tiff}]) 881#####################################################################
882evas_image_loader_ico_cflags=""
883evas_image_loader_ico_libs=""
884AC_SUBST([evas_image_loader_ico_cflags])
885AC_SUBST([evas_image_loader_ico_libs])
886AM_CONDITIONAL(BUILD_LOADER_ICO, [${do_module}])
887AM_CONDITIONAL(EVAS_STATIC_BUILD_ICO, [${do_static}])
888AC_DEFINE(BUILD_LOADER_ICO, [1], [ICO Loader])
962 889
963EVAS_CHECK_IMAGE_LOADER([XPM], [${want_evas_image_loader_xpm}]) 890#####################################################################
891evas_image_loader_pmaps_cflags=""
892evas_image_loader_pmaps_libs=""
893AC_SUBST([evas_image_loader_pmaps_cflags])
894AC_SUBST([evas_image_loader_pmaps_libs])
895AM_CONDITIONAL(BUILD_LOADER_PMAPS, [${do_module}])
896AM_CONDITIONAL(EVAS_STATIC_BUILD_PMAPS, [${do_static}])
897AC_DEFINE(BUILD_LOADER_PMAPS, [1], [PMAPS Loader])
964 898
965EVAS_CHECK_IMAGE_LOADER([BMP], [${want_evas_image_loader_bmp}]) 899#####################################################################
900evas_image_loader_psd_cflags=""
901evas_image_loader_psd_libs=""
902AC_SUBST([evas_image_loader_psd_cflags])
903AC_SUBST([evas_image_loader_psd_libs])
904AM_CONDITIONAL(BUILD_LOADER_PSD, [${do_module}])
905AM_CONDITIONAL(EVAS_STATIC_BUILD_PSD, [${do_static}])
906AC_DEFINE(BUILD_LOADER_PSD, [1], [PSD Loader])
966 907
967EVAS_CHECK_IMAGE_LOADER([TGA], [${want_evas_image_loader_tga}]) 908#####################################################################
909evas_image_loader_tga_cflags=""
910evas_image_loader_tga_libs=""
911AC_SUBST([evas_image_loader_tga_cflags])
912AC_SUBST([evas_image_loader_tga_libs])
913AM_CONDITIONAL(BUILD_LOADER_TGA, [${do_module}])
914AM_CONDITIONAL(EVAS_STATIC_BUILD_TGA, [${do_static}])
915AC_DEFINE(BUILD_LOADER_TGA, [1], [TGA Loader])
968 916
969EVAS_CHECK_IMAGE_LOADER([WBMP], [${want_evas_image_loader_wbmp}]) 917#####################################################################
918evas_image_loader_wbmp_cflags=""
919evas_image_loader_wbmp_libs=""
920AC_SUBST([evas_image_loader_wbmp_cflags])
921AC_SUBST([evas_image_loader_wbmp_libs])
922AM_CONDITIONAL(BUILD_LOADER_WBMP, [${do_module}])
923AM_CONDITIONAL(EVAS_STATIC_BUILD_WBMP, [${do_static}])
924AC_DEFINE(BUILD_LOADER_WBMP, [1], [WBMP Loader])
970 925
971EVAS_CHECK_IMAGE_LOADER([WEBP], [${want_evas_image_loader_webp}]) 926#####################################################################
927PKG_CHECK_MODULES([EET], [eet >= 1.7.0], [requirement="eet >= 1.7.0"], [AC_MSG_ERROR([Eet not found])])
928dnl requirement_evas="${requirement} ${requirement_evas}"
929evas_image_loader_eet_cflags="${EET_CFLAGS}"
930evas_image_loader_eet_libs="${EET_LIBS}"
931AC_SUBST([evas_image_loader_eet_cflags])
932AC_SUBST([evas_image_loader_eet_libs])
933AM_CONDITIONAL(BUILD_LOADER_EET, [${do_module}])
934AM_CONDITIONAL(EVAS_STATIC_BUILD_EET, [${do_static}])
935AC_DEFINE(BUILD_LOADER_EET, [1], [EET Loader])
972 936
973EVAS_CHECK_IMAGE_LOADER([ICO], [${want_evas_image_loader_ico}]) 937#####################################################################
938have_evas_image_saver_jpeg="no"
939evas_image_loader_jpeg_cflags=""
940AC_CHECK_HEADER([jpeglib.h], [], [AC_MSG_ERROR([JPEG header not found])])
941AC_CHECK_LIB([jpeg], [jpeg_CreateDecompress],
942 [ evas_image_loader_jpeg_libs="-ljpeg"
943 AC_COMPILE_IFELSE(
944 [ AC_LANG_PROGRAM([[
945#include <stdio.h>
946#include <jpeglib.h>
947#include <setjmp.h>
948 ]],
949 [[
950struct jpeg_decompress_struct decomp;
951decomp.region_x = 0;
952 ]])],
953 [have_jpeg_region="yes"],
954 [have_jpeg_region="no"])
955 ],[ AC_MSG_ERROR([JPEG missing jpeg_CreateDecompress]) ])
956AC_SUBST([evas_image_loader_jpeg_cflags])
957AC_SUBST([evas_image_loader_jpeg_libs])
958AM_CONDITIONAL(BUILD_LOADER_JPEG, [${do_module}])
959AM_CONDITIONAL(EVAS_STATIC_BUILD_JPEG, [${do_static}])
960AC_DEFINE(BUILD_LOADER_JPEG, [1], [JPEG Loader])
961case "$host_os" in
962 mingw*)
963 ;;
964 *)
965 AC_DEFINE(EVAS_BUILD_SAVER_JPEG, [1], [Build JPEG saver])
966 AM_CONDITIONAL([BUILD_SAVER_JPEG], [true])
967 have_evas_image_saver_jpeg="yes"
968 ;;
969esac
974 970
975EVAS_CHECK_IMAGE_LOADER([PSD], [${want_evas_image_loader_psd}]) 971#####################################################################
972PKG_CHECK_MODULES([PNG], [libpng >= 1.2.10], [requirement="libpng >= 1.2.10"], [
973 PKG_CHECK_MODULES([PNG], [libpng15], [requirement="libpng15"], [
974 PKG_CHECK_MODULES([PNG], [libpng14], [requirement="libpng14"], [
975 PKG_CHECK_MODULES([PNG], [libpng12], [requirement="libpng12"], [
976 AC_MSG_ERROR([PNG not found])
977 ])
978 ])
979 ])
980])
981dnl requirement_evas="${requirement} ${requirement_evas}"
982evas_image_loader_png_cflags="${PNG_CFLAGS}"
983evas_image_loader_png_libs="${PNG_LIBS}"
984AC_SUBST([evas_image_loader_png_cflags])
985AC_SUBST([evas_image_loader_png_libs])
986AM_CONDITIONAL(BUILD_LOADER_PNG, [${do_module}])
987AM_CONDITIONAL(EVAS_STATIC_BUILD_PNG, [${do_static}])
988AC_DEFINE(BUILD_LOADER_PNG, [1], [PNG Loader])
976 989
977EVAS_CHECK_IMAGE_LOADER([GENERIC], [${want_evas_image_loader_generic}]) 990EVAS_CHECK_IMAGE_LOADER([WEBP], [${want_evas_image_loader_webp}])
991EVAS_CHECK_IMAGE_LOADER([Gif], [${want_evas_image_loader_gif}])
992EVAS_CHECK_IMAGE_LOADER([Tiff], [${want_evas_image_loader_tiff}])
993EVAS_CHECK_IMAGE_LOADER([SVG], [${want_evas_image_loader_svg}])
978 994
979##################################################################### 995#####################################################################
980## Cpu based optimizations 996## Cpu based optimizations
981 997
982####################################### 998#######################################
983## PTHREADS 999## PTHREADS
984pthread_cflags=""
985pthread_libs=""
986build_pthreads="no"
987has_pthreads="no"
988need_pthreads="no"
989# basic pthread support
990AC_CHECK_HEADER(pthread.h,
991 [
992 has_pthreads="yes"
993 ],
994 [
995 has_pthreads="no"
996 ]
997)
998 1000
1001# basic pthread support
1002AC_CHECK_HEADER(pthread.h, [], [AC_MSG_ERROR([Pthread support missing.])])
999# sched_getaffinity pthread_attr_setaffinity_np 1003# sched_getaffinity pthread_attr_setaffinity_np
1000AC_CHECK_HEADERS([pthread.h sched.h], 1004AC_CHECK_HEADERS([pthread.h sched.h],
1001 [ 1005 [
@@ -1011,49 +1015,16 @@ AC_CHECK_HEADERS([pthread.h sched.h],
1011 [[ 1015 [[
1012pthread_attr_setaffinity_np(NULL, 0, NULL); 1016pthread_attr_setaffinity_np(NULL, 0, NULL);
1013pthread_barrier_wait(NULL); 1017pthread_barrier_wait(NULL);
1014 ]])], 1018 ]])], [],
1015 [build_pthreads="yes"], 1019 [AC_MSG_ERROR([Missing pthread_attr_setaffinity_np or pthread_barrier_wait.])])
1016 [build_pthreads="no"])
1017 CFLAGS=${CFLAGS_save} 1020 CFLAGS=${CFLAGS_save}
1018 LIBS=${LIBS_save} 1021 LIBS=${LIBS_save}
1019 ], 1022 ],
1020 [build_pthreads="no"]) 1023 [AC_MSG_ERROR([Missing sched.h])])
1021 1024pthread_cflags="-pthread"
1022AC_MSG_CHECKING([whether pthread_attr_setaffinity_np() and pthread_barrier_wait() are supported]) 1025pthread_libs="-pthread"
1023AC_MSG_RESULT([${build_pthreads}]) 1026AC_DEFINE(BUILD_ASYNC_EVENTS, 1, [Build async events support])
1024 1027AC_DEFINE(BUILD_ASYNC_PRELOAD, 1, [Build async image preload support])
1025#######################################
1026## Pthread
1027AC_MSG_CHECKING(whether to build pthread code)
1028AC_ARG_ENABLE(pthreads,
1029 AC_HELP_STRING([--enable-pthreads], [enable threaded rendering]),
1030 [
1031 if test "x$enableval" = "xyes" ; then
1032 if test "x$build_pthreads" = "xyes"; then
1033 AC_MSG_RESULT(yes)
1034 AC_DEFINE(BUILD_PTHREAD, 1, [Build Threaded Rendering])
1035 build_pthreads="yes"
1036 need_pthreads="yes"
1037 else
1038 if "x$use_strict" = "xyes"; then
1039 AC_MSG_ERROR(pthreads headers or functions not found (strict dependencies checking))
1040 else
1041 AC_MSG_RESULT(no: pthread headers or functions not found)
1042 fi
1043 fi
1044 else
1045 AC_MSG_RESULT(no)
1046 build_pthreads="no"
1047 fi
1048 ],
1049 [
1050 AC_MSG_RESULT($build_pthreads)
1051 if test "x$build_pthreads" = "xyes" ; then
1052 AC_DEFINE(BUILD_PTHREAD, 1, [Build Threaded Rendering])
1053 need_pthreads="yes"
1054 fi
1055 ]
1056)
1057 1028
1058####################################### 1029#######################################
1059## Pipe Renderer 1030## Pipe Renderer
@@ -1069,154 +1040,97 @@ build_pipe_render="no"
1069# [ build_pipe_render=$enableval ] 1040# [ build_pipe_render=$enableval ]
1070#) 1041#)
1071#AC_MSG_RESULT($build_pipe_render) 1042#AC_MSG_RESULT($build_pipe_render)
1072
1073#AC_MSG_CHECKING(whether we can build Threaded Pipe Rendering support) 1043#AC_MSG_CHECKING(whether we can build Threaded Pipe Rendering support)
1074#if test \( "x$build_pipe_render" = "xyes" -o "x$build_pipe_render" = "xauto" \); then 1044#if test \( "x$build_pipe_render" = "xyes" -o "x$build_pipe_render" = "xauto" \); then
1075# AC_MSG_RESULT(yes) 1045# AC_MSG_RESULT(yes)
1076# AC_DEFINE(BUILD_PIPE_RENDER, 1, [Build pipe render support]) 1046# AC_DEFINE(BUILD_PIPE_RENDER, 1, [Build pipe render support])
1077# build_pipe_render="yes" 1047# build_pipe_render="yes"
1078# need_pthreads="yes"
1079#else 1048#else
1080# AC_MSG_RESULT(no) 1049# AC_MSG_RESULT(no)
1081# build_pipe_render="no" 1050# build_pipe_render="no"
1082#fi 1051#fi
1083 1052
1084####################################### 1053#######################################
1085## Async events 1054## CPU architecture specific assembly
1086build_async_events="auto"
1087AC_MSG_CHECKING(whether to build Async Events support)
1088AC_ARG_ENABLE(async-events,
1089 AC_HELP_STRING([--enable-async-events], [enable async events support]),
1090 [ build_async_events=$enableval ]
1091)
1092AC_MSG_RESULT($build_async_events)
1093 1055
1094AC_MSG_CHECKING(whether we can build Async Events support) 1056AC_DEFINE(BUILD_C, 1, [Build plain C code])
1095if test "x$build_async_events" = "xyes" || test "x$build_async_events" = "xauto" ; then
1096 AC_MSG_RESULT(yes)
1097 AC_DEFINE(BUILD_ASYNC_EVENTS, 1, [Build async events support])
1098 build_async_events="yes"
1099else
1100 AC_MSG_RESULT(no)
1101 build_async_events="no"
1102fi
1103
1104#######################################
1105## Async image preload
1106build_async_preload="auto"
1107AC_MSG_CHECKING(whether to build Async Image Preload support)
1108AC_ARG_ENABLE(async-preload,
1109 AC_HELP_STRING([--enable-async-preload], [enable async image preloading support]),
1110 [ build_async_preload=$enableval ]
1111)
1112AC_MSG_RESULT($build_async_preload)
1113
1114AC_MSG_CHECKING(whether we can build Async Image Preload support)
1115if test \( "x$build_async_preload" = "xyes" -o "x$build_async_preload" = "xauto" \) -a "x$build_async_events" = "xyes"; then
1116 AC_MSG_RESULT(yes)
1117 AC_DEFINE(BUILD_ASYNC_PRELOAD, 1, [Build async image preload support])
1118 build_async_preload="yes"
1119 need_pthreads="yes"
1120else
1121 AC_MSG_RESULT(no)
1122 build_async_preload="no"
1123fi
1124 1057
1125#######################################
1126## Link with pthread if needed
1127AC_MSG_CHECKING(whether we should link with pthread)
1128if test "x$need_pthreads" = "xyes"; then
1129 AC_MSG_RESULT(yes)
1130 pthread_cflags="-pthread"
1131 pthread_libs="-pthread"
1132else
1133 AC_MSG_RESULT(no)
1134fi
1135
1136#######################################
1137## MMX
1138build_cpu_mmx="no" 1058build_cpu_mmx="no"
1059build_cpu_sse3="no"
1060build_cpu_altivec="no"
1061build_cpu_neon="no"
1062
1139case $host_cpu in 1063case $host_cpu in
1140 i*86) 1064 i*86|x86_64|amd64)
1141 build_cpu_mmx="yes" 1065 AC_DEFINE(BUILD_MMX, 1, [Build MMX Code])
1142 ;; 1066 AC_DEFINE(BUILD_SSE, 1, [Build SSE Code])
1143 x86_64)
1144 build_cpu_mmx="yes" 1067 build_cpu_mmx="yes"
1068 build_cpu_sse3="yes"
1145 ;; 1069 ;;
1146 amd64) 1070
1147 build_cpu_mmx="yes" 1071 *power* | *ppc*)
1072 build_cpu_altivec="yes"
1073 AC_CHECK_HEADER(altivec.h,
1074 [
1075 AC_DEFINE(BUILD_ALTIVEC, 1, [Build Altivec Code])
1076 AC_DEFINE(HAVE_ALTIVEC_H, 1, [Have altivec.h header file])
1077 build_cpu_altivec="yes"
1078 ],
1079 [
1080 save_CFLAGS=$CFLAGS
1081 save_CPPFLAGS=$CPPFLAGS
1082 CFLAGS=$CFLAGS" -maltivec"
1083 CPPFLAGS=$CPPFLAGS" -maltivec"
1084 unset ac_cv_header_altivec_h
1085 AC_CHECK_HEADER(altivec.h,
1086 [
1087 AC_DEFINE(BUILD_ALTIVEC, 1, [Build Altivec Code])
1088 AC_DEFINE(HAVE_ALTIVEC_H, 1, [Have altivec.h header file])
1089 build_cpu_altivec="yes"
1090 ],
1091 [
1092 build_cpu_altivec="no"
1093 ]
1094 )
1095 CFLAGS=$save_CFLAGS
1096 CPPFLAGS=$save_CPPFLAGS
1097 ]
1098 )
1099 if test "x$build_cpu_altivec" = "xyes"; then
1100 AC_MSG_CHECKING(whether to use altivec compiler flag)
1101 if test "x$GCC" = "xyes"; then
1102 if echo "int main(){return 0;}" | ${CPP} -faltivec - > /dev/null 2>&1; then
1103 altivec_cflags="-faltivec"
1104 AC_DEFINE(BUILD_ALTIVEC, 1, [Build Altivec Code])
1105 elif echo "int main(){return 0;}" | ${CPP} -maltivec - > /dev/null 2>&1; then
1106 altivec_cflags="-maltivec"
1107 AC_DEFINE(BUILD_ALTIVEC, 1, [Build Altivec Code])
1108 fi
1109 fi
1110 AC_MSG_RESULT($altivec_cflags)
1111 CFLAGS="$CFLAGS $altivec_cflags"
1112 fi
1148 ;; 1113 ;;
1149esac 1114
1150AC_MSG_CHECKING(whether to build mmx code) 1115 arm*)
1151AC_ARG_ENABLE(cpu-mmx, 1116 build_cpu_neon="yes"
1152 AC_HELP_STRING([--enable-cpu-mmx], [enable mmx code]), 1117 AC_TRY_COMPILE([#include <arm_neon.h>],
1153 [ 1118 [asm volatile ("vqadd.u8 d0, d1, d0\n")],
1154 if test "x$enableval" = "xyes" ; then 1119 [
1155 AC_MSG_RESULT(yes) 1120 AC_MSG_RESULT(yes)
1156 AC_DEFINE(BUILD_MMX, 1, [Build MMX Code]) 1121 AC_DEFINE(BUILD_NEON, 1, [Build NEON Code])
1157 build_cpu_mmx="yes" 1122 build_cpu_neon="yes"
1158 else 1123 ],[
1159 AC_MSG_RESULT(no) 1124 AC_MSG_RESULT(no)
1160 build_cpu_mmx="no" 1125 build_cpu_neon="no"
1161 fi 1126 ])
1162 ],
1163 [
1164 AC_MSG_RESULT($build_cpu_mmx)
1165 if test "x$build_cpu_mmx" = "xyes" ; then
1166 AC_DEFINE(BUILD_MMX, 1, [Build MMX Code])
1167 fi
1168 ]
1169)
1170
1171#######################################
1172## SSE
1173build_cpu_sse="no"
1174case $host_cpu in
1175 i*86)
1176 build_cpu_sse="yes"
1177 ;;
1178 x86_64)
1179 build_cpu_sse="yes"
1180 ;;
1181 amd64)
1182 build_cpu_sse="yes"
1183 ;; 1127 ;;
1184esac 1128esac
1185AC_MSG_CHECKING(whether to build sse code)
1186AC_ARG_ENABLE(cpu-sse,
1187 AC_HELP_STRING([--enable-cpu-sse], [enable sse code]),
1188 [
1189 if test "x$enableval" = "xyes" ; then
1190 AC_MSG_RESULT(yes)
1191 AC_DEFINE(BUILD_SSE, 1, [Build SSE Code])
1192 build_cpu_sse="yes"
1193 else
1194 AC_MSG_RESULT(no)
1195 build_cpu_sse="no"
1196 fi
1197 ],
1198 [
1199 AC_MSG_RESULT($build_cpu_sse)
1200 if test "x$build_cpu_sse" = "xyes" ; then
1201 AC_DEFINE(BUILD_SSE, 1, [Build SSE Code])
1202 fi
1203 ]
1204)
1205 1129
1206####################################### 1130#######################################
1207## SSE3 1131## CHECK SSE3
1208build_cpu_sse3="no" 1132## sse3 is still an option because older gcc's dont have support for
1209case $host_cpu in 1133## intrinsics used
1210 i*86)
1211 build_cpu_sse3="yes"
1212 ;;
1213 x86_64)
1214 build_cpu_sse3="yes"
1215 ;;
1216 amd64)
1217 build_cpu_sse3="yes"
1218 ;;
1219esac
1220AC_MSG_CHECKING(whether to build sse3 code) 1134AC_MSG_CHECKING(whether to build sse3 code)
1221AC_ARG_ENABLE(cpu-sse3, 1135AC_ARG_ENABLE(cpu-sse3,
1222 AS_HELP_STRING([--enable-cpu-sse3], [enable sse3 code]), 1136 AS_HELP_STRING([--enable-cpu-sse3], [enable sse3 code]),
@@ -1254,166 +1168,15 @@ AC_ARG_ENABLE(cpu-sse3,
1254 ] 1168 ]
1255) 1169)
1256 1170
1257
1258# as a big warning flag to anyone doing stuff like this...
1259# NEVER EVER EVER EVER put **OPTIMIZATION** flags in
1260# build flags in makefiles (from configure or anywhere else)
1261# EVER as this screws your ability to build 1 binary and
1262# cover ALL x86 arch's. This is the HEIGHT of WRONG. If the
1263# person building choses to add optimization flags themselves
1264# and decide the minimum baseline cpu arch is X then that's
1265# their business, but NEVER should it be done here. NEVER.
1266# I now have to do this due to the way this sse3 code was done - using
1267# intrinsics and "functions" (opcodes) and types that only compile *IF*
1268# you compile with -msse3. this ALSO tries to optimize REGULAR c code
1269# with sse3 asm.. and this breaks things so badly. so... sse3 will be
1270# off until further notice for 32bit x86.
1271EVAS_SSE3_CFLAGS=" " 1171EVAS_SSE3_CFLAGS=" "
1272if test "x$build_cpu_sse3" = "xyes" ; then 1172if test "x$build_cpu_sse3" = "xyes" ; then
1273 EVAS_SSE3_CFLAGS="-msse3 " 1173 EVAS_SSE3_CFLAGS="-msse3 "
1274# CFLAGS="${CFLAGS} ${EVAS_SSE3_CFLAGS}"
1275fi 1174fi
1276 1175
1277AC_SUBST(CFLAGS) 1176AC_SUBST(CFLAGS)
1278AC_SUBST(EVAS_SSE3_CFLAGS) 1177AC_SUBST(EVAS_SSE3_CFLAGS)
1279 1178
1280####################################### 1179#######################################
1281## ALTIVEC
1282build_cpu_altivec="no"
1283case $host_cpu in
1284 *power* | *ppc*)
1285 build_cpu_altivec="auto"
1286 ;;
1287esac
1288altivec_cflags=""
1289AC_MSG_CHECKING(whether to build altivec code)
1290AC_ARG_ENABLE(cpu-altivec,
1291 AC_HELP_STRING([--enable-cpu-altivec], [enable altivec code]),
1292 [ build_cpu_altivec=$enableval ],
1293 [
1294 if test ! "x$build_cpu_altivec" = "xauto"; then
1295 build_cpu_altivec="no"
1296 fi
1297 ]
1298)
1299AC_MSG_RESULT($build_cpu_altivec)
1300
1301if test "x$build_cpu_altivec" = "xyes"; then
1302 AC_CHECK_HEADER(altivec.h,
1303 [
1304 AC_DEFINE(BUILD_ALTIVEC, 1, [Build Altivec Code])
1305 AC_DEFINE(HAVE_ALTIVEC_H, 1, [Have altivec.h header file])
1306 build_cpu_altivec="yes"
1307 ],
1308 [
1309 save_CFLAGS=$CFLAGS
1310 save_CPPFLAGS=$CPPFLAGS
1311 CFLAGS=$CFLAGS" -maltivec"
1312 CPPFLAGS=$CPPFLAGS" -maltivec"
1313 unset ac_cv_header_altivec_h
1314 AC_CHECK_HEADER(altivec.h,
1315 [
1316 AC_DEFINE(BUILD_ALTIVEC, 1, [Build Altivec Code])
1317 AC_DEFINE(HAVE_ALTIVEC_H, 1, [Have altivec.h header file])
1318 build_cpu_altivec="yes"
1319 ],
1320 [
1321 if test "x$build_cpu_altivec" = "xyes" -a "x$use_strict" = "xyes" ; then
1322 AC_MSG_ERROR(Altivec not found (strict dependencies checking))
1323 fi
1324 build_cpu_altivec="no"
1325 ]
1326 )
1327 CFLAGS=$save_CFLAGS
1328 CPPFLAGS=$save_CPPFLAGS
1329 ]
1330 )
1331fi
1332
1333if test "x$build_cpu_altivec" = "xyes"; then
1334 AC_MSG_CHECKING(whether to use altivec compiler flag)
1335 if test "x$GCC" = "xyes"; then
1336 if echo "int main(){return 0;}" | ${CPP} -faltivec - > /dev/null 2>&1; then
1337 altivec_cflags="-faltivec"
1338 AC_DEFINE(BUILD_ALTIVEC, 1, [Build Altivec Code])
1339 elif echo "int main(){return 0;}" | ${CPP} -maltivec - > /dev/null 2>&1; then
1340 altivec_cflags="-maltivec"
1341 AC_DEFINE(BUILD_ALTIVEC, 1, [Build Altivec Code])
1342 fi
1343 fi
1344 AC_MSG_RESULT($altivec_cflags)
1345 CFLAGS="$CFLAGS $altivec_cflags"
1346fi
1347
1348#######################################
1349## NEON
1350build_cpu_neon="no"
1351case $host_cpu in
1352 arm*)
1353 build_cpu_neon="yes"
1354 ;;
1355esac
1356AC_MSG_CHECKING(whether to build neon code)
1357AC_ARG_ENABLE(cpu-neon,
1358 AC_HELP_STRING([--enable-cpu-neon], [build neon code, the code will be
1359 checked at run time to see if the CPU supports it]),
1360 [
1361 if test "x$enableval" = "xyes" ; then
1362 AC_TRY_COMPILE([],
1363 [asm volatile (".fpu neon\nvqadd.u8 d0, d1, d0\n")],
1364 [
1365 AC_MSG_RESULT(yes)
1366 AC_DEFINE(BUILD_NEON, 1, [Build NEON Code])
1367 build_cpu_neon="yes"
1368 ],[
1369 AC_MSG_RESULT(no)
1370 build_cpu_neon="no"
1371 ])
1372 else
1373 AC_MSG_RESULT(no)
1374 build_cpu_neon="no"
1375 fi
1376 ],
1377 [
1378 if test "x$build_cpu_neon" = "xyes" ; then
1379 AC_TRY_COMPILE([#include <arm_neon.h>],
1380 [asm volatile ("vqadd.u8 d0, d1, d0\n")],
1381 [
1382 AC_MSG_RESULT(yes)
1383 AC_DEFINE(BUILD_NEON, 1, [Build NEON Code])
1384 build_cpu_neon="yes"
1385 ],[
1386 AC_MSG_RESULT(no)
1387 build_cpu_neon="no"
1388 ])
1389 fi
1390 ]
1391)
1392
1393#######################################
1394## C
1395build_cpu_c="yes"
1396AC_MSG_CHECKING(whether to build c code)
1397AC_ARG_ENABLE(cpu-c,
1398 AC_HELP_STRING([--enable-cpu-c], [enable C code]),
1399 [
1400 if test "x$enableval" = "xyes" ; then
1401 AC_MSG_RESULT(yes)
1402 AC_DEFINE(BUILD_C, 1, [Build plain C code])
1403 build_cpu_c="yes"
1404 else
1405 AC_MSG_RESULT(no)
1406 build_cpu_c="no"
1407 fi
1408 ], [
1409 AC_MSG_RESULT($build_cpu_c)
1410 if test "x$build_cpu_c" = "xyes" ; then
1411 AC_DEFINE(BUILD_C, 1, [Build plain C code])
1412 fi
1413 ]
1414)
1415
1416#######################################
1417## MAGIC_DEBUG 1180## MAGIC_DEBUG
1418want_evas_magic_debug="yes" 1181want_evas_magic_debug="yes"
1419AC_MSG_CHECKING(whether to check magic for evas object) 1182AC_MSG_CHECKING(whether to check magic for evas object)
@@ -1432,42 +1195,8 @@ if test "x$want_evas_magic_debug" = "xyes"; then
1432fi 1195fi
1433 1196
1434##################################################################### 1197#####################################################################
1435## ARGB engine options 1198## dither options
1436
1437#######################################
1438## Nearest sampling scaler
1439EVAS_CHECK_SCALER([scale-sample], [sampling scaler], [scaler_sample="yes"], [scaler_sample="no"])
1440## Smooth super and sub sampling scaler
1441EVAS_CHECK_SCALER([scale-smooth], [smooth scaler], [scaler_smooth="yes"], [scaler_smooth="no"])
1442
1443#######################################
1444## YUV -> ARGB converter
1445conv_yuv="no"
1446conv_yuv="yes"
1447AC_MSG_CHECKING(whether to build yuv converter code)
1448AC_ARG_ENABLE(convert-yuv,
1449 AC_HELP_STRING([--enable-convert-yuv], [enable yuv converter code]),
1450 [
1451 if test "x$enableval" = "xyes" ; then
1452 AC_MSG_RESULT(yes)
1453 AC_DEFINE(BUILD_CONVERT_YUV, 1, [YUV Converter Support])
1454 conv_yuv="yes"
1455 else
1456 AC_MSG_RESULT(no)
1457 conv_yuv="no"
1458 fi
1459 ], [
1460 AC_MSG_RESULT($conv_yuv)
1461 if test "x$conv_yuv" = "xyes" ; then
1462 AC_DEFINE(BUILD_CONVERT_YUV, 1, [YUV Converter Support])
1463 fi
1464 ]
1465)
1466
1467#####################################################################
1468## Output rendering features
1469 1199
1470#######################################
1471## Small dither mask instead of big one (lower quality) 1200## Small dither mask instead of big one (lower quality)
1472EVAS_CHECK_DITHER([small-dither-mask], [small dither mask], [conv_small_dither="yes"], [conv_small_dither="no"]) 1201EVAS_CHECK_DITHER([small-dither-mask], [small dither mask], [conv_small_dither="yes"], [conv_small_dither="no"])
1473## Alternate Line dither mask instead of big one (lower quality - but fastest) 1202## Alternate Line dither mask instead of big one (lower quality - but fastest)
@@ -1475,153 +1204,43 @@ EVAS_CHECK_DITHER([line-dither-mask], [line dither mask], [conv_line_dither="yes
1475## No dither mask at all for 16bpp 1204## No dither mask at all for 16bpp
1476EVAS_CHECK_DITHER([no-dither-mask], [conversion to 16bpp without dither mask], [conv_no_dither="yes"], [conv_no_dither="no"]) 1205EVAS_CHECK_DITHER([no-dither-mask], [conversion to 16bpp without dither mask], [conv_no_dither="yes"], [conv_no_dither="no"])
1477 1206
1478####################################### 1207#####################################################################
1479## Convert to 8bpp RGB 332 1208## no longer options - turn on.
1480EVAS_CONVERT_COLOR(8, RGB, 332, [yes]) 1209
1481## Convert to 8bpp RGB 666 1210AC_DEFINE(BUILD_SCALE_SAMPLE, 1, [YUV])
1482EVAS_CONVERT_COLOR(8, RGB, 666, [yes]) 1211AC_DEFINE(BUILD_SCALE_SMOOTH, 1, [YUV])
1483## Convert to 8bpp RGB 232 1212AC_DEFINE(BUILD_CONVERT_YUV, 1, [YUV])
1484EVAS_CONVERT_COLOR(8, RGB, 232, [yes]) 1213AC_DEFINE(BUILD_CONVERT_8_RGB_332, 1, [8bpp RGB 332])
1485## Convert to 8bpp RGB 222 1214AC_DEFINE(BUILD_CONVERT_8_RGB_666, 1, [8bpp RGB 666])
1486EVAS_CONVERT_COLOR(8, RGB, 222, [yes]) 1215AC_DEFINE(BUILD_CONVERT_8_RGB_232, 1, [8bpp RGB 232])
1487## Convert to 8bpp RGB 221 1216AC_DEFINE(BUILD_CONVERT_8_RGB_222, 1, [8bpp RGB 222])
1488EVAS_CONVERT_COLOR(8, RGB, 221, [yes]) 1217AC_DEFINE(BUILD_CONVERT_8_RGB_221, 1, [8bpp RGB 221])
1489## Convert to 8bpp RGB 121 1218AC_DEFINE(BUILD_CONVERT_8_RGB_121, 1, [8bpp RGB 121])
1490EVAS_CONVERT_COLOR(8, RGB, 121, [yes]) 1219AC_DEFINE(BUILD_CONVERT_8_RGB_111, 1, [8bpp RGB 111])
1491## Convert to 8bpp RGB 111 1220AC_DEFINE(BUILD_CONVERT_16_BGR_565, 1, [16bpp BGR 565])
1492EVAS_CONVERT_COLOR(8, RGB, 111, [yes]) 1221AC_DEFINE(BUILD_CONVERT_16_RGB_565, 1, [16bpp RGB 565])
1493## Convert to 16bpp RGB 565 1222AC_DEFINE(BUILD_CONVERT_16_RGB_555, 1, [16bpp RGB 555])
1494EVAS_CONVERT_COLOR(16, RGB, 565) 1223AC_DEFINE(BUILD_CONVERT_16_RGB_444, 1, [16bpp RGB 444])
1495## Convert to 16bpp BGR 565 1224AC_DEFINE(BUILD_CONVERT_16_RGB_454645, 1, [16bpp RGB 565 (444 ipaq)])
1496EVAS_CONVERT_COLOR(16, BGR, 565) 1225AC_DEFINE(BUILD_CONVERT_16_RGB_ROT0, 1, [16bpp 0 dgeree rotation])
1497## Convert to 16bpp RGB 555 1226AC_DEFINE(BUILD_CONVERT_16_RGB_ROT90, 1, [16bpp 90 dgeree rotation])
1498EVAS_CONVERT_COLOR(16, RGB, 555) 1227AC_DEFINE(BUILD_CONVERT_16_RGB_ROT180, 1, [16bpp 180 dgeree rotation])
1499## Convert to 16bpp RGB 444 1228AC_DEFINE(BUILD_CONVERT_16_RGB_ROT270, 1, [16bpp 270 dgeree rotation])
1500EVAS_CONVERT_COLOR(16, RGB, 444) 1229AC_DEFINE(BUILD_CONVERT_24_RGB_888, 1, [24bpp RGB 888])
1501 1230AC_DEFINE(BUILD_CONVERT_24_BGR_888, 1, [24bpp BGR 888])
1502####################################### 1231AC_DEFINE(BUILD_CONVERT_32_RGB_8888, 1, [32bpp RGB 8888])
1503## Convert to 16bpp RGB 565 (444 ipaq) 1232AC_DEFINE(BUILD_CONVERT_32_RGBX_8888, 1, [32bpp RGBX 8888])
1504conv_16_rgb_ipq="yes" 1233AC_DEFINE(BUILD_CONVERT_32_BGR_8888, 1, [32bpp BGR 8888])
1505AC_MSG_CHECKING(whether to build 16bpp 565 (444 ipaq) converter code) 1234AC_DEFINE(BUILD_CONVERT_32_BGRX_8888, 1, [32bpp BGRX 8888])
1506AC_ARG_ENABLE(convert-16-rgb-ipq, 1235AC_DEFINE(BUILD_CONVERT_24_RGB_666, 1, [24bpp RGB 666 (666 ezx)])
1507 AC_HELP_STRING([--disable-convert-16-rgb-ipq], [disable 16bpp 565 (444 ipaq) converter code]), 1236AC_DEFINE(BUILD_CONVERT_32_RGB_666, 1, [32bpp RGB 666 (666 ezx)])
1508 [ 1237AC_DEFINE(BUILD_CONVERT_32_RGB_ROT0, 1, [32bpp 0 dgeree rotation])
1509 if test "x$enableval" = "xyes" ; then 1238AC_DEFINE(BUILD_CONVERT_32_RGB_ROT90, 1, [32bpp 90 dgeree rotation])
1510 AC_DEFINE(BUILD_CONVERT_16_RGB_454645, 1, [16bpp 565 (444 ipaq) Converter Support]) 1239AC_DEFINE(BUILD_CONVERT_32_RGB_ROT180, 1, [32bpp 180 dgeree rotation])
1511 conv_16_rgb_ipq="yes" 1240AC_DEFINE(BUILD_CONVERT_32_RGB_ROT270, 1, [32bpp 270 dgeree rotation])
1512 else 1241AC_DEFINE(BUILD_CONVERT_8_GRY_1, 1, [1bpp Mono])
1513 conv_16_rgb_ipq="no" 1242AC_DEFINE(BUILD_CONVERT_8_GRY_16, 1, [4bpp Greyscale])
1514 fi 1243AC_DEFINE(BUILD_CONVERT_8_GRAYSCALE_64, 1, [32bpp Grayscale 64 palette])
1515 ], [
1516 if test "x$conv_16_rgb_ipq" = "xyes" ; then
1517 AC_DEFINE(BUILD_CONVERT_16_RGB_454645, 1, [16bpp 565 (444 ipaq) Converter Support])
1518 fi
1519 ]
1520)
1521AC_MSG_RESULT($conv_16_rgb_ipq)
1522
1523#######################################
1524## Convert to 16bpp RGB with rotation of 0
1525EVAS_CONVERT_ROT(16, RGB, 0)
1526## Convert to 16bpp RGB with rotation of 180
1527EVAS_CONVERT_ROT(16, RGB, 180)
1528## Convert to 16bpp RGB with rotation of 270
1529EVAS_CONVERT_ROT(16, RGB, 270)
1530## Convert to 16bpp RGB with rotation of 90
1531EVAS_CONVERT_ROT(16, RGB, 90)
1532
1533#######################################
1534## Convert to 24bpp RGB 888
1535EVAS_CONVERT_COLOR(24, RGB, 888)
1536## Convert to 24bpp BGR 888
1537EVAS_CONVERT_COLOR(24, BGR, 888)
1538## Convert to 32bpp RGB 8888
1539EVAS_CONVERT_COLOR(32, RGB, 8888)
1540## Convert to 32bpp RGBX 8888
1541EVAS_CONVERT_COLOR(32, RGBX, 8888)
1542## Convert to 32bpp BGR 8888
1543EVAS_CONVERT_COLOR(32, BGR, 8888)
1544## Convert to 32bpp BGRX 8888
1545EVAS_CONVERT_COLOR(32, BGRX, 8888)
1546
1547#######################################
1548## Convert to 24bpp RGB 666 (666 ezx)
1549conv_24_rgb_ezx="yes"
1550AC_MSG_CHECKING(whether to build 24bpp 666 (666 ezx) converter code)
1551AC_ARG_ENABLE(convert-24-rgb-ezx,
1552 AC_HELP_STRING([--disable-convert-24-rgb-ezx], [disable 24bpp 666 (666 ezx) converter code]),
1553 [
1554 if test "x$enableval" = "xyes" ; then
1555 AC_DEFINE(BUILD_CONVERT_24_RGB_666, 1, [24bpp 666 (666 ezx) Converter Support])
1556 conv_24_rgb_ezx="yes"
1557 else
1558 conv_24_rgb_ezx="no"
1559 fi
1560 ], [
1561 if test "x$conv_24_rgb_ezx" = "xyes" ; then
1562 AC_DEFINE(BUILD_CONVERT_24_RGB_666, 1, [24bpp 666 (666 ezx) Converter Support])
1563 fi
1564 ]
1565)
1566AC_MSG_RESULT($conv_24_rgb_ezx)
1567
1568#######################################
1569## Convert to 32bpp RGB 666 (666 ezx)
1570conv_32_rgb_ezx="yes"
1571AC_MSG_CHECKING(whether to build 32bpp 666 (666 ezx) converter code)
1572AC_ARG_ENABLE(convert-32-rgb-ezx,
1573 AC_HELP_STRING([--disable-convert-32-rgb-ezx], [disable 32bpp 666 (666 ezx) converter code]),
1574 [
1575 if test "x$enableval" = "xyes" ; then
1576 AC_DEFINE(BUILD_CONVERT_32_RGB_666, 1, [32bpp 666 (666 ezx) Converter Support])
1577 conv_32_rgb_ezx="yes"
1578 else
1579 conv_32_rgb_ezx="no"
1580 fi
1581 ], [
1582 if test "x$conv_32_rgb_ezx" = "xyes" ; then
1583 AC_DEFINE(BUILD_CONVERT_32_RGB_666, 1, [32bpp 666 (666 ezx) Converter Support])
1584 fi
1585 ]
1586)
1587AC_MSG_RESULT($conv_32_rgb_ezx)
1588
1589#######################################
1590## Convert to 32bpp RGB with rotation of 0
1591EVAS_CONVERT_ROT(32, RGB, 0)
1592## Convert to 32bpp RGB with rotation of 180
1593EVAS_CONVERT_ROT(32, RGB, 180)
1594## Convert to 32bpp RGB with rotation of 270
1595EVAS_CONVERT_ROT(32, RGB, 270)
1596## Convert to 32bpp RGB with rotation of 90
1597EVAS_CONVERT_ROT(32, RGB, 90)
1598
1599#######################################
1600## Convert to 8bpp grayscale with 256 value, no palette
1601EVAS_CONVERT_COLOR(8, GRY, 1)
1602## Convert to 8bpp grayscale with 16 value, no palette
1603EVAS_CONVERT_COLOR(8, GRY, 16)
1604
1605#######################################
1606## Convert to 8bpp grayscale, 64-palette
1607conv_8_grayscale_64="yes"
1608AC_MSG_CHECKING(whether to build 8bpp grayscale 64-palette converter code)
1609AC_ARG_ENABLE(convert-8-grayscale-64,
1610 AC_HELP_STRING([--disable-convert-8-grayscale-64], [disable 8bpp grayscale 64-palette converter code]),
1611 [
1612 if test "x$enableval" = "xyes"; then
1613 AC_DEFINE(BUILD_CONVERT_8_GRAYSCALE_64, 1, [8bpp Grayscale 64-palette Converter Support])
1614 conv_8_grayscale_64="yes"
1615 else
1616 conv_8_grayscale_64="no"
1617 fi
1618 ], [
1619 if test "x$conv_8_grayscale_64" = "xyes"; then
1620 AC_DEFINE(BUILD_CONVERT_8_GRAYSCALE_64, 1, [32bpp Grayscale 64-palette Converter Support])
1621 fi
1622 ]
1623)
1624AC_MSG_RESULT($conv_8_grayscale_64)
1625 1244
1626## valgrind 1245## valgrind
1627want_valgrind="no" 1246want_valgrind="no"
@@ -1717,7 +1336,6 @@ AC_SUBST(pthread_cflags)
1717AC_SUBST(pthread_libs) 1336AC_SUBST(pthread_libs)
1718AC_SUBST(requirement_evas) 1337AC_SUBST(requirement_evas)
1719 1338
1720
1721##################################################################### 1339#####################################################################
1722## Output 1340## Output
1723 1341
@@ -1762,7 +1380,6 @@ src/lib/canvas/Makefile
1762src/lib/file/Makefile 1380src/lib/file/Makefile
1763src/lib/cache/Makefile 1381src/lib/cache/Makefile
1764src/lib/cache2/Makefile 1382src/lib/cache2/Makefile
1765src/lib/cserve/Makefile
1766src/lib/cserve2/Makefile 1383src/lib/cserve2/Makefile
1767src/lib/engines/Makefile 1384src/lib/engines/Makefile
1768src/lib/engines/common/Makefile 1385src/lib/engines/common/Makefile
@@ -1793,7 +1410,6 @@ src/modules/engines/software_8_x11/Makefile
1793src/modules/engines/wayland_shm/Makefile 1410src/modules/engines/wayland_shm/Makefile
1794src/modules/engines/wayland_egl/Makefile 1411src/modules/engines/wayland_egl/Makefile
1795src/modules/loaders/Makefile 1412src/modules/loaders/Makefile
1796src/modules/loaders/edb/Makefile
1797src/modules/loaders/eet/Makefile 1413src/modules/loaders/eet/Makefile
1798src/modules/loaders/gif/Makefile 1414src/modules/loaders/gif/Makefile
1799src/modules/loaders/jpeg/Makefile 1415src/modules/loaders/jpeg/Makefile
@@ -1810,7 +1426,6 @@ src/modules/loaders/webp/Makefile
1810src/modules/loaders/psd/Makefile 1426src/modules/loaders/psd/Makefile
1811src/modules/loaders/generic/Makefile 1427src/modules/loaders/generic/Makefile
1812src/modules/savers/Makefile 1428src/modules/savers/Makefile
1813src/modules/savers/edb/Makefile
1814src/modules/savers/eet/Makefile 1429src/modules/savers/eet/Makefile
1815src/modules/savers/jpeg/Makefile 1430src/modules/savers/jpeg/Makefile
1816src/modules/savers/png/Makefile 1431src/modules/savers/png/Makefile
@@ -1825,25 +1440,6 @@ evas.spec
1825]) 1440])
1826 1441
1827##################################################################### 1442#####################################################################
1828## Sanity Checks
1829
1830if test "x$build_pthreads" = "xno" ; then
1831 if test "x$build_pipe_render" = "xyes" ; then
1832 echo "ERROR: PThreads off, but pipe rendering on. Pipe rendering"
1833 echo " needs thread support."
1834 exit 1
1835 fi
1836fi
1837
1838if test "x${has_pthreads}" = "xno" ; then
1839 if test "x$build_async_preload" = "xyes" ; then
1840 echo "ERROR: PThreads off, but Async Preload on. Async Preload"
1841 echo " needs thread support."
1842 exit 1
1843 fi
1844fi
1845
1846#####################################################################
1847## Info 1443## Info
1848 1444
1849echo 1445echo
@@ -1882,25 +1478,11 @@ echo " Wayland Shm................: $have_evas_engine_wayland_shm"
1882echo " Wayland Egl................: $have_evas_engine_wayland_egl" 1478echo " Wayland Egl................: $have_evas_engine_wayland_egl"
1883echo 1479echo
1884echo "Image Loaders:" 1480echo "Image Loaders:"
1885echo " BMP.....................: $have_evas_image_loader_bmp" 1481echo " JPEG region decode......: $have_jpeg_region"
1886echo " EDB.....................: $have_evas_image_loader_edb" 1482echo " WEBP....................: $have_evas_image_loader_webp"
1887echo " EET.....................: $have_evas_image_loader_eet"
1888echo " GENERIC.................: $have_evas_image_loader_generic"
1889echo " GIF.....................: $have_evas_image_loader_gif" 1483echo " GIF.....................: $have_evas_image_loader_gif"
1890echo " ICO.....................: $have_evas_image_loader_ico"
1891echo " JPEG....................: $have_evas_image_loader_jpeg (region: $have_jpeg_region)"
1892echo " PMAPS...................: $have_evas_image_loader_pmaps"
1893echo " PNG.....................: $have_evas_image_loader_png"
1894echo " PSD.....................: $have_evas_image_loader_psd"
1895echo " SVG.....................: $have_evas_image_loader_svg"
1896echo " TGA.....................: $have_evas_image_loader_tga"
1897echo " TIFF....................: $have_evas_image_loader_tiff" 1484echo " TIFF....................: $have_evas_image_loader_tiff"
1898echo " WBMP....................: $have_evas_image_loader_wbmp" 1485echo " SVG.....................: $have_evas_image_loader_svg"
1899echo " WEBP....................: $have_evas_image_loader_webp"
1900echo " XPM.....................: $have_evas_image_loader_xpm"
1901echo
1902echo "Font Sourcing Systems:"
1903echo " EET.....................: $have_evas_font_loader_eet"
1904echo 1486echo
1905echo "Font Searching Systems:" 1487echo "Font Searching Systems:"
1906echo " Fontconfig..............: $have_fontconfig" 1488echo " Fontconfig..............: $have_fontconfig"
@@ -1913,27 +1495,15 @@ echo " liblinebreak............: $have_linebreak"
1913# FIXME: make freetype2 optional 1495# FIXME: make freetype2 optional
1914echo 1496echo
1915echo "CPU Specific Extensions:" 1497echo "CPU Specific Extensions:"
1916echo " Fallback C Code.........: $build_cpu_c" 1498echo " MMX/SSE.................: $build_cpu_mmx"
1917echo " MMX.....................: $build_cpu_mmx"
1918echo " SSE.....................: $build_cpu_sse"
1919echo " SSE3....................: $build_cpu_sse3" 1499echo " SSE3....................: $build_cpu_sse3"
1920echo " ALTIVEC.................: $build_cpu_altivec" 1500echo " ALTIVEC.................: $build_cpu_altivec"
1921echo " NEON....................: $build_cpu_neon" 1501echo " NEON....................: $build_cpu_neon"
1922echo " Thread Support..........: $build_pthreads"
1923echo 1502echo
1924echo "Features:" 1503echo "Features:"
1925echo " MAGIC_DEBUG.............: $want_evas_magic_debug" 1504echo " MAGIC_DEBUG.............: $want_evas_magic_debug"
1926echo " Cache Server............: $want_evas_cserve"
1927echo " Cache Server 2..........: $want_evas_cserve2" 1505echo " Cache Server 2..........: $want_evas_cserve2"
1928echo
1929dnl
1930dnl ... DISABLED! some testing has shown that this seems to have some
1931dnl nasty bugs on both x86 and arm (tegra2 dual core tested), so just
1932dnl disabling this for now until it can be fixed
1933dnl
1934echo " Threaded Pipe Rendering.: $build_pipe_render" 1506echo " Threaded Pipe Rendering.: $build_pipe_render"
1935echo " Async Events............: $build_async_events"
1936echo " Async Image Preload.....: $build_async_preload"
1937echo 1507echo
1938echo " Pixman..................: $have_pixman" 1508echo " Pixman..................: $have_pixman"
1939echo " Pixman Fonts............: $have_pixman_font" 1509echo " Pixman Fonts............: $have_pixman_font"
@@ -1945,54 +1515,10 @@ echo " Pixman Image ScaleSample: $have_pixman_image_scale_sample"
1945echo 1515echo
1946echo " Tiled 32BPP rotate......: $have_tile_rotate" 1516echo " Tiled 32BPP rotate......: $have_tile_rotate"
1947echo 1517echo
1948echo "ARGB Software Engine Options:" 1518echo "Conversion Options:"
1949echo " Sampling Scaler.........: $scaler_sample"
1950echo " Smooth Scaler...........: $scaler_smooth"
1951# FIXME: add an mmx scaler routine
1952echo " YUV Converter...........: $conv_yuv"
1953# FIXME: add more YUV format and colorvariant support
1954echo
1955echo "ARGB Conversion Options:"
1956echo " Smaller Dither Mask.....: $conv_small_dither" 1519echo " Smaller Dither Mask.....: $conv_small_dither"
1957echo " Line Dither Mask........: $conv_line_dither" 1520echo " Line Dither Mask........: $conv_line_dither"
1958echo " No Dither Mask for 16bpp: $conv_no_dither" 1521echo " No Dither Mask for 16bpp: $conv_no_dither"
1959echo " 8bpp RGB 332............: $conv_8_rgb_332"
1960echo " 8bpp RGB 666............: $conv_8_rgb_666"
1961echo " 8bpp RGB 232............: $conv_8_rgb_232"
1962echo " 8bpp RGB 222............: $conv_8_rgb_222"
1963echo " 8bpp RGB 221............: $conv_8_rgb_221"
1964echo " 8bpp RGB 121............: $conv_8_rgb_121"
1965echo " 8bpp RGB 111............: $conv_8_rgb_111"
1966echo " 8bpp Grayscale (256)....: $conv_8_gry_1"
1967echo " 8bpp Grayscale (16).....: $conv_8_gry_16"
1968echo " 8bpp Grayscale 64-pal...: $conv_8_grayscale_64"
1969# FIXME: add grayscale and B&W support to standard x converters
1970echo " 16bpp RGB 565...........: $conv_16_rgb_565"
1971echo " 16bpp BGR 565...........: $conv_16_bgr_565"
1972echo " 16bpp RGB 555...........: $conv_16_rgb_555"
1973echo " 16bpp RGB 444...........: $conv_16_rgb_444"
1974echo " 16bpp RGB 565 (444 ipaq): $conv_16_rgb_ipq"
1975# FIXME: add 555 (444 ipaq) support
1976# FIXME: add 30bpp support
1977# FIXME: add palletted support (ugh!)
1978# FIXME: add 8bpp and below rotation
1979echo " 16bpp Rotation 0........: $conv_16_rgb_rot_0"
1980echo " 16bpp Rotation 90.......: $conv_16_rgb_rot_90"
1981echo " 16bpp Rotation 180......: $conv_16_rgb_rot_180"
1982echo " 16bpp Rotation 270......: $conv_16_rgb_rot_270"
1983echo " 24bpp RGB 888...........: $conv_24_rgb_888"
1984echo " 24bpp BGR 888...........: $conv_24_bgr_888"
1985echo " 24bpp RGB 666 (666 ezx).: $conv_24_rgb_ezx"
1986# FIXME: add 24bpp rotation
1987echo " 32bpp RGB 8888..........: $conv_32_rgb_8888"
1988echo " 32bpp RGBX 8888.........: $conv_32_rgbx_8888"
1989echo " 32bpp BGR 8888..........: $conv_32_bgr_8888"
1990echo " 32bpp BGRX 8888.........: $conv_32_bgrx_8888"
1991echo " 32bpp RGB 666 (666 ezx).: $conv_32_rgb_ezx"
1992echo " 32bpp Rotation 0........: $conv_32_rgb_rot_0"
1993echo " 32bpp Rotation 90.......: $conv_32_rgb_rot_90"
1994echo " 32bpp Rotation 180......: $conv_32_rgb_rot_180"
1995echo " 32bpp Rotation 270......: $conv_32_rgb_rot_270"
1996echo 1522echo
1997echo "Documentation.............: ${build_doc}" 1523echo "Documentation.............: ${build_doc}"
1998echo "Examples..................: install:${install_examples} build:${build_examples}" 1524echo "Examples..................: install:${install_examples} build:${build_examples}"
diff --git a/legacy/evas/m4/evas_check_loader.m4 b/legacy/evas/m4/evas_check_loader.m4
index f8d585d3b6..c4fd834412 100644
--- a/legacy/evas/m4/evas_check_loader.m4
+++ b/legacy/evas/m4/evas_check_loader.m4
@@ -1,61 +1,3 @@
1dnl use: EVAS_CHECK_LOADER_DEP_EDB(loader, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
2
3AC_DEFUN([EVAS_CHECK_LOADER_DEP_EDB],
4[
5
6requirement=""
7have_dep="no"
8evas_image_loader_[]$1[]_cflags=""
9evas_image_loader_[]$1[]_libs=""
10
11PKG_CHECK_MODULES([EDB], [edb], [have_dep="yes" requirement="edb"], [have_dep="no"])
12evas_image_loader_[]$1[]_cflags="${EDB_CFLAGS}"
13evas_image_loader_[]$1[]_libs="${EDB_LIBS}"
14
15AC_SUBST([evas_image_loader_$1_cflags])
16AC_SUBST([evas_image_loader_$1_libs])
17
18if test "x$2" = "xstatic" ; then
19 requirement_evas="${requirement} ${requirement_evas}"
20fi
21
22if test "x${have_dep}" = "xyes" ; then
23 m4_default([$3], [:])
24else
25 m4_default([$4], [:])
26fi
27
28])
29
30dnl use: EVAS_CHECK_LOADER_DEP_EET(loader, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
31
32AC_DEFUN([EVAS_CHECK_LOADER_DEP_EET],
33[
34
35requirement=""
36have_dep="no"
37evas_image_loader_[]$1[]_cflags=""
38evas_image_loader_[]$1[]_libs=""
39
40PKG_CHECK_MODULES([EET], [eet >= 1.6.0], [have_dep="yes" requirement="eet >= 1.4.0"], [have_dep="no"])
41evas_image_loader_[]$1[]_cflags="${EET_CFLAGS}"
42evas_image_loader_[]$1[]_libs="${EET_LIBS}"
43
44AC_SUBST([evas_image_loader_$1_cflags])
45AC_SUBST([evas_image_loader_$1_libs])
46
47if test "x$2" = "xstatic" ; then
48 requirement_evas="${requirement} ${requirement_evas}"
49fi
50
51if test "x${have_dep}" = "xyes" ; then
52 m4_default([$3], [:])
53else
54 m4_default([$4], [:])
55fi
56
57])
58
59dnl use: EVAS_CHECK_LOADER_DEP_GIF(loader, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) 1dnl use: EVAS_CHECK_LOADER_DEP_GIF(loader, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
60 2
61AC_DEFUN([EVAS_CHECK_LOADER_DEP_GIF], 3AC_DEFUN([EVAS_CHECK_LOADER_DEP_GIF],
@@ -98,130 +40,6 @@ fi
98 40
99]) 41])
100 42
101dnl use: EVAS_CHECK_LOADER_DEP_JPEG(loader, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
102
103AC_DEFUN([EVAS_CHECK_LOADER_DEP_JPEG],
104[
105
106have_dep="no"
107evas_image_loader_[]$1[]_cflags=""
108evas_image_loader_[]$1[]_libs=""
109
110AC_CHECK_HEADER([jpeglib.h], [have_dep="yes"])
111
112if test "x${have_dep}" = "xyes" ; then
113 AC_CHECK_LIB([jpeg],
114 [jpeg_CreateDecompress],
115 [
116 evas_image_loader_[]$1[]_libs="-ljpeg"
117 AC_COMPILE_IFELSE(
118 [AC_LANG_PROGRAM(
119 [[
120#include <stdio.h>
121#include <jpeglib.h>
122#include <setjmp.h>
123 ]],
124 [[
125struct jpeg_decompress_struct decomp;
126decomp.region_x = 0;
127 ]])],
128 [have_jpeg_region="yes"],
129 [have_jpeg_region="no"])
130 ],
131 [have_dep="no"]
132 )
133 if test "x${have_jpeg_region}" = "xyes" ; then
134 AC_DEFINE(BUILD_LOADER_JPEG_REGION, [1], [JPEG Region Decode Support])
135 fi
136fi
137
138AC_SUBST([evas_image_loader_$1_cflags])
139AC_SUBST([evas_image_loader_$1_libs])
140
141if test "x${have_dep}" = "xyes" ; then
142 m4_default([$3], [:])
143else
144 m4_default([$4], [:])
145fi
146
147])
148
149dnl use: EVAS_CHECK_LOADER_DEP_PMAPS(loader, want_static[[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
150
151AC_DEFUN([EVAS_CHECK_LOADER_DEP_PMAPS],
152[
153
154have_dep="yes"
155evas_image_loader_[]$1[]_cflags=""
156evas_image_loader_[]$1[]_libs=""
157
158AC_SUBST([evas_image_loader_$1_cflags])
159AC_SUBST([evas_image_loader_$1_libs])
160
161if test "x${have_dep}" = "xyes" ; then
162 m4_default([$3], [:])
163else
164 m4_default([$4], [:])
165fi
166
167])
168
169dnl use: EVAS_CHECK_LOADER_DEP_PNG(loader, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
170
171AC_DEFUN([EVAS_CHECK_LOADER_DEP_PNG],
172[
173
174requirement=""
175have_dep="no"
176evas_image_loader_[]$1[]_cflags=""
177evas_image_loader_[]$1[]_libs=""
178
179dnl libpng.pc is the latest version of libpng that ahs been installed.
180dnl We check it first.
181PKG_CHECK_MODULES([PNG],
182 [libpng >= 1.2.10],
183 [have_dep="yes" requirement="libpng"],
184 [have_dep="no"])
185
186if test "x${have_dep}" = "xno" ; then
187 PKG_CHECK_MODULES([PNG],
188 [libpng15],
189 [have_dep="yes" requirement="libpng15"],
190 [have_dep="no"])
191fi
192
193if test "x${have_dep}" = "xno" ; then
194 PKG_CHECK_MODULES([PNG],
195 [libpng14],
196 [have_dep="yes" requirement="libpng14"],
197 [have_dep="no"])
198fi
199
200if test "x${have_dep}" = "xno" ; then
201 PKG_CHECK_MODULES([PNG],
202 [libpng12 >= 1.2.10],
203 [have_dep="yes" requirement="libpng12"],
204 [have_dep="no"])
205fi
206
207evas_image_loader_[]$1[]_cflags="${PNG_CFLAGS}"
208evas_image_loader_[]$1[]_libs="${PNG_LIBS}"
209
210AC_SUBST([evas_image_loader_$1_cflags])
211AC_SUBST([evas_image_loader_$1_libs])
212
213if test "x$2" = "xstatic" ; then
214 requirement_evas="${requirement} ${requirement_evas}"
215fi
216
217if test "x${have_dep}" = "xyes" ; then
218 m4_default([$3], [:])
219else
220 m4_default([$4], [:])
221fi
222
223])
224
225dnl use: EVAS_CHECK_LOADER_DEP_SVG(loader, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) 43dnl use: EVAS_CHECK_LOADER_DEP_SVG(loader, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
226 44
227AC_DEFUN([EVAS_CHECK_LOADER_DEP_SVG], 45AC_DEFUN([EVAS_CHECK_LOADER_DEP_SVG],
@@ -311,126 +129,6 @@ fi
311 129
312]) 130])
313 131
314dnl use: EVAS_CHECK_LOADER_DEP_XPM(loader, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
315
316AC_DEFUN([EVAS_CHECK_LOADER_DEP_XPM],
317[
318
319have_dep="yes"
320evas_image_loader_[]$1[]_cflags=""
321evas_image_loader_[]$1[]_libs=""
322
323AC_SUBST([evas_image_loader_$1_cflags])
324AC_SUBST([evas_image_loader_$1_libs])
325
326if test "x${have_dep}" = "xyes" ; then
327 m4_default([$3], [:])
328else
329 m4_default([$4], [:])
330fi
331
332])
333
334dnl use: EVAS_CHECK_LOADER_DEP_BMP(loader, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
335
336AC_DEFUN([EVAS_CHECK_LOADER_DEP_BMP],
337[
338
339have_dep="yes"
340evas_image_loader_[]$1[]_cflags=""
341evas_image_loader_[]$1[]_libs=""
342
343AC_SUBST([evas_image_loader_$1_cflags])
344AC_SUBST([evas_image_loader_$1_libs])
345
346if test "x${have_dep}" = "xyes" ; then
347 m4_default([$3], [:])
348else
349 m4_default([$4], [:])
350fi
351
352])
353
354dnl use: EVAS_CHECK_LOADER_DEP_ICO(loader, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
355
356AC_DEFUN([EVAS_CHECK_LOADER_DEP_ICO],
357[
358
359have_dep="yes"
360evas_image_loader_[]$1[]_cflags=""
361evas_image_loader_[]$1[]_libs=""
362
363AC_SUBST([evas_image_loader_$1_cflags])
364AC_SUBST([evas_image_loader_$1_libs])
365
366if test "x${have_dep}" = "xyes" ; then
367 m4_default([$3], [:])
368else
369 m4_default([$4], [:])
370fi
371
372])
373
374dnl use: EVAS_CHECK_LOADER_DEP_TGA(loader, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
375
376AC_DEFUN([EVAS_CHECK_LOADER_DEP_TGA],
377[
378
379have_dep="yes"
380evas_image_loader_[]$1[]_cflags=""
381evas_image_loader_[]$1[]_libs=""
382
383AC_SUBST([evas_image_loader_$1_cflags])
384AC_SUBST([evas_image_loader_$1_libs])
385
386if test "x${have_dep}" = "xyes" ; then
387 m4_default([$3], [:])
388else
389 m4_default([$4], [:])
390fi
391
392])
393
394dnl use: EVAS_CHECK_LOADER_DEP_WBMP(loader, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
395
396AC_DEFUN([EVAS_CHECK_LOADER_DEP_WBMP],
397[
398
399have_dep="yes"
400evas_image_loader_[]$1[]_cflags=""
401evas_image_loader_[]$1[]_libs=""
402
403AC_SUBST([evas_image_loader_$1_cflags])
404AC_SUBST([evas_image_loader_$1_libs])
405
406if test "x${have_dep}" = "xyes" ; then
407 m4_default([$3], [:])
408else
409 m4_default([$4], [:])
410fi
411
412])
413
414dnl use: EVAS_CHECK_LOADER_DEP_PSD(loader, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
415
416AC_DEFUN([EVAS_CHECK_LOADER_DEP_PSD],
417[
418
419have_dep="yes"
420evas_image_loader_[]$1[]_cflags=""
421evas_image_loader_[]$1[]_libs=""
422
423AC_SUBST([evas_image_loader_$1_cflags])
424AC_SUBST([evas_image_loader_$1_libs])
425
426if test "x${have_dep}" = "xyes" ; then
427 m4_default([$3], [:])
428else
429 m4_default([$4], [:])
430fi
431
432])
433
434dnl use: EVAS_CHECK_LOADER_DEP_WEBP(loader, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) 132dnl use: EVAS_CHECK_LOADER_DEP_WEBP(loader, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
435 133
436AC_DEFUN([EVAS_CHECK_LOADER_DEP_WEBP], 134AC_DEFUN([EVAS_CHECK_LOADER_DEP_WEBP],
@@ -463,26 +161,6 @@ fi
463 161
464]) 162])
465 163
466dnl use: EVAS_CHECK_LOADER_DEP_GENERIC(loader, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
467
468AC_DEFUN([EVAS_CHECK_LOADER_DEP_GENERIC],
469[
470
471have_dep="yes"
472evas_image_loader_[]$1[]_cflags=""
473evas_image_loader_[]$1[]_libs=""
474
475AC_SUBST([evas_image_loader_$1_cflags])
476AC_SUBST([evas_image_loader_$1_libs])
477
478if test "x${have_dep}" = "xyes" ; then
479 m4_default([$3], [:])
480else
481 m4_default([$4], [:])
482fi
483
484])
485
486dnl use: EVAS_CHECK_IMAGE_LOADER(loader, want_loader, macro) 164dnl use: EVAS_CHECK_IMAGE_LOADER(loader, want_loader, macro)
487 165
488 166
@@ -552,42 +230,3 @@ m4_popdef([UP])
552m4_popdef([DOWN]) 230m4_popdef([DOWN])
553 231
554]) 232])
555
556dnl use: EVAS_CHECK_FONT_LOADER(want)
557
558
559AC_DEFUN([EVAS_CHECK_FONT_LOADER],
560[
561
562pushdef([UP], translit([$1], [a-z], [A-Z]))dnl
563pushdef([DOWN], translit([$1], [A-Z], [a-z]))dnl
564
565want_loader="$1"
566have_evas_font_loader_eet="no"
567
568AC_ARG_ENABLE([font-loader-eet],
569 [AC_HELP_STRING([--disable-font-loader-eet],
570 [disable EET font loader. [[default=enabled]]])],
571 [want_loader=${enableval}]
572)
573
574AC_MSG_CHECKING([whether to enable Eet font loader])
575AC_MSG_RESULT([${want_loader}])
576
577if test "x$want_loader" = "xyes" -o "x$want_loader" = "xauto"; then
578 PKG_CHECK_MODULES([EET], [eet >= 1.6.0], [have_evas_font_loader_eet="yes"], [have_evas_font_loader_eet="no"])
579fi
580
581if test "x${have_evas_font_loader_eet}" = "xno" -a "x$want_loader" = "xyes" -a "x$use_strict" = "xyes" ; then
582 AC_MSG_ERROR([Eet dependencies not found (strict dependencies checking)])
583fi
584
585if test "x$have_evas_font_loader_eet" = "xyes" ; then
586 AC_DEFINE([BUILD_FONT_LOADER_EET], [1], [EET Font Loader Support])
587 requirement_evas="eet >= 1.6.0 ${requirement_evas}"
588fi
589
590popdef([UP])
591popdef([DOWN])
592
593])
diff --git a/legacy/evas/m4/evas_converter.m4 b/legacy/evas/m4/evas_converter.m4
deleted file mode 100644
index 4a5a390caa..0000000000
--- a/legacy/evas/m4/evas_converter.m4
+++ /dev/null
@@ -1,83 +0,0 @@
1dnl use: EVAS_CONVERT_COLOR(bpp, colorspace, components[, default-enabled])
2AC_DEFUN([EVAS_CONVERT_COLOR],
3[
4pushdef([UP], translit([$1_$2_$3], [a-z], [A-Z]))dnl
5pushdef([DOWN_D], translit([$1-$2-$3], [A-Z], [a-z]))dnl
6pushdef([DOWN_U], translit([$1_$2_$3], [A-Z], [a-z]))dnl
7
8conv_[]DOWN_U="no"
9
10ifelse("x$4", "xno",
11[
12 AC_ARG_ENABLE(convert-[]DOWN_D,
13 AC_HELP_STRING(
14 [--enable-convert-[]DOWN_D],
15 [enable the $1bpp $2 $3 converter code]
16 ),
17 [ conv_[]DOWN_U=$enableval ],
18 [ conv_[]DOWN_U=no ]
19 )
20], [
21 AC_ARG_ENABLE(convert-[]DOWN_D,
22 AC_HELP_STRING(
23 [--disable-convert-[]DOWN_D],
24 [disable the $1bpp $2 $3 converter code]
25 ),
26 [ conv_[]DOWN_U=$enableval ],
27 [ conv_[]DOWN_U=yes ]
28 )
29])
30
31AC_MSG_CHECKING(whether to build $1bpp $2 $3 converter code)
32AC_MSG_RESULT($conv_[]DOWN_U)
33
34if test "x$conv_[]DOWN_U" = "xyes" ; then
35 AC_DEFINE(BUILD_CONVERT_[]UP, 1, [$1bpp $2 $3 Converter Support])
36fi
37
38popdef([UP])
39popdef([DOWN_D])
40popdef([DOWN_U])
41])
42
43dnl use: EVAS_CONVERT_ROT(bpp, colorspace, rot[, default-enabled])
44AC_DEFUN([EVAS_CONVERT_ROT],
45[
46pushdef([UP], translit([$1_$2_ROT$3], [a-z], [A-Z]))dnl
47pushdef([DOWN_D], translit([$1-$2-rot-$3], [A-Z], [a-z]))dnl
48pushdef([DOWN_U], translit([$1_$2_rot_$3], [A-Z], [a-z]))dnl
49
50conv_[]DOWN_U="no"
51
52ifelse("x$4", "xno",
53[
54 AC_ARG_ENABLE(convert-[]DOWN_D,
55 AC_HELP_STRING(
56 [--enable-convert-[]DOWN_D],
57 [enable the $1bpp $2 rotation $3 converter code]
58 ),
59 [ conv_[]DOWN_U=$enableval ],
60 [ conv_[]DOWN_U=no ]
61 )
62], [
63 AC_ARG_ENABLE(convert-[]DOWN_D,
64 AC_HELP_STRING(
65 [--disable-convert-[]DOWN_D],
66 [disable the $1bpp $2 rotation $3 converter code]
67 ),
68 [ conv_[]DOWN_U=$enableval ],
69 [ conv_[]DOWN_U=yes ]
70 )
71])
72
73AC_MSG_CHECKING(whether to build $1bpp $2 rotation $3 converter code)
74AC_MSG_RESULT($conv_[]DOWN_U)
75
76if test "x$conv_[]DOWN_U" = "xyes" ; then
77 AC_DEFINE(BUILD_CONVERT_[]UP, 1, [$1bpp $2 Rotation $3 Converter Support])
78fi
79
80popdef([UP])
81popdef([DOWN_D])
82popdef([DOWN_U])
83])
diff --git a/legacy/evas/m4/evas_scaler.m4 b/legacy/evas/m4/evas_scaler.m4
deleted file mode 100644
index c78dcc6e7d..0000000000
--- a/legacy/evas/m4/evas_scaler.m4
+++ /dev/null
@@ -1,44 +0,0 @@
1dnl Copyright (C) 2009 Vincent Torri <vtorri at univ-evry dot fr>
2dnl That code is public domain and can be freely used or copied.
3
4dnl Macro that enables scaler support is wanted.
5
6dnl Usage: EVAS_CHECK_SCALER(scaler, description [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
7dnl The parameter 'scaler' is the type of scaler.
8dnl The parameter 'description' is the description of the scaler.
9dnl Defines BUILD_[TYPEOFSCALER]
10
11AC_DEFUN([EVAS_CHECK_SCALER],
12[
13m4_pushdef([UP], m4_translit([$1], [-a-z], [_A-Z]))dnl
14m4_pushdef([DOWN], m4_translit([$1], [-A-Z], [_a-z]))dnl
15
16AC_ARG_ENABLE([$1],
17 AC_HELP_STRING([--disable-$1], [disable $2 code @<:@default=enabled@:>@]),
18 [
19 if test "x${enableval}" = "xyes" ; then
20 _efl_enable_scaler_option_[]DOWN="yes"
21 else
22 _efl_enable_scaler_option_[]DOWN="no"
23 fi
24 ],
25 [_efl_enable_scaler_option_[]DOWN="yes"])
26
27AC_MSG_CHECKING(whether to build $2)
28AC_MSG_RESULT([${_efl_enable_scaler_option_[]DOWN}])
29
30if test "x${_efl_enable_scaler_option_[]DOWN}" = "xyes" ; then
31 AC_DEFINE([BUILD_]UP[], [1], [define to 1 if you have the $2 support])
32fi
33
34if test "x${_efl_enable_scaler_option_[]DOWN}" = "xyes" ; then
35 m4_default([$3], [:])
36else
37 m4_default([$4], [:])
38fi
39
40m4_popdef([UP])
41m4_popdef([DOWN])
42])
43
44dnl End of evas_scaler.m4
diff --git a/legacy/evas/src/bin/Makefile.am b/legacy/evas/src/bin/Makefile.am
index 84028cee96..8f118811bc 100644
--- a/legacy/evas/src/bin/Makefile.am
+++ b/legacy/evas/src/bin/Makefile.am
@@ -1,45 +1,5 @@
1MAINTAINERCLEANFILES = Makefile.in 1MAINTAINERCLEANFILES = Makefile.in
2 2
3if EVAS_CSERVE
4
5AM_CPPFLAGS = \
6-I. \
7-I$(top_srcdir)/src/lib \
8-I$(top_srcdir)/src/lib/include \
9-I$(top_srcdir)/src/lib/cserve \
10-DPACKAGE_BIN_DIR=\"$(bindir)\" \
11-DPACKAGE_LIB_DIR=\"$(libdir)\" \
12-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
13@EVAS_GENERAL_CFLAGS@ \
14@FREETYPE_CFLAGS@ \
15@FRIBIDI_CFLAGS@ \
16@EET_CFLAGS@ \
17@FONTCONFIG_CFLAGS@ \
18@pthread_cflags@ \
19@PIXMAN_CFLAGS@
20
21bin_PROGRAMS = evas_cserve evas_cserve_tool
22
23evas_cserve_SOURCES = \
24evas_cserve_main.c
25
26evas_cserve_LDADD = \
27$(top_builddir)/src/lib/libevas.la \
28@pthread_libs@ \
29@EVAS_GENERAL_LIBS@
30
31evas_cserve_tool_LDFLAGS =
32
33evas_cserve_tool_SOURCES = \
34evas_cserve_tool.c
35
36evas_cserve_tool_LDADD = \
37$(top_builddir)/src/lib/libevas.la \
38@pthread_libs@ \
39@EVAS_GENERAL_LIBS@
40
41endif
42
43if EVAS_CSERVE2 3if EVAS_CSERVE2
44 4
45SUBDIRS = loaders 5SUBDIRS = loaders
diff --git a/legacy/evas/src/bin/evas_cserve_main.c b/legacy/evas/src/bin/evas_cserve_main.c
deleted file mode 100644
index 92718dae48..0000000000
--- a/legacy/evas/src/bin/evas_cserve_main.c
+++ /dev/null
@@ -1,1683 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <signal.h>
6#include <sys/time.h>
7#include <time.h>
8#ifdef _WIN32
9# include <windows.h>
10#endif
11
12#ifdef BUILD_PTHREAD
13#include <pthread.h>
14#endif
15
16#include "Evas.h"
17#include "evas_cs.h"
18
19#define D(...) EINA_LOG_DOM_DBG(_evas_cserve_bin_log_dom, __VA_ARGS__)
20#ifdef ERR
21#undef ERR
22#endif
23#define ERR(...) EINA_LOG_DOM_ERR(_evas_cserve_bin_log_dom, __VA_ARGS__)
24#ifdef DBG
25#undef DBG
26#endif
27#define DBG(...) EINA_LOG_DOM_DBG(_evas_cserve_bin_log_dom, __VA_ARGS__)
28#ifdef WRN
29#undef WRN
30#endif
31#define WRN(...) EINA_LOG_DOM_WARN(_evas_cserve_bin_log_dom, __VA_ARGS__)
32
33#ifdef CSERVE_BIN_DEFAULT_COLOR
34#undef CSERVE_BIN_DEFAULT_COLOR
35#endif
36#define CSERVE_BIN_DEFAULT_COLOR EINA_COLOR_BLUE
37// fixme:'s
38//
39// preload - make it work (both)
40
41//
42// pants!
43
44typedef struct _Img Img;
45typedef struct _Lopt Lopt;
46typedef struct _Load_Inf Load_Inf;
47
48struct _Lopt
49{
50 int scale_down_by; // if > 1 then use this
51 double dpi; // if > 0.0 use this
52 int w, h; // if > 0 use this
53 struct {
54 int x, y, w, h;
55 } region;
56};
57
58struct _Img
59{
60 Image_Entry ie;
61 int ref;
62 int dref;
63 int usage;
64 Mem *mem;
65 const char *key;
66 time_t cached;
67 struct {
68 const char *file;
69 const char *key;
70 time_t modtime;
71 time_t last_stat;
72 } file;
73 struct {
74 int load1saved, load2saved;
75 double load1, load2;
76 } stats;
77 Lopt load_opts;
78 struct {
79 int w, h;
80 void *data;
81 Eina_Bool alpha : 1;
82 } image;
83 int incache;
84 LK(lock);
85 Eina_Bool dead : 1;
86 Eina_Bool active : 1;
87 Eina_Bool useless : 1;
88 Eina_Bool killme : 1;
89};
90
91struct _Load_Inf
92{
93 Img *img;
94 Client *c;
95};
96
97// config
98static int stat_res_interval = 2;
99
100static time_t t_now = 0;
101
102static int server_id = 0;
103
104LK(strshr_freeme_lock);
105static int strshr_freeme_count = 0;
106static int strshr_freeme_alloc = 0;
107static const char **strshr_freeme = NULL;
108
109static int cache_cleanme = 0;
110static Evas_Cache_Image *cache = NULL;
111
112static Eina_Hash *active_images = NULL;
113LK(cache_lock);
114static Eina_List *cache_images = NULL;
115static int cache_usage = 0;
116static int cache_max_usage = 1 * 1024;
117static int cache_max_adjust = 0;
118static int cache_item_timeout = -1;
119static int cache_item_timeout_check = -1;
120static Mem *stat_mem = NULL;
121static int _evas_cserve_bin_log_dom = -1;
122static Eina_List *stat_mems = NULL;
123
124static void cache_clean(void);
125
126#ifndef _WIN32
127static double
128get_time(void)
129{
130 struct timeval timev;
131
132 gettimeofday(&timev, NULL);
133 return (double)timev.tv_sec + (((double)timev.tv_usec) / 1000000);
134}
135#else
136static double
137get_time(void)
138{
139 return (double)GetTickCount()/1000.0;
140}
141#endif
142
143static int mem_total = 0;
144static int mem_free = 0;
145static int mem_buffers = 0;
146static int mem_cached = 0;
147
148static void
149meminfo_check(void)
150{
151 FILE *f;
152 char buf[1024];
153 int v;
154
155 f = fopen("/proc/meminfo", "r");
156 if (!f) return;
157 if (!fgets(buf, sizeof(buf), f)) goto done;
158 v = 0; if (sscanf(buf, "%*s %i %*s", &v) != 1) goto done;
159 mem_total = v;
160 if (!fgets(buf, sizeof(buf), f)) goto done;
161 v = 0; if (sscanf(buf, "%*s %i %*s", &v) != 1) goto done;
162 mem_free = v;
163 if (!fgets(buf, sizeof(buf), f)) goto done;
164 v = 0; if (sscanf(buf, "%*s %i %*s", &v) != 1) goto done;
165 mem_buffers = v;
166 if (!fgets(buf, sizeof(buf), f)) goto done;
167 v = 0; if (sscanf(buf, "%*s %i %*s", &v) != 1) goto done;
168 mem_cached = v;
169 done:
170 fclose(f);
171}
172
173static int stats_dirty = 0;
174static int saved_loads = 0;
175static double saved_load_time = 0;
176static double saved_load_lifetime = 0;
177
178static int saved_loaddatas = 0;
179static double saved_loaddata_time = 0;
180static double saved_loaddata_lifetime = 0;
181
182static int saved_memory = 0;
183static int saved_memory_peak = 0;
184static int alloced_memory = 0;
185static int alloced_memory_peak = 0;
186static int real_memory = 0;
187static int real_memory_peak = 0;
188
189static Eina_Bool
190stats_hash_image_cb(const Eina_Hash *hash __UNUSED__,
191 const void *key __UNUSED__,
192 void *data, void *fdata __UNUSED__)
193{
194 Img *img = data;
195
196
197 saved_load_time += img->stats.load1 * img->stats.load1saved;
198 saved_loaddata_time += img->stats.load2 * img->stats.load2saved;
199 if (img->ref > 1)
200 saved_memory += img->image.w * img->image.h * sizeof(DATA32) * (img->ref - 1);
201 if (img->mem)
202 {
203 alloced_memory += img->image.w * img->image.h * sizeof(DATA32);
204 real_memory += (((img->image.w * img->image.h * sizeof(DATA32)) + 4095) >> 12) << 12;
205 }
206 return 1;
207}
208
209static void
210stats_calc(void)
211{
212 Img *img;
213 Eina_List *l;
214
215 if (!stats_dirty) return;
216 stats_dirty = 0;
217 saved_loads = 0;
218 saved_load_time = 0;
219 saved_loaddatas = 0;
220 saved_loaddata_time = 0;
221 saved_memory = 0;
222 alloced_memory = 0;
223 real_memory = 0;
224
225 if (active_images)
226 eina_hash_foreach(active_images, stats_hash_image_cb, NULL);
227 LKL(cache_lock);
228 EINA_LIST_FOREACH(cache_images, l, img)
229 {
230 saved_loads += img->stats.load1saved;
231 saved_load_time += img->stats.load1 * img->stats.load1saved;
232 saved_loaddatas += img->stats.load2saved;
233 saved_loaddata_time += img->stats.load2 * img->stats.load2saved;
234 if (img->mem)
235 {
236 alloced_memory += img->image.w * img->image.h * sizeof(DATA32);
237 real_memory += (((img->image.w * img->image.h * sizeof(DATA32)) + 4095) >> 12) << 12;
238 }
239 }
240 LKU(cache_lock);
241 if (saved_memory > saved_memory_peak)
242 saved_memory_peak = saved_memory;
243 if (real_memory > real_memory_peak)
244 real_memory_peak = real_memory;
245 if (alloced_memory > alloced_memory_peak)
246 alloced_memory_peak = alloced_memory;
247}
248
249static void
250stats_update(void)
251{
252 stats_dirty = 1;
253}
254
255static void
256stats_lifetime_update(Img *img)
257{
258 saved_load_lifetime += img->stats.load1 * img->stats.load1saved;
259 saved_loaddata_lifetime += img->stats.load2 * img->stats.load2saved;
260}
261
262static void
263stat_clean(Mem *m)
264{
265 int *ints;
266 int size, pid, *ids, count, i;
267
268 ints = (int *)m->data;
269 size = ints[0];
270 if (!evas_cserve_mem_resize(m, size)) return;
271 ints = (int *)m->data;
272 pid = ints[1];
273 count = (size - (2 * sizeof(int))) / sizeof(int);
274 ids = ints + 2;
275 for (i = 0; i < count; i++)
276 evas_cserve_mem_del(pid, ids[i]);
277}
278
279static int
280stat_init(Mem *m)
281{
282 int *ints;
283
284 ints = (int *)m->data;
285
286 if (!evas_cserve_mem_resize(m, 2 * sizeof(int))) return 0;
287 ints[0] = 2 * sizeof(int);
288 ints[1] = getpid();
289 msync(m->data, 2 * sizeof(int), MS_SYNC | MS_INVALIDATE);
290 return 1;
291}
292
293static int
294stat_update(Mem *m)
295{
296 Eina_List *l;
297 Mem *m2;
298 int *ints, *ids, i;
299
300 ints = (int *)m->data;
301 ints[0] = (2 * sizeof(int)) + (eina_list_count(stat_mems) * sizeof(int));
302 if (!evas_cserve_mem_resize(m, ints[0])) return 0;
303 ints = (int *)m->data;
304 ids = ints + 2;
305 i = 0;
306 EINA_LIST_FOREACH(stat_mems, l, m2)
307 {
308 ids[i] = m2->id;
309 i++;
310 }
311 msync(m->data, ints[0], MS_SYNC | MS_INVALIDATE);
312 return 1;
313}
314
315static Image_Entry *
316_img_alloc(void)
317{
318 Img *img;
319
320 img = calloc(1, sizeof(Img));
321 LKI(img->lock);
322 return (Image_Entry *)img;
323}
324
325static void
326_img_dealloc(Image_Entry *ie)
327{
328 Img *img = (Img *)ie;
329 LKD(img->lock);
330 free(img);
331}
332
333static int
334_img_surface_alloc(Image_Entry *ie, unsigned int w, unsigned int h)
335{
336 Img *img = (Img *)ie;
337
338 img->mem = evas_cserve_mem_new(w * h * sizeof(DATA32), NULL);
339 if (!img->mem) return -1;
340 img->image.data = img->mem->data + img->mem->offset;
341
342 stat_mems = eina_list_append(stat_mems, img->mem);
343 stat_update(stat_mem);
344 return 0;
345}
346
347static void
348_img_surface_delete(Image_Entry *ie)
349{
350 Img *img = (Img *)ie;
351
352 if (!img->mem) return;
353
354 stat_mems = eina_list_remove(stat_mems, img->mem);
355 stat_update(stat_mem);
356
357 evas_cserve_mem_free(img->mem);
358 img->mem = NULL;
359 img->image.data = NULL;
360}
361
362static DATA32 *
363_img_surface_pixels(Image_Entry *ie)
364{
365 Img *img = (Img *)ie;
366
367 return img->image.data;
368}
369
370static int
371_img_load(Image_Entry *ie)
372{
373 return evas_common_load_rgba_image_module_from_file(ie);
374}
375
376static void
377_img_unload(Image_Entry *ie __UNUSED__)
378{
379}
380
381static void
382_img_dirty_region(Image_Entry *ie __UNUSED__, unsigned int x __UNUSED__, unsigned int y __UNUSED__, unsigned int w __UNUSED__, unsigned int h __UNUSED__)
383{
384}
385
386static int
387_img_dirty(Image_Entry *dst __UNUSED__, const Image_Entry *src __UNUSED__)
388{
389 return 0;
390}
391
392static int
393_img_size_set(Image_Entry *dst __UNUSED__, const Image_Entry *src __UNUSED__, unsigned int w __UNUSED__, unsigned int h __UNUSED__)
394{
395 return 0;
396}
397
398static int
399_img_copied_data(Image_Entry *ie __UNUSED__, unsigned int w __UNUSED__, unsigned int h __UNUSED__, DATA32 *image_data __UNUSED__, int alpha __UNUSED__, int cspace __UNUSED__)
400{
401 return 0;
402}
403
404static int
405_img_data(Image_Entry *ie __UNUSED__, unsigned int w __UNUSED__, unsigned int h __UNUSED__, DATA32 *image_data __UNUSED__, int alpha __UNUSED__, int cspace __UNUSED__)
406{
407 return 0;
408}
409
410static int
411_img_color_space(Image_Entry *ie __UNUSED__, int cspace __UNUSED__)
412{
413 return 0;
414}
415
416static int
417_img_load_data(Image_Entry *ie)
418{
419 return evas_common_load_rgba_image_data_from_file(ie);
420}
421
422static int
423_img_mem_size_get(Image_Entry *ie __UNUSED__)
424{
425 return 1;
426}
427
428static void
429img_init(void)
430{
431 const Evas_Cache_Image_Func cache_funcs =
432 {
433 _img_alloc,//Image_Entry *(*alloc)(void);
434 _img_dealloc,//void (*dealloc)(Image_Entry *im);
435 /* The cache provide some helpers for surface manipulation. */
436 _img_surface_alloc,//int (*surface_alloc)(Image_Entry *im, unsigned int w, unsigned int h);
437 _img_surface_delete,//void (*surface_delete)(Image_Entry *im);
438 _img_surface_pixels,//DATA32 *(*surface_pixels)(Image_Entry *im);
439 /* The cache is doing the allocation and deallocation, you must just do the rest. */
440 _img_load,//int (*constructor)(Image_Entry *im);
441 _img_unload,//void (*destructor)(Image_Entry *im);
442 _img_dirty_region,//void (*dirty_region)(Image_Entry *im, unisnged int x, unisnged int y, unisnged int w, unsigned int h);
443 /* Only called when references > 0. Need to provide a fresh copie of im. */
444 /* The destination surface does have a surface, but no allocated pixel data. */
445 _img_dirty,//int (*dirty)(Image_Entry *dst, const Image_Entry *src);
446 /* Only called when references == 1. We will call drop on im'. */
447 /* The destination surface does not have any surface. */
448 _img_size_set,//int (*size_set)(Image_Entry *dst, const Image_Entry *src, unisnged int w, unisnged int h);
449 /* The destination surface does not have any surface. */
450 _img_copied_data,//int (*copied_data)(Image_Entry *dst, unisnged int w, unisnged int h, DATA32 *image_data, int alpha, int cspace);
451 /* The destination surface does not have any surface. */
452 _img_data,//int (*data)(Image_Entry *dst, unsigned int w, unisgned int h, DATA32 *image_data, int alpha, int cspace);
453 _img_color_space,//int (*color_space)(Image_Entry *dst, int cspace);
454 /* This function need to update im->w and im->h. */
455 _img_load_data,//int (*load)(Image_Entry *im);
456 _img_mem_size_get,//int (*mem_size_get)(Image_Entry *im);
457 NULL,//void (*debug)(const char *context, Image_Entry *im);
458 };
459
460 active_images = eina_hash_string_superfast_new(NULL);
461 cache = evas_cache_image_init(&cache_funcs);
462 LKI(cache_lock);
463 LKI(strshr_freeme_lock);
464}
465
466static void
467img_shutdown(void)
468{
469 evas_cache_image_shutdown(cache);
470 cache = NULL;
471 // FIXME: shutdown properly
472 LKD(strshr_freeme_lock);
473 LKI(cache_lock);
474}
475
476static Img *
477img_new(const char *file, const char *key, RGBA_Image_Loadopts *load_opts, const char *bufkey)
478{
479 Img *img;
480 struct stat st;
481 int ret;
482 Image_Entry *ie;
483 int err = 0;
484 double t;
485
486 DBG("... stat %s", file);
487 ret = stat(file, &st);
488 if (ret < 0) return NULL;
489 DBG("... load header");
490 t = get_time();
491 ie = evas_cache_image_request(cache, file, key, load_opts, &err);
492 t = get_time() - t;
493 DBG("... header done");
494 if (!ie) return NULL;
495 DBG("... ie->cache = %p", ie->cache);
496 img = (Img *)ie;
497 img->stats.load1 = t;
498 img->key = eina_stringshare_add(bufkey);
499 img->file.modtime = st.st_mtime;
500 img->file.last_stat = t_now;
501 img->file.file = eina_stringshare_add(file);
502 if (key) img->file.key = eina_stringshare_add(key);
503 img->load_opts.scale_down_by = load_opts->scale_down_by;
504 img->load_opts.dpi = load_opts->dpi;
505 img->load_opts.w = load_opts->w;
506 img->load_opts.h = load_opts->h;
507 img->image.w = ie->w;
508 img->image.h = ie->h;
509 img->image.alpha = ie->flags.alpha;
510 img->ref = 1;
511 img->active = 1;
512 img->usage = sizeof(Img) + strlen(img->key) + 1 +
513 strlen(img->file.file) + 1;
514 if (img->file.key) img->usage += strlen(img->file.key) + 1;
515 eina_hash_direct_add(active_images, img->key, img);
516 return img;
517}
518
519static void
520img_loaddata(Img *img)
521{
522 double t;
523
524 if (img->mem) return;
525 t = get_time();
526 LKL(cache_lock);
527 evas_cache_image_load_data((Image_Entry *)img);
528 t = get_time() - t;
529 img->stats.load2 = t;
530 if (img->image.data)
531 msync(img->image.data, img->image.w * img->image.h * sizeof(DATA32), MS_SYNC | MS_INVALIDATE);
532 if (!img->active) cache_usage -= img->usage;
533 img->usage +=
534 (4096 * (((img->image.w * img->image.h * sizeof(DATA32)) + 4095) / 4096)) +
535 sizeof(Mem);
536 if (!img->active) cache_usage += img->usage;
537 LKU(cache_lock);
538 cache_clean();
539}
540
541static void
542img_free(Img *img)
543{
544 if (img->incache > 0)
545 {
546 ERR("EEEEEEEEEEEEEEEEK!");
547 ERR("EEEEEEEEEEEEEEEEK! %p '%s' still in cache",
548 img, img->file.file);
549 ERR("EEEEEEEEEEEEEEEEK!");
550 return;
551 }
552 stats_lifetime_update(img);
553 stats_update();
554
555 LKL(strshr_freeme_lock);
556 strshr_freeme_count += 3;
557 if (strshr_freeme_count > strshr_freeme_alloc)
558 {
559 const char **tmp;
560
561 strshr_freeme_alloc += 32;
562 tmp = realloc(strshr_freeme, strshr_freeme_alloc * sizeof(const char **));
563 if (tmp) strshr_freeme = tmp;
564 else
565 {
566 ERR("realloc of strshr_freeme failed for %i items",
567 strshr_freeme_alloc);
568 strshr_freeme_alloc -= 32;
569 strshr_freeme_count -= 3;
570 return;
571 }
572 }
573 strshr_freeme[strshr_freeme_count - 3] = img->key;
574 strshr_freeme[strshr_freeme_count - 2] = img->file.file;
575 strshr_freeme[strshr_freeme_count - 1] = img->file.key;
576 LKU(strshr_freeme_lock);
577
578 evas_cache_image_drop((Image_Entry *)img);
579}
580
581static void
582cache_clean(void)
583{
584 DBG("... cache clean!!! do");
585 LKL(cache_lock);
586 while ((cache_usage > ((cache_max_usage + cache_max_adjust) * 1024)) &&
587 (cache_images))
588 {
589 Img *img;
590 Eina_List *l;
591
592 DBG("... clean loop %i > %i", cache_usage, (cache_max_usage + cache_max_adjust) * 1024);
593 l = eina_list_last(cache_images); // THREAD: called from thread. happens to be safe as it uses no unlocked shared resources
594 if (!l) break;
595 img = l->data;
596 if (!img) break;
597 LKL(img->lock);
598 DBG("... REMOVE %p '%s'", img, img->file.file);
599#ifdef BUILD_PTHREAD
600 img->killme = 1;
601 img->useless = 1;
602 img->dead = 1;
603 cache_cleanme++;
604 LKU(img->lock);
605#else
606 cache_images = eina_list_remove_list(cache_images, l); // FIXME: called from thread
607 img->incache--;
608 cache_usage -= img->usage;
609 DBG("... IMG FREE %p", img);
610 img_free(img);
611#endif
612 }
613 LKU(cache_lock);
614}
615
616static void
617cache_timeout(time_t t)
618{
619 Eina_List *l, *l_next;
620 Img *img;
621
622 if (cache_item_timeout < 0) return;
623 LKL(cache_lock);
624 EINA_LIST_FOREACH_SAFE(cache_images, l, l_next, img)
625 {
626 LKL(img->lock);
627 if ((t - img->cached) > cache_item_timeout)
628 {
629 cache_images = eina_list_remove_list(cache_images, l);
630 img->incache--;
631 cache_usage -= img->usage;
632 img_free(img);
633 }
634 else
635 LKU(img->lock);
636 }
637 LKU(cache_lock);
638}
639
640static void
641mem_cache_adjust(void)
642{
643 int pval = cache_max_adjust;
644 int max = 0;
645
646 if (mem_total <= 0) return;
647 //int mem_used = mem_total - mem_free - mem_cached - mem_buffers;
648#if 0 // this lets the image cache to grow to fill all real free ram, if
649 // there is any (ie ram unused by disk cache)
650 if (mem_free < mem_total)
651 {
652 cache_max_adjust = mem_free;
653 return;
654 }
655#endif
656
657 max = ((mem_free + mem_cached + mem_buffers) / 8) - cache_max_usage;
658 if (max < 0) max = 0;
659 if (max > cache_max_usage) max = cache_max_usage;
660 cache_max_adjust = max - cache_max_usage;
661
662 if (cache_max_adjust < -cache_max_usage)
663 cache_max_adjust = -cache_max_usage;
664 DBG("... cache_max_adjust = %i", cache_max_adjust);
665 if (pval != cache_max_adjust)
666 {
667 DBG("... cache clean");
668 // FIXME lock problem
669 cache_clean();
670 }
671}
672
673static void
674img_cache(Img *img)
675{
676 eina_hash_del(active_images, img->key, img);
677 if (img->dead)
678 {
679 DBG("... img %p '%s' dead", img , img->file.file);
680 img_free(img);
681 return;
682 }
683 if ((cache_usage + img->usage) > ((cache_max_usage + cache_max_adjust) * 1024))
684 {
685 DBG("... img %p '%s' too big for cache", img , img->file.file);
686 img_free(img);
687 return;
688 }
689 DBG("... img %p '%s' cached += %i", img , img->file.file, img->usage);
690 if (img->incache > 0)
691 {
692 ERR("EEEEEEEEEEEEEEEEK!");
693 ERR("EEEEEEEEEEEEEEEEK! %p '%s' already in cache",
694 img, img->file.file);
695 ERR("EEEEEEEEEEEEEEEEK!");
696 return;
697 }
698 LKL(cache_lock);
699 cache_images = eina_list_prepend(cache_images, img);
700 LKU(cache_lock);
701 img->incache++;
702 cache_usage += img->usage;
703 img->active = 0;
704 img->cached = t_now;
705 // FIXME: lock problem
706 if (cache_usage > ((cache_max_usage + cache_max_adjust) * 1024))
707 cache_clean();
708}
709
710static void
711img_dead(Img *img)
712{
713 if (img->active) return;
714 LKL(cache_lock);
715 cache_images = eina_list_remove(cache_images, img);
716 LKU(cache_lock);
717 img->incache--;
718 cache_usage -= img->usage;
719 img_free(img);
720}
721
722static Eina_Bool
723img_ok(Img *img)
724{
725 struct stat st;
726 int ret;
727
728 if (img->dead) return 0;
729 if ((t_now > img->file.last_stat) &&
730 ((t_now - img->file.last_stat) < stat_res_interval)) return 1;
731 img->file.last_stat = t_now;
732 ret = stat(img->file.file, &st);
733 img->file.last_stat = t_now;
734 if (ret < 0)
735 {
736 img->dead = 1;
737 img_dead(img);
738 return 0;
739 }
740 if (st.st_mtime != img->file.modtime)
741 {
742 img->dead = 1;
743 img_dead(img);
744 return 0;
745 }
746 return 1;
747}
748
749static Img *
750img_load(const char *file, const char *key, RGBA_Image_Loadopts *load_opts)
751{
752 Img *img;
753 char buf[8192];
754 Eina_List *l, *l_next;
755
756 if (!file) return NULL;
757 DBG("... img_load '%s'", file);
758 if (key) DBG("... ... key '%s'", key);
759 if (key)
760 snprintf(buf, sizeof(buf), "%s///::/%s/\001/%i/%1.8f/%ix%i",
761 file, key,
762 load_opts->scale_down_by,
763 load_opts->dpi,
764 load_opts->w, load_opts->h);
765 else
766 snprintf(buf, sizeof(buf), "%s///\001/%i/%1.8f/%ix%i",
767 file,
768 load_opts->scale_down_by,
769 load_opts->dpi,
770 load_opts->w, load_opts->h);
771 DBG("... find '%s'", buf);
772 img = eina_hash_find(active_images, buf);
773 if ((img) && (img_ok(img)))
774 {
775 DBG("... found!");
776 img->stats.load1saved++;
777 img->ref++;
778 DBG("... stats update");
779 stats_update();
780 DBG("... return %p", img);
781 return img;
782 }
783
784 // FIXME: keep hash of cached images too
785 LKL(cache_lock);
786 EINA_LIST_FOREACH_SAFE(cache_images, l, l_next, img)
787 {
788 if (!strcmp(img->key, buf))
789 {
790 LKL(img->lock);
791 if (img_ok(img))
792 {
793 DBG("... found cached");
794 cache_images = eina_list_remove_list(cache_images, l);
795 img->incache--;
796 cache_usage -= img->usage;
797 img->active = 1;
798 img->stats.load1saved++;
799 img->ref++;
800 eina_hash_direct_add(active_images, img->key, img);
801 DBG("... sats update");
802 stats_update();
803 DBG("... return %p", img);
804 LKU(img->lock);
805 LKU(cache_lock);
806 return img;
807 }
808 LKU(img->lock);
809 }
810 }
811 LKU(cache_lock);
812 DBG("... ned new img");
813 return img_new(file, key, load_opts, buf);
814}
815
816static void
817img_unload(Img *img)
818{
819 if (img->ref == 0)
820 {
821 ERR("EEEEEEEEEEEEEEEEK!");
822 ERR("EEEEEEEEEEEEEEEEK! %p '%s' already @ ref 0",
823 img, img->file.file);
824 ERR("EEEEEEEEEEEEEEEEK!");
825 return;
826 }
827 img->ref--;
828 DBG("... img ref-- = %i", img->ref);
829 if (img->ref == 0)
830 {
831 DBG("... img cache %p '%s'", img, img->file.file);
832 img_cache(img);
833 }
834}
835
836static void
837img_unloaddata(Img *img)
838{
839 DBG("img_unloaddata() %p '%s'", img, img->file.file);
840 if ((img->dref <= 0) && (img->useless) && (img->mem))
841 {
842 Image_Entry *ie = (Image_Entry *)img;
843
844 DBG("... really do forced unload");
845 if (!img->active) cache_usage -= img->usage;
846 img->usage -=
847 (4096 * (((img->image.w * img->image.h * sizeof(DATA32)) + 4095) / 4096)) +
848 sizeof(Mem);
849 if (!img->active) cache_usage += img->usage;
850 evas_cserve_mem_free(img->mem);
851 stat_mems = eina_list_remove(stat_mems, img->mem);
852 img->mem = NULL;
853 img->image.data = NULL;
854 img->dref = 0;
855 DBG("... done");
856
857 ie->flags.loaded = 0;
858 ie->allocated.w = 0;
859 ie->allocated.h = 0;
860 }
861}
862
863static void
864img_useless(Img *img)
865{
866 DBG("img_useless() %p", img);
867 img->useless = 1;
868 if (img->dref <= 0) img_unloaddata(img);
869}
870
871static void
872img_forcedunload(Img *img)
873{
874 DBG("img_forcedunload() %p", img);
875 img->dead = 1;
876 img_unload(img);
877}
878
879static void
880img_preload(Img *img)
881{
882 DBG("img_preload() %p", img);
883}
884
885static void
886client_del(void *data, Client *c)
887{
888 Eina_List *images;
889 Img *img;
890
891 images = data;
892 DBG("... CLIENT DEL %i", c->pid);
893 EINA_LIST_FREE(images, img)
894 {
895 DBG("... unloaddata img %p", img);
896 img_unloaddata(img);
897 DBG("... unload img %p", img);
898 img_unload(img);
899 }
900}
901
902static Eina_Bool
903getinfo_hash_image_cb(const Eina_Hash *hash __UNUSED__,
904 const void *key __UNUSED__,
905 void *data, void *fdata __UNUSED__)
906{
907 Img *img = data;
908 Eina_List **list = fdata;
909
910 *list = eina_list_append(*list, img);
911 return 1;
912}
913
914#ifdef BUILD_PTHREAD
915static void *
916load_data_thread(void *data)
917{
918 Load_Inf *li = data;
919 Img *img = li->img;
920 Client *c = li->c;
921 Op_Loaddata_Reply msg;
922
923 free(li);
924 LKL(img->lock);
925 if (img->mem)
926 {
927 memset(&msg, 0, sizeof(msg));
928 msg.mem.id = img->mem->id;
929 msg.mem.offset = img->mem->offset;
930 msg.mem.size = img->mem->size;
931 DBG("... reply");
932 evas_cserve_client_send(c, OP_LOADDATA, sizeof(msg), (unsigned char *)(&msg));
933 LKU(c->lock);
934 return NULL;
935 }
936 img_loaddata(img);
937 memset(&msg, 0, sizeof(msg));
938 if (img->mem)
939 {
940 msg.mem.id = img->mem->id;
941 msg.mem.offset = img->mem->offset;
942 msg.mem.size = img->mem->size;
943 }
944 else
945 msg.mem.id = msg.mem.offset = msg.mem.size = 0;
946 LKU(img->lock);
947 DBG("... reply");
948 evas_cserve_client_send(c, OP_LOADDATA, sizeof(msg), (unsigned char *)(&msg));
949 LKU(c->lock);
950 return NULL;
951}
952#endif
953
954static int
955message(void *fdata __UNUSED__, Server *s __UNUSED__, Client *c, int opcode, int size, unsigned char *data)
956{
957 // copy data into local aligned buffer... in case.
958 unsigned char *tdata = alloca(size + 16);
959 memcpy(tdata, data, size);
960
961 t_now = time(NULL);
962 DBG("message @ %i...", (int)t_now);
963 switch (opcode)
964 {
965 case OP_INIT:
966 {
967 Op_Init *rep;
968 Op_Init msg;
969
970 memset(&msg, 0, sizeof(msg));
971 msg.pid = getpid();
972 msg.server_id = server_id;
973 msg.handle = c;
974 rep = (Op_Init *)tdata;
975 c->pid = rep->pid;
976 if (rep->server_id == 1) // 2nd channel conn
977 {
978 c->client_main = rep->handle;
979 }
980 c->func = client_del;
981 c->data = NULL;
982 DBG("OP_INIT %i", c->pid);
983 DBG("... reply");
984 evas_cserve_client_send(c, OP_INIT, sizeof(msg), (unsigned char *)(&msg));
985 }
986 break;
987 case OP_LOAD:
988 {
989 Op_Load *rep;
990 Op_Load_Reply msg;
991 Img *img;
992 RGBA_Image_Loadopts lopt;
993 char *file = NULL, *key = NULL;
994
995 memset(&lopt, 0, sizeof lopt);
996 DBG("OP_LOAD %i", c->pid);
997 rep = (Op_Load *)tdata;
998 file = (char*) (data + sizeof(Op_Load));
999 key = file + strlen(file) + 1;
1000 if (key[0] == 0) key = NULL;
1001 lopt.scale_down_by = rep->lopt.scale_down_by;
1002 lopt.dpi = rep->lopt.dpi;
1003 lopt.w = rep->lopt.w;
1004 lopt.h = rep->lopt.h;
1005 lopt.region.x = rep->lopt.region.x;
1006 lopt.region.y = rep->lopt.region.y;
1007 lopt.region.w = rep->lopt.region.w;
1008 lopt.region.h = rep->lopt.region.h;
1009 DBG("... img_load '%s'", file);
1010 if (key) DBG("'%s'", (char *)key);
1011 else DBG(" '%s'", "");
1012 DBG(" lopt { %i %1.1f %i %i { %i %i %i %i}}",
1013 lopt.scale_down_by, lopt.dpi, lopt.w, lopt.h,
1014 lopt.region.x, lopt.region.y, lopt.region.w, lopt.region.h);
1015 img = img_load(file, key, &lopt);
1016 DBG("... img_load = %p", img);
1017 if (img)
1018 {
1019 DBG("... add image to client list");
1020 if (c->client_main)
1021 c->client_main->data = eina_list_append(c->client_main->data, img);
1022 else
1023 c->data = eina_list_append(c->data, img);
1024 }
1025 memset(&msg, 0, sizeof(msg));
1026 msg.handle = img;
1027 if ((img) && (img->mem))
1028 {
1029 msg.mem.id = img->mem->id;
1030 msg.mem.offset = img->mem->offset;
1031 msg.mem.size = img->mem->size;
1032 img->stats.load2saved++;
1033 stats_update();
1034 }
1035 else
1036 msg.mem.id = msg.mem.offset = msg.mem.size = 0;
1037 if (img)
1038 {
1039 msg.image.w = img->image.w;
1040 msg.image.h = img->image.h;
1041 msg.image.alpha = img->image.alpha;
1042 }
1043 DBG("... reply");
1044 evas_cserve_client_send(c, OP_LOAD, sizeof(msg), (unsigned char *)(&msg));
1045 }
1046 break;
1047 case OP_UNLOAD:
1048 {
1049 Op_Unload *rep;
1050 Img *img;
1051
1052 DBG("OP_UNLOAD %i", c->pid);
1053 rep = (Op_Unload *)tdata;
1054 img = rep->handle;
1055 if ((img) && (rep->server_id == server_id))
1056 {
1057 Eina_Bool doflush = 0;
1058
1059 DBG("... remove %p from list", img);
1060 if (c->client_main)
1061 c->client_main->data = eina_list_remove(c->client_main->data, img);
1062 else
1063 c->data = eina_list_remove(c->data, img);
1064 DBG("... unload %p", img);
1065 LKL(img->lock);
1066 img->ref++;
1067 img_unload(img);
1068 img->ref--;
1069 if (img->ref == 0) doflush = 1;
1070 LKU(img->lock);
1071 if (doflush)
1072 img_cache(img);
1073 cache_clean();
1074 }
1075 }
1076 break;
1077 case OP_LOADDATA:
1078 {
1079 Op_Loaddata *rep;
1080 Op_Loaddata_Reply msg;
1081 Img *img;
1082
1083 DBG("OP_LOADDATA %i", c->pid);
1084 rep = (Op_Loaddata *)tdata;
1085 img = rep->handle;
1086 if ((img) && (rep->server_id == server_id))
1087 {
1088 if (img->mem)
1089 {
1090 DBG("... load saved - cached %p", img);
1091 img->stats.load2saved++;
1092 stats_update();
1093 memset(&msg, 0, sizeof(msg));
1094 if (img->mem)
1095 {
1096 msg.mem.id = img->mem->id;
1097 msg.mem.offset = img->mem->offset;
1098 msg.mem.size = img->mem->size;
1099 }
1100 else
1101 msg.mem.id = msg.mem.offset = msg.mem.size = 0;
1102 DBG("... reply");
1103 evas_cserve_client_send(c, OP_LOADDATA, sizeof(msg), (unsigned char *)(&msg));
1104 }
1105 else
1106 {
1107#ifdef BUILD_PTHREAD
1108 pthread_t tid;
1109 pthread_attr_t attr;
1110 Load_Inf *li;
1111
1112 DBG("... load data %p", img);
1113 pthread_attr_init(&attr);
1114 li = calloc(1, sizeof(Load_Inf));
1115 if (li)
1116 {
1117 li->img= img;
1118 li->c = c;
1119 LKL(c->lock);
1120 if (pthread_create(&tid, &attr, load_data_thread, li))
1121 {
1122 perror("pthread_create()");
1123 }
1124 else
1125 pthread_detach(tid);
1126 }
1127 pthread_attr_destroy(&attr);
1128#else
1129 img_loaddata(img);
1130 memset(&msg, 0, sizeof(msg));
1131 if (img->mem)
1132 {
1133 msg.mem.id = img->mem->id;
1134 msg.mem.offset = img->mem->offset;
1135 msg.mem.size = img->mem->size;
1136 }
1137 else
1138 msg.mem.id = msg.mem.offset = msg.mem.size = 0;
1139 DBG("... reply");
1140 evas_cserve_client_send(c, OP_LOADDATA, sizeof(msg), (unsigned char *)(&msg));
1141#endif
1142 }
1143 }
1144 else
1145 {
1146 msg.mem.id = msg.mem.offset = msg.mem.size = 0;
1147 evas_cserve_client_send(c, OP_LOADDATA, sizeof(msg), (unsigned char *)(&msg));
1148 }
1149 }
1150 break;
1151 case OP_UNLOADDATA:
1152 {
1153 Op_Unloaddata *rep;
1154 Img *img;
1155
1156 DBG("OP_UNLOADDATA %i", c->pid);
1157 rep = (Op_Unloaddata *)tdata;
1158 img = rep->handle;
1159 if ((img) && (rep->server_id == server_id))
1160 {
1161 DBG("... dref--");
1162 LKL(img->lock);
1163 img->dref--;
1164 if (img->dref < 0) img->dref = 0;
1165 DBG("... unload data %p '%s'", img, img->file.file);
1166 img_unloaddata(img);
1167 LKU(img->lock);
1168 }
1169 }
1170 break;
1171 case OP_USELESSDATA:
1172 {
1173 Op_Unloaddata *rep;
1174 Img *img;
1175
1176 DBG("OP_USELESSDATA %i", c->pid);
1177 rep = (Op_Unloaddata *)tdata;
1178 img = rep->handle;
1179 if ((img) && (rep->server_id == server_id))
1180 {
1181 DBG("... dref--");
1182 LKL(img->lock);
1183 img->dref--;
1184 if (img->dref < 0) img->dref = 0;
1185 DBG("... useless %p", img);
1186 img_useless(img);
1187 LKU(img->lock);
1188 }
1189 }
1190 break;
1191 case OP_PRELOAD:
1192 {
1193 Op_Preload *rep;
1194 Img *img;
1195
1196 DBG("OP_PRELOAD %i", c->pid);
1197 rep = (Op_Preload *)tdata;
1198 img = rep->handle;
1199 if ((img) && (rep->server_id == server_id))
1200 {
1201 LKL(img->lock);
1202 if (c->client_main)
1203 c->client_main->data = eina_list_remove(c->client_main->data, img);
1204 else
1205 c->data = eina_list_remove(c->data, img);
1206 // FIXME: preload doesn't work async
1207 img_preload(img);
1208 LKU(img->lock);
1209 }
1210 }
1211 case OP_FORCEDUNLOAD:
1212 {
1213 Op_Forcedunload *rep;
1214 Img *img;
1215
1216 DBG("OP_FORCEDUNLOAD %i", c->pid);
1217 rep = (Op_Forcedunload *)tdata;
1218 img = rep->handle;
1219 if ((img) && (rep->server_id == server_id))
1220 {
1221 Eina_Bool doflush = 0;
1222
1223 LKL(img->lock);
1224 DBG("remove %p from list", img);
1225 if (c->client_main)
1226 c->client_main->data = eina_list_remove(c->client_main->data, img);
1227 else
1228 c->data = eina_list_remove(c->data, img);
1229 DBG("... forced unload now");
1230 img->ref++;
1231 img_forcedunload(img);
1232 img->ref--;
1233 if (img->ref == 0) doflush = 1;
1234 LKU(img->lock);
1235 if (doflush)
1236 img_cache(img);
1237 cache_clean();
1238 }
1239 }
1240 break;
1241 case OP_GETCONFIG:
1242 {
1243 Op_Getconfig_Reply msg;
1244
1245 DBG("OP_GETCONFIG %i", c->pid);
1246 msg.cache_max_usage = cache_max_usage;
1247 msg.cache_item_timeout = cache_item_timeout;
1248 msg.cache_item_timeout_check = cache_item_timeout_check;
1249 DBG("... reply");
1250 evas_cserve_client_send(c, OP_GETCONFIG, sizeof(msg), (unsigned char *)(&msg));
1251 }
1252 break;
1253 case OP_SETCONFIG:
1254 {
1255 Op_Setconfig *rep;
1256
1257 DBG("OP_SETCONFIG %i", c->pid);
1258 rep = (Op_Setconfig *)tdata;
1259 cache_max_usage = rep->cache_max_usage;
1260 cache_item_timeout = rep->cache_item_timeout;
1261 cache_item_timeout_check = rep->cache_item_timeout_check;
1262 DBG("... cache timeout");
1263 cache_timeout(t_now);
1264 DBG("... cache clean");
1265 cache_clean();
1266 }
1267 break;
1268 case OP_GETSTATS:
1269 {
1270 Op_Getstats_Reply msg;
1271
1272 DBG("OP_GETSTATS %i", c->pid);
1273 stats_calc();
1274 msg.saved_memory = saved_memory;
1275 msg.wasted_memory = (real_memory - alloced_memory);
1276 msg.saved_memory_peak = saved_memory_peak;
1277 msg.wasted_memory_peak = (real_memory_peak - alloced_memory_peak);
1278 msg.saved_time_image_header_load = saved_load_lifetime + saved_load_time;
1279 msg.saved_time_image_data_load = saved_loaddata_lifetime + saved_loaddata_time;
1280 DBG("... reply");
1281 evas_cserve_client_send(c, OP_GETSTATS, sizeof(msg), (unsigned char *)(&msg));
1282 }
1283 break;
1284 case OP_GETINFO:
1285 {
1286 Op_Getinfo_Reply *msg;
1287 int len;
1288 Eina_List *imgs = NULL, *l;
1289 Img *img;
1290
1291 DBG("OP_GETINFO %i", c->pid);
1292 len = sizeof(Op_Getinfo_Reply);
1293 DBG("... foreach");
1294 if (active_images)
1295 eina_hash_foreach(active_images, getinfo_hash_image_cb, &imgs);
1296 DBG("... walk foreach list output");
1297 LKL(cache_lock);
1298 EINA_LIST_FOREACH(cache_images, l, img)
1299 {
1300 imgs = eina_list_append(imgs, img);
1301 }
1302 LKU(cache_lock);
1303 DBG("... walk image cache");
1304 EINA_LIST_FOREACH(imgs, l, img)
1305 {
1306 len += sizeof(Op_Getinfo_Item);
1307 if (img->file.file) len += strlen(img->file.file);
1308 len++;
1309 if (img->file.key) len += strlen(img->file.key);
1310 len++;
1311 }
1312 DBG("... malloc msg");
1313 msg = calloc(1, len);
1314 if (msg)
1315 {
1316 unsigned char *p;
1317
1318 DBG("... init msg");
1319 p = (unsigned char *)msg;
1320 msg->active.mem_total = 0;
1321 msg->active.count = 0;
1322 msg->cached.mem_total = 0;
1323 msg->cached.count = 0;
1324 p += sizeof(Op_Getinfo_Reply);
1325 DBG("... walk all imgs");
1326 EINA_LIST_FOREACH(imgs, l, img)
1327 {
1328 Op_Getinfo_Item it;
1329
1330 LKL(img->lock);
1331 DBG("... img %p", img);
1332 memset(&it, 0, sizeof(Op_Getinfo_Item));
1333 it.file_key_size = 0;
1334 if (img->file.file)
1335 {
1336 strcpy((char *)p + sizeof(Op_Getinfo_Item) + it.file_key_size, img->file.file);
1337 it.file_key_size += strlen(img->file.file);
1338 }
1339 p[sizeof(Op_Getinfo_Item) + it.file_key_size] = 0;
1340 it.file_key_size += 1;
1341 if (img->file.key)
1342 {
1343 strcpy((char *)p + sizeof(Op_Getinfo_Item) + it.file_key_size, img->file.key);
1344 it.file_key_size += strlen(img->file.key);
1345 }
1346 p[sizeof(Op_Getinfo_Item) + it.file_key_size] = 0;
1347 it.file_key_size += 1;
1348
1349 it.w = img->image.w;
1350 it.h = img->image.h;
1351 it.file_mod_time = img->file.modtime;
1352 it.file_checked_time = img->file.last_stat;
1353 if (!img->active)
1354 it.cached_time = img->cached;
1355 else
1356 it.cached_time = 0;
1357 it.refcount = img->ref;
1358 it.data_refcount = img->dref;
1359 it.memory_footprint = img->usage;
1360 it.head_load_time = img->stats.load1;
1361 it.data_load_time = img->stats.load2;
1362 it.alpha = img->image.alpha;
1363 if (img->image.data)
1364 it.data_loaded = 1;
1365 else
1366 it.data_loaded = 0;
1367 it.active = img->active;
1368 if (it.active)
1369 {
1370 msg->active.count++;
1371 msg->active.mem_total += img->usage;
1372 }
1373 else
1374 {
1375 msg->cached.count++;
1376 msg->cached.mem_total += img->usage;
1377 }
1378 it.dead = img->dead;
1379 it.useless = img->useless;
1380 DBG("... memcpy %p %p %zu ",
1381 p, &it, sizeof(Op_Getinfo_Item));
1382 memcpy(p, &it, sizeof(Op_Getinfo_Item));
1383 DBG("... memcpy done %p", img);
1384 p += sizeof(Op_Getinfo_Item) + it.file_key_size;
1385 LKU(img->lock);
1386 }
1387 DBG("... walk all imgs done");
1388 msg->active.mem_total =
1389 (msg->active.mem_total + 1023) / 1024;
1390 msg->cached.mem_total =
1391 (msg->cached.mem_total + 1023) / 1024;
1392 DBG("... reply");
1393 evas_cserve_client_send(c, OP_GETINFO, len, (unsigned char *)msg);
1394 free(msg);
1395 }
1396 else
1397 {
1398 DBG("... reply empty");
1399 evas_cserve_client_send(c, OP_GETINFO, 0, NULL);
1400 }
1401 DBG("... free imgs list");
1402 if (imgs) eina_list_free(imgs);
1403 }
1404 break;
1405 default:
1406 DBG("OP_... UNKNOWN??? %i opcode: %i", c->pid, opcode);
1407 break;
1408 }
1409 return 0;
1410}
1411
1412static void
1413parse_args(int argc, char **argv)
1414{
1415 int i;
1416
1417 for (i = 1; i < argc; i++)
1418 {
1419 if ((!strcmp(argv[i], "-h")) ||
1420 (!strcmp(argv[i], "-help")) ||
1421 (!strcmp(argv[i], "--help")))
1422 {
1423 printf("Options:\n"
1424 "\t-h This help\n"
1425 "\t-csize Size of speculative cache (Kb)\n"
1426 "\t-ctime Maximum life of a cached image (seconds)\n"
1427 "\t-ctimecheck Time between checking the cache for timeouts (seconds)\n"
1428 "\t-debug Enable debug logging\n"
1429 "\n");
1430 exit(0);
1431 }
1432 else if ((!strcmp(argv[i], "-csize")) && (i < (argc - 1)))
1433 {
1434 i++;
1435 cache_max_usage = atoi(argv[i]);
1436 }
1437 else if ((!strcmp(argv[i], "-ctime")) && (i < (argc - 1)))
1438 {
1439 i++;
1440 cache_item_timeout = atoi(argv[i]);
1441 }
1442 else if ((!strcmp(argv[i], "-ctimecheck")) && (i < (argc - 1)))
1443 {
1444 i++;
1445 cache_item_timeout_check = atoi(argv[i]);
1446 }
1447 else if (!strcmp(argv[i], "-debug"))
1448 {
1449 eina_log_level_set(EINA_LOG_LEVEL_DBG);
1450 }
1451 }
1452}
1453
1454static int exit_flag = 0;
1455
1456static void
1457exit_handler(int x __UNUSED__, siginfo_t *info __UNUSED__, void *data __UNUSED__)
1458{
1459 exit_flag = 1;
1460}
1461
1462static void
1463pipe_handler(int x __UNUSED__, siginfo_t *info __UNUSED__, void *data __UNUSED__)
1464{
1465}
1466
1467static void
1468signal_init(void)
1469{
1470 struct sigaction action, old_action;
1471
1472 action.sa_handler = NULL;
1473 action.sa_sigaction = exit_handler;
1474 action.sa_flags = SA_RESTART | SA_SIGINFO;
1475 sigemptyset(&action.sa_mask);
1476 sigaction(SIGINT, &action, &old_action);
1477
1478 action.sa_handler = NULL;
1479 action.sa_sigaction = exit_handler;
1480 action.sa_flags = SA_RESTART | SA_SIGINFO;
1481 sigemptyset(&action.sa_mask);
1482 sigaction(SIGTERM, &action, &old_action);
1483
1484 action.sa_handler = NULL;
1485 action.sa_sigaction = exit_handler;
1486 action.sa_flags = SA_RESTART | SA_SIGINFO;
1487 sigemptyset(&action.sa_mask);
1488 sigaction(SIGQUIT, &action, &old_action);
1489
1490 action.sa_handler = NULL;
1491 action.sa_sigaction = pipe_handler;
1492 action.sa_flags = SA_RESTART | SA_SIGINFO;
1493 sigemptyset(&action.sa_mask);
1494 sigaction(SIGPIPE, &action, &old_action);
1495
1496 // SIGUSR1
1497 // SIGUSR2
1498 // SIGHUP
1499
1500 // SIGCHLD
1501
1502 // SIGSEGV
1503 // SIGILL
1504 // SIGBUS
1505 // SIGFPE
1506 // SIGABRT
1507}
1508
1509static void
1510signal_shutdown(void)
1511{
1512}
1513
1514int
1515main(int argc, char **argv)
1516{
1517 Server *s;
1518 time_t last_check, t, t_next;
1519 pid_t pid;
1520
1521 t = time(NULL);
1522 pid = getpid();
1523 t ^= (pid << 24) | (pid << 16) | (pid << 8) | (pid);
1524 srand(t);
1525 server_id = rand();
1526
1527 parse_args(argc, argv);
1528
1529 unsetenv("EVAS_CSERVE");
1530
1531 eina_init();
1532 _evas_cserve_bin_log_dom = eina_log_domain_register
1533 ("evas_cserve_bin", CSERVE_BIN_DEFAULT_COLOR);
1534 if (_evas_cserve_bin_log_dom < 0)
1535 {
1536 EINA_LOG_ERR("impossible to create a log domain.");
1537 eina_shutdown();
1538 exit(1);
1539 }
1540
1541 DBG("evas init...");
1542 evas_init();
1543 DBG("img init...");
1544 img_init();
1545 DBG("signal init...");
1546 signal_init();
1547 DBG("cserve add...");
1548 s = evas_cserve_server_add();
1549 if (!s)
1550 {
1551 ERR("ERROR: server socket init fail. abort.");
1552 goto error;
1553 }
1554 DBG("mem open (status)...");
1555 stat_mem = evas_cserve_mem_open(0, 0, "status", sizeof(int), 0);
1556 if (stat_mem)
1557 {
1558 WRN("WARNING: previous evas_cserve left garbage. cleaning up.");
1559 stat_clean(stat_mem);
1560 evas_cserve_mem_close(stat_mem);
1561 stat_mem = NULL;
1562 }
1563 DBG("mem new (status)...");
1564 stat_mem = evas_cserve_mem_new(sizeof(int), "status");
1565 if (!stat_mem)
1566 {
1567 ERR("ERROR: cannot create status shmseg. abort.");
1568 goto error;
1569 }
1570 DBG("init status...");
1571 if (!stat_init(stat_mem))
1572 {
1573 ERR("cannot init status shmseg. abort.");
1574 evas_cserve_mem_free(stat_mem);
1575 stat_mem = NULL;
1576 goto error;
1577 }
1578
1579 DBG("cset server message handler...");
1580 evas_cserve_server_message_handler_set(s, message, NULL);
1581 last_check = time(NULL);
1582 t_next = 0;
1583 if (cache_item_timeout_check > 0) t_next = cache_item_timeout_check;
1584 DBG("LOOP!!! ...");
1585 for (;;)
1586 {
1587 /* fixme: timeout 0 only her - future use timeouts for timed
1588 * housekeping */
1589 if (exit_flag) break;
1590 DBG("wait for messages...");
1591 evas_cserve_server_wait(s, t_next * 1000000);
1592 if (exit_flag) break;
1593 t = time(NULL);
1594 t_next = t - last_check;
1595 if ((cache_item_timeout_check > 0) &&
1596 ((t_next) >= cache_item_timeout_check))
1597 {
1598 DBG("check timeout of items...");
1599 t_next = cache_item_timeout_check;
1600
1601 last_check = t;
1602 DBG("cache timeout...");
1603 cache_timeout(t);
1604 DBG("meminfo check...");
1605 meminfo_check();
1606 DBG("mem cache adjust...");
1607 mem_cache_adjust();
1608 }
1609 if ((t_next <= 0) && (cache_item_timeout_check > 0))
1610 t_next = 1;
1611 DBG("sleep for %isec...", (int)t_next);
1612
1613 LKL(strshr_freeme_lock);
1614 if (strshr_freeme_count > 0)
1615 {
1616 int i;
1617
1618 for (i = 0; i < strshr_freeme_count; i++)
1619 eina_stringshare_del(strshr_freeme[i]);
1620 strshr_freeme_count = 0;
1621 }
1622 LKU(strshr_freeme_lock);
1623
1624 LKL(cache_lock);
1625 if (cache_cleanme)
1626 {
1627 Eina_List *l;
1628 Img *img;
1629 Eina_List *kills = NULL;
1630
1631 EINA_LIST_FOREACH(cache_images, l, img)
1632 {
1633 LKL(img->lock);
1634 if (img->killme)
1635 kills = eina_list_append(kills, img);
1636 LKU(img->lock);
1637 }
1638 while (kills)
1639 {
1640 img = kills->data;
1641 kills = eina_list_remove_list(kills, kills);
1642 LKL(img->lock);
1643 cache_images = eina_list_remove(cache_images, img);
1644 img->incache--;
1645 cache_usage -= img->usage;
1646 DBG("... IMG FREE %p", img);
1647 img_free(img);
1648 }
1649 cache_cleanme = 0;
1650 }
1651 LKU(cache_lock);
1652 }
1653 DBG("end loop...");
1654 error:
1655 DBG("cleanup...");
1656 if (stat_mem)
1657 {
1658 DBG("clean mem stat...");
1659 stat_clean(stat_mem);
1660 }
1661 DBG("signal shutdown...");
1662 signal_shutdown();
1663 DBG("img shutdown...");
1664 img_shutdown();
1665 if (stat_mem)
1666 {
1667 DBG("free stat mem...");
1668 evas_cserve_mem_free(stat_mem);
1669 stat_mem = NULL;
1670 }
1671 if (s)
1672 {
1673 DBG("del server...");
1674 evas_cserve_server_del(s);
1675 }
1676 DBG("evas shutdown...");
1677 evas_shutdown();
1678 eina_log_domain_unregister(_evas_cserve_bin_log_dom);
1679 DBG("eina shutdown...");
1680 eina_shutdown();
1681 DBG("exit..");
1682 return 0;
1683}
diff --git a/legacy/evas/src/bin/evas_cserve_tool.c b/legacy/evas/src/bin/evas_cserve_tool.c
deleted file mode 100644
index acaa703446..0000000000
--- a/legacy/evas/src/bin/evas_cserve_tool.c
+++ /dev/null
@@ -1,160 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include "evas_cs.h"
6
7int _cserve_tool_log_dom = -1;
8
9int
10main(int argc, char **argv)
11{
12 int i;
13
14 evas_init();
15 if (!evas_cserve_init())
16 {
17 printf("ERROR: Cannot connect to cserve. abort\n");
18 exit(-1);
19 }
20
21 for (i = 1; i < argc; i++)
22 {
23 if ((!strcmp(argv[i], "-h")) ||
24 (!strcmp(argv[i], "-help")) ||
25 (!strcmp(argv[i], "--help")))
26 {
27 printf("Options:\n"
28 "\t-h This help\n"
29 "\tgetconfig Get configuration values\n"
30 "\tsetconfig CSIZE CTIME CTIMECHECK Set the config values\n"
31 "\tgetstats Get current cache statistics\n"
32 "\tgetinfo Get current cache content info\n"
33 );
34 exit(0);
35 }
36 else if ((!strcmp(argv[i], "getconfig")))
37 {
38 Op_Getconfig_Reply config;
39
40 if (!evas_cserve_raw_config_get(&config))
41 {
42 printf("ERROR: cannot fetch config.\n");
43 exit(-1);
44 }
45 printf("-REPLY-\n");
46 printf("csize: %i\n", config.cache_max_usage);
47 printf("ctime: %i\n", config.cache_item_timeout);
48 printf("ctimecheck: %i\n", config.cache_item_timeout_check);
49 printf("-OK-\n");
50 }
51 else if ((!strcmp(argv[i], "setconfig")) && (i < (argc - 3)))
52 {
53 Op_Setconfig config;
54
55 i++;
56 config.cache_max_usage = atoi(argv[i]);
57 i++;
58 config.cache_item_timeout = atoi(argv[i]);
59 i++;
60 config.cache_item_timeout_check = atoi(argv[i]);
61 if (!evas_cserve_raw_config_set(&config))
62 {
63 printf("ERROR: cannot set config.\n");
64 exit(-1);
65 }
66 }
67 else if ((!strcmp(argv[i], "getstats")))
68 {
69 Op_Getstats_Reply stats;
70
71 if (!evas_cserve_raw_stats_get(&stats))
72 {
73 printf("ERROR: cannot fetch stats.\n");
74 exit(-1);
75 }
76 printf("-REPLY-\n");
77 printf("saved_memory: %i Kb\n", stats.saved_memory / 1024);
78 printf("wasted_memory: %i Kb\n", stats.wasted_memory / 1024);
79 printf("saved_memory_peak: %i Kb\n", stats.saved_memory_peak / 1024);
80 printf("wasted_memory_peak: %i Kb\n", stats.wasted_memory_peak / 1024);
81 printf("saved_time_image_header_load: %1.3f sec\n", stats.saved_time_image_header_load);
82 printf("saved_time_image_data_load: %1.3f sec\n", stats.saved_time_image_data_load);
83 printf("-OK-\n");
84 }
85 else if ((!strcmp(argv[i], "getinfo")))
86 {
87 Op_Getinfo_Reply *info;
88 unsigned char *p;
89 int h, j;
90
91 info = evas_cserve_raw_info_get();
92 if (!info)
93 {
94 printf("ERROR: cannot fetch info.\n");
95 exit(-1);
96 }
97 j = info->active.count + info->cached.count;
98 printf("-REPLY-\n");
99 printf("active_count: %i\n", info->active.count);
100 printf("active_memory: %i Kb\n", info->active.mem_total);
101 printf("cache_count: %i\n", info->cached.count);
102 printf("cache_memory: %i Kb\n", info->cached.mem_total);
103 p = (unsigned char *)info;
104 p += sizeof(Op_Getinfo_Reply);
105 for (h = 0; h < j; h++)
106 {
107 Op_Getinfo_Item it;
108 char *file, *key, buf[512];
109 struct tm *ltm;
110
111 memcpy(&it, p, sizeof(Op_Getinfo_Item));
112 file = (char*) (p + sizeof(Op_Getinfo_Item));
113 key = file + strlen(file) + 1;
114 printf("-IMAGE- [#%i]\n", h);
115 printf(" file : %s\n", file);
116 printf(" key : %s\n", key);
117 printf(" size : %i x %i\n", it.w, it.h);
118 printf(" active : %i\n", (int)it.active);
119 printf(" memory used: %i bytes (%i Kb)\n", it.memory_footprint, (it.memory_footprint + 1023) / 1024);
120 printf(" has alpha : %i\n", (int)it.alpha);
121 printf(" data loaded: %i\n", (int)it.data_loaded);
122 printf(" dead : %i\n", (int)it.dead);
123 printf(" useless : %i\n", (int)it.useless);
124 printf(" image refs : %i\n", it.refcount);
125 printf(" data refs : %i\n", it.data_refcount);
126 printf(" header load: %1.5f sec\n", it.head_load_time);
127 printf(" data load : %1.5f sec\n", it.data_load_time);
128 if (it.cached_time == 0)
129 printf(" cached at : N/A\n");
130 else
131 {
132 ltm = localtime(&(it.cached_time));
133 if (ltm)
134 {
135 strftime(buf, sizeof(buf), "%Y.%m.%d %T", ltm);
136 printf(" cached at : %s\n", buf);
137 }
138 }
139 ltm = localtime(&(it.file_mod_time));
140 if (ltm)
141 {
142 strftime(buf, sizeof(buf), "%Y.%m.%d %T", ltm);
143 printf(" file mod at: %s\n", buf);
144 }
145 ltm = localtime(&(it.file_checked_time));
146 if (ltm)
147 {
148 strftime(buf, sizeof(buf), "%Y.%m.%d %T", ltm);
149 printf(" file check : %s\n", buf);
150 }
151 p += sizeof(Op_Getinfo_Item) + it.file_key_size;
152 }
153 free(info);
154 printf("-OK-\n");
155 }
156 }
157 evas_cserve_shutdown();
158 evas_shutdown();
159 return 0;
160}
diff --git a/legacy/evas/src/lib/Makefile.am b/legacy/evas/src/lib/Makefile.am
index fe44f3dcb0..59f1942579 100644
--- a/legacy/evas/src/lib/Makefile.am
+++ b/legacy/evas/src/lib/Makefile.am
@@ -1,6 +1,6 @@
1MAINTAINERCLEANFILES = Makefile.in 1MAINTAINERCLEANFILES = Makefile.in
2 2
3SUBDIRS = canvas cache cache2 cserve cserve2 file engines include 3SUBDIRS = canvas cache cache2 cserve2 file engines include
4EVAS_STATIC_MODULE = 4EVAS_STATIC_MODULE =
5EVAS_STATIC_LIBADD = 5EVAS_STATIC_LIBADD =
6 6
@@ -82,11 +82,6 @@ SUBDIRS += ../modules/loaders/bmp
82EVAS_STATIC_MODULE += ../modules/loaders/bmp/libevas_loader_bmp.la 82EVAS_STATIC_MODULE += ../modules/loaders/bmp/libevas_loader_bmp.la
83EVAS_STATIC_LIBADD += @evas_image_loader_bmp_libs@ 83EVAS_STATIC_LIBADD += @evas_image_loader_bmp_libs@
84endif 84endif
85if EVAS_STATIC_BUILD_EDB
86SUBDIRS += ../modules/savers/edb ../modules/loaders/edb
87EVAS_STATIC_MODULE += ../modules/savers/edb/libevas_saver_edb.la ../modules/loaders/edb/libevas_loader_edb.la
88EVAS_STATIC_LIBADD += @evas_image_loader_edb_libs@
89endif
90if EVAS_STATIC_BUILD_EET 85if EVAS_STATIC_BUILD_EET
91SUBDIRS += ../modules/savers/eet ../modules/loaders/eet 86SUBDIRS += ../modules/savers/eet ../modules/loaders/eet
92EVAS_STATIC_MODULE += ../modules/savers/eet/libevas_saver_eet.la ../modules/loaders/eet/libevas_loader_eet.la 87EVAS_STATIC_MODULE += ../modules/savers/eet/libevas_saver_eet.la ../modules/loaders/eet/libevas_loader_eet.la
@@ -181,23 +176,14 @@ includesdir = $(includedir)/evas-@VMAJ@
181 176
182libevas_la_SOURCES = main.c 177libevas_la_SOURCES = main.c
183 178
184if EVAS_CSERVE
185
186libevas_cserve_la = cserve/libevas_cserve.la
187
188endif
189
190if EVAS_CSERVE2 179if EVAS_CSERVE2
191
192libevas_cserve2_la = cserve2/libevas_cserve2.la 180libevas_cserve2_la = cserve2/libevas_cserve2.la
193
194endif 181endif
195 182
196libevas_la_LIBADD = \ 183libevas_la_LIBADD = \
197canvas/libevas_canvas.la \ 184canvas/libevas_canvas.la \
198file/libevas_file.la \ 185file/libevas_file.la \
199cache/libevas_cache.la \ 186cache/libevas_cache.la \
200$(libevas_cserve_la) \
201$(libevas_cserve2_la) \ 187$(libevas_cserve2_la) \
202engines/common/libevas_engine_common.la \ 188engines/common/libevas_engine_common.la \
203@FREETYPE_LIBS@ \ 189@FREETYPE_LIBS@ \
@@ -217,26 +203,20 @@ libevas_la_DEPENDENCIES = \
217canvas/libevas_canvas.la \ 203canvas/libevas_canvas.la \
218file/libevas_file.la \ 204file/libevas_file.la \
219cache/libevas_cache.la \ 205cache/libevas_cache.la \
220$(libevas_cserve_la) \
221$(libevas_cserve2_la) \ 206$(libevas_cserve2_la) \
222engines/common/libevas_engine_common.la \ 207engines/common/libevas_engine_common.la \
223$(EVAS_STATIC_MODULE) 208$(EVAS_STATIC_MODULE)
224 209
225if EVAS_CSERVE2 210if EVAS_CSERVE2
226
227libevas_la_LIBADD += \ 211libevas_la_LIBADD += \
228cache2/libevas_cache2.la 212cache2/libevas_cache2.la
229
230libevas_la_DEPENDENCIES += \ 213libevas_la_DEPENDENCIES += \
231cache2/libevas_cache2.la 214cache2/libevas_cache2.la
232
233endif 215endif