Commit Graph

393 Commits

Author SHA1 Message Date
Cedric BAIL 35e54acc46 evas: stat introducing a concept of engine and output in the backend. 2017-05-12 15:24:45 -07:00
Jean-Philippe Andre 290f1893cd evas map: Reach feature parity with legacy API
I've done this by translating "Flip Page" to this new set of
EO APIs. In particular, absolute coordinates need to be used
in some calls, and the map needs to be calculated between
get and set operations.

This required an adjustment of the raw_coord API as the flip_page
code does some math after reading and then writing to the map.
Same for color. Those two properties now act like commands (ie.
like the other gfx map functions).

This also introduces a duplicate set of APIs to handle absolute
coordinates. Other solutions included:

 - Use an enum to specify the type of coordinates (but then the
   unit of cx,cy varies between non-unit relative position and
   pixel position. Also this adds an extra argument to all those
   function calls.

 - Pass a special value (an empty eo object) as the argument for
   pivot. Same remark about the unit as above. This way was
   deemed too confusing because of the weird object.

Those two options have been discarded after asking the opinion
of a few developers I could reach.

@feature
2017-05-11 18:02:31 +09:00
Jean-Philippe Andre 0a224da86f evas map: Introduce new API for maps (Efl.Gfx.Map)
This implements an entirely new API model for Evas Map by relying
on high-level transformations on the object rather than an external
Evas_Map structure that needs to be constantly updated manually.

The implementation relies on Evas_Map.

To rotate an object all you need to do now is
  efl_gfx_map_rotate(obj, 45.0, NULL, 0.5, 0.5);

Or with a C++ syntax:
  obj.rotate(45.0, NULL, 0.5, 0.5);

Or even simply (with default arguments):
  obj.rotate(45.0);

The map transformation functions are:
 - rotate
 - rotate_3d
 - rotate_quat
 - zoom
 - translate (new!)
 - perspective_3d
 - lightning_3d

@feature
2017-05-11 17:54:00 +09:00
Cedric BAIL 55e1b3f205 evas: remove engine.data.output.
This is the first step toward handling multi output. This patch
remove engine.data.output from Evas structure and use an Eina_List
for it instead. It also start moving code around to fetch an output
or an engine context (which are the same at the moment, but will be
split in a later patch).
2017-04-24 15:10:48 -07:00
Cedric BAIL 76c6830b29 evas: evas_render actually need to access that structure. 2017-04-24 15:10:48 -07:00
Derek Foreman fddbf75fc9 Fix sed error that changed "video" to "videfl"
commit c662934be8 seems to have accidentally
renamed a few instances of _video_ to _videfl_, this hopefully changes
them all back.
2017-04-17 17:06:28 -05:00
Jean-Philippe Andre 08a8072571 evas: Fix cutout handling for snapshot objects
This improves over the previous code for handling
snapshot objects and cutouts. Basically any opaque object
above a snapshot should be obscuring it. That is true
unless a crazy filter is applied, or the snapshot object
is itself the source of a map or proxy.

This also uses eina_tiler instead of a custom (and really
bad) algorithm to compute the obscure regions.
2017-04-14 11:26:44 +09:00
Jean-Philippe Andre c53f1526f1 evas: Make save() work on snapshots
This make save() work on snapshot objects, provided the call
is done from inside render_post.

Also, this saves the filtered output of an image, rather than
its source pixels. Any call to save() on a filtered image must
be done from post-render as well.

Fixes T2102

@feature
2017-04-14 11:26:44 +09:00
Jean-Philippe Andre 530399acde evas filters: Force redraw of snapshot if cutout shrank
The situation is clearly visible in the Snapshot test case:
increase the radius and a red glow would appear. This is because
the snapshot object was not marked as needing redraw and so had
no pixels under the opaque rectangle.
2017-04-14 11:26:44 +09:00
Jean-Philippe Andre a8b6c1cd7f evas filters: Move private data out of evas headers
This moves the filter internal data back to the filters
implementation, rather than inside evas common headers.
2017-04-14 11:26:44 +09:00
Jean-Philippe Andre b6c5af5edc evas: Fix excessive redraws of snapshot objects 2017-04-14 11:26:44 +09:00
Jean-Philippe Andre 1bf24f8762 evas filters: Refactor to support reuse of buffers
This will reuse existing buffers by resetting only the minimum
required in the filter context (also reused). Work in progress,
as the actual reuse is disabled for now.
2017-04-14 11:26:44 +09:00
Jean-Philippe Andre 1336b2d9e0 evas filters: Expand snapshot regions by blur radius
When using a snapshot object we have access to exactly all
the pixels below it inside the snapshot surface. So, in order
to produce a nice blur, it is necessary to expand this snapshot
and then clip it otherwise the edges will look a bit ugly.

Unfortunately, there are still places where blurs didn't look
so good, as objects below an opaque region would never get
rendered into the snapshot object. So the edges, inside a
snapshot object, around an opaque region would have blur
artifacts.

This fixes that by shrinking the cutout regions by the radius
of the filter. Eg for blur this is the blur radius.

The test case in elm_test can exhibit this fix very clearly:
a red glow would be visible around the opaque rectangle, but with
these changes we instead see the blurry edges of the objects
below the rectangle.
2017-04-14 11:26:43 +09:00
Jean-Philippe Andre 9b1ea2fc6b evas: Pass obscuring region to the filters
This will be most useful in a special case, where a filter is
used in a window decoration, applied to a snapshot object.

Another optimization that might be wanted is passing a list
of update regions (from the proxy or snapshot).

The filters don't support the obscuring region yet, only some
of the high-level logic is implemented.
2017-04-14 11:26:43 +09:00
Jean-Philippe Andre a6951397f6 evas: Optimize redraws of snapshot objects
If anything in the canvas needs redraw and a snapshot object
happens to intersect with the update region then it was redrawn,
even if all objects below it hadn't changed. This has an insane
performance impact when you apply a blur filter on the snapshot
object. Walking the object list will always be cheaper than
rendering the snapshot!

Note: Added a FIXME comment and forced clean_them to be true
because some odd behaviour happens when breaking with GDB and
the array snapshot_objects keeps growing at each frame (I guess
only if we miss a frame or something like that).
2017-04-14 11:26:43 +09:00
Jean-Philippe Andre 3d2f1a3d9b evas filters: Implement mask filter in pure GL
This reuses the existing mask infrastructure, but adds a color
flag to use the whole RGBA range, rather than just the Alpha
channel.

Filters are still very slow (glReadPixels and non-optimized use of
GL buffers...), but this is progress :)
2017-04-14 11:26:43 +09:00
Jean-Philippe Andre 2ef8d6f39a evas filters: Refactor ector and gfx filters A LOT
Alright, so this is a massive patch that is the result of
trying to get rid of unused or poorly implemented classes in
ector. Originally ector was meant to support VG but extend to
things like filters as well. At the moment, ector's design
makes it quite hard to plug in the filters.

