Commit Graph

79 Commits

Author SHA1 Message Date
Bryce Harrington 27920d31c1 Spelling fixes
Summary:
emmited  ==> emitted
resistence  ==> resistance
occured  ==> occurred

Reviewers: cedric, zmike, devilhorns

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D2192
2015-03-18 21:38:33 -04:00
Stefan Schmidt 68ba2f6791 cserve2: Check retrun of fcntl and print a message if we fail.
CID 1039707
2014-09-11 12:33:21 +02:00
Stefan Schmidt 7e2d60a63c evas/cserve2: Check return value of fcntl
Print an error when not able to set non-blocking but continue.

CID 1039707
2014-09-04 11:28:33 +02:00
Carsten Haitzler caf2b018a2 fix possible focket fd of -1 in cserve
this fixes CID 1193207 where a server fd may be -1, connect fail and
still be -1 due to failed connect.
2014-08-14 17:18:57 +09:00
Jean-Philippe Andre 320a9f18c5 Evas cserve2: Fix client crashes when a file changed
Clients must ignore changed file entries as they are not valid
anymore. The server will also mark the entry as invalid in case
of file update.

@fix
2014-03-18 13:49:05 +09:00
Jean-Philippe Andre 752fde1025 Evas cserve2: Fix excessive warnings during shutdown
The global index for fonts will be freed after cserve2 shutdown
but Evas keeps trying to free all its fonts after that.
2014-03-04 14:59:27 +09:00
Jean-Philippe Andre 34b8045d90 Evas cserve2: Fix invalid memory access
In case of load error, we free the file entry, but forgot to
reset the pointer to it in the image entry.
2014-01-17 19:00:54 +09:00
Jean-Philippe Andre e465e7d58a Evas/cserve2: Stop looking at those dirty pics!
What I mean is erm... images marked as dirty don't have a
cache_key, and that's perfectly fine when the image file
has changed.
2014-01-14 14:23:05 +09:00
Jean-Philippe Andre 06b53dd09b Evas/cserve2: Keep image_id when reopening a changed file
If a file had changed, a new OPEN message was sent, and the
client image ID was then changed, but the LOAD message was
sent with the previous image ID. So cserve2 would not be
able to honor that request.
2014-01-14 14:23:05 +09:00
Jean-Philippe Andre 1d99c82381 Evas/cserve2: Improve error messages a bit 2014-01-14 14:23:04 +09:00
Carsten Haitzler 86a97efeea evas - fonts - move to using 4bit and rel 4 bit compressed font glyphs
this changes the internal encoding of font glyphs in evas to use 4bit
uncompressed if small, or 4bit rle (run length encoded) if larger.
this caves at least 50% of memory on fonts - and more if bigger. with
large fonts (40-80pixel size) we can save in the region of 80% of
memory used for glyphs. this also happesn to allow speedups in
rendering too.
2014-01-13 05:15:32 +09:00
Jean-Philippe Andre b84787bf57 Evas/cserve2: Fix valgrind warning about uninitialized memory
In cserve2, a shortcut was taken to check if two images were the
same, using memcmp() on the Evas_Image_Load_Opts struct. But it
seems some empty areas in the struct are uninitialized, potentially
making memcmp() fail when the images were actually the same.

This is a minor issue since this function is called only when
bypassing the socket wait.

Also, memset load_opts to 0 and copy all the fields to avoid
the same warning in socket send().

I'm just wondering about the performance impact vs. memcpy/memcmp.
2014-01-09 17:35:35 +09:00
Carsten Haitzler e8c13118eb fix mingw build for setuid fix/checks 2014-01-08 22:06:41 +09:00
Carsten Haitzler b95ef3801f setuid safeness - ensure if an app that is setuid doesn't do bad things
this makes efl ignore certain env vars for thnigs and entirely removes
user modules (that no one ever used) etc. etc. to ensure that *IF* an
app is setuid, there isn't a priv escalation path that is easy.
2014-01-08 19:46:23 +09:00
Jean-Philippe Andre 5f601cd753 Evas: Fix some clang warnings in evas_cs2_client.c
- Invalid alloc size (typo)
- Initialized value never read (set twice)
- Potential memleak (call free(msg) in case of send error)
- Null pointer dereference (check nullity)

