Commit Graph

27 Commits

Author SHA1 Message Date
Carsten Haitzler 43ac3c0b4c eina - tiler -= return true if rect alreadt there as its not a failure
docs say return true on succesas, false on failure. adding a rect we
already added is not a failur. it's an optimization to a NOP. so fix.
this was brought up by and fixes T6669 ... but in the opposite way.
2018-02-11 15:55:13 +09:00
Shinwoo Kim bb5f4aa857 eina_tiler: fix typo of rect comparing 2018-02-05 20:02:06 +09:00
Mike Blumenkrantz 83ff889f6d eina: fix eina_tiler_equal to not always return true
ref e3f4f4457d
broken by D996

@fix
2017-07-14 18:43:00 -04:00
Mike Blumenkrantz 47ddbede05 eina: make tiler function params const where appropriate
stop throwing warnings when passing const params to functions which don't
modify the params
2017-07-14 18:43:00 -04:00
Mike Blumenkrantz ab67217434 eina_tiler: use int size matching Eina_Rectangle internally to avoid overflow
since this code's creation it seems that the internal int size was set to use
short in order to micro-optimize memory usage, while the api function parameters
used Eina_Rectangle which had a larger int size. when initializing the internal
rect struct, this would lead to overflows which resulted in broken tilers which
returned iterators with no valid rects after having valid rects added

test case: run weston-subsurfaces

@fix
2017-04-21 16:16:12 -04:00
Carsten Haitzler f18d9d7237 remove memcmp calls for better performance where size is known
so i have been doing some profiling on my rpi3 ... and it seems
memcmp() is like the number one top used function - especially running
e in wayland compositor mode. it uses accoring to perf top about 9-15%
of samples (samples are not adding up to 100%). no - i cant seem to
get a call graph because all that happens is the whole kernel locks up
solid if i try, so i can only get the leaf node call stats. what
function was currently active at the sample time. memcmp is the
biggest by far. 2-3 times anything else.

  13.47%  libarmmem.so                [.] memcmp
   6.43%  libevas.so.1.18.99          [.] _evas_render_phase1_object_pro
   4.74%  libevas.so.1.18.99          [.] evas_render_updates_internal.c
   2.84%  libeo.so.1.18.99            [.] _eo_obj_pointer_get
   2.49%  libevas.so.1.18.99          [.] evas_render_updates_internal_l
   2.03%  libpthread-2.24.so          [.] pthread_getspecific
   1.61%  libeo.so.1.18.99            [.] efl_data_scope_get
   1.60%  libevas.so.1.18.99          [.] _evas_event_object_list_raw_in
   1.54%  libevas.so.1.18.99          [.] evas_object_smart_changed_get
   1.32%  libgcc_s.so.1               [.] __udivsi3
   1.21%  libevas.so.1.18.99          [.] evas_object_is_active
   1.14%  libc-2.24.so                [.] malloc
   0.96%  libevas.so.1.18.99          [.] evas_render_mapped
   0.85%  libeo.so.1.18.99            [.] efl_isa

yeah. it's perf. it's sampling so not 100% accurate, but close to
"good enough" for the bigger stuff. so interestingly memcmp() is
actually in a special library/module (libarmmem.so) and is a REAL
function call. so doing memcmp's for small bits of memory ESPECIALLY
when we know their size in advance is not great. i am not sure our own
use of memcmp() is the actual culprit because even with this patch
memcmp still is right up there. we use it for stringshare which is
harder to remove as stringshare has variable sized memory blobs to
compare.

but the point remains - memcmp() is an ACTUAL function call. even on
x86 (i checked the assembly). and replacing it with a static inline
custom comparer is better. in fact i did that and benchmarked it as a
sample case for eina_tiler which has 4 ints (16 bytes) to compare
every time. i also compiled to assembly on x86 to inspect and make sure
things made sense.

