This code was all dead, since neither cairo-glesv2 nor the sample nested
compositor ever made it to the Meson build.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Instead of closing the window directly by calling close_handler() use a
deferred task to do that instead.
That way we avoid a potential invalid access on a link which was
previously removed, due to the fact both window_destroy() and
touch_handle_up() traverse the same list.
This is an alternative to 841.
Fixes: #607.
Suggested-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Reported-by: He Yong <hyyoxhk@163.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Commit 62ab6891db intended to change the angle calculation
so that the a time delta since the first frame would be used
instead of the absolute time. That was done in order to ensure
the angle would always start with the same value, allowing users
to differentiate left and right, which again is needed when
testing flipped transforms.
However, the `benchmark_time` variable is unsuitable for that
purpose as it gets reset on each benchmark interval, abruptly
changing the angle.
Thus introduce a dedicated variable.
Fixes 62ab6891db
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Buffer scale is common enough in the modern desktop space to
expect average GL clients to handle it. Thus lets include it into
our main example client.
While on it, also handle buffer transforms. It's essentially free
for GL clients in terms of computing power but may increase the
chance that Wayland compositors are able to hit scanout fast paths.
Thus having an example client for it is likely valueabel for client
and compositor developers.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Setting the opaque region correctly is common source of error for
clients that simply want to express that a whole surface is opaque.
This is especially true once buffer_scale and buffer_transform come
into play, as unlike for damage, where buffer_damage is the
encouraged and user friendly way today, opaque regions are always
in logical coordinates.
As faulty opaque regions don't have a visual impact in these cases
but only increase resource consumption, these errors often remain
for long times. See
1e2bc68171
for one of many examples.
Give an easy example how to set the opaque region in a conformant
and reliable way.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
It is used in Mesa. Lets switch to it as well in order to provide
good examples and encourage proper API usage.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Compositors may choose to send multiple scanout or non-scanout
tranches. So instead of assuming that the first respective tranche
contains the format/modifier we're looking for, check all tranches.
While on it, make sure that in case a compositor sends scanout
tranches on the initial feedback, `pick_format_from_scanout_tranche()`
does not unintentionally pick `INITIAL_BUFFER_FORMAT`.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
It doesn't and can't build, because it depends on cairo-gl. We already
have simple-egl which shows how to use EGL/GLESv2 on Wayland.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Weston uses a timeout of 2 seconds before it sends scanout
tranches to clients in order to not trigger excessive buffer
reallocations in clients.
`simple-dmabuf-feedback` in turn counts redraws (200) before
exiting. That doesn't work on e.g. 144Hz screens, thus use a
timer here as well.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
- Use more consistent style, e.g. the tree structure uses
the same indentation level throughout
- Swap format name and code for consistency with modifiers
- Use constants for ASCII art (taken from drm_info)
Signed-off-by: Simon Ser <contact@emersion.fr>
Rather than setting the fullscreen/maximized before initial
wl_surface.commit, make it part of the initial window state.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Rather than creating the wl_egl_window at the same time as wl_surface,
do it after we get the first configure event.
With it, we also defer eglMakeCurrent() as according to the spec, the
first time a OpenGL or OpenGL ES context is made current, the viewport
and scissor dimensions are set to the size of the draw surface.
This is particulary important when attempting to start simple-egl either
as fullscreen or as maximized, as not doing so will either incorrectly
commit a buffer with the original dimensions, and later on to resize to
the correct dimensions (which is the case for fullscreen), or it will
terminate the wayland connection abruptly due to xdg-shell protocol
violation, with a mismatch for the client's geometry (the case for
maximized).
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Daniel Stone <daniel.stone@collabora.com>
display->wm_base is checked right after handling registry object, and
with it the globals, so there's no to perform and additional check for
xwm_base.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Just like start as fullscreen, let us add a start as maximized as well.
It tests out the maximized state and with clients geometry checks.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Print a message when presentation switches to/from zero-copy mode.
This makes it easier to understand whether the compositor DMA-BUF
feedback was effective.
Signed-off-by: Simon Ser <contact@emersion.fr>
This fixes an issue when running simple-dmabuf-feedback:
"wl_display@1: error 1: invalid arguments for wl_surface@3.attach".
As we are not using create_immed request from zwp_linux_dmabuf_v1, we
can't start to use a dma-buf buffer before we process compositor's event
telling us that the creation succeeded.
This was causing problems in the following scenario:
1. buffer is marked to be recreated (because of dma-buf feedback);
2. in buffer_release() event, we destroy the buffer and recreate it;
3. after we recreate it, roundtrip is not called, as we don't want to
block during the drawing loop;
4. buffer status is not being properly tracked, so we are trying to
use a buffer before receiving the event from the compositor telling
us that the creation succeeded.
To fix this, this patch improves buffer status tracking. Now we only
pick a buffer in the drawing loop when it is available. Also, if we have
no buffers available we perform a roundtrip and try again, as we may
have recreated all of them but still didn't have the chance to process
compositor's events telling us that creation succeeded.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Using `pixel_format_get_info()` can result in formats being
reported as `UNKNOWN` when used on compositors other than Weston.
As `weston-simple-dmabuf-feedback` somewhat succeeds `wayland-info`
as tool for `zwp_linux_dmabuf_v1` debugging from version 4 on, copy
the approach from the later for these cases.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
In certain situations these clients crash a lot due to the low
buffer limit. Four buffers is also what EGL allows without blocking
and what is arguably the upper limit of what a compositor should
demand.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Users should rely on wayland-info from wayland-utils [1] instead.
We've been printing a deprecation since 85382d394a ("clients:
deprecate weston-info"), so users should be aware already.
[1]: https://gitlab.freedesktop.org/wayland/wayland-utils/
Signed-off-by: Simon Ser <contact@emersion.fr>
It's invalid for a client to pass the compositor's supported version
directly to wl_registry_bind. For instance, under wlroots the client
will bind to wl_output version 4 and crash because it doesn't handle
the new "name" event.
Signed-off-by: Simon Ser <contact@emersion.fr>
Adds appid for all clients using the toolkit, flower, fullscreen, image,
resizor, scaler, smoke, stacking, subsurfaces, terminal,
touch-calibrator, transformed, etc.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Since commit 992ee045f1 we create a new surface when we update the cursor
image. This broke animated cursors by discarding any existing frame
callback used for timing, and moving the setup for frame callbacks to
after the commit on the pointer surface.
To fix this we need another surface commit for the frame callbacks, but
this alone is not enough to fix the regression, as a lingering kludge
intended to fix problems when reusing the pointer surface is no longer
working as intended.
Since we no longer re-use the same surface, we can delete the old surface
on pointer exit, along with any callbacks set on it. Then a frame callback
will be recreated naturally. This lets us remove the now broken kludge
from the past and restore animated cursor functionality.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
As mesa includes gbm_bo_get_fd_for_plane() from 21.1.0 version onwards,
build the dma-buf feedback client only after that. This should provide
some sanity for package maintainers, as this would need pulling a
rather newer mesa version to build it (which might not be available).
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
When setting the window as opaque or fullscreen (which creates an opaque
region) make it so we don't have any alpha pixels set.
This was mistakenly dropped from a previous patch series update to
simple-egl.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This avoids some unwarranted errors about conditional jumps or
invalid access from ASan as malloc doesn't set the memory to zero.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Simple client to test the dma-buf feedback implementation. This does not
replace the need to implement a dma-buf feedback test that can be run in
the CI. But as we still don't know exactly how to do this, this client
can be helpful to run tests manually.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Constraining the buffer size of an EGLConfig to 32 means that
the sum of red, green, blue, and alpha channels must equal 32.
This constraint prevented weston-simple-egl from picking an
RGBX pixel format when an opaque surface was asked for, since
the typical RGBX pixel formats have buffer sizes of 30, 24,
and 16.
Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
The "sans" and "mono" aliases for "sans-serif" and "monospace" are
deprecated[1]. Let's standardize on the non-deprecated versions, which were
already in use in some places.
[1]: be453bd159/fonts.conf.in (L33-67)
Signed-off-by: Alyssa Ross <hi@alyssa.is>
When trying to get Weston to run on a new system I was building up bit
by bit, I encountered a problem: when I started weston-terminal, it
would close a split second later. This turned out to be because
weston-terminal defaults to trying to spawn /bin/bash, which my
busybox-based system didn't have.
I can configure the terminal to use a shell I do have, of course, but I
think /bin/sh is a much friendlier default, because it's more likely to
exist (POSIX requires it), and will save people just trying to get
started with Weston from the confusing experience I had. I think it's
better overall that somebody who specifically wants /bin/bash has to
configure that (if they even have to — depending on how they're running
Weston, $SHELL might already be /bin/bash) than somebody who just wants
to see the terminal working debug why it won't launch at all.
I realise there might be a (small) backward compatibility concern here
as well, but I hope I've made the case for a friendlier default.
Signed-off-by: Alyssa Ross <hi@alyssa.is>
This makes it possible to close this client without using a terminal,
especially useful on a phone.
Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
input-method-v1 protocol provides two surface type for the input
panel, `toplevel` and `overlay`. But there is no example for the later
one. This change enables to set weston-keyboard as overlay panel by the
environment variable `WESTON_KEYBOARD_SURFACE_TYPE=overlay` to
demonstrate this feature. In Addition, add weston.ini option
`overlay-keyboard` to set it.
Signed-off-by: Takuro Ashie <ashie@clear-code.com>
wl_shell is officially deprecated so remove support for it and
instead add support for xdg-shell. With it, we've further:
- moved out the buffer handling into its own a distinct structure in
case we might want to do multi-buffer rendering
- perform a redraw after we have receiving the initial configure event,
as to draw to working area where to user can use it for receving touch
events
Additionally we are setting an appid in case one might want to use it in
tandem with kiosk-shell as to be able to place it on a
distinct/different output.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Memleak found by ASAN:
Direct leak of 258 byte(s) in 8 object(s) allocated from:
#0 0x7f3eedb6e817 in __interceptor_strdup (/usr/lib/x86_64-linux-gnu/libasan.so.6+0x57817)
#1 0x55821ce5e6a5 in stream_alloc ../clients/weston-debug.c:94
#2 0x55821ce5e974 in stream_find ../clients/weston-debug.c:128
#3 0x55821ce5eb15 in debug_advertise ../clients/weston-debug.c:157
#4 0x7f3eed7b4d1c (/usr/lib/x86_64-linux-gnu/libffi.so.7+0x6d1c)
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Fixes ASan leak:
Direct leak of 80 byte(s) in 1 object(s) allocated from:
#0 0x7fe7791f4518 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9518)
#1 0x7fe779100892 in zalloc ../../git/wayland/src/wayland-private.h:232
#2 0x7fe779100892 in proxy_create ../../git/wayland/src/wayland-client.c:422
#3 0x7fe779100ede in create_outgoing_proxy ../../git/wayland/src/wayland-client.c:651
#4 0x7fe779100ede in wl_proxy_marshal_array_constructor_versioned ../../git/wayland/src/wayland-client.c:736
#5 0x7fe779101226 in wl_proxy_marshal_constructor ../../git/wayland/src/wayland-client.c:834
#6 0x56428c9bc578 in zwp_input_panel_v1_get_input_panel_surface protocol/input-method-unstable-v1-client-protocol.h:678
#7 0x56428c9c0bbb in set_toplevel ../../git/weston/clients/keyboard.c:965
#8 0x56428c9c0c8d in display_output_handler ../../git/weston/clients/keyboard.c:980
#9 0x56428c9ddead in display_handle_mode ../../git/weston/clients/window.c:5700
#10 0x7fe7786668ed in ffi_call_unix64 (/lib/x86_64-linux-gnu/libffi.so.6+0x68ed)
#11 0x7fe7786662be in ffi_call (/lib/x86_64-linux-gnu/libffi.so.6+0x62be)
#12 0x7fe779103fac in wl_closure_invoke ../../git/wayland/src/connection.c:1018
#13 0x7fe779100a48 in dispatch_event ../../git/wayland/src/wayland-client.c:1452
#14 0x7fe779101e43 in dispatch_queue ../../git/wayland/src/wayland-client.c:1598
#15 0x7fe779101e43 in wl_display_dispatch_queue_pending ../../git/wayland/src/wayland-client.c:1840
#16 0x56428c9e031c in handle_display_data ../../git/weston/clients/window.c:6211
#17 0x56428c9e2147 in display_run ../../git/weston/clients/window.c:6553
#18 0x56428c9c1559 in main ../../git/weston/clients/keyboard.c:1053
#19 0x7fe77885e09a in __libc_start_main ../csu/libc-start.c:308
#20 0x56428c9bc029 in _start (/home/pq/build/weston-meson/clients/weston-keyboard+0x19029)
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This fixes ASan report:
SUMMARY: AddressSanitizer: 151360 byte(s) leaked in 451 allocation(s).
The leaks can be observed if you let weston-desktop-shell start fully
before shutting down Weston. Many simple test suite tests are too fast
to hit this, or do not even use desktop-shell.
This clean-up code is copied from keyboard_handle_keymap().
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
== 8 bytes in 1 blocks are definitely lost in loss record 4 of 71
== at 0x48450F8: malloc (vg_replace_malloc.c:309)
== by 0x500213F: strdup (strdup.c:42)
== by 0x40A57F: display_handle_geometry (in weston-desktop-shell)
== by 0x4864D27: ffi_call_SYSV (in libffi.so.6.0.4)
== by 0x4865697: ffi_call (in libffi.so.6.0.4)
== by 0x4880E07: wl_closure_invoke (connection.c:935)
== by 0x487DD73: dispatch_event.isra.5 (wayland-client.c:1310)
== by 0x487EF87: dispatch_queue (wayland-client.c:1456)
== by 0x487EF87: wl_display_dispatch_queue_pending (wayland-client.c:1698)
== by 0x4104E3: handle_display_data (in weston-desktop-shell)
== by 0x40FE8F: display_run (in weston-desktop-shell)
== by 0x405AB3: main (in weston-desktop-shell)
Signed-off-by: Lujin Wang <luwang@nvidia.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>