Commit Graph

67 Commits

Author SHA1 Message Date
Derek Foreman b5674b7885 wayland_shm: Remove useless function
This serves no purpose anymore.
2017-11-08 15:12:51 -06:00
Derek Foreman 73bddb4471 wayland_shm: Make EVAS_WAYLAND_SHM_DISABLE_DMABUF use new code
Use the new wl_shm allocation functions making the old wl_shm code
unreachable even with the use of the disable env var.
2017-11-08 15:12:51 -06:00
Chris Michael 39184e78af evas-wayland-shm: Remove need for useless free_region function
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-11-06 09:21:59 -05:00
Derek Foreman e207e05067 wayland_shm: Remove hidden from the outbuf
Outbuf shouldn't have to track its hidden status, that should be ecore_evas
problem.  Until now we were doing this because our kludgey wayland
ticking made things difficult, but I think it's safe to remove now.
2017-10-12 12:24:03 -05:00
Derek Foreman 656d892581 wayland_shm: Remove hidden from surface posting calls
Now that we tick based on frame callbacks it should be impossible to post
an update while hidden.
2017-10-12 12:24:03 -05:00
Derek Foreman 4a23e69bcc wayland_shm: Remove surface_set function
Now that we use the display's shm and dmabuf pointers we don't need to
update them.
2017-10-12 12:24:03 -05:00
Derek Foreman 3f576e8436 wayland_shm: Add Outbuf to Surface struct
We're going to need that soon.
2017-10-12 12:24:03 -05:00
Derek Foreman 7faa20f3c8 wayland_shm: Handle dirty bit outside of the backends
We don't have to query that deeply to know whether we need to redraw the
buffer or not, we can make that decision in more generic code.
2017-10-12 12:24:03 -05:00
Derek Foreman 2a15d7b730 wayland_shm: Store the ecore_wl2_display in the Outbuf
We'll need it soon.
2017-10-12 12:24:03 -05:00
Cedric BAIL 3e88aa37bc evas: Render_Engine_Swap_Mode is actually about output swap. 2017-08-25 10:49:15 -07:00
Derek Foreman 972633e7e8 wayland_shm: Remove direct access to wl_surface
Querying it through Ecore_Wl2_Window now
2017-08-18 14:27:32 -05:00
Derek Foreman e3b9fbaed8 wayland: Put Ecore_Wl2_Win instead of wl_surface into the engines
We'll need to track some state in a common way, so attaching it to the
window seems like a good idea.
2017-08-18 14:27:31 -05:00
Chris Michael 6c9dc2a5ba evas-wayland-shm: Compare hidden flag during reconfigure
Small patch to compare if the hidden flag being passed in is the same
as the one stored in Outbuf. With the addition of xdg_shell v6
support, we cannot commit a surface with an existing buffer until the
surface has been configured. In order to facilitate this, we will use
the 'hidden' flag so that any surface_post does not actually attach a
buffer unless configure has already been handled on the surface.

ref T5090

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-01-11 12:36:33 -05:00
Chris Michael d1216ba7dd evas-wayland-shm: Minor formatting fix
NB: No functional changes, just formatting

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-01-11 12:36:16 -05:00
Derek Foreman 4c1227433f wayland_shm: Add a way to update the stored wayland objects
On session recovery the engine needs to be given new copies of the
surface, dmabuf, and shm objects to run in the new connection.

This fixes session recovery breakage introduced when we stopped recreating
the outbuf on reconfigure.
2017-01-05 13:40:31 -06:00
Derek Foreman 7b0f937880 wayland_shm: Add a force flag to surface reconfigure
We're going to need a way to force reconfigure unconditionally to make
session recovery work again.
2017-01-05 13:40:31 -06:00
Chris Michael 5ebba44635 evas-wayland-shm: Don't destroy Outbuf on resize
On an engine resize, rather than destroy & recreate the Outbuf
structure (and the associated surface) we can just call the
eng_output_resize function (which in turn will call
outbuf_reconfigure) to update Outbuf with new properties. This saves
us from having to create a whole new Outbuf every time we resize.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2016-12-06 13:03:52 -05:00
Chris Michael 9492ee21df evas-wayland-shm: Fix issue of destroying & recreating wl_surfaces on hide
When a canvas gets hidden, we don't need to destroy & recreate the
wl_surface. We can simply attach a NULL wl_buffer to the surface which
achieves the same result. This saves us from having to always destroy
& recreate surfaces when we hide/show.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2016-12-02 14:25:10 -05:00
Derek Foreman 9b6ec1ecc3 wayland_shm: enable dmabuf by default
Software rendered wayland clients will now attempt
to use dmabuf on some platforms.  This results in a window
that a compositor may be able to drop into a plane without a copy.