the text color compare was just comparing 4 bytes as a color (an int
worth) which was silly to use memcmp on as it could just cast to an
int and do a == b. the map was a little more evil as it was 2 ptrs
plus 2 bitfields, but the way bitfields work means i can assume the
last byte is both bitfields combined. i can be a little more evil for
the rect tests as 4 ints compared is the same as comparing 2 long
longs (64bit types). yes. don't get pedantic. all platforms efl works
on work this way and this is a base assumption in efl and it's true
everywhere worth talking about.

yes - i tried __int128 too. it was not faster on x86 anyway and can't
compile on armv7. in my speed tests on x86-64, comparing 2 rects by
casting to a struct of 2 long long's and comparing just those is 70%
faster than comapring 4 ints. and the 2 long longs is 360% faster than
a memcmp. on arm (my rpi3) the long long is 12% faster than the 4 ints,
and it is 226% faster than a memcmp().

it'd be best if we didnt even have to compare at all, but with these
algorithms we do, so doing it faster is better.

we probably should nuke all the memcmp's we have that are not of large
bits of memory or variable sized bits of memory.

i set breakpoints for memcmp and found at least a chunk in efl. but
also it seems the vc4 driver was also doing it too. i have no idea how
much memory it was doing this to and it may ultimately be the biggest
culprit here, BUT we may as well reduce our overhead since i've found
this anyway. less "false positives" when hunting problems.

why am i doing this? i'm setting framerate hiccups. eg like we drop 3,
5 or 10 frames, then drop another bunch, then go back to smooth, then
this hiccup again. finding out WHAT is causing that hiccup is hard. i
can only SEE the hiccups on my rpi3 - not on x86. i am not so sure
it's cpufreq bouncing about as i've locked cpu to 600mhz and it still
happens. it's something else. maybe something we are polling? maybe
it's something in our drm/kms backend? maybe its in the vc4 drivers or
kernel parts? i have no idea. trying to hunt this is hard, but this is
important as this is something that possibly is affecting everyone but
other hw is fast enough to hide it...

in the meantime find and optimize what i find along the way.

@optimize
2016-11-06 13:13:10 +09:00
Cedric BAIL 0c4880e99d efl: everyone should now rely on Eina MIN/MAX redefinition. 2016-05-09 16:58:53 -07:00
Mike Blumenkrantz 6a93062b25 eina: invalidate last add/del rects when the opposite operation occurs
applying this optimization to prevent the same rectangle from being added
or removed repeatedly in succession would result in the rejecting of successive
operations of the same type when the other operation occurred in between.

as an example:

add(0, 0, 100, 100)
del(0, 0, 100, 100)
add(0, 0, 100, 100)

should yield (0, 0, 100, 100), not zero rects and a failure to add the
second rect

this fixes a serious issue in enlightenment where stacking three windows
on top of each other with the first and third windows having the same geometry
would result in the top window receiving no input geometry (oops)

@fix
2016-02-05 14:35:28 -05:00
Mike Blumenkrantz 26b35222b4 eina: make re-setting the same tiler tile size a no-op 2015-07-08 12:33:23 -04:00
Mike Blumenkrantz 46f546c43e eina: don't return NULL silently when creating new tilers 2015-07-02 14:18:21 -04:00
Gwanglim Lee 3d534e87c3 eina: Eina_Tiler - return a NULL if intersection of two tilers doesn't exist
Summary:
change eina_tiler_intersection to return a NULL if intersection
of two tilers doesn't exist. and add test case to check it.

This doesn't break ABI/API as this call could already return a NULL value and it
should have been handled by the caller anyway. This just make an expected behavior
more correct.

Test Plan: run eina_suite after building eina test suite

Reviewers: cedric, raster, torori, devilhorns

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1205

Signed-off-by: Cedric BAIL <c.bail@partner.samsung.com>
2014-07-21 19:33:27 +02:00
MinJeong Kim aa5e2c6132 eina-tiler: Fix invalid read on eina tiler
Summary:
Fix invalid read on eina tiler reported by valgrind.
This revision will prevent access to data that was gained from eina iterator, after free of eina_iterator.

Test Plan:
1. Build enlightenment on devs/devilhorns/e_comp_wl branch with efl applyied this patch.
2. Run enlightenment with valgrind options.
3. build enlightenment with this patch
4. Run any wayland app on enlightenment
5. There will be no more invalid read message by valgrind.