There are still other warnings, but I believe these are false
positives.
2014-01-07 15:51:56 +09:00
Daniel Juyung Seo 76d8532b54 efl: Unified eina critical manro to CRI.
Being annoyed by different types of eina critical macros - CRI, CRIT,
 CRITICAL -, I concluded to unify them to one. Discussed on IRC and
 finally, CRI was chosen to meet the consistency with other macros -
 ERR, WRN, INF, DBG - in terms of the number of characters.
If there is any missing bits, please let me know.
2013-12-26 12:27:13 +09:00
Jean-Philippe Andre b10dcb5c23 Evas/cserve2: Fix crash during shutdown
If an image failed to load, and cserve2 returned an error message,
then the File_Entry was freed, but not removed from the hash.
Solution: remove entry from the hash, let the callback free the data.
2013-12-09 17:48:32 +09:00
Jean-Philippe Andre 62093d99d4 evas/cserve2: Fix interrupt on select in edje_cc
Summary:
Block SIGCHLD during select().
This fixes a bug with edje_cc when EVAS_CSERVE2=1: Fixes T464.

select() used to return prematurately with EINTR because the
app received some unexpected signals. In particular SIGCHLD
is received when a child terminates, but this is not a reason
to cancel the image load.

In theory, all blocked signals in pselect() should be pending
until pselect returns, so any SIGCHLD should still trigger
the app's signal handler.

Reviewers: cedric

CC: raster, cedric

Maniphest Tasks: T464

Differential Revision: https://phab.enlightenment.org/D357
2013-11-29 15:47:57 +09:00
Jean-Philippe Andre 44f89bb8ad evas/cserve2: Fix CID 1039286 (Resource leak)
Close socket in case of connection failure.
2013-10-29 15:08:19 +09:00
Jean-Philippe Andre 10f80df018 evas/cserve2: Fix new Coverity issues
Nothing extraordinary here.
Most potential crashes are extremely unlikely.

- Fix CID 1113444

- Fix CID 1113442

- Fix CID 1113441 (Logically dead code, can not be NULL)

- Fix CID 1113440: Explicit null dereferenced

This is actually an impossible situation.
Fixed by checking for nullity and printing out some error
messages instead of just crashing.

- Fix CID 1113439: Dereference after null check

Logically impossible code as both idxpath and datapath
must be either set or null at the same time.
Change the if logic to tell Coverity there's no bug.

- Fix CID 1113438 (Argument cannot be negative)

Fix wrong check of return value from shm_open.

- Fix CID 1113437 (Argument cannot be negative)

Fix wrong check of return value from shm_open.

- Fix CID 1113436 (Dereference null return value)

This case really shouldn't happen.
But the extra check does not hurt.

- Fix CID 1113435 (Dereference before null check)

Check for nullity after map open.

- Fix CID 1113434 (Extra sizeof expression)

Debug buggy debug tool :)

- Fix CID 1113433 (Uninitialized scalar variable)

Insignificant issue: only prints wrong debug logs :)

- Fix CID 1113431 (Uninitialized scalar value)

Check if (!found) only to print out logs. Not a big deal
if found was invalid.

- Fix CID 1039462 (Logically dead code)
2013-10-29 15:08:14 +09:00
Jean-Philippe Andre 1513007815 evas/cserve2: Merge Glyph_Data and mempool index
Glyphs were previously using 3 shared buffers, now reduce to 2:
- Memory pool (mempool) containing the glyph drawable data
- Index table (Shared_Index / array) containing only the
  indexes of the buffers in the mempool
- Glyph_Data table (array) containing the glyphs descriptors
  AS WELL as the buffer indexes.

So, we just merge the two index tables into one by using directly
objects of type Glyph_Data for the referencing of the mempool
buffers.
2013-10-28 15:47:16 +09:00
Jean-Philippe Andre 7b62d77cf5 evas/cserve2: Add debug and reduce number of GLYPHS_USED messages
One socket message was sent per each glyph used ... which means
a LOT of messages when text is being redrawn.

Reduce this flow of messages by triggering send() only when
50+ items are being used.
Btw, USED is a bit useless as there is no UNUSED equivalent.

Also, slightly improve debug logs.
2013-10-28 15:47:16 +09:00
Jean-Philippe Andre 4c44b5a553 evas/cserve2: Use Eina_Refcount instead of int
Use the refcount macros instead of manually handling
integers. Not sure if it really helps since the refcounting
in cs2 client is a bit special :)
2013-10-28 15:47:16 +09:00
Jean-Philippe Andre ffa27c7082 evas/cserve2: prevent unwanted remap of strings table
In the client, string_get() can cause a remapping of the
strings index & mempool. This means that all pointers to
string data are invalid past that call.

