Apparently when we initiate a client side move in ecore_wl2 we flag that
and send a mouse-up immediately on the next pointer enter.
Do the same for resize.
At some point this might need to be revisited, we should probably be
sending a "cancel" at the start of client initiated move/resize instead
of an up at the end?
Fix T6422
ecore_wl2_window_commit() must be called during window size negotiation,
but this currently trips a warning when no frame callback has been
received for the first commit. We can't even have frame callbacks at
that point because no buffer is attached.
Don't set up the commit_pending logic until after we have a buffer.
As strlen() cannot accept NULL (segfaults), we should check for valid
key, keyname, and compose strings here before passing to strlen().
@fix
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Small patch to reduce calls to strlen when sending key events. This
patch is loosely based on Phab D5567
@fix
Signed-off-by: Chris Michael <cp.michael@samsung.com>
We had a "clever" optimization that would keep a buffer on resize
if it was resizing up horizontal and fit within the previously
allocated stride.
Unfortunately, there still needs to be a buffer reconfigure between
client and compositor that wasn't taking place. Remove this for now.
Since surface handling is now done via modules, we need to ensure
the library can't be shutdown while a surface exists. Otherwise,
we get a segfault trying to call a function we've unmapped.
Fixes a bug on shutdown for some wayland clients using software
rendering.
If we have more buffers than we need for 100 frames then drop the oldest.
This can happen if we're on a hardware plane and then removed from it, or
really whenever the compositor feels like holding onto a few frames.
Trimming the queue too soon could result in having to do a costly full
frame redraw, so we wait a while to make sure we don't need one again.
Having more frames than we need costs us a little every draw since we
always use the oldest available. It also wastes memory.
When a surface leaves all outputs we can discard its buffers to save
memory.
Currently most compositors don't send leave events for iconify, so this
pretty much just saves us a cursor buffer under weston for now, but in
the future it could be used for freeing resources of offscreen (fully
occluded or iconified) windows.
We used to abandon all buffers even if they were locked. This can't
actually free them until they're all released by the compositor.
Instead just free any buffer the compositor doesn't have locked, so we can
still re-use them when they're released without needing a full redraw.
There's probably room for additional cleverness here. If we get a new
frame event before the buffer release we may want to keep it, and if we
get the release first we may want to abandon it.
It was currently only used internally and had the side effect of
creating a new buffer instead of just returning the existing one.
Now it's useful to external callers, as it only returns the existing
wl_buffer and has no freaky side effects.
It was originally thought that this could be common code for multiple
back-ends, but that doesn't really make sense now, so rename it to match
the other dmabuf functions.
The backend should allocate its own private data and return it instead
of a bool.
This assumes all back-ends will need some manner of private data, which
is certanly true for the one back-end we provide.
The specific surface code only needs these generic surface bits to pass
to buffer_create, so make a helper function for that instead of queries
for w, h, and alpha.
This tries to resize the buffer's useable area to fit the specified size -
this is possible if the stride of the buffer is larger than the current
width.
Clear out the window callback when doing session recovery, and
make sure we have a valid on if we get a double commit.
This should stop a session recovery crash, and fix a small leak per
recovery.
b48781aa6c fixed multiple bugs where the
display wasn't flushed correctly, however it was a little overzealous.
Some of the flushes were added after calls that only updated internal
state, some in internal functions in which the caller was already going
to flush, and some were after wayland protocol calls that are double
buffered anyway and won't do anything until a following commit.
Also, I've removes at least one long standing flush where the recently
added flush is in a better location than the original.
in the case where a connection was not actively rendering, there was nothing
which would trigger a display flush, leading to applications potentially
deadlocking
@fix
This fixes cycles of init/shutdown/init where ecore event types would
become invalid, since they are now stored in a dynamic array rather than
a statically stored array.
The risk here is that if a module of EFL tends to init/shutdown in a
"normal" scenario then the event type array will grow in a leaking
manner. This could be fixed by resetting those event ID's only when the
loop actually exits (EFL_EVENT_DEL on the main loop). I'm not using
EFL_EVENT_DEL in this patch as this would add too many event callbacks
to the main loop object, which may result in slightly slower event calls
to it, affecting the overall performance.
This allows something that only has the Ecore_Wl2_Window (ie: something
that isn't engine code) to force dropping of all the buffers.
This should be safe to call at any time as the buffer handling logic
will properly cleanup the buffers when async render is done with them
or the compositor releases them.
This will eventually be used when a wayland client receives a
wl_output.leave events to indicate it isn't displayed on any outputs.
Coverity detected a resource leak here because we were not freeing the
malloc'd 'obo' variable.
Fixes Coverity CID1382907
Signed-off-by: Chris Michael <cp.michael@samsung.com>
commit 0cf806005e correctly fixed a
leaked buffer. However, other code was already accounting for the
leaked reference to the buffer manager, so an extra deref happened
and broke the universe - but only on hardware that no developer
has access to for testing.
Small patch to destroy our test buffer before we exit the
_ecore_wl2_buffer_test function so that we do not leak here.
@fix
Signed-off-by: Chris Michael <cp.michael@samsung.com>
We no longer allocate 3 buffers at startup, we now allocate only as needed.
Trimming the queue will come later, as there are some situations where we
might need 3 buffers and later drop down to 2 (when on a hardware plane)
Most clients will only ever need 2 buffers, so this is a reasonable RAM
savings.
We should only open this when actually testing dmabuf. Otherwise we're
just wasting time and adding an opportunity to fail shm init over
unrelated issues.
Calling this multiple times even after it fails the first time is a legit
thing now. We'll be doing that when we want to test dmabuf at connection
start.
We use immediate mode dmabuf creation at runtime, but this can result in
clients being killed with no option to fallback if the buffers can't be
consumed by the compositor.
This test should catch when a system can allocate a dmabuf buffer and the
compositor claims to accept dmabuf, but the buffer can't actually be used
for whatever reason. We'll then use wl_shm at runtime instead of dmabuf.
It does us no good to be able to allocate dmabuf capable memory if the
compositor can't handle it. This should fix failures on systems where
allocation is possible but the compositor doesn't advertise dmabuf.
There are some binds at startup that result in additional information
being sent, so we may need to call wl_display_sync() multiple times, and
only send the client a SYNC_DONE event when the final one completes.
This moves all the platform specific buffer allocation into ecore_wl2
instead of the engine.
Note that this makes an internal struct available in the header. This
will be removed shortly.
We need at least version 2 for create_immed, so don't even bind the
global if it's useless to us.
This will also stop us from trying to use dmabuf (and getting killed by
the compositor) on older compositors that don't support the version we
need - we'll just use wl_shm instead when this pointer is NULL.
Flushing should be done where it's needed now, but we still
need the rest of the idle handler as something like mesa may
have dispatched its queue, which reads all the pending wayland
events. In that case we have events to process but the fd will
not poll readable.
@fix T6250
This is really several inseparable commits mashed together, as doing this
a piece at a time would introduce broken intermediate revisions.
Double buffer incoming "configure" state from the compositor so it's held
back during asynchronous render and processed at frame completion.
Hold off on certain requests if their API has been invoked during async
render.
This should fix a lot of races, cosmetic issues, issues where weston can
kill our clients for acking configure (or not) at bad times, etc.
This adds the concept of a "false commit" that just sends a surface
commit without changing any other state.
This is intended to be used by ecore_evas to request a frame callback
from the compositor
Seems my brain missed the efl release and started tagging new API
incorrectly in the doxy.
This is all beta API that should probably only be used by other EFL
internals anyway, but I suppose it's a good idea to try to be somewhat
correct.
I broke this in commit 1bb45f6e61
We intentionally *don't* flush in window_semi_free, as this could be
when there's no compositor left to flush to (in the case of session
recovery).