For now I think it's easier to implement the GL support for
the filters directly in the engine, where I hope to interfere
as little as possible.

This massive patch keeps only the required minimum to support
a versatile gl buffer that can be mapped, drawn or rendered to (FBO).
It's extremely inefficient as it relies on glReadPixels and lots
of texture uploads, as well as conversions between ARGB and Alpha.

Another type of GL buffer is a wrap around an existing GL image,
but that one is read-only (map or draw: no write map, no FBO).

No, all the filters run fine, and the high-level implementation
(evas_filters.c) does not need to know whether the underlying engine
is SW or GL. One problem though appears with the blending or blurring
of some Alpha buffers, the colors are wrong.

This patch removes more lines than it adds so it must be good ;)
2017-04-14 11:26:43 +09:00
Jean-Philippe Andre 0740010a06 evas filters: Move blend to software_generic (1/8)
This is an attempt at refactoring the filters code so I can
later implement GL support. This patch adds a few extra changes
to remove avoid calling functions of libevas from the software
engine: use the draw functions from static_libs/draw rather
than evas_common APIs.
2017-04-14 11:26:42 +09:00
Youngbok Shin 1ab87367d8 evas: give width offset when Evas tries to find ellipsis position
Summary:
If the last item before ellipsis item has bigger width than its advance,
evas_common_font_query_last_up_to_pos() function can find wrong ellipsis position.
When Evas finds a position for non last item, Evas must care about additionally
available space for glyph's width of the given x position.

ex) the last item's glyph before ellipsis item has a tail to draw above the ellipsis item.

@fix

Test Plan:
Test case will added as comment.
(Becasue of font license problem.)

Reviewers: herdsman, raster, jpeg, woohyun

Subscribers: cedric, Blackmole

Differential Revision: https://phab.enlightenment.org/D4727
2017-04-10 12:15:20 +09:00
Cedric BAIL 30c5225bec evas: properly disable Evas_Object event catching once we can't access Evas anymore. 2017-02-27 15:05:35 -08:00
Jean-Philippe Andre 51765b8b9f evas: Avoid data_scope_get in internal function 2017-02-21 12:24:56 +09:00
Jean-Philippe Andre a55e0ced26 evas: Inline part of clip_dirty
clip_dirty is called A LOT. Unfortunately this patch does not
result in very measurable improvements.

**********************
Note about this merge:

After this series of patches, the CPU usage for a certain test
case has significantly gone down:

Based on c0e6a8d698c17fc16f9b67fc9 (upstream before git push):
NS since frame 2 = 28910806786 , 2937 frames = 9843652 / frame

After this patch:
NS since frame 2 = 19218592951 , 2928 frames = 6563727 / frame

1.18:
NS since 2 = 13105584220 , 2961 frames = 4426066 / frame

As we can see, 1.18 remains *much* better than 1.19. I'm still
struggling trying to figure out why (clip_recalc is called more,
but the call tree is hard to decypher).

The test case is:
EINA_FREEQ_BYPASS=1 ELM_TEST_AUTOBOUNCE=100 \
  elementary_test -to "Scroller 2"

EFL was compiled with GCC 6.3.1 with -O3 -g

@optimization
2017-02-21 11:23:07 +09:00
Jean-Philippe Andre cbb804f814 evas: Inline part of clip_recalc
This function was moved out of inline (see d7c6fca6c0) but
unfortunately the early checks at its beginning are likely
to result in an early return. Inline this part so we get back a
better performance. Inlining the whole function does not improve
the performance, as GCC simply gives up with inlining.

