Commit Graph

43 Commits

Author SHA1 Message Date
Jean-Philippe Andre 1e82480c9a evas/cserve2: Use scalecache with cserve2
Let's reuse the logic from scalecache and call cserve2
functions when the scalecache should be used.
So, now, cserve2 server will not scale any image... This is
too computationally intensive for the server's main thread.

This is not optimal but makes a hell of a lot more sense for
the moment. (since cserve2 manages the SHM segments)
2013-10-28 15:47:15 +09:00
Jean-Philippe Andre 0d506a7b73 evas/cserve2: Fix images indexing (File_Entry stuff)
High-level problem:
cserve2 does not support load_opts properly when opening an image.
As a result, when (pre)loading a JPEG file with specific load
options (eg. w, h, region and orientation), the image buffer might
have the wrong dimensions.

So, we need to use load_opts when computing file hash key.
And, pass these load options to the loader slave,
and use them while OPENING the image. This will set
properly the geometry.

Fixes test "Preload and Prescale" in elementary_test.
2013-10-28 15:47:15 +09:00
Jean-Philippe Andre 85cd382725 evas/cserve2: Drop pre-emptive load of large images
When the image is too large, let's not preload it unless
specifically requested by the application.

Value 320x320 is completely arbitrary.
2013-10-28 15:47:15 +09:00
Jean-Philippe Andre 97d9fab704 evas/cserve2: Fallback to normal cache for animated gifs
Pass around "animated" flag for images that can be animated.
Fallback to local cache if the image is animated.
Implementing support for animated images in cserve2 does
not seem to make a lot of sense considering each frame must
be requested independently in real time,... and to be honest
there doesn't seem to be any valid use case anyway :)
2013-10-28 15:47:15 +09:00
Jean-Philippe Andre 808c20f989 evas/cserve2: Fix font hinting
cserve2 was not handling font hints properly in the server side
Add some consistency checks and separate glyphs per hinting value
2013-10-28 15:47:15 +09:00
Jean-Philippe Andre 877532e000 evas/cserve2: Repack strings index when too fragmented 2013-10-28 15:47:14 +09:00
Jean-Philippe Andre 74d399ab81 evas/cserve2: Fix NULL vs. empty string
Server side: Some strings were NULL, some other were empty.
Client side was looking for NULL, but the shared index contained
empty key.
2013-10-28 15:47:14 +09:00
Jean-Philippe Andre 3f30fae818 evas/cserve2: Remap indexes when count is wrong
When advertised count is wrong, try to remap the index.
This will avoid errors with string_get().
2013-10-28 15:47:14 +09:00
Jean-Philippe Andre 9d2400af8b evas/cserve2: Add valid flag on Image_Data and File_Data
Images and Files can be discovered by the client scanner before they
are valid (aka. loaded or opened). We want clients to ignore all
shared objects that are not ready yet, as they are in an undefined
state (values and memory might be invalid).
2013-10-28 15:47:14 +09:00
Jean-Philippe Andre bc7b337fc0 evas/cserve2: Add glyph shm names to Font_Data 2013-10-28 15:47:14 +09:00
Jean-Philippe Andre 4f5c48236f evas/cserve2: Add proper tags to shm arrays
Use tags such as INDX, FONT, IMAG, FILE.
These can help debugging and for robustness, as they will
be visible in the memory dump.

Update generation_id after repack as well
2013-10-28 15:47:14 +09:00
Jean-Philippe Andre 1e4ee656a0 evas/cserve2: Fix cserve2_usage tool
Also, print shared arrays usage as it is sent as first message
upon connection to the server.

Add fonts to LRU and flush LRU as needed.
Seems to work okay. Could probably be finetuned a bit.
2013-10-28 15:47:14 +09:00
Jean-Philippe Andre 467b1b1739 evas/cserve2: Store Glyph_Data in shared mempools
- Create one Glyph_Data array per Font_Entry
- Copy Font_Source descriptors in shared array
- Copy font entries in shared index
- Send font index path over socket
- Merge Font_Source and Font_Data in shared memory
- Send font index path on client connect
- Repack font index after free
- Pass font shm name to clients
2013-10-28 15:47:14 +09:00
Jean-Philippe Andre 7ebda2d123 evas/cserve2: Store glyphs in shared arrays
Also, change the internal structure of glyph listing:
 - Use lists instead of inlists