Disable it with the env var EVAS_WAYLAND_SHM_DISABLE_DMABUF
but if you need to disable it, please ping me or file a bug report.
2016-12-01 15:05:52 -06:00
Derek Foreman af4a71bcf0 wayland evas engines: share engine info structure
These engines are incredibly similar - by sharing the same engine info
structure we'll be able to simplify the wayland ecore_evas bits and
make them much more maintainable.
2016-11-02 13:37:01 -05:00
Chris Michael 21a8fbde7e evas-wayland-shm: Don't post updates to surface if no surface
In the event that an ecore_evas (using wayland_shm) gets hidden then
the corresponding wl_surface gets destroyed. If evas_norender is
called after that, the outbuf_redraws_clear function follows.
Outbuf_redraw_clear function ends up trying to post updates to the
wl_surface however if that wl_surface is gone, then we end up crashing.

This patch addresses that issue by checking for a valid wl_surface
inside the engine before trying to post updates to that wl_surface.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2016-10-28 09:55:27 -04:00
Chris Michael 001d8255b8 evas-wayland-shm: Remove unused varible
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2016-10-26 12:18:30 -04:00
Chris Michael 0fa7abae7b evas-wayland-shm: Get page flips out of the render thread
Now that we have redraws_clear exposed through software generic, we can
use that to do the final buffer swap from the main thread instead of doing
it in outbuf_flush which runs from the render thread.

This becomes more important later when other call sites in the main thread
will perform buffer flips.

Based on 95a00b8e49 by Derek Foreman

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2016-10-26 12:00:39 -04:00
Chris Michael bb2a55ead6 evas-wayland-shm: Default to triple buffering
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2016-10-26 11:33:07 -04:00
Derek Foreman 7a978fe58c evas_engines: Send both surface and buffer damage to outbuf_flush callback
Some engines should using sending surface damage, until now we'd only ever
provided them with buffer damage.

The difference is that surface damage is the damage to the surface the
compositor is displaying, and the buffer damage is the damage to the
buffer the client has rendered.  These are different when the client
is using multiple buffers of different ages to render into.

Anything that calls eglSwapBuffersWithDamage, wl_surface_damage() or
wl_surface_damage_buffer() should be using surface damage, and not
buffer damage.

This patch is intended to make no functional change - any flush cb that
used buffer damage before still should.  Actual fixes to follow.

Apologies if I broke any engines - it's a bit of a copy and wasteland
out here.
2016-10-19 16:29:05 -05:00
Derek Foreman 455afb707f Revert "wayland_shm: Add swap mode fallback when buffer age changes"
This reverts commit 62ca4486ea.

Honestly, I think the gl_x11 code doesn't make sense either. :)

There's no logical reason that we have to do that, though it may be
hiding some other bug?  If that's the case, the bug should be fixed
properly.
2016-10-19 16:29:05 -05:00
Jean-Philippe Andre 62ca4486ea wayland_shm: Add swap mode fallback when buffer age changes
This copies the behaviour in opengl_x11 engine, where the buffer
age needs to be continuously the same to be taken into account.
If the age varies, then we fallback to a full redraw.