Note: Between 1.18 and master the number of calls to clip_recalc
has simply blown out. It is thus crucial to find out where those
calls come from but also micro-optimize the function itself. This
patch does the latter only.

@optimize
2017-02-21 10:52:40 +09:00
Jean-Philippe Andre 0d555dda7f evas: Optimize out some calls to data_scope_get
Within evas when we know an object is marked as is_smart, then
we know it's a smart object. :)

@optimize
2017-02-21 10:52:40 +09:00
Jean-Philippe Andre 9a83113b9f evas: Optimize out more calls to efl_isa
In relative smart move, we only need to check once that the object
is indeed a valid smart object. This drops the call count from ~1.02M
to ~785k.

@optimization
2017-02-21 10:52:39 +09:00
Jean-Philippe Andre 05cc5ab940 evas: Avoid useless calls to eo_data_scope_get
Use an internal variant of the function for evas when we already
have the protected data pointer.
2017-02-21 10:52:39 +09:00
Jean-Philippe Andre 60dc978857 evas: Inline checks for post-event cb call
This avoid excessive calls to a real function.

@optimization
2017-02-21 10:52:39 +09:00
Jean-Philippe Andre 54e5841b2f evas: Re-fix post-event cb by supporting recursion
The previous patch (b184874fa5) was preventing
post-event callbacks from triggering any form of input event,
including side-effects due to mouse,in. In fact by tracking
which exact events we want to post-process we can support
proper recursion. This fixes crashes in Bryce.

I'm not changing the documentation as this is still a dubious
code design.

Fixes T3144
Fixes T5157
2017-02-16 19:51:06 +09:00
Jean-Philippe Andre b184874fa5 evas: Strengthen post-event callbacks
See T3144 that I marked as Wontfix.

Bryce in E manually feeds events from a post-event callback
resulting in Evas going insane and leading to frequent crashes.
The ideal solution (for E) would be to ensure that everything works
smoothly, the input event data is valid up until the post-event cb
is called, etc... Unfortunately, with recursive events the exact
order of operations may be messed up: the post-event

I don't want to add yet more complexity to Evas events here (it's
already spaghetti all over the place) so I'm simply blocking any
new event feed when running the post-event callback list.

It's not possible to just freeze the events (I tried, it failed).

**********************
Some more explanation:

post-event callbacks are used to implement reverse-order logic
where the on-hold flag of an input event may be set by an event
listener that does not come first.

Here's a situation to illustrate: scroller A inside scroller B.

As events are propagated from children to parents (assuming the
propagate flag is set), we'd assume the events to go first to A
and then to B, which means a mouse wheel event would make the
inner-most scroller (A) scroll, and the outer-most scroller (B)
wouldn't budge.

But as things are designed, A and B are not simple evas objects,
and the actual event-catching object is a top-most transparent
rectangle (top-most in Z stack order). Since A is inside B, B's
rectangle BR is over A's rectangle AR, thus catches the wheel
event first. But in terms of UX we still want A to scroll, not B.

The solution then is to reverse the event processing order and
post-event callbacks are the way to do that. This comes with the
consequence that the event_info needs to remain valid until the
post-event is called, and stay the same (so that the on-hold flag
set by A can be read by B).

Recursive events (by explicit feed or modifying the canvas so
that mouse,in or mouse,out are triggered) mess with this logic,
and trigger the post-events too early (event is not fully
processed) or too late (event_info is not valid anymore... and
crash!).

Thanks @raster for explaining the goal of post-event callbacks!
2017-02-16 18:10:18 +09:00
Jean-Philippe Andre e434653fc2 evas: Ensure post-event cb push is called from an event cb
This rejects calls to evas_post_event_callback_push() that don't
originate from inside an input event callback.
2017-02-16 16:26:42 +09:00
Jean-Philippe Andre d689afccae group: Track calls to group_del
After a long search I found that fileselector was not calling
super.group_del on deletion, leading to the use of dangling pointers.
So let's verify that group_del is properly called.

See T4598
2017-02-15 20:11:22 +09:00
Jean-Philippe Andre 65ae1c812c evas: Fix double free in post events
A use of the post event callback in Bryce triggered a double free
as an event was being processed but not yet removed from its list,
leading to an invalid state of the Eina_List.

Also remove obj from struct as it is unused.

