We have no guarantee that we can create a surface for the pointer at the
instant we receive a seat that will (probably eventually) need one.
Hold off until we receive an enter event before creating this - at that
point we know with certainty that wl_compositor is available, since we've
used it to create the surface that was entered.
Fixes#659
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
With commit 62ab6891db, 'clients/simple-egl: Handle buffer
scale and transform' we changed the way we resized the client, by
encapsulating the resize in update_buffer_geometry() function.
we didn't correct that when creating the EGL window, which might be
problematic if you attempt to start the window with different a
different state, like maximized.
Fixes 62ab6891db
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
If weston-simple-egl is run with the "-b" flag, it will attempt to set
the swap interval to 0 during create_surface. However, at that point, it
will not have made its EGLContext current yet, causing the
eglSwapInterval call to have no effect. To fix this, wait until the
EGLContext has been made current in init_gl before updating the swap
interval.
Signed-off-by: Erik Kurzinger <ekurzinger@nvidia.com>
We want atomic hotspot updates - this can't happen with
wl_pointer_set_cursor. So if we have a surface that already has a cursor
role, just update the hotspot when attaching new content.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This reverts commit 992ee045f1.
Recreating the surface for every cursor change causes flickering
cursors on some compositors, and is not the best way to achieve
atomic cursor updates
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This reverts commit f079f43658.
This only partially fixed a problem introduced in
992ee045f1
I'm reverting that commit in favor of a different fix, so this
broken fix needs to go first.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
It seems we've missed an update from 3 to 4 (bounds events). With it,
this updates to version 5 which sends the capabilities event. Stubs, as
we're not using them.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This file relied on shared/xalloc.h to include <libweston/zalloc.h>.
That would be a problem if xalloc.h stopped doing that.
Just use xzalloc().
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Recently I learnt that fprintf() is not async-signal-safe. Maybe it also
attempts to allocate memory sometimes. Hence, using it when we
presumably are out of memory is wishful thinking.
Therefore replace that with async-signal-safe code. If you have to check
pointers from traditional signal handlers, now you could do that too!
While doing this, we also lose the string formatting for line number. I
would argue that printing file and line number is not that useful, if
the system really is out of memory. If not out of memory, a core dump
would give us much more detailed information about what went wrong.
clients/window.c had some calls to fail_on_null() and these are simply
replaced. They were used for checking that creating new wl_proxy by
issuing a protocol request worked, and IIRC that only fails on
out-of-memory, so the same rationale applies here.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Rather than open-coding our own implementation of parsing a string to
construct an envp and an argp, just use custom_env's implementation.
Signed-off-by: Daniel Stone <daniels@collabora.com>
It was binding to any advertised version, but it can't actually work
with version 4 (because it doesn't handle the new configure_bounds
event).
Other sample clients in the tree are hard-coding version 1, so do the
same here.
Fixes: 6d9fda7156 ("clients/presentation-shm: use xdg_shell instead of wl_shell")
Signed-off-by: Michel Dänzer <mdaenzer@redhat.com>
Pango, Cairo, and fontconfig, all want to leave thread-global data
hanging around in order to maintain a cache. Try to clean up as much of
it as we possibly can on exit, apart from the Pango language string
which appears to be unfreeable, so has been added to LSan suppressions.
Signed-off-by: Daniel Stone <daniels@collabora.com>
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>
Another patch will want to call global_destroy() too.
Pure refactoring, no functional change.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This fixes a bunch of leaks when trying to run a Weston test with
desktop-shell, which spawns weston-keyboard.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Trying to run viewporter-test with ASan leak checking,
weston-desktop-shell helper client reports many leaks, because the
compositor quits before the client can start. Hence the
wl_display_roundtrip() fails.
Clean up by calling display_destroy() when wl_display_roundtrip() fails.
It's late enough that all kinds of things may have been allocated, so a
special local tear-down path is not feasible.
To make that work, display_destroy() must handle many things that might
be NULL which normally aren't. Also display_create() needs to initialize
lists early enough so that cleaning them up works.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Currently, Weston clients update the pointer cursor by first issuing
a wl_surface.commit request to update the buffer, then a
wl_pointer.set_cursor request to update the hotspot. This causes an
issue because buffer and hotspot aren't updated atomically: in-between
the two requests, the buffer is new but the hotspot is old.
To fix this issue, create a new surface each time the cursor is
updated.
Signed-off-by: Simon Ser <contact@emersion.fr>
While this is harmless because gbm_bo_create_with_modifiers will just
fail, it's easy to misunderstand that gbm_bo_create_with_modifiers
accepts MOD_INVALID. Let's just keep modifiers_count to zero instead
and stop even trying to call that function with invalid input.
Stop using modifiers_count to decide whether the compositor supports a
format. Instead use a separate format_supported flag.
Signed-off-by: Simon Ser <contact@emersion.fr>
References: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7601#note_778845
This allows to specify a custom DRM format. For instance, to test
XBGR2101010:
weston-simple-dmabuf-egl -f 0x30334258
Signed-off-by: Simon Ser <contact@emersion.fr>
This header is for sharing fallback definitions for drm_fourcc.h. A new
test in tests/yuv-buffer-test.c is going to be needing XYUV8888 format,
and more new formats will be expected with HDR supports.
Share these fallback definitions in one place instead of copying them
all over.
All users of drm_fourcc.h are converted to include weston-drm-fourcc.h
instead for consistency: have the same definitions available everywhere.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
MOD_INVALID came with libdrm 2.4.83 and MOD_LINEAR came with libdrm
2.4.82. libweston unconditionally depends on libdrm >= 2.4.95, so the
fallback is not necessary.
Since linux-dmabuf.h itself has no use for these and also forgets to
include drm_fourcc.h, .c files including drm_fourcc.h after this header
would trigger compiler warnings.
linux-dmabuf.c does need these, so add the proper include.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Fixes: #400
the clock on upper right corner of screen for
desktop shell is behind one minute when compared
to output of date command, so change initial expiration
it_value for minute and sec to remove the delay.
Signed-off-by: Veeresh Kadasani <veeresh.kadasani@huawei.com>
We have two functions with the name weston_screenshooter_shoot():
1. screenshot protocol function that the screenshooter
client uses to request screenshots to the compositor
2. libweston function used by the compositor to take
screenshots as requested by the screenshooter client
Until now we had no problem with that, but in the next commits
we are going to use the screenshot protocol in the test suite,
which is also user of libweston. So rename screenshot protocol
function to weston_screenshooter_take_shot() to avoid the conflict.
For consistency, also rename screenshooter_shoot() to
screenshooter_take_shot() in compositor/weston-screenshooter.c
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
If weston.ini is not setting background-image path,
then desktop-shell sets ${DATDIR}/weston/pattern.png
as background. However in this case width and height
is set to 1 during background config and is being
scaled to avoid allocation of buffer.
This behavior is not right. Along with background-image
path, we should also check if background-color is set.
If background color is set, then only scale 1x1 buffer.
This would allow to set pattern.png as default wallpaper
of weston correctly, if background-color is also not set
in weston.ini file.
Fixes: 3623e46dc5
Signed-off-by: Tanmay Shah <tanmay@codeaurora.org>
weston-info is now deprecated in favor of wayland-info which is part of
wayland-utils.
Add a note to weston-info to inform users that weston-info is deprecated
and will be removed soon.
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
It was discovered in issue #99 that the implementations of the 90 and 270
degree rotations were actually the inverse of what the Wayland specification
spelled out. This patch fixes the libweston implementation to follow the
specification.
As a result, the behaviour of the the weston.ini transform key also changes. To
force all users to re-think their configuration, the transform key values are
also changed. Since Weston and libweston change their behaviour, the handling
of clients' buffer transform changes too.
All the functions had their 90/270 cases simply swapped, probably due to
confusion of whether WL_OUTPUT_TRANSFORM_* refers to rotating the monitor or
the content.
Hint: a key to understanding weston_matrix_rotate_xy(m, c, s) is that the
rotation matrix is formed as
c -s
s c
that is, it's column-major. This fooled me at first.
Fixing window.c fixes weston-terminal and weston-transformed.
In simple-damage, window_get_transformed_ball() is fixed to follow the proper
transform definitions, but the fix to the viewport path in redraw() is purely
mechanical. The viewport path looks broken to me in the presence of any
transform, but it is not this patch's job to fix it.
Screen-share fix just repeats the general code fix pattern, I did not even try
to understand that bit.
https://gitlab.freedesktop.org/wayland/weston/issues/99
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This adds a new NULL check to fail earlier when frame_create fails. This can
happen because PNG files couldn't be loaded from the data directory.
Signed-off-by: Simon Ser <contact@emersion.fr>
For certain cases when using vivid module, some display-controllers
require to allocate the dmabuf in a contiguous fashion so explain that
to the user when adding details about vivid module.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Makes use of weston-direct-display protocol to pass the dmabuf
straight to the display-controller if such a path is possible.
Removes the Y_INVERT flag in case that was passed, and notifies
the user about it, as the weston implementation would force going
through the renderer when passing the Y_INVERT flag, but in the same
time direct-display avoids any GPU import so having them both in the
same time would result into weston refusing the create a buffer.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Allow clients to pass Y_INVERT, not only when v4l reports it so.
Document it briefly and add a note about this Y_INVERT flag is passed
if the camera sensors is detected as being y-flipped.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Makes adding further flags/options/args much easier.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Pekka Paalanen <pekka.paalanen@collabora.com>
We're missing format checks and still using first version of
zwp_linux_dmabuf protocol. Use the latest release and check that the
advertised formats/modifier accepts the user-supplied requested DRM
format.
Accept the format only if the modifier is LINEAR (@emersion).
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Declare touch_handle_shape and touch_handle_orientation as static
functions as they are local to window.c.
Signed-off-by: Guillaume Champagne <champagne.guillaume.c@gmail.com>
protocol
As dmabuf uses a different coordinate (top-left) system than OpenGL
(bottom-left) using both direct-display with the Y_INVERT dmabuf attrib
flag would result in the image being inverted (direct-display will
remove the Y_INVERT flag, which caused the image to be displayed
correctly). Notifies users that direct-display is in use.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Remove member preferred_format from struct window and hardcode
ARGB32 pixel format for clients/window.
The member preferred_format was first added to allow hinting
of a preference for RGB565 when creating a window. But it is
not being used for a long time now. So it's safe to remove it
from the code, dropping support for RGB565 in clients/window.
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
This header is not used anymore.
Signed-off-by: Simon Ser <contact@emersion.fr>
Fixes: 0a4f6e7d6d ("clients: drop simple-dmabuf-drm")
Reported-by: Marius Vlad <marius.vlad@collabora.com>
When option-parser is confronted with a boolean option, have it write a
bool rather than treating the value as a pointer to an int32.
(lib)weston already heavily uses bool types internally, so this has the
nice side effect of eliminating quite a few local variables which only
existed as integer shadows of internal boolean variables.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Wayland innovated a lot of cool things, but non-binary boolean values is
the great advances of our time.
Make config_parser_get_bool() work on boolean values, and switch all its
users.
Signed-off-by: Daniel Stone <daniels@collabora.com>
This client contains driver-specific code to allocate buffers. However clients
shouldn't contain driver-specific code and should rely on e.g. mesa to allocate
buffers via standard interfaces.
Additionally, because the build system always tries to enable all features, some
experimental drivers and drivers that aren't included in amd64 distribution
packages were required. Users would need to manually disable some drivers.
Releasers would need to install libdrm from source (because the release process
forbids adding custom build flags). Dropping simple-dmabuf-drm simplifies both
building and releasing.
The functionality previously tested via simple-dmabuf-drm can now be tested with
simple-dmabuf-egl.
Signed-off-by: Simon Ser <contact@emersion.fr>
When we are going to set a solid color for the background, use
a 1x1 buffer and set the viewport to the full size. This avoids
un-necessary allocation of buffer memory.
Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
Add support for setting the widget's destination wp viewport.
Setting it in the widget instead of being set directly by the client
ensure that the widget can be identified in widget_find_widget.
v2: Return -1 on error (Pekka)
Scale allocated x and y when viewport is set (Pekka)
Allow user to set -1 for viewport width and height (Pekka)
v3: Use NULL instead of 0 (Daniel)
return 0 if width and height are -1 (Daniel)
Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
This would be causing a protocol error in which the buffer size needs to
match the one provided in the configure event.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Add a sanity check to touch_handle_down() and data_device_enter() as
what we did for pointer and keyboard.
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Make sure gl-renderer is enabled when building the EGL and EGL
dmabuf clients. This avoids missing declaration warnings and
linking errors such as:
../clients/simple-dmabuf-egl.c:1142: undefined reference to `weston_check_egl_extension
...
../clients/simple-egl.c:206: undefined reference to `weston_check_egl_extension'
Signed-off-by: Stefan Agner <stefan@agner.ch>
Define common_inc which includes both public_inc and the project root directory.
The project root directory will allow access to config.h and all the shared/
headers.
Replacing all custom '.', '..', '../..', '../shared' etc. include paths with
common_inc reduces clutter in the target definitions and enforces the common
#include directive style, as e.g. including shared/ headers without the
subdirectory name no longer works.
Unfortunately this does not prevent one from using private libweston headers
with the usual include pattern for public headers.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
When all shared/ headers are included in the same way, we can drop unnecessary
include seach paths from the compiler.
This include style was chosen because it is prevalent in the code base. Doing
anything different would have been a bigger patch.
This also means that we need to keep the project root directory in the include
search path, which means that one could accidentally include private headers
with
#include "libweston/dbus.h"
or even
#include <libweston/dbus.h>
IMO such problem is smaller than the churn caused by any of the alternatives,
and we should be able to catch those in review. We might even be able to catch
those with grep in CI if necessary.
The "bad" include style was found with:
$ for h in shared/*.h; do git grep -F $(basename $h); done | grep -vF '"shared/'
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
matrix.c needs to be built differently for a test program vs. everything else,
so it cannot be in a helper lib. Instead, make a dependency object for it for
easy use which always gets all the paths correct automatically.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Some drivers expose the extension so they can expose
eglQueryDmaBufFormatsEXT, but don't support any modifiers. Treat this the
same as if the extension wasn't present.
All these have the printf format string wrong. "%*s" sets the field width but
does not limit the string to len bytes. You need to set precision instead to
limit to len bytes: "%.*s".
Found by grepping, after wondering why my WIP prints printed garbage at the
end.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This ensures that the default signal action doesn't kill weston-terminal
when the terminal tries to paste into a pipe whose read end has already
been shut down. (For example, a pipe from a misconfigured program or from
one which crashes/exits before the terminal calls write().)
Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
Check return values for wl_display_dispatch_* functions, so that
the program stops running when the compositor that it is connected
to crashes.
Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
This patch adds a client app which can be used to show the
implementation of weston content-protection protocol. The app can
request for Type-0 and Type-1 content or request for disabling
content-protection to the content-protection server.
It listens for the content-protection status change event from the
server and accordingly display the required content.
The content Type-0, Type-1 and unprotected contents are prepared
using cairo surface, with different color and text to distinguish
between the contents.
Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
wl_shell is deprecated, and using xdg_shell allows the client to run on
compositors which do not implement the old protocol. Functionality
should be identical.
Signed-off-by: Astatos Aner <random.bored.human@gmail.com>
Pads launchers with the empty space that used to be around them. Moving
pointer to 0,0 and clicking launches the preferred app. First launcher
has more padding at its start to look nice.
Moves the clock to the right edge with same padding. Keeps one of the
two values for text extents that the code was already retrieving but
never read. Horizontal panel position centers the clock.
Sets text in the panel, meaning tooltips and the clock, to consistent 14
units of the default system font at 85% of the max brightness, so it's
less tiring on eyes.
The printf() format specifier "%m" is a glibc extension to print
the string returned by strerror(errno). While supported by other
libraries (e.g. uClibc and musl), it is not widely portable.
In Weston code the format string is often passed to a logging
function that calls other syscalls before the conversion of "%m"
takes place. If one of such syscall modifies the value in errno,
the conversion of "%m" will incorrectly report the error string
corresponding to the new value of errno.
Remove all the occurrences of the specifier "%m" in Weston code
by using directly the string returned by strerror(errno).
While there, fix some minor indentation issue.
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
In the simple examples in which keymap is not handled, the open
descriptor has to be properly closed.
After each suspend/resume sequence the keymap is send again to
every client. On client weston-simple-egl the leak causes a
segfault when no more file descriptors can be opened.
Close the file descriptor and lazily copy/paste the comment
already available in simple-dmabuf-v4l.
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
As per the wl_data_offer::finish documentation, the request is only
valid for drag n drop operations and signifies that a dnd is completed.
Send finish request only when we have a dnd operation active.
Signed-off-by: Harish Krupo <harishkrupo@gmail.com>
The toytoolkit assumes that wl_seats are advertised after
wl_data_device_manager and creates a data_device during wl_seat
registry binding. This patch removes this assumption by creating
data_devices for all the wl_seats created up until then.
Fixes: https://gitlab.freedesktop.org/wayland/weston/issues/201
Signed-off-by: Harish Krupo <harishkrupo@gmail.com>
Making this into a dependency object not only carries the .c files with it, but
it also brings the include directories as well, which means the users can
simply use the object without guessing the paths.
This should help with moving GL-renderer into a new subdirectory.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
It is a public installed header used by libweston.h.
See "Rename compositor.h to libweston/libweston.h" for rationale.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
It is a public installed header used by libweston.h.
See "Rename compositor.h to libweston/libweston.h" for rationale.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
matrix.h is a public installed header and even used by libweston.h.
See "Rename compositor.h to libweston/libweston.h" for rationale.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
In file included from ../clients/multi-resource.c:38:
/usr/include/sys/poll.h:1:2: warning: #warning redirecting incorrect #include <sys/poll.h> to <poll.h> [-Wcpp]
#warning redirecting incorrect #include <sys/poll.h> to <poll.h>
^~~~~~~
gbm_bo_get_handle_for_plane returns handle.s32 == -1 on error, at least
for the Mesa dri implementation.
Reported-by: Marius Vlad <marius.vlad@collabora.com>
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
editor.c calls g_clear_object(), so it should link to gobject directly instead
of relying on pangocairo pulling it in in its pkg-config.
Fixes: https://gitlab.freedesktop.org/wayland/weston/issues/211
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Since we are managing and rendering to buffers on our own with GBM,
create the EGL display using the GBM platform with the DRM render node,
instead of using the Wayland EGL platform.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Now that Weston supports the stable revision, use it. Better to excercise the
current rather than outdated protocol.
Pekka:
- split the patch, rewrote commit message
- rename xdg_shell_ping to xdg_wm_base_ping
- rename xdg_shell_listener to wm_base_listener
- rename shell to wm_base
- fix continued line alignment
- drop unrelated change of adding parentheses around bit-wise and
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Support drawing a mandelbrot set in the fragment shader, rendering it
with separate draw calls, one for each cell in a virtual 4x4 grid. This
more complex and heavy drawing will potentially help us to visually
discover any present or future explicit synchronization issues.
The mandelbrot set rendering is enabled with the -m/--mandelbrot
command-line switch.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
This is probably the most annoying ones. Some distributions do not even package
a libdrm_${driver} if the driver's hardware does not occur on the CPU
architecture, e.g. Debian x86_64 does not have libdrm_etnaviv.
Helps people to disable those.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Render a moving square instead of just clearing the buffer, to help
uncover rendering issues (e.g. modifier-related issues) which may not be
visible with a simple glClear.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Take into account format modifiers advertised by the compositor and the
EGL implementation and supported by the buffer creation mechanism, to
select the optimal buffer modifier.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Check the egl, glesv2 and gbm dependencies locally instead of relying on
the dep_* variables from the top level meson.build or
libweston/meson.build (dep_gbm).
This should make these dependencies now explicitly checked when the app
is built, rather than relying on other components doing the checks. If
the drm-backend was disabled, this would have probably hit an error
using the undeclared variable dep_gbm.
Signed-off-by: Pekka Paalanen <pq@iki.fi>
Cannot use dependency() directly in the structure, because it will
execute regardless of the option. Instead, let's store the dependency
name in the structure and use the same logic as with simple_clients to
conditionally look for the dependencies.
As a bonus, this brings friendly error messages to demo-clients
dependencies.
subsurfaces' dependencies are also converted to maintain consistency
with simple_clients.
Signed-off-by: Pekka Paalanen <pq@iki.fi>