Reviewers: cedric, devilhorns, raster, gwanglim, zmike

CC: cedric

Differential Revision: https://phab.enlightenment.org/D1080
2014-06-24 09:00:56 -04:00
Gwanglim Lee e3f4f4457d eina-tiler: fix crash when trying to check intersection between two tilers
Summary:
If one of the given tilers is empty, then crash could be occurred in internal while loop of eina_tiler_intersection.
And fix some memory leaks in eina_tiler_intersection and eina_tiler_equal.

Reviewers: devilhorns, raster, cedric, torori

CC: cedric

Differential Revision: https://phab.enlightenment.org/D996
2014-06-12 12:40:24 +09:00
Cedric BAIL ba53bf8533 eina: fix possible memory leak on failure in eina_tiler_equal.
CID 1216618, 1216615, 1216614.
2014-06-05 02:51:54 +02:00
MinJeong Kim 61cecf1f3f eina-tiler:add union, subtract, intersection, equal apis for tilers
Summary:
Support union, subtract, intersection, equal(comparison) between tilers.
@feature

Test Plan: Test with added test case(src/tests/eina/eina_test_tiler.c) and the example(src/examples/eina/eina_tiler_02.c)

Reviewers: gwanglim, devilhorns, raster, zmike, cedric

CC: cedric

Differential Revision: https://phab.enlightenment.org/D880
2014-05-28 16:51:30 +09:00
Carsten Haitzler 555df8f510 Revert "fix allocator sizeof operand mismatch reported by clang"
This reverts commit 955cc579d4.

why? wrong. no. and it breaks actual execution/functioning. segv land
2014-01-09 10:02:26 +09:00
Jihoon Kim 955cc579d4 fix allocator sizeof operand mismatch reported by clang
https://build.enlightenment.org/job/nightly_efl_clang_x86_64/lastSuccessfulBuild/artifact/scan-build/build/2014-01-07-1/report-QL6MiM.html#EndPath
https://build.enlightenment.org/job/nightly_efl_clang_x86_64/lastSuccessfulBuild/artifact/scan-build/build/2014-01-07-1/report-a2l0Ci.html#EndPath
https://build.enlightenment.org/job/nightly_efl_clang_x86_64/lastSuccessfulBuild/artifact/scan-build/build/2014-01-07-1/report-McvqNf.html#EndPath
2014-01-09 09:10:02 +09:00
Carsten Haitzler 69e27abdc3 eina - and e3fl in general - stop using eina_error_get/set - useless really 2013-10-11 16:50:40 +09:00
Cedric Bail f07d4c17e9 eina: add eina_tiler_empty. 2013-07-11 14:01:06 +09:00
Cedric Bail 5479da04b6 eina: Eina_Tiler formatting. 2013-07-11 14:01:06 +09:00
Cedric Bail d2b94729bc eina: don't insert the same rectangle multiple time in a row. 2013-07-11 14:01:06 +09:00
Cedric Bail 2e347b5e22 eina: let's not complain for nothing. 2013-07-11 14:01:06 +09:00
Mike Blumenkrantz b8e16b8f4a +eina_tiler_area_size_get
also fix docs for eina_tiler_area_size_set
2013-07-08 09:08:04 +01:00
Cedric Bail f825bebcdb eina: improve Eina_Tiler to be in par with Evas_Tilebuf. 2013-07-04 13:02:48 +09:00
Cedric BAIL e684f5a823 efl/eina: Eina_Tiler take tile size into account.
SVN revision: 83708
2013-02-07 07:32:45 +00:00
Vincent Torri 7fe3d35994 merge: __UNUSED__ --> EINA_UNUSED and some fixes in eo.
SVN revision: 77542
2012-10-05 20:09:47 +00:00
Vincent Torri 785f2a6b3a merge : add eina
currently, examples, tests and benchmark are not set. That's the next things i'll do


SVN revision: 76710
2012-09-16 10:57:48 +00:00