Fixes T5157
2017-02-14 15:21:25 +09:00
Carsten Haitzler 51638afbeb evas render - drop eo overhead by using ptrs we already have
several calls, specifically evas_object_change_reset,
evas_object_cur_prev, and evas_object_clip_changes_clean that are
called directly or indirectly as part of evas render on at least every
active object if not more, were doing full eo obj lookups when their
calling functions already all had the eo protected data looked up.
tha's silly and just adds overhead we don't need. my test dropped
_eo_obj_pointer_get overhead in perf profiles from 4.48% to 2.65%. see:

   4.48%  libeo.so.1.18.99            [.] _eo_obj_pointer_get
   4.23%  libevas.so.1.18.99          [.] evas_render_updates_internal
   2.61%  libevas.so.1.18.99          [.] evas_render_updates_internal_loop
   1.68%  libeo.so.1.18.99            [.] efl_data_scope_get
   1.57%  libc-2.24.so                [.] _int_malloc
   1.42%  libevas.so.1.18.99          [.] evas_object_smart_changed_get
   1.09%  libevas.so.1.18.99          [.] evas_object_clip_recalc.part.37
   1.08%  libpthread-2.24.so          [.] pthread_getspecific
   1.05%  libevas.so.1.18.99          [.] efl_canvas_object_class_get
   1.01%  libevas.so.1.18.99          [.] evas_object_cur_prev
   0.99%  libeo.so.1.18.99            [.] _efl_object_event_callback_legacy_call
   0.87%  libevas.so.1.18.99          [.] _evas_render_phase1_object_ctx_render_cache_append
   0.82%  libpthread-2.24.so          [.] pthread_mutex_lock
   0.81%  libevas.so.1.18.99          [.] _evas_render_phase1_object_process
   0.79%  libc-2.24.so                [.] _int_free

vs now the improved:

   4.82%  libevas.so.1.18.99          [.] evas_render_updates_internal
   3.44%  libevas.so.1.18.99          [.] evas_render_updates_internal_loop
   2.65%  libeo.so.1.18.99            [.] _eo_obj_pointer_get
   2.22%  libc-2.24.so                [.] _int_malloc
   1.46%  libevas.so.1.18.99          [.] evas_object_smart_changed_get
   1.04%  libeo.so.1.18.99            [.] _efl_object_event_callback_legacy_call
   1.03%  libevas.so.1.18.99          [.] _evas_render_phase1_object_ctx_render_cache_append
   0.97%  libeina.so.1.18.99          [.] eina_chained_mempool_malloc
   0.93%  libevas.so.1.18.99          [.] evas_object_clip_recalc.part.37
   0.92%  libpthread-2.24.so          [.] pthread_mutex_lock
   0.91%  libevas.so.1.18.99          [.] _evas_render_phase1_object_process
   0.84%  libc-2.24.so                [.] _int_free
   0.84%  libevas.so.1.18.99          [.] evas_object_cur_prev
   0.83%  libeina.so.1.18.99          [.] eina_chained_mempool_free
   0.80%  libeo.so.1.18.99            [.] efl_data_scope_get

of course other things "increase their percentage" as oe overhead now
dropped, and things seem to move around a bit, but it does make sense
to do this with no downsides i can see as we already are accessing the
protected data ptr in the parent func.
2017-02-04 11:49:56 +09:00
Jean-Philippe Andre 301e80a10a evas: Remove most extra data from filter mixin
This should save a bit of memory for all image & text
objects. This exploits the previous patch for the post-render
job queue added to evas, and simplifies this bit of code.
2017-01-17 14:35:28 +09:00
Jean-Philippe Andre c2ba0939d8 evas: Add a very simple post-render job list
This will be used by the filters
2017-01-17 14:35:27 +09:00
Carsten Haitzler b0530aba4f evas cutouts - quickly avoid huge per issues with large nos of cutouts
i found evas_common_draw_context_apply_cutouts() was procsessing 300+
cutouts and as it's O(n^2)/2 to try and merge adjacent rects for
cutouts this really performs like complete junk. we apply cutout rects
a LOT. this is not the best solution, but it's quick and much faster
than doing the clipouts which drop framerate to like 1-2fps or so in the
nasty case i say (tyls -m of photos in a dir with a 2160 high
terminal).

this figures out the target area to limit the count of rects
significantly so O(n^2) is far far better when n is now < 10 most of
the time. and for the few operations where it's a high value this now
uses qsort to speed up merges etc. etc.

@optimize
2017-01-02 18:53:56 +09:00
Jean-Philippe Andre 2e89702d57 evas: Fix image save with GL engine and orientation
This fixes evas_object_image_save after changing the orientation
of an image in the GL engine. In SW engine the pixel data is rotated
in memory, so things worked fine from the beginning. In GL we may
have to go through loops and hoops in order to rotate and fetch the
data from the GL texture.

This should fix ce45d44.
2016-12-21 13:56:05 +09:00
Jean-Philippe Andre a28cb93d0d Revert "evas: Add source_region property to proxy objects"
This reverts commit 4e110a34bf.

Urgh. I'm stupid. Conceptually I still like the idea of the
region proxy, that only renders part of the source object
in a proxy surface. The problem right now is that the proxy
subrender mechanism renders to a surface that belongs to
the **source** and not the proxy object. As a consequence,
the region would become a property of the source, rather than
the proxy, which is not at all the intention of the original
patch. In other words, everything would fall apart if an object
has more than one proxy, for whatever reason.

I realized that when trying to actually test the region proxy.
It didn't work at all. Revert for now.
2016-12-20 15:47:54 +09:00
Bruno Dilly ecdf56de47 evas: improve logic regarding events filtering enablement
Only the size of events_whitelist isn't enough, because in some
cases the user may be disabling the usage of a specific seat.

Considering the following scenario, the issue will easy to understand:
 - an application with two entries (one to be used by seat 1 and other
     by seat 2)
 - the first seat is announced - it is enabled for entry 1 and
     disabled for entry 2
 - the second seat is announced

