Commit Graph

341 Commits

Author SHA1 Message Date
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