Switch to use Glyph_Data instead of Glyph_Entry
2013-10-28 15:47:14 +09:00
Jean-Philippe Andre 28a5c6f587 evas/cserve2: Add compile-time log level flag for cserve2
DBG and INF messages pollute the logs and performance reports
from valgrind, let's disable them at build-time for better
benchmarking.

Fix other compilation warnings and clean code a bit
2013-10-28 15:47:13 +09:00
Jean-Philippe Andre 9d731364c1 evas/cserve2: Optimize cserve2_shared_string_del()
eina_hash_del_by_data is very expensive, so let's delete by key
since we can get the original data.
2013-10-28 15:47:13 +09:00
Jean-Philippe Andre 88ef4131a0 evas/cserve2: Share paths of index tables with clients
- Send paths to all connected clients
- Send paths upon connection from a new client

- Client side:
 - Fast find opened images
 - Fast find loaded images
 - Optimize load by skipping socket wait

Also, remap indexes when needed (file size changed)
When index file grows, the clients are not notified, so they
must constantly check that their mapping matches the current array
size.
2013-10-28 15:47:13 +09:00
Jean-Philippe Andre 47be3a2b81 evas/cserve2: Prepare shared indexes in clients
- Move required struct definitions to common evas_cs2.h

- Open/close shm and map arrays to memory
Pretty stupid for now as it will close & reopen the shm files
even when unchanged.

- Check shm size and array header consistency

- Implement message send

- Send messages from server when calling repack()
2013-10-28 15:47:13 +09:00
Jean-Philippe Andre db66f69104 evas/cserve2: _cserve2_cache_fast_scaling_check()
Adapt function to new Data/Entry model.
2013-10-28 15:47:13 +09:00
Jean-Philippe Andre ee74562bf0 evas/cserve2: Simplify error logs 2013-10-28 15:47:13 +09:00
Jean-Philippe Andre 64e7d48296 evas/cserve2: Store Image_Data in shared array
Split image entries into Image_Data and Image_Entry.
Store, find and use Image_Data descriptors from shared array.
Fix some wrong hash table usages.
2013-10-28 15:47:13 +09:00
Jean-Philippe Andre d0e647fee3 evas/cserve2: Repack File_Data shared array 2013-10-28 15:47:13 +09:00
Jean-Philippe Andre acae35b4d1 evas/cserve2: Use Shared_Array storage for File_Data
File_Entry and File_Data are now two different types,
one being stored in the shared array, the other one
is only a reference counting entry.
2013-10-28 15:47:13 +09:00
Jean-Philippe Andre c57a319df3 evas/cserve2: Rename File_Data pointers to fd
The name fe is also used by Font_Entry, slightly confusing
2013-10-28 15:47:13 +09:00
Jean-Philippe Andre 12deed8073 evas/cserve2: Use unique id counter
Merge file id and image id into a single entry id.
2013-10-28 15:47:12 +09:00
Jean-Philippe Andre 781c2e26e5 evas/cserve2: Prepare usage of shared strings
+ Add macros to fake usage of future cserve2 strings functions
+ Rename all File_Entry to fe
+ Other costmetic changes
2013-10-28 15:47:12 +09:00
Carsten Haitzler 4c970812f2 fix clang nonnull complaint 2013-07-16 17:16:20 +09:00
Jean-Philippe Andre ee037d3586 evas/cserve2: Add infix to shm filenames
Minor change
So, we can distinguish between image, font and index shm files.
2013-07-08 17:16:04 +09:00
Jean-Philippe Andre c6db8ba782 evas/cserve2: Implement fast(er) scaling of images
In its current model, cserve2 will reopen, reload and scale an
image whenever a new scaled version is requested by the client.

Instead, we can load the original image when too many scaled
versions are requested, and place the original in the LRU.
2013-07-08 16:06:08 +09:00
Jean-Philippe Andre 09a5c28e5b evas/cserve2: no cache for large images or non-smooth
The concept is taken from scalecache. I am not sure of the
performance impact.
2013-07-04 13:02:48 +09:00
Jean-Philippe Andre 7c7c231015 evas/cserve2: simplify more
Remove Image_Load_Opts and use Evas_Image_Load_Opts for cs2 master to
slave communication.
2 things to note:
- The struct size is bigger (but at the same time we removed a memcpy)
- The scale_load field is not passed to the slave
2013-07-04 13:02:48 +09:00
Jean-Philippe Andre 46b7baa379 evas/cserve2: merge SETOPTS into OPEN
When opening an image, OPEN and SETOPTS were always sent
consecutively. Merging these two messages may improve the
performance a bit (not measured), but also simplify the
whole thing.