Before second seat is announced, the first seat would be able
to input the entry 1, because the events_whitelist of such
object will continue empty.

So a flag will be used to identify an object with active
filter.

Reviewed By: iscaro

Differential Revision: https://phab.enlightenment.org/D4498
2016-12-19 16:47:14 -02:00
Jean-Philippe Andre e3b8bcc771 evas: Change int into a single bit
clean_layer is a bool
2016-12-16 14:35:52 +09:00
Jean-Philippe Andre 1c21cdfdbb evas: Remove flag use_mapped_ctx and add do_async
Always assume use_mapped_ctx as true, the caller of evas_render_mapped
must ensure that the context is suitable (so either clean or contains
the appropriate clip info).

Also pass do_async to mask_subrender. For now it will always be reset
to false as the SW engine requires sync render to convert from RGBA
to Alpha (not great). The upcoming GL async engine should be able to
render masks asynchronously without any problem.
2016-12-16 11:05:45 +09:00
Jean-Philippe Andre 70676a4179 evas: Remove context from the evas public data
It was never used, except in dubious situations (most likely a typo).
A clean context is now used in the top-most call to
evas_render_updates_internal_loop.
2016-12-16 10:51:05 +09:00
Jean-Philippe Andre 581505791a evas: Remove context from some engine function
This is for canvas_alpha_get. context is never used.
2016-12-16 10:40:55 +09:00
Jean-Philippe Andre 260d838d22 evas: Remove context from polygon internal functions
It's not used
2016-12-16 10:37:54 +09:00
Jean-Philippe Andre ae69b10455 evas: Avoid calling efl_isa in proxy_subrender
It's not necessary.
2016-12-16 10:24:52 +09:00
Jean-Philippe Andre 4e110a34bf evas: Add source_region property to proxy objects
This will allow partially rendering a proxy in a smaller image,
limited to the specified region. At the moment, this will allow
apps to create proxies of very large objects and let them deal
with the geometry & clipping.

This is not directly solving the issues with adding a filter
to textblock or the infinite page scrollers.

@feature
2016-12-16 10:24:52 +09:00
Guilherme Iscaro f153d4ce0f Efl.Canvas.Object: Remove the extra parementer at _evas_object_pointer_data_get()
The Evas_Pointer_Data struct already contains a Efl.Input.Device pointer.
2016-12-13 03:28:31 -02:00
Guilherme Iscaro b42a0ba5d2 Efl.Canvas.Object: Reduce memory used to store Evas_Object_Pointer_Data.
The hash implementation demonstrated that too much memory was being used
to store the Evas_Object_Pointer_Data. In order to reduce the memory usage
this patches now changes the Evas_Object_Pointer_Data storage to an Eina_Inlist and
now Massif profiles shows that the memory usage was drastically reduced.
2016-12-13 03:28:31 -02:00
Guilherme Iscaro ddfc98359f Evas: Add seat_event_filter_set()/get() API.
With this new API one can block or unblock keyboard, mouse and
focus events that was originated from a seat. This is useful to
create applications that wants to establish some kind of seat segregation.
2016-12-12 14:59:22 -02:00
Cedric BAIL 73b308fb66 evas: refactor setup stage and reduce complexity for engine. 2016-12-07 15:47:56 -08:00
Cedric BAIL 8205051ff6 evas: wait on one specific task to be done.
This prevent dead lock.
2016-12-07 11:17:20 -08:00
Cedric BAIL 27a47da15b evas: add infrastructure for Evas_Loader to know if what they are working on is still useful. 2016-12-06 16:26:08 -08:00
Cedric BAIL 3fab272906 evas: add capability to know if a thread has been cancelled. 2016-12-06 16:26:08 -08:00
Jean-Philippe Andre aac516f352 evas: Ensure single init of common per canvas
After @cedric's commit 6427c77707 we end up with E
not working in Xephyr, because evas_common_shutdown() is called
too many times (init_count == -1). So I'm being paranoid and
tracking whether Evas has initialized or not evas_common. That
way we end up with exactly the right number of inits. We even
reach 0 after E shuts down :)
2016-12-06 10:48:17 +09:00
Guilherme Iscaro c3ed1d3154 Evas: Add support for per seat modifiers and locks.
This patch introduces possibility to enable key locks and modifers by seat.
It's very useful when the user has two keyboards attached to different seats.
2016-12-02 09:57:50 -02:00
Guilherme Iscaro 484dae76e6 Evas: Add support for per mouse pointer mode/properties.
This patch introduces the possibility to set the pointer mode and
query other properties like current position per pointer device.
The old API will still works, however it will only act on the default seat.
2016-12-02 09:57:50 -02:00
Jean-Philippe Andre 0891466d5f evas: Fix infinite recursion on smart object resize
In some situations smart object resize could fall in an
infinite loop even though the size was stable.

Thanks @vtorri for the report!
2016-12-01 17:56:18 +09:00
Guilherme Iscaro c5f14a61e3 Evas: Add per seat Evas focus state. 2016-11-28 13:57:55 -02:00
Carsten Haitzler d7c6fca6c0 evas render and clip calc - move evas_object_clip_recalc out of inline
evas_object_clip_recalc is big. it's fat. it shouldnt be inline. so
make it a real function. being inline just hurts performance by making
our code bigger, hurting l1 instruction prefetch and cache
performance. this function isn't small. it's huge and should not be
inline basically because of that reason.

