This adds a test that tries to simulate a simple game loop that would
be like this:
while (1) {
draw_something();
eglSwapBuffers();
}
In this case the test is relying on eglSwapBuffers to throttle to a
sensible frame rate.
The test then verifies that only 2 EGL buffers are used. This is done
via a new request and event in the wayland-test protocol.
Currently this causes 3 buffers to be created because the release
event generated by the swap buffers is not processed by Mesa until it
blocks for the frame complete event in the next swap buffers call, but
that is too late.
This can be fixed in Mesa by issuing a sync request after the swap
buffers and blocking on it before deciding whether to allocate a new
buffer.
The surface type now no longer changes and we track pending state changes in
next_state. Instead of testing type != next_type to detect changes in
state, we just look at state_changed.
An xwayland surface corresponds to a override-redirect window under X,
which is typically a menu or a popup window. They typically appear
with a keyboard and mouse grab and by nature of being override-redirect
these window can appear anywhere on screen and in the stack.
We need to resort to heuristics to decide where to place the
override-redirect in our surface stack, and for now we'll just put it on
top of everything. That's going to be correct for almost all cases of
clicking to open a menu, but we can revisit and refine if we run into
a case that needs better handling.
Just as for set_maximized() we can move the setting of the fullscreen and
state_changed flags into the common set_fullscreen() function. This
function is also used from the xwayland wm to set fullscreen windows, and
with this change that now works again.
We can set the maximized and state_changed flags in set_maximized(),
which is shared between shell_surface_set_maximized() and
xdg_surface_set_maximized().
Since internally there's no more SHELL_SURFACE_FULLSCREEN and
SHELL_SURFACE_MAXIMIZED, the surface must be set to
SHELL_SURFACE_TOPLEVEL on the respective functions.
This fixes the bug when clients start already in fullscreen mode. In
that case, they aren't set first to toplevel, and then change to
fullscreen. They are set as fullscreen directly, not receiving the
SHELL_SURFACE_TOPLEVEL type on the set_fullscreen function.
The gl renderer typically repaints everything since we don't have
EGL_buffer_age under X, but the pixman renderer carefully only repaints
damaged regions. So to actually repaint anything with the pixman
renderer, we need to damage the output.
https://bugs.freedesktop.org/show_bug.cgi?id=72351
Adds a second renderer implementation to the nested compositor example
that creates a subsurface for each of the client's surfaces. The
client buffers are directly attached to the subsurface using the
EGL_WL_create_wayland_buffer_from_image extension instead of blitting
them in the redraw_handler.
The new renderer is always used if the parent compositor supports the
wl_subcompositor protocol and the EGL extension is available.
Otherwise it will fall back to the blit renderer.
Eventually the nested compositor example will want to be able to cope
with either rendering as it does now with a blit to an intermediate
surface or by attaching the client buffers directly to a subsurface
without copying. This patch moves the code that is specific to the
blitting mechanism into a separate set of functions with a vtable to
make it easier to add the second way of rendering in a later patch.
Previously the frame callback list was tracked as part of the global
compositor state. This patch moves the list to be part of the surface
state like it is in Weston. The frame callback now iterates the list
of surfaces to flush all of the callbacks. This change will be useful
when the example is converted to use subsurfaces so that it can have a
separate frame callback for the subsurface and flush the list for an
individual client surface rather than flushing globally.
The nested compositor example now responds to damage requests and
tracks them in the pending buffer state. This isn't currently used for
anything and it is immediately discarded when the surface is commited
but it will be used later when the example is converted to use
subsurfaces.
The buffer and frame callback state on the surfaces in the nested
compositor example are now double-buffered so that they only take
effect when the commit request is received. This doesn't really make
much difference for the current state that the example has but it will
be useful when more state is added in later patches.
This copies the buffer reference busy count implementation from Weston
to the nested compositor example and adds an internal nested_buffer
struct that we could eventually use to attach data. This will be
useful to adapt the example to use subsurfaces so that we can attach
our compositor-side buffer to the resource.
Otherwise if the surface is destroyed then it will crash when it later
tries to render all of the surfaces. You can replicate this by doing
killall weston-nested-client while the example is running.
udev-seat will call weston_launcher_open(), so we better init launcher
first. Fixes a segfault.
Cc: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Fix the default seat name, so that we can find the input devices by
default.
This is just a quick fix. Further enhancement would be to make the
default seat on rpi taken from a command line option like the other
backends do. Furthermore, udev_input_init() should accept NULL as seat
to use the default seat, avoiding us hardcoding "seat0" all over.
Cc: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
In a recent commit 37d38d932c, "rpi: Use
common udev_input for input device handling", the rpi-backend was made
to use the common udev code.
It just forgot to actually build the common udev code into the
rpi-backend.
Cc: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Compiling fbdev backend on RaspberryPi caused the following warning:
compositor-fbdev.c: In function 'fbdev_compositor_create':
compositor-fbdev.c:929:6: warning: passing argument 2 of
'gl_renderer->create' makes integer from pointer without a cast [enabled
by default]
compositor-fbdev.c:929:6: note: expected 'EGLNativeDisplayType' but
argument is of type 'void *'
Fix the definition of EGL_DEFAULT_DISPLAY to match the definition in
EGL/egl.h (of Mesa).
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
The tablet-shell is unmaintained and unused. It is currently
dead-weight and a burden when we make changes to weston. Let's
drop it for now, we can pull it out of git if we find a need for it later.
This fixes crashes caused by popup windows that don't have override_redirect
(e.g., menus in VLC and KDE apps).
Signed-off-by: Dima Ryazanov <dima@gmail.com>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
Fixes a crash caused by accessing a deleted view in weston_wm_window_schedule_repaint. It can be easily reproduced by switching between menus in Firefox.
Signed-off-by: Dima Ryazanov <dima@gmail.com>
The commit "Remove the weston_view.geometry.width/height fields" changed
the type of the surface configure callback function, but did not change
the callbacks in data-device.c. This commit fixes the type of the
functions left needed to be changed.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
The logind API was designed to allow any kind of devices and any number of
devices. It has no idea of "main DRM device" or similar. However, the
weston DRM backend was designed with a single DRM device as master.
Therefore, we wake it up unconditionally on session-wakeup. But this may
fail with logind as a session may be awake, but not all devices have been
resumed, yet.
Therefore, we change the weston-logind backend to deal with this case
correctly. Instead of waking up the compositor on session-wakeup, we wait
for the main DRM device to wake up. Once we get the event, we notify the
compositor.
For sleep, we reverse this logic. On *any* of the following events we
tell the compositor to go to sleep:
- Session gets inactive
- DRM device gets inactive
- DRM device is removed
This guarantees, that weston is only active if *both*, the session and the
main DRM device are awake/active.
Note that we could actually rely solely on the DRM-device Pause/Resume
events from logind and drop all the Active-Prop-Changed handling. logind
guarantees proper ordering of both. However, in case we ever change weston
to support multiple GPUs, we need the per-device notification. Thus, keep
the code. This also makes weston more fail-safe in case logind fails to
send the PauseDevice event (for whatever reason..).
The parent update on set_maximized and set_fullscreen is a behavior of
wl_shell.
That does not happen on xdg-shell, so it can't be in the set_fullscreen
and set_maximized common code, but rather in the wl_shell_surface
interfaces.
These surface types don't exist anymore inside weston desktop shell
implementation. They are just exposed as wl_shell surface types, but
internally the implementation is done with surface states.
The previous behavior (setting a surface type unsets another one) still
happens when using wl_shell. This change is mainly done as a refactory
to allow xdg-shell to use the same code.
xdg_shell is a protocol aimed to substitute wl_shell in the long term,
but will not be part of the wayland core protocol. It starts as a
non-stable API, aimed to be used as a development place at first, and
once features are defined as required by several desktop shells, we can
finally make it stable.
It provides mainly two new interfaces: xdg_surface and xdg_popup.
The xdg_surface interface implements a desktop-style window, that can be
moved, resized, maximized, etc. It provides a request for creating
child/parent relationship, called xdg_surface.set_transient_for.
The xdg_popup interface implements a desktop-style popup/menu. A
xdg_popup is always transient for another surface, and also has implicit
grab.