Note: cserve2 debug tools have not been fixed yet.
2013-07-04 13:02:48 +09:00
Jean-Philippe Andre ca5d174568 evas/cserve2: use Evas_Image_Load_Opts directly
Image_Data contained a similar struct to the standard Evas struct,
let's not duplicate it uselessly.
2013-07-04 13:02:48 +09:00
Jean-Philippe Andre 29bf164c75 evas/cserve2: pass loader data during open.
Note: this path seems never to be used.
Loader options are set by the file loader or after open.

Signed-off-by: Cedric Bail <cedric.bail@samsung.com>
2013-07-02 16:58:10 +09:00
Jean-Philippe Andre f7c6545170 evas/cserve2: minor fixes (error paths).
Signed-off-by: Cedric Bail <cedric.bail@samsung.com>
2013-07-02 16:58:10 +09:00
Jean-Philippe Andre d712a13a7a evas/cserve2: use null-terminated strings everywhere.
Some hashtable lookups failed because the keys were added
either with eina_stringshare_add() or e_s_add_lenth() but
looked for with e_s_add_length() only.

Signed-off-by: Cedric Bail <cedric.bail@samsung.com>
2013-07-02 16:58:09 +09:00
Jean-Philippe Andre 681c8cda4c evas/cserve2: (shutdown) fix double free issue
glibc double free happens when shutting down cserve, while
requests are being processed. this is because the entry is
being deleted from the hash but the cancel request fails
(so it should be deleted again from the hash)

Another patch going to fix the double free.
2013-06-14 16:38:18 +09:00
Jean-Philippe Andre 5d7689d627 evas/cserve2: fix crash in server side when sending SIGINT.
Signed-off-by: Cedric Bail <cedric.bail@samsung.com>
2013-06-04 20:21:16 +09:00
Paulo Alcantara fb97c82882 efl/cserve2: Fix some bugs regarding fonts
Signed-off-by: Paulo Alcantara <pcacjr@profusion.mobi>


SVN revision: 81582
2012-12-21 21:11:23 +00:00
Paulo Alcantara da061849b0 efl/cserve2: Fix invalid iteration over client references
The _request_failed() function is called by error responses from slaves,
and iterating over references of a entry and removing each of them must
be done with EINA_LIST_FOREACH_SAFE(), since _entry_free_cb() calls
_entry_reference_del() which then removes the reference that is used in
the next iteration in for-loop from _request_failed().

Signed-off-by: Paulo Alcantara <pcacjr@profusion.mobi>


SVN revision: 81580
2012-12-21 21:09:45 +00:00
Paulo Alcantara 633e29c5a5 evas/cserve2: Re-enable speculative load
I've tested it and I can confirm that it's working fine with the new
scalecache support on Cserve2. So, let's use it again.

Signed-off-by: Paulo Alcantara <pcacjr@profusion.mobi>

Patch by: Paulo Alcantara <pcacjr@profusion.mobi>



SVN revision: 80177
2012-12-04 15:40:00 +00:00
Paulo Alcantara f8f79f8599 evas/cserve2: Add scalecache support
Signed-off-by: Paulo Alcantara <pcacjr@profusion.mobi>

Patch by: Paulo Alcantara <pcacjr@profusion.mobi>



SVN revision: 79754
2012-11-27 18:23:25 +00:00
Vincent Torri c15e9c6575 merge: and now Evas
I've tested make -j 3 install and it works nicely

I've tested expedite with software and opengl xlib,
and it works. Not tested other engines, so please
report any problems (engines or other) on the ML.

TODO: examples and tests, I'll add them later

ISSUE: Eina_Unicode size check. It indirectly depends on
       eina_config.h, which is created at the end of the
       configure script. So its size is always 0. I don't
       know how that size is used, so I can't do a lot,
       for now.


SVN revision: 78895
2012-11-04 11:51:42 +00:00