also throw in some likely/unlikely hints etc.

@optimize
2016-11-27 12:10:12 +09:00
Carsten Haitzler e3489d5f89 evas_render - store active obj geom in array to be able to filter faster
part of rendering is figuring if obj is inside current geometry.
before we had to actuall poke around inside the object. this moves the
geometry into the active object array so the data is fecthed fast and
already there for filtering as this is the most likely thing to filter
out an object.

unfortunately this seems to have some bugsd and i'm baffled why, so
leave it there and ifdefed out for now for suture hunting.
2016-11-27 12:09:25 +09:00
Carsten Haitzler 69cb85aaca evas render - cache object arrays rto avoid processing them in phase1
evas render in phase1 in order to generate update rects, active,
render etc. object arrays has to walk every object in our tree. this
is a waste of time if we already have walked objects in a previous
frame if they havent changed, so cache this data in render cache in
smart objects to avoid re-walking and now just dumbly "memcpy" these
cached arrays into the master array. i have seen cpu usage by e drop
like about 15% in the sencarios i'm looking at "enlightenment
compositor with some window updating animation all the time, but most
other stuff being static).

@optimize
2016-11-26 18:33:56 +09:00
Guilherme Iscaro b77f0086f5 Efl.Canvas: Use Efl.Input.Focus as event info for object,focus.in/out. 2016-11-24 19:18:47 -02:00
Carsten Haitzler 7bdcb0b8ca evas render - clean up phase 1 process to be more funcs and faster
this refactors _evas_render_phase1_object_process() into a bunch of
sub functions with leaner code, some LIKELY/UNLIKELY hints etc. etc.
in the hope that we have better l1 instruction cache use when
executing. this actually measureably helps and drops the overhead of
this func ANd all its sub functions from (in my tests in enlightenment
compositing while a video plays) from about 13.2% of all cpu usage by
e to 10%. that's about a 25% drop in cost for passing through phase 1
of evas render... and thats a good thing.

and it also makes the code nicer and more broken up.

@optimize
2016-11-22 21:07:29 +09:00
Carsten Haitzler f504950597 image prepares - put in some disabled code to show how to possibly use
this is how you would possibly use prepare stages for objects like
image objects by pre-rendering them to a buffer. this is not complete
and it's actually disabled right now, but it's to show how it might be
done. some more exploring is needed, but this is to share how it
might/should work.
2016-11-17 18:41:32 +09:00
Carsten Haitzler 3eb0df1022 evas engines - add more support for noscale pixel buffers esp in gl
for gl noscale buffers are texture atlases that are fbo's. the point
is never to scale or transofmr them but to render them pixel for pixel
and just store pre-rendered data where its cheaper to do this than
rebuild every time. this is the enigne infra for sw and gl with the gl
code... it SHOULD work... in theory...
2016-11-17 18:41:32 +09:00
Carsten Haitzler 622277c82a evas - add engine api to get a specific fbo/surf that wont be scaled
this is to allow gl to specifically use an fbo as an atlas for these
kinds of buffers
2016-11-17 18:41:31 +09:00
Carsten Haitzler a479745e4f evas - add a prepare stage for objects before render
preparing an object is a good idea. especially with gl. you want to do
texture uploads BEFORE using textures all in one batch. otherwise this
may mean the gl implementation has to make a copy of your data in a
tmp location then copy it in later when texture becomes "unused" as it
may be in use at the moment, or it may have to stall and wait.

i have seen somewhere around 7-10% speedups on nvidia and intel
drivers with this on given a very special test case i brewed up (1000
32x32 images where i change 1 pixel every frame). this should have
impact really when we are modifying textures a lot. this is all i've
implemented for now, but this should/would/could do much more like
re-order map, proxy renders to render FIRST in a pre-render list
instead of inline and to pre-render fbo/buffer content for complex
objects like text or textblock etc.
2016-11-17 18:41:31 +09:00
Jean-Philippe Andre f50b0fed13 elm/evas: Fix disappearance of window icons with CSD
After a few patches trying to fix clipping of frame or
non-frame objects the icon finally ended up invisible. Even
if the elm_icon was marked as is_frame, its internal evas
object image would not have the flag set, thus it would be
clipped out.

Solution: Propagate the is_frame flag to all smart children,
not only when setting it but also when adding new members.
A hack with the API indicates that the frame edje is a very
special object that does not propagate the flag.

See also:
7ce79be1a1
0f6c33eff1
9c9c8809a7
ac5ca9281c
2016-11-16 20:48:58 +09:00
Guilherme Iscaro 0e53b9a8ac Evas: Add support for multiple focused objects.
Using the multi-seat support, Evas is able to handle multiple focused objects.
This implementation allows one focused object per seat.
This patch introduces new APIs and events to handle this new scenario,
while keeping compatible with the old focus APIs.
2016-11-08 17:54:34 -02:00
Guilherme Iscaro 453770137f Evas: Add the default input devices for Evas.
This will be useful when Ecore_Evas is setting up the
EFL_POINTER/KEY_EVENT struct.
2016-11-08 17:54:34 -02:00
Jean-Philippe Andre 0c850f67ce evas: Fix previous pointer position in output coords
This fixes the test "Window Socket" map resize.
I broke that in 40fec5f608