Solution: add a safe_get() function that prevents remap
during search. It might prove faster also, but will
return NULL more often.
2013-10-28 15:47:16 +09:00
Jean-Philippe Andre c8e6f9e5f9 evas/cserve2: Fix font reloading after cserve2 restart.
Well it LOOKS like it's working properly.
Clients can safely keep running after cserve2 crashed and
restarted.
2013-10-28 15:47:16 +09:00
Jean-Philippe Andre 6b6e33e262 evas/cserve2: Fix refcount for glyphs & glyph buffers
Maybe a little overkill on the iterations (ref/unref),
but at least we can really track down which glyphs are
currently being used.
2013-10-28 15:47:16 +09:00
Jean-Philippe Andre e74cac57e4 evas/cserve2: Reconnect to cserve2 in case of server crash
Try to reconnect to cserve2 if the socket connection was lost.
Resend some messages if necessary.

Images reload seems to be working.
Actually, the images don't change over time, so the clients just
keep the previous references to their images.

FONT RELOAD IS NOT WORKING:
- Crashes
- Invalid glyph data
- Infinite loop in _glyph_map_remap_check()

Root cause:
When new glyphs are requested from the server, they are added to
the mempool. So it is necessary to remap the font.
Unfortunately, in case of server reboot, we did not keep the mempool
so the old glyphs that were not requested again will not be valid.
2013-10-28 15:47:16 +09:00
Jean-Philippe Andre 2cd0b316f1 evas/cserve2: Fix CList usage
In some error cases, the list could become a cycle.
Foreach would then loop forever!
2013-10-28 15:47:15 +09:00
Jean-Philippe Andre f18b71d515 evas/cserve2: Fix invalid file referencing in client
Fixes elementary_test "Bg Image":
 - Various load_opts (jpeg geometry) where not handled properly
   by the client.
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 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 31a5bfb464 evas/cserve2: Reuse file entries when possible
For some reason, a new File_Entry was created whenever
a new image is loaded, even if that file was already
opened by the client.
2013-10-28 15:47:15 +09:00
Jean-Philippe Andre 8aa4a58d5b evas/cserve2: Reduce debug logs (s/INF/DBG) 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 a7b3f7efd3 evas/cserve2: Reset pointers to NULL after close 2013-10-28 15:47:14 +09:00
Jean-Philippe Andre e061114934 evas/cserve2: Add TIMEOUT macro for cs2 client
This will help debugging as we can disable the timeout on demand.
2013-10-28 15:47:14 +09:00
Jean-Philippe Andre 50be9145a1 evas/cserve2: Small performance fixes 2013-10-28 15:47:14 +09:00
Jean-Philippe Andre 45456f8cf0 evas/cserve2: Fix crashes in E17/cserve2
When remapping the glyph data buffer, we need to reposition
the glyph pointers as well.
2013-10-28 15:47:14 +09:00
Jean-Philippe Andre ca44473f18 evas/cserve2: Scan glyphs and add to fash
This will save (just) a few socket waits.
2013-10-28 15:47:14 +09:00
Jean-Philippe Andre d5ac5a8df3 evas/cserve2: Remap glyph mempool if resized 2013-10-28 15:47:14 +09:00
Jean-Philippe Andre 22009a3f64 evas/cserve2: Use only one Glyph_Map per font
In the new cs2 model, only one shared buffer is allocated
for a font, and it resizes on demand.
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 a14e69e573 evas/cserve2: Remap string entries when size changed
Lots of files can't be found by the client when the strings table
changed, because it was not remapped properly.
2013-10-28 15:47:14 +09:00
Jean-Philippe Andre 743e204763 evas/cserve2: Optimize shared strings
Shared string indexes are not repacked, since they live in a
memory pool (where the indexes can be reused).
So, the index in the table is equal to their ID. Add initial
test to check if the item at index n has the ID n.
2013-10-28 15:47:14 +09:00
Jean-Philippe Andre df31807329 evas/cserve2: Client-side scanning of Font Entries 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 a230e41409 evas/cserve2: Fix Eina_File leak at shutdown
cserve2_shutdown was not called
2013-10-28 15:47:13 +09:00
Jean-Philippe Andre f5d0f0aec3 evas/cserve2: Scan shared indexes in client side
Read Image descriptors from the shared arrays

But, accessing the shared index can be a bit expensive, so
try to read from the socket before scanning the index,
without blocking.
2013-10-28 15:47:13 +09:00