Apparently this fixes issues on actual devices. I tested this
patch in weston (I didn't have issues before and buffer age is 1).
2016-10-18 17:40:01 +09:00
Chris Michael 59a09e04aa evas-wayland-shm: Remove logically dead code
Coverity reports that this bpp check is actuall dead code due to the
fact that bpp can never be < 0.

Fixes Coverity CID1357144

@fix

Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-06-30 10:56:01 -04:00
Derek Foreman d2a3502481 wayland_shm: Make dmabuf opt-in
Some weird bugs and performance issues around these days, and I
keep chasing them in dmabuf first.  Removing it from the equation for
now.
2016-06-23 13:55:03 -05:00
Derek Foreman 16108a972f wayland_shm: Fix bad indenting 2016-05-03 14:24:45 -05:00
Derek Foreman 4f6e7a8ab3 wayland_shm: Fix dmabuf fallback to shm
The outbuf code should free the surface structure, not the dmabuf
abstraction or a use after free occurs on fallback.

Re-organize some code to make sure we don't rely on anything that may
have already been freed.

Add a wl_surface_commit() to keep the animation timer alive through
the fallback process.
2016-05-03 14:24:45 -05:00
Derek Foreman 45a662c91c wayland_shm: Add dmabuf support
This adds a separate backend to the "shm" engine that allows allocation
of buffers via libdrm that can be turned into dmabuf handles and used
with the wayland dmabuf extension.

Currently only the intel buffer manager is supported.

The benefit of dmabuf buffers is that they don't require a texture upload
like shm buffers do, and when we have plane support they can be dropped
directly into a plane without a memcpy.
2016-04-19 15:11:10 -04:00
Derek Foreman 0d684d4559 wayland_shm: Refactor surface creation
Split this into two parts, one that makes the base surface, one that
calls the potential back ends.

Once the dmabuf backend is added this will allow a fallback path to
re-initialize the surface as wl_shm if dmabuf fails.
2016-04-19 15:11:10 -04:00
Derek Foreman 8635f56aeb wayland_shm: pass engine info to shm_surface_create
Gratuitous change to pass less parameters and make some code prettier.
2016-04-19 15:11:10 -04:00
Derek Foreman 0ada4d3d56 wayland_shm: Pull the damage stuff out of evas_shm
This doesn't really care what the buffers were allocated with, so
let's make this chunk of code useful to both the shm method and the
upcoming dmabuf one
2016-04-19 15:11:10 -04:00
Derek Foreman 2c33bae2d5 wayland_shm: Don't pass num_buff to reconfigure
We can't really reconfigure the number of buffers after they're created,
there's nothing above us that would try to do it...
2016-04-19 15:11:10 -04:00
Derek Foreman e5fb4cada7 wayland_shm: Gratuitous code simplification
Refactor evas_outbuf_setup a bit so there's only one call to
_evas_shm_surface_create.

Also makes the NULL return on unhandled rotation a lot more obvious.
2016-04-19 15:11:09 -04:00
Derek Foreman 405b278528 wayland_shm: Pass Evas_Engine_Info_Wayland_Shm directly to setup functions
We pretty much pass all its contents anyway.
2016-04-19 15:11:09 -04:00
Derek Foreman ed665ee6ee wayland_shm: Abstract the actual shm operations
Make the Surface carry function pointers and the shm surface create
function set them.  This refactor makes implementing dmabuf operations
simpler.
2016-04-19 15:11:09 -04:00
Derek Foreman 4c61ec5e05 wayland_shm: Remove unused dx, dy params from resize functions
We don't appear to actually use these for anything except long term storage
2016-04-19 15:11:09 -04:00
Derek Foreman 7e2f5e759e wayland_shm: Remove flags
We only used this for resize, and didn't actually even need it then.
2016-04-19 15:11:09 -04:00
Derek Foreman 745435deab wayland_shm: Don't use number of buffers in swap mode calculation
The number of allocated buffers shouldn't change a thing...
2016-04-19 15:11:09 -04:00
Derek Foreman f92c2d2330 wayland_shm: Return buffer age from shm_surface_assign
This makes refactoring the Surface abstraction a little easier.
2016-04-19 15:11:09 -04:00
Chris Michael 6a1a1305b5 evas-wayland-shm: Fix rotation for wayland shm engine
Prior to this fix, window rotation was not operating correctly and the
surface contents would get rendered at the wrong size and position.
This patch fixes the engine so that rotation operates properly now.

NB: Tested with the Window States(2) test in elementary

Thanks to shiin for reporting :)

@fix

Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-03-21 09:29:32 -04:00
Derek Foreman ddae80af1d wayland: use wl_surface.damage_buffer if available
Summary:
wl_surface.damage_buffer() takes surface damage in buffer co-ordinates.

Right now since we don't use wayland's scaling, transforms, or viewports
it's exactly the same as wl_surface.damage().  In the future if we start
using those features it's much easier to do so with damage_buffer().

Reviewers: zmike, devilhorns

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D3457
2015-12-28 09:09:04 -05:00
Tom Hacohen 4a92415d12 Evas engine wayland_shm: pass the correct enum value.
Following this patch, the correct enum type is now passed to this
function. It's also passing the same value (0), but now from the correct
enum. This doesn't change behaviour, and looks like what was intended.

This fixes the clang warning.
2015-10-09 14:24:30 +01:00
Chris Michael 37718b2cf6 evas-wayland-shm: Fix silly typo
Summary: OOpppss, this should be eina_rectangle_free

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-10-08 15:15:00 -04:00
Chris Michael dd8ec36962 evas-wayland-shm: Don't leak rectangles during flush
Summary: As we loop the regions of the output buffer and accumulate
changes to post, we should be freeing the rectangles when we are done
with them.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-10-08 13:35:07 -04:00
Chris Michael fae40e995b evas-wayland-shm: Pass along the wl_display parameter to the surface creation function
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-07-30 15:10:49 -04:00
Chris Michael 37b767994e evas-wayland-shm: If no depth is specified during reconfigure, use existing depth
Summary: This fixes a crash which Could occur if no outbuf depth was
given during a call to reconfigure.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-07-30 13:53:10 -04:00