Makes me wonder if the previous position should be exposed
in EO as well.
2016-11-08 14:15:14 +09: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
Carsten Haitzler b533f15880 evas - fix smart clipped if a move happens to recurse within itself
so since this uses new pos - cur pos to move BY x pixels... there is
an issue that if the move of the obj ends up re-moving the current obj
TO the same pos. it moved BY the same delta again thus racing ahead.
not great. because x/y is not stored until the call stack returns to
after the smart move func and the pos set storce the new position in
the object struct. the easiest way atm until we have relative
positioning etc. is to store this in the smart obj and use the delta
at that time of the call then store it immediately so a recursion ends
up with a delta of 0 if its the same pos, so go back to where we were.

this fixes a nasty issue i spotted in fileselector that made filesel
icons race along when scrolling 2x as fast as everything else. oddly i
couldnt see this in any other widget that scrolled when i looked...
which is odd, but... either way a nasty issue... subtle... and now
fixed. never saw this before so this seems new.
2016-10-28 08:21:50 +09:00
Jean-Philippe Andre 40fec5f608 evas: Fix legacy events output vs. canvas coords
In case of a mapped object (eg. when applying a map to a window
in wayland compositor), the canvas and output coordinates are
not meant to be the same.

In EO land, applications should instead use the common interface
Efl.Input.Interface.pointer_xy.get (on the canvas).

@fix
2016-10-26 13:42:54 +09:00
Subhransu Mohanty 8b7f060946 evas/module: add a new module in vg_saver for eet
Reviewers: cedric, jpeg

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D4350
2016-10-14 15:52:51 +09:00
Subhransu Mohanty 0d9b168146 evas/module: Added a new module vg_loader for svg
Reviewers: cedric, jpeg

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D4346
2016-10-12 18:39:10 +09:00
Jean-Philippe Andre 8a9f0bd603 evas/elm: Remove function group_resize
This is an override of efl_gfx_size_set. Same as before, the
order of operations matter so it is possible that a corner
case will break. In particular, legacy code was:
 - intercept
 - smart resize (do stuff), super, super, super
 - evas object resize

The new code is more like:
 - intercept
 - super, super, super, evas object resize
 - do stuff

But unfortunately this broke elm_widget (read: all widgets) as
the internal resize was done before the object resize. So,
inside the resize event cb, the resize_obj size would not match
the smart object size. >_<
2016-10-12 11:25:56 +09:00
Jean-Philippe Andre 62abe2cbff evas: Move clip_unset to legacy, remove group_clip
Similarly to group_color_set, group_clip_[un]set should not
exist and should be a result of efl_super and inheritance.

This patch also removes clip_unset from the EO API and keeps
only clip_set(NULL). The reason is that it will avoid bad overrides
of clip_unset() vs. clip_unset(NULL). This also simplifies the code
a bit. Ideally we should be able to reintroduce clip_unset in EO
if we can have a "@final" tag (like java's final keyword), to
prevent overrides.
2016-10-12 11:25:56 +09:00
Jean-Philippe Andre c60cc50f5a evas: Remove inexisting private function declarations 2016-10-12 11:25:56 +09:00
Jean-Philippe Andre 39949b022d evas: Add pseudo-internal API to intercept basic calls
This is a poor man's solution to get rid of group functions such
as clip_set, clip_unset, color_set, etc... See the following
commits.

This API needs to be EAPI for elementary but shouldn't be used
outside EFL. This is required purely for legacy compatibility.

Here's the call flow, inside show(obj):
1. if (intercept_show(obj)) return;
2. show(super(obj));
3. do other stuff
2016-10-12 11:25:55 +09:00
Cedric BAIL b5456893ee evas: start working on efl_canvas_output.
This should when done enable the possibility for multi screen in wayland
along with remote display, wireless display and screencasting.
2016-09-12 16:19:10 -07:00
Ji-Youn Park 7ce79be1a1 evas_render: fix clipping the whole area in each rendering.
evas_render should not be going and doing evas_object_clip_set () at all.
The framespace clip should be enforced at RENDER time.
2016-09-08 09:56:30 +08:30
Jean-Philippe Andre b2d92f2626 evas: Implement support for external buffers
This brings support for the eo api for external buffers (like
the old data_set / data_get). The new API now works with slices
and planes.

The internal code still relies on the old cs.data array for
YUV color conversion. This makes the code a little bit too
complex to my taste.

Tested with expedite for RGBA and YUV 422 601 planar, both
SW and GL engines (x11).
2016-09-06 16:55:00 +09:00
Jean-Philippe Andre 2f737e8f3b evas: Change internal function image_data_direct 2016-09-06 16:54:54 +09:00
Jean-Philippe Andre 8ee431572d evas: Switch EO APIs to Eina_Slice for gfx buffers (map)
This adds a plane and eina slice argument to the map/unmap
functions, instead of void_ptr + length.
2016-09-06 16:54:53 +09:00
Jean-Philippe Andre 1773ba5d82 evas: Internally switch to Eina_Slice for buffers
This will be used for the gfx buffer map/unmap eo apis.
2016-09-06 16:54:53 +09:00
Jean-Philippe Andre b3993b684e win: Add EO API to query state of multi touch points
This combines evas canvas functions to list and query
touch points into a single iterator:
 - evas_touch_point_list_count
 - evas_touch_point_list_nth_xy_get
 - evas_touch_point_list_nth_id_get
 - evas_touch_point_list_nth_state_get

This also fixes a number of issues related to feeding fake
input events.

Note: I wanted to add delta x,y information as well but it's
in fact not really possible outside the event callback itself,
as the previous x,y position will not be updated unless there's
an event.

@feature
2016-09-01 14:57:11 +09:00
Jean-Philippe Andre d504284dd2 efl: Rename Efl.Event.XX to Efl.Input.XX
This removes:
 Efl.Event interface

And renames:
 Efl.Event.Input -> Efl.Input.Event
 Efl.Event -> Efl.Input.Event (merged)
 Efl.Event.Pointer -> Efl.Input.Pointer
 Efl.Event.Key -> Efl.Input.Key
 Efl.Event.Hold -> Efl.Input.Hold

This also moves some interfaces from efl/ to evas/ where they
belong better.

This allows renaming Eo_Event to Efl_Event.
2016-08-26 10:18:01 +09:00
Jean-Philippe Andre 443aa91d53 evas: Simplify internal evas_object_event_callback_call
This removes the distinction between legacy and new eo style
event info, since all those types have now been ported to eo.
2016-08-26 10:18:01 +09:00
Jean-Philippe Andre ef4859d5bd evas: Optimize out most callback call events
This sets a bit whenever a callback listener is added.
I couldn't get any profiling data easily (too small for
valgrind).

Note: This removes the proper refcounting on the "move"
event listeners. I believe this is not a problem as most times
the move_ref goes to 0, it is because the object is deleted.
Worst case, we just trigger a callback_call with no listeners.

This adds 32 bits to each evas object private data.
2016-08-26 10:18:01 +09:00
Jean-Philippe Andre 57f0c850ec evas: Move event catcher to evas_callbacks.c
No functional change.
2016-08-26 10:18:01 +09:00
Jean-Philippe Andre 049a5ddb44 evas events: Remove now unused code 2016-08-26 10:18:01 +09:00
Jean-Philippe Andre 290413543d evas events: Switch wheel event to the new type
For now this covers only the wheel event.

Note: This patch also modifies evas map to use double in an
internal function, rather than ints.
2016-08-26 10:18:00 +09:00
Jean-Philippe Andre 6d6e41c5c9 evas: Fix mouse inputs when also listening to multi
Since the new event type is the same for multi and single
touch (finger id is the only difference), multi touch listeners
would get triggered even for single mouse events.

Fixes https://phab.enlightenment.org/T4345
Fixes https://phab.enlightenment.org/T4378

This raises a question though: How do we want to differentiate
between single & multi touch events in the eo interfaces?
2016-08-17 13:13:23 +09:00
Jean-Philippe Andre 6d52d1db2b evas: Fix ordering of input event
The previous patch 1185c40e50 shows how having
two event types for the same thing (key or mouse input events)
was a bad idea. The only guaranteed order of callbacks is the
priority but even that was not enforced (since legacy or eo
style event had to come first).

Fixes T4310
2016-08-16 20:22:57 +09:00
Tom Hacohen e65aae994e Eo: Finish the renaming of Eo to the EFL.
This renames all the rest of the API to the EFL namespace except for
Eo_Event that will follow soon.

Obviously breaks both API and ABI.
2016-08-15 15:07:42 +01:00
Tom Hacohen c662934be8 Change the EFL to follow the new Eo rename. 2016-08-11 17:04:43 +01:00
Carsten Haitzler ac10a00acc evas - on shutdown avoid potential invalid memory access
i don't know for sure if this fixes T4103 but in theory i think it
might given a reading of the backtrace and a guess at what might
happen, so try this fix. it doesn't hurt and can only help.

@fix
2016-07-19 15:43:22 +09:00
Jean-Philippe Andre 2078b74e28 evas: Use proper type for stringshares 2016-06-28 19:21:46 +09:00
Youngbok Shin 2ce33e73a7 evas: add pattern "style" when evas query fonts via fontconfig
Summary:
Some fonts can have weird style and weight value.
If a font has a style name as "medium" and a weight value as "semi-bold",
Evas can't load the font using "font=Somefont:style=Medium".
It only can be load with "font=Somefont:style=SemiBold" or
"font=Somefont:weight=SemiBold".
On the other hand, it could be loaded when I tested the following commands.
fc-match -s ":family=Somefont:style=Medium" or
fc-match -s ":family=Somefont:weight=SemiBold"

Evas also should load font based on font's style name.
@fix

Test Plan: N/A

Reviewers: tasn, herdsman, cedric, woohyun, raster

Reviewed By: raster

Subscribers: Blackmole, z-wony, jpeg

Differential Revision: https://phab.enlightenment.org/D4108
2016-06-28 13:32:49 +09:00