Scott Anderson [Fri, 20 Dec 2019 02:07:43 +0000 (15:07 +1300)]
gl-renderer: Move EGL display creation to egl-glue.c
It makes more sense for it to be there instead.
Signed-off-by: Scott Anderson <scott.anderson@collabora.com>
Scott Anderson [Fri, 20 Dec 2019 01:55:39 +0000 (14:55 +1300)]
gl-renderer: Move platform extension checks to EGL client setup
This removes the duplicate checks for EGL_EXT_platform_base.
Signed-off-by: Scott Anderson <scott.anderson@collabora.com>
Scott Anderson [Fri, 20 Dec 2019 01:39:38 +0000 (14:39 +1300)]
gl-renderer: Move get_platform_display to EGL client setup
This is to put more of the EGL client extension handling in the same
place. This also adds a boolean to check if EGL_EXT_platform_base is
supported, similar to other extensions we check.
Signed-off-by: Scott Anderson <scott.anderson@collabora.com>
Scott Anderson [Fri, 20 Dec 2019 01:28:44 +0000 (14:28 +1300)]
gl-renderer: Move EGL client extension handling earlier
EGL client extensions are not tied to the EGLDisplay we create, and have
an effect on how we create the EGLDisplay. Since we're using this to
look for EGL_EXT_platform_base, it makes more sense for this to be near
the start of the GL renderer initialization.
Signed-off-by: Scott Anderson <scott.anderson@collabora.com>
Simon Ser [Mon, 10 Feb 2020 14:49:20 +0000 (15:49 +0100)]
clients/window: fail earlier when frame_create fails
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>
Leandro Ribeiro [Tue, 4 Feb 2020 02:45:59 +0000 (23:45 -0300)]
weston-log-wayland: make stream_destroy() use weston_log_subscriber_release()
Make stream_destroy() use weston_log_subscriber_release().
This avoids code duplication and allow us to destroy
weston_log_subscriber_get_only_subscription(), since it's
being used only in this case and it's internal.
Calls for weson_log_subscriber_release() leads to
weston_log_debug_wayland_to_destroy(), which should not
send an error event when the stream has already been closed.
Also, stream_destroy() shouldn't lead to an event error, as
it is a wl_resource destroy handler. So close the stream before
calling weston_log_subscriber_release() in stream_destroy()
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
Leandro Ribeiro [Tue, 4 Feb 2020 03:05:47 +0000 (00:05 -0300)]
compositor: destroy log context only after the destruction of subscribers
Before commit "weston-log: destroy subscriptions with
destruction of subscribers", we had to destroy subscribers
before the log context. Currently there's no required order,
both are valid.
But since we've created log context before the subscribers,
we can destroy it after them. This is a style change and
also a prove that now this order is valid as well.
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
Leandro Ribeiro [Fri, 7 Feb 2020 19:06:19 +0000 (16:06 -0300)]
weston-log: share code between weston_log_scope_destroy() and weston_log_subscriber_release()
Both weston_log_scope_destroy() and weston_log_subscriber_release()
have calls for destroy_subscription(). We can move this call to
weston_log_subscription_destroy() without losing anything and
avoiding repetition.
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
Leandro Ribeiro [Tue, 4 Feb 2020 01:59:16 +0000 (22:59 -0300)]
weston-log: destroy subscriptions with destruction of subscribers
The subscription is directly related to both the log scope and
the subscriber. It makes no sense to destroy one of them and
keep the subscriptions living.
We only had code to destroy subscription with
the destruction of log scopes. Add code to destroy
subscriptions with destruction of subscribers.
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
Leandro Ribeiro [Thu, 6 Feb 2020 19:43:51 +0000 (16:43 -0300)]
weston-log: merge functions that destroy different types of subscribers
Log subscriber API is not type-safe. File and flight recorder
subscribers are created with functions that return
weston_log_subscriber objects. But there's a problem: to destroy
these objects you have to call the right function for each type
of subscriber, and a user calling the wrong destroy function
wouldn't get a warning.
Merge functions that destroy different types of subscribers, making
the log subscriber API type-safe.
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
Leandro Ribeiro [Thu, 6 Feb 2020 18:41:32 +0000 (15:41 -0300)]
weston-log: rename weston_log_subscriber::destroy to destroy_subscription
weston_log_subscriber has a member named destroy. There are
other structs (weston_output, for instance) that have this
member, and by convention it is a pointer to a function
that destroys the struct.
In weston_log_subscriber it is being used to destroy
subscriptions of the debug protocol, and not the subscriber,
so this name is misleading. Rename it to destroy_subscription.
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
Philipp Zabel [Tue, 4 Feb 2020 23:40:01 +0000 (00:40 +0100)]
build: add rpath to modules that use symbols from libexec_weston
The cms-static, desktop-shell, hmi-controller, ivi-shell, and screen-share
modules use symbols from libexec_weston, e.g.:
$ ldd /usr/lib/x86_64-linux-gnu/weston/desktop-shell.so | grep "not found"
libexec_weston.so.0 => not found
Loading these modules from weston happens to work because the weston executable
itself links against libexec_weston, and has an rpath set. Still, these modules
depend on a library in a non-standard location. Adding an rpath could help
static checkers to make sure all shared objects' dependencies are present.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Pekka Paalanen [Mon, 25 Nov 2019 13:17:56 +0000 (15:17 +0200)]
tests: run subsurface-shot on GL too
This adds the necessary fuzz to image matching to let GL-renderer pass.
The difference is due to rounding. weston-test-desktop-shell.c uses
weston_surface_set_color(dts->background_surface, 0.16, 0.32, 0.48, 1.);
to set the background color. Pixman-renderer will truncate those to uint8, but
GL-renderer seems to round instead, which causes the +1 in background color
channel values.
0.16 * 255 = 40.8
0.32 * 255 = 81.6
0.48 * 255 = 122.4
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Pekka Paalanen [Tue, 4 Feb 2020 15:03:07 +0000 (17:03 +0200)]
CI: do not attempt to test GL-renderer
Because of https://gitlab.freedesktop.org/mesa/mesa/issues/2219 it would crash,
so disable GL-renderer.
https://gitlab.freedesktop.org/wayland/weston/issues/358 shall revert this.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Pekka Paalanen [Tue, 4 Feb 2020 14:59:59 +0000 (16:59 +0200)]
build: add test-gl-renderer option
This shall be used by CI due to https://gitlab.freedesktop.org/mesa/mesa/issues/2219
It defaults to true, meaning that people by default will be running the
GL-renderer tests. It works fine on hardware drivers, just not llvmpipe.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Pekka Paalanen [Mon, 25 Nov 2019 12:54:06 +0000 (14:54 +0200)]
tests: add range argument for fuzzy image matching
The fuzzy range will be used with GL-renderer testing, as it may produce
slightly different images than Pixman-renderer yet still correct results.
Such allowed differences are due to different rounding.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Pekka Paalanen [Fri, 13 Dec 2019 09:47:18 +0000 (11:47 +0200)]
weston-log-flight-rec: allow re-running a compositor
weston_primary_flight_recorder_ring_buffer needs to be cleared on destruction
of the subscriber it was assigned from so that a compositor and be re-executed
in-process (static variables do not get re-initialized automatically).
This will be used by the test harness when it will execute wet_main() multiple
times in the same process. Otherwise it would hit the assert in
weston_log_subscriber_create_flight_rec().
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Sebastian Wick [Wed, 5 Feb 2020 09:27:23 +0000 (10:27 +0100)]
shared: guard all the seal logic behind HAVE_MEMFD_CREATE
The initial version of os_ro_anonymous_file missed two guards around the
seal logic which leads to a compilation error on older systems.
Also make the check for a read-only file symmetric in
os_ro_anonymous_file_get_fd and os_ro_anonymous_file_put_fd.
Signed-off-by: Sebastian Wick <sebastian@sebastianwick.net>
Guillaume Champagne [Mon, 3 Feb 2020 00:59:52 +0000 (19:59 -0500)]
tests: release resources on compositor destruction
Releases touch devices and seat if they were allocated, clean up the
layers and free the weston_test structure.
Signed-off-by: Guillaume Champagne <champagne.guillaume.c@gmail.com>
Guillaume Champagne [Mon, 3 Feb 2020 00:45:36 +0000 (19:45 -0500)]
headless: fix uninitialized variable
`no_outputs` is declared on the stack and left uninitialized if no
weston option changing its value is provided.
Signed-off-by: Guillaume Champagne <champagne.guillaume.c@gmail.com>
Daniel Stone [Mon, 3 Feb 2020 20:01:21 +0000 (20:01 +0000)]
gl-renderer: Avoid double-free on init failure
If gl-renderer fails its initialisation, we return to compositor
teardown, which will try to free the renderer if ec->renderer was set.
This is unfortunate when we've already torn it down whilst failing
gl-renderer init, so just clear the renderer member so we don't try to
tear down twice.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reported-by: Emil Velikov <emil.velikov@collabora.com>
Daniel Stone [Mon, 3 Feb 2020 20:00:54 +0000 (20:00 +0000)]
gl-renderer: Fail earlier if shader compilation fails
If we can't compile our shaders, there's no point trying to link them.
Signed-off-by: Daniel Stone <daniels@collabora.com>
James Hilliard [Sun, 2 Feb 2020 03:02:29 +0000 (20:02 -0700)]
unconditionally include sys/mman.h in os-compatibility.c
Fixes:
../shared/os-compatibility.c:273:25: error: ‘PROT_READ’ undeclared (first use in this function); did you mean ‘LOCK_READ’?
map = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, file->fd, 0);
^~~~~~~~~
LOCK_READ
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Stefan Agner [Thu, 14 Nov 2019 22:55:35 +0000 (23:55 +0100)]
launcher-weston-launch: avoid race condition when switching VT merge
When using weston-launch launcher deactivating the VT is sometimes
racy and leads to Weston still being displayed. The launcher-direct.c
backend makes sure that the session signal is emitted first, then DRM
master is dropped and finally the VT switch is acknowledged via
VT_RELDISP.
However, in the weston-launch case the session signal is emitted via
a socket message to the weston process, which might get handled a bit
later. This leads to dropping DRM master and acknowledging the VT
switch prematurely.
Add a socket message which allows weston to notify weston-launch that
the signal has been emitted and deactivating can be proceeded.
Signed-off-by: Stefan Agner <stefan@agner.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Stefan Agner [Wed, 22 Jan 2020 21:40:19 +0000 (22:40 +0100)]
launcher-weston-launch: move send loop into separate function
Create a separate function handling the send loop. This allows to reuse
the same code later on.
Signed-off-by: Stefan Agner <stefan@agner.ch>
Stefan Agner [Thu, 14 Nov 2019 22:39:40 +0000 (23:39 +0100)]
weston-launch: reset tty properly
On weston-launch exit we see errors such as:
failed to restore keyboard mode: Invalid argument
failed to set KD_TEXT mode on tty: Invalid argument
This has been resolved by making sure the tty file descriptor
does not get closed. However, the ioctrl's KDSKBMODE/KDSETMODE
and VT_SETMODE still fail with -EIO:
failed to restore keyboard mode: Input/output error
failed to set KD_TEXT mode on tty: Input/output error
It turns out the reason for this lies in some very particular
behavior of the kernel, the separation of weston-launch/weston
and the fact that we restore the tty only after the weston
process quits: When the controlling process for a TTY exits,
all open file descriptors for that TTY are put in a hung-up
state! For more details see this systemd-logind issue:
https://github.com/systemd/systemd/issues/989
We can work around by reopening the particular TTY. This allows
to properly restore the TTY settings such that a successive VT
switch will show text terminals fine again.
Signed-off-by: Stefan Agner <stefan@agner.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Stefan Agner [Wed, 22 Jan 2020 21:23:07 +0000 (22:23 +0100)]
weston-launch: check string truncation
Since weston-launch is a setuid-root program we should be extra careful:
Check for a potential string trunction. Move the check in a separate
function and return with error in case trunction has happened.
Signed-off-by: Stefan Agner <stefan@agner.ch>
Stefan Agner [Thu, 14 Nov 2019 22:29:09 +0000 (23:29 +0100)]
weston-launch: make sure weston-launch activates the VT
Currently weston-launch does not activate the VT when opening the
terminal directly (e.g. using --tty=/dev/tty7). Weston takes full
control over the terminal by switching it to graphical mode etc.
However, the old VT stays active as can be seen when looking at
sysfs:
# cat /sys/class/tty/tty0/active
tty1
Always switch to the new VT to make sure the correct VT is active.
This aligns with how TTY setup is implemented in launcher-direct.c.
Signed-off-by: Stefan Agner <stefan@agner.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Stefan Agner [Wed, 22 Jan 2020 23:53:31 +0000 (00:53 +0100)]
weston-launch: fix newline in error message
Add newline character at the end of the error message to make sure we
get a new line after this error has been printed.
Fixes:
a1450a8a71ef ("make error() portable")
Signed-off-by: Stefan Agner <stefan@agner.ch>
Stefan Agner [Wed, 22 Jan 2020 23:37:16 +0000 (00:37 +0100)]
weston-launch: get ttynr also when no user is given
In case an user is given but no tty, the code opens tty0 to allocate a
new tty. With that ttynr is known.
In case a tty name is given the user must be given too. In this case
we later recover the ttynr by using stat on the file tty file descriptor
which allows as to find the ttynr by looking at the devices minor number.
However, the third case, when no user and no tty name is given, we do
not get the ttynr.
This hasn't been a problem in practise since ttynr has not been used.
However, it makes sense to get the ttynr always for consistency. Also
upcomming fixes will start to make use of ttynr.
Fixes:
636156d5f693 ("weston-launch: Don't start new session unless -u is given")
Signed-off-by: Stefan Agner <stefan@agner.ch>
Stefan Agner [Thu, 14 Nov 2019 21:07:27 +0000 (22:07 +0100)]
weston-launch: do not close tty prematurely
The tty file descriptor is used in signal handling (when switching
VT via SIGUSR1/SIGUSR2 for the VT_RELDISP ioctrl) and in quit() when
weston-launch exits for the KDSKBMUTE/KDSKBMODE/KDSETMODE/VT_SETMODE
ioctrls.
This fixes VT switching when using weston-launch from a non-VT shell
(e.g. ssh or from within a container).
Signed-off-by: Stefan Agner <stefan@agner.ch>
Pekka Paalanen [Wed, 13 Nov 2019 14:47:40 +0000 (16:47 +0200)]
tests: remove tests_weston and WESTON_TEST_CLIENT_PATH
This test category is empty, so it and all the supporting code can go.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Pekka Paalanen [Wed, 13 Nov 2019 14:41:46 +0000 (16:41 +0200)]
tests: migrate xwayland
Move xwayland test to the new harness.
This is the only test that can actually skip. It does it by exit(77) and that
is fine, because there is only one test case in the file so far. To get rid of
the exit() calls we need to return a value from the TEST() function but that is
a big surgery for another time.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Pekka Paalanen [Wed, 13 Nov 2019 14:28:20 +0000 (16:28 +0200)]
tests: migrate linux-explicit-synchronization
Moved to the new test harness.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Pekka Paalanen [Wed, 13 Nov 2019 13:45:10 +0000 (15:45 +0200)]
tests: migrate client tests
This migrates all the client tests that have nothing special in them to the new
test harness.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Pekka Paalanen [Wed, 13 Nov 2019 13:35:22 +0000 (15:35 +0200)]
tests: migrate devices
The devices test was actually using the defaults instead of
weston-test-desktop-shell in meson.build, so this patch keeps it that way.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Pekka Paalanen [Wed, 13 Nov 2019 12:39:22 +0000 (14:39 +0200)]
meson: remove tests_weston_plugin
All plugin tests have been converted to the new harness, so the old definition
can be removed.
The one remaining test surface-screenshot is a manual test, the plugin only
installs a debug key binding. Hence it is open-coded as a normal plugin, not as
a test.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Pekka Paalanen [Wed, 13 Nov 2019 12:20:45 +0000 (14:20 +0200)]
tests: migrate surface, surface-global
These are normal plugin tests, moved to the new harness.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Pekka Paalanen [Mon, 11 Nov 2019 15:29:41 +0000 (17:29 +0200)]
tests: migrate internal-screenshot
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Pekka Paalanen [Mon, 11 Nov 2019 15:17:57 +0000 (17:17 +0200)]
tests: migrate ivi-shell-app
Moving to the new test harness.
Carrying the test ini file still just to keep it the same even though I
accidentally noticed the test succeeds also with --no-config.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Pekka Paalanen [Mon, 11 Nov 2019 14:28:28 +0000 (16:28 +0200)]
tests: migrate ivi-layout-internal
Moving to the new harness.
It would be possible to convert every case here into a separate PLUGIN_TEST,
but I did not see the value in that at this time.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Pekka Paalanen [Mon, 11 Nov 2019 13:30:07 +0000 (15:30 +0200)]
tests: migrate ivi-layout-test
The ivi-layout-test comprises of two halves: the client and the plugin. This
migrates the test to the new test harness.
In the old harness, the plugin was built as the test in meson.build and it fork
& exec'd the client part. In the new harness client tests start from the client
program which sets up the compositor in-process, so now the client is built as
the test in meson.build and the plugin is just an additional file.
Therefore there is not need for the plugin for fork & exec anything anymore, so
all that code is removed.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Pekka Paalanen [Thu, 7 Nov 2019 10:59:30 +0000 (12:59 +0200)]
tests: migrate string and vertex-clip
These are the only remaining standalone non-ZUC tests. They do not need any
changes to be built with the new harness - in fact they have already been
running through the new harness.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Pekka Paalanen [Mon, 18 Nov 2019 14:13:19 +0000 (16:13 +0200)]
doc: overview of the test suite
This should lower the barrier to entry for writing more tests.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Pekka Paalanen [Fri, 1 Nov 2019 13:39:30 +0000 (15:39 +0200)]
tests: stop relying on environment in the new harness
Instead of relying on Meson setting up environment so that Weston and tests
find all their files, build those values into the tests. This way one can
execute a test program successfully wihtout Meson, simply by running it.
The old environment variables are still honoured if set. This might change in
the future.
Baking the source or build directory paths into the tests should not regress
reproducible builds, because the binaries where test-config.h values are used
will not be installed.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Pekka Paalanen [Fri, 1 Nov 2019 12:02:15 +0000 (14:02 +0200)]
tests: thread-based client harness
This replaces the old test harness with a new one.
The old harness relied on fork()'ing each test which makes tests independent,
but makes debugging them harder. The new harness runs client code in a thread
instead of a new process. A side-effect of not fork()'ing anymore is that any
failure will stop running a test series short. Fortunately we do not have any
tests that are expected to crash or fail.
The old harness executed 'weston' from Meson, with lots of setup as both
command line options and environment variables. The new harness executes
wet_main() instead: the test program itself calls the compositor main function
to execute the compositor in-process. Command line arguments are configured in
the test program itself, not in meson.build. Environment variables aside, you
are able to run a test by simply executing the test program, even if it is a
plugin test.
The new harness adds a new type of iteration: fixtures. For now, fixtures are
used to set up the compositor for tests that need a compositor. If necessary, a
fixture setup may include a data array of arbitrary type for executing the test
series for each element in the array. This will be most useful for running
screenshooting tests with both Pixman- and GL-renderers.
The new harness outputs TAP formatted results into stdout. Meson is not
switched to consume TAP yet though, because it would require a Meson version
requirement bump and would not have any benefits at this time. OTOH outputting
TAP is trivial and sets up a clear precedent of random test chatter belonging
to stderr.
This commit migrates only few tests to actually make use of the new features:
roles is a basic client test, subsurface-shot is a client test that
demonstrates the fixture array, and plugin-registry is a plugin test. The rest
of the tests will be migrated later.
Once all tests are migrated, we can remove the test-specific setup from
meson.build, leaving only the actual build instructions in there.
The not migrated tests and stand-alone tests suffer only a minor change: they
no longer fork() for each TEST(), otherwise they keep running as before.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Pekka Paalanen [Thu, 31 Oct 2019 15:20:17 +0000 (17:20 +0200)]
tests: move exit() from run_test()
I will be able to re-use this function if it does not call exit() itself.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Pekka Paalanen [Fri, 25 Oct 2019 10:57:10 +0000 (13:57 +0300)]
compositor: add test suite data
Allow to set and get one opaque pointer. The test suite will then use this to
pass data from the test runner to the test plugin, so that the plugin can then
run what it needs to. This is useful when the test runner calls wet_main()
directly instead of forking a compositor.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Leandro Ribeiro [Mon, 27 Jan 2020 22:12:01 +0000 (19:12 -0300)]
libweston: fold weston_compositor_tear_down() into weston_compositor_destroy()
The only reason why we have both weston_compositor_tear_down() and
weston_compositor_destroy() is that the only we had to destroy
the log context was keeping weston_compositor alive and calling
weston_log_ctx_compositor_destroy().
After commit "weston-log: replace weston_log_ctx_compositor_destroy()
by weston_log_ctx_destroy()", it's not necessary to keep a zombie
weston_compositor just to be able to call
weston_log_ctx_compositor_destroy().
Fold weston_compositor_tear_down() into weston_compositor_destroy(),
as this split is useless now.
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
Leandro Ribeiro [Fri, 24 Jan 2020 04:12:59 +0000 (01:12 -0300)]
weston-log: replace weston_log_ctx_compositor_destroy() by weston_log_ctx_destroy()
The function weston_log_ctx_compositor_destroy(), which destroys struct
weston_log_context, takes weston_compositor as argument. We may have a
weston_log_context unlinked from a weston_compositor and currently there
is no way to destroy it.
Add function weston_log_ctx_destroy(), what makes the destruction of
weston_log_context independent of weston_compositor.
With this change, one could destroy a weston_compositor and keep the
related weston_log_context (since now weston_log_context can be destroyed
without the need of a weston_compositor). But if weston_compositor gets
destroyed it's also necessary to destroy weston_log_context::global,
as the debug protocol depends on the compositor. So a listener has been
added to the destroy signal of weston_compositor.
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
Leandro Ribeiro [Fri, 17 Jan 2020 14:19:59 +0000 (11:19 -0300)]
weston-log: rename weston_log_ctx_compositor_create() to weston_log_ctx_create()
Since weston_log_ctx_compositor_create() does not have any relation
with weston_compositor, rename it to weston_log_ctx_create().
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
Leandro Ribeiro [Fri, 17 Jan 2020 13:47:49 +0000 (10:47 -0300)]
weston-log: fold weston_log_ctx_compositor_setup() into weston_compositor_create()
The function weston_log_ctx_compositor_setup() is being called only inside
weston_compositor_create() and it is so tiny that the code gets easier to
follow if it gets folded in weston_compositor_create().
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
Marius Vlad [Thu, 5 Dec 2019 12:09:58 +0000 (14:09 +0200)]
clients/simple-dmabuf-v4l: Dmabuf-contiguous for vivid module
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>
Marius Vlad [Wed, 20 Nov 2019 22:28:31 +0000 (00:28 +0200)]
clients/simple-dmabuf-v4l: Add 'weston-direct-display' protocol
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>
Marius Vlad [Wed, 20 Nov 2019 21:44:20 +0000 (23:44 +0200)]
clients/simple-dmabuf-v4l: Add Y_INVERT option flag
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>
Marius Vlad [Wed, 20 Nov 2019 21:10:22 +0000 (23:10 +0200)]
clients/simple-dmabuf-v4l: Convert to use getopt_long
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>
Marius Vlad [Tue, 22 Oct 2019 10:36:37 +0000 (13:36 +0300)]
clients/dmabuf-v4l: Pass FLAGS_Y_INVERT to linux-dmabuf if v4l2 reports so
Zero-initialize the display as to correctly pass the options if it was
supplied (@emersion).
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Marius Vlad [Tue, 22 Oct 2019 10:13:28 +0000 (13:13 +0300)]
client/dmabuf-v4l: Use zwp_linux_dmabuf version 3
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>
Pekka Paalanen [Mon, 9 Dec 2019 11:03:02 +0000 (13:03 +0200)]
xwm: always configure on send_configure()
There is more state than just the application window width and height that
affects whether calling weston_wm_window_configure() is necessary: everything
that affects the frame window, fullscreen state in particular. Therefore do not
skip the call by just width and height.
If send_configure() happens to be called "unnecessarily", this will now forward
some of those calls to the X11 clients. However, since it uses an idle task, it
should not result in a flood at least. And if send_configure() is spammed,
maybe that should then be fixed in its callers.
This patch should fix the misplacement of a fullscreen X11 window due to the
frame window being incorrectly sized and positioned, and the app window
incorrectly positioned inside the frame window.
The fullscreen window problems were observed in a case where the window does
not hit legacy_fullscreen() but first maps and then sets
_NET_WM_STATE_FULLSCREEN. Additionally the initial window size must match the
output size where it gets fullscreened. In that case the frame window was left
as if not fullscreened.
This practically reverts
3f53d9179bcdb11d053527336ac4a49f274bc8d1. I'm not sure
what problem that patch was fixing, but I couldn't make any resizing freeze.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Pekka Paalanen [Thu, 5 Dec 2019 14:47:16 +0000 (16:47 +0200)]
xwm: do not configure frame window None
Spotted this in debug log:
[xwm-wm-x11] XWM: configure window 4194324: x=32 y=32 width=1920 height=1080 border_width=0 stack_mode=0
[xwm-wm-x11] XWM: configure window 0: width=1984 height=1144
Trying to configure window 0 makes no sense. So do not try.
To avoid patching two different places with the same thing, refactor the code
into a common helper.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Pekka Paalanen [Thu, 5 Dec 2019 14:42:48 +0000 (16:42 +0200)]
xwm: remove configure_source on destroy
It would lead to use-after-free if there was a pending idle callback to
weston_wm_window_configure() when the weston_wm_window gets destroyed. Make
sure the callback will not fire.
Found by inspection.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Pekka Paalanen [Thu, 5 Dec 2019 14:36:17 +0000 (16:36 +0200)]
xwm: remove configure_source on dispatch
This function is called also directly from weston_wm_window_set_toplevel(). If
configure_source is set at that point, simply resetting the pointer will "leak"
the source until it fires and calls this function again.
Let's keep the variable up-to-date by removing the source when called,
dispatched or not. This removes the second call. I only hope it doesn't cause
issues. This is also necessary if we intend to remove the source on window
destruction too.
Found by inspection.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Pekka Paalanen [Wed, 4 Dec 2019 10:47:12 +0000 (12:47 +0200)]
xwm: fix initially-fullscreen windows
It looks like commit
ad0da4596d6315b18e888af75eee0a9bad1ff44d introduced a bug
for X11 windows that are initially fullscreen by adding code to the end of
xserver_map_shell_surface() while ignoring the 'return' that this patch
removes. That may have caused some annoying window state issues, but the
problem became more pronounced with
7ace831ca6205ea288e49fdbd6b63f53e73fae59
when used with an Xwayland version that honours _XWAYLAND_ALLOW_COMMITS.
In the latter case, there is a possiblity the window will never show up, as XWM
forgets to set allow_commits=true. However, the window may sometimes actually
show up due to an oversight in Xwayland: the Present code may be flipping the
window buffers and not checking _XWAYLAND_ALLOW_COMMITS if it is supposed
commit at all.
Since then,
f568968f8a30eab6bfd8a15518014deb8f6c81d5 added more places where
allow_commits is set to true, masking the window-does-not-show-up issue. Window
pending state likely still remained an issue.
This patch properly fixes the "window never appears" issue by making sure
allow_commit=true is set. At the same time, it ensures the pending state
functions are called at the end of xserver_map_shell_surface(), which may fix
some window state issues like misplaced decorations and/or position of
initially-fullscreen windows. Unfortunately, it certainly does not fix all such
state problems.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Leandro Ribeiro [Thu, 26 Dec 2019 19:46:16 +0000 (16:46 -0300)]
xwayland: stop direct accessing core struct member
Commit "weston-log: add function to avoid direct
access to compositor members in non-core code" added the
function weston_compositor_add_log_scope mainly to allow
libweston users to avoid direct accessing core structs, as
weston_compositor.
Replace weston_log_context_add_log_scope usage by
weston_compositor_add_log_scope.
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
Leandro Ribeiro [Thu, 26 Dec 2019 19:44:56 +0000 (16:44 -0300)]
pipewire: stop direct accessing core struct member
Commit "weston-log: add function to avoid direct
access to compositor members in non-core code" added the
function weston_compositor_add_log_scope mainly to allow
libweston users to avoid direct accessing core structs, as
weston_compositor.
Replace weston_log_context_add_log_scope usage by
weston_compositor_add_log_scope.
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
Leandro Ribeiro [Thu, 26 Dec 2019 19:41:09 +0000 (16:41 -0300)]
content-protection: stop direct accessing core struct member
Commit "weston-log: add function to avoid direct
access to compositor members in non-core code" added the
function weston_compositor_add_log_scope mainly to allow
libweston users to avoid direct accessing core structs, as
weston_compositor.
Replace weston_log_context_add_log_scope usage by
weston_compositor_add_log_scope.
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
Leandro Ribeiro [Thu, 26 Dec 2019 19:35:49 +0000 (16:35 -0300)]
compositor: stop direct accessing core struct member
Commit "weston-log: add function to avoid direct
access to compositor members in non-core code" added the
function weston_compositor_add_log_scope mainly to allow
libweston users to avoid direct accessing core structs, as
weston_compositor.
Replace weston_log_context_add_log_scope usage by
weston_compositor_add_log_scope.
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
Leandro Ribeiro [Thu, 26 Dec 2019 19:23:43 +0000 (16:23 -0300)]
backend-drm: stop direct accessing core struct member
Commit "weston-log: add function to avoid direct
access to compositor members in non-core code" added the
function weston_compositor_add_log_scope mainly to allow
libweston users to avoid direct accessing core structs, as
weston_compositor.
Replace weston_log_context_add_log_scope usage by
weston_compositor_add_log_scope.
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
Leandro Ribeiro [Thu, 26 Dec 2019 19:03:04 +0000 (16:03 -0300)]
weston-log: add function to avoid direct access to compositor members in non-core code
If we use the function weston_log_context_add_log_scope()
in non-core code, it's necessary to access
weston_compositor::weston_log_ctx.
This is not ideal, since the goal is to make core structs
(weston_compositor, weston_surface, weston_output, etc)
opaque.
Add function weston_compositor_add_log_scope(), so non-core
users are able to pass weston_compositor as argument instead
of weston_compositor::weston_log_ctx.
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
Leandro Ribeiro [Wed, 18 Dec 2019 18:21:03 +0000 (15:21 -0300)]
weston-log: rename the confusing function name weston_compositor_add_log_scope()
There's a function named weston_compositor_add_log_scope()
but it doesn't take a struct weston_compositor argument.
Rename it to weston_log_ctx_add_log_scope(), as
the log_scope is being added to a log_context.
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
Guillaume Champagne [Sun, 26 Jan 2020 23:24:44 +0000 (18:24 -0500)]
meson: add -Wmissing-prototypes to the build
Meson's warning level maps to -Wall, -Wextra and -Wpedantic.
-Wmissing-prototypes is added by neither of those flag. Consequently,
it is manually added to the build command line arguments.
Signed-off-by: Guillaume Champagne <champagne.guillaume.c@gmail.com>
Guillaume Champagne [Tue, 28 Jan 2020 01:14:29 +0000 (20:14 -0500)]
libweston: add missing include
Fixes missing prototypes compilation warnings emitted when a function
is defined before its prototype is declared.
These warnings were introduced over time since the switch to meson
because the -Wmissing-protoypes was not included in the compilation
arguments.
Signed-off-by: Guillaume Champagne <champagne.guillaume.c@gmail.com>
Guillaume Champagne [Tue, 28 Jan 2020 01:12:16 +0000 (20:12 -0500)]
window: fix missing prototypes warning
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>
Guillaume Champagne [Tue, 28 Jan 2020 01:08:15 +0000 (20:08 -0500)]
launcher: move weston_environment_get_fd
weston_environment_get_fd was declared in weston-launch and implemented
in compositor.c. Since the function is not used elsewhere in the code,
it is replaced by a static function in launcher-weston-launch.c
Signed-off-by: Guillaume Champagne <champagne.guillaume.c@gmail.com>
Scott Anderson [Tue, 28 Jan 2020 04:18:33 +0000 (17:18 +1300)]
Fix Wmaybe-uninitialized warnings
Just a couple of places which shouldn't be possible, so initialized and
added assertions to make sure.
Signed-off-by: Scott Anderson <scott.anderson@collabora.com>
Leandro Ribeiro [Wed, 18 Dec 2019 18:52:18 +0000 (15:52 -0300)]
weston-log: rename the confusing function name weston_compositor_log_scope_destroy()
There's a function named weston_compositor_log_scope_destroy()
but it doesn't take a struct weston_compositor argument.
Rename it to weston_log_scope_destroy(), as the argument is a
struct weston_log_scope.
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
Leandro Ribeiro [Wed, 18 Dec 2019 18:21:03 +0000 (15:21 -0300)]
weston-log: rename the confusing function name weston_compositor_add_log_scope()
There's a function named weston_compositor_add_log_scope()
but it doesn't take a struct weston_compositor argument.
Rename it to weston_log_ctx_add_log_scope(), as
the log_scope is being added to a log_context.
Also, bump libweston_major to 9.
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
Leandro Ribeiro [Thu, 26 Dec 2019 15:44:06 +0000 (12:44 -0300)]
weston-log: rename a confusing parameter name in weston_log_subscription_printf()
In the function weston_log_subscription_printf() we have
a struct weston_log_subscription parameter that in the .c file
is named sub. In the .h, the same parameter is named scope.
This is confusing, since its type is not struct weston_log_scope,
but struct weston_log_subscription.
Rename the parameter in the .h to sub.
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
Leandro Ribeiro [Wed, 18 Dec 2019 17:52:23 +0000 (14:52 -0300)]
weston-log: rename a confusing parameter name in weston_compositor_add_log_scope()
In the function weston_compositor_add_log_scope() we have
a struct weston_log_context parameter that in the .c file
is named log_ctx. In the .h, the same parameter is named
compositor. This is confusing, since its type is not
struct weston_compositor, but struct weston_log_context.
Rename the parameter in the .h to log_ctx.
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
Pekka Paalanen [Thu, 16 Jan 2020 15:44:51 +0000 (17:44 +0200)]
doc: output management sequence diagrams
When we were designing the libweston output API, I wrote a design document
as a Phabricator wiki page. Phabricator is no longer accessible so that
information needs to be migrated to a new place. Here I am converting most of
it into libweston Sphinx documentation, particularly pulling in the sequence
diagrams I drew. This should help people understand how libweston output
configuration works.
The diagrams are committed as both MSC source files and rendered PNG files. I
did not bother tinkering with the build to run mscgen automatically and then
with the CI images to install the tool.
The Sphinx configuration need numref explicitly enabled so that figures are
automatically numbered and can be referenced by their number rather than their
whole caption text(!).
The document structure is changed a little better flowing with Output
Management being the overview page and the Heads and Outputs being the API
pages.
First I wrote the struct weston_output and weston_head descriptions in Doxygen
comments in libweston.h, but then in the API page that text would have been
buried somewhere towards the end of the page. So I put that text in ReST
instead where it comes as first on the pages as it should. The doc for the
structs only contain a link to the top of the page. Yes, the comment style in
libweston.h is a little broken. If I left the asterisk there it would show up
as a bullet point in Sphinx. OTOH putting everything from \rst in a single line
did not produce anything.
Because Sphinx cannot look in two places, the images need to be copied into the
build dir too.
mscgen: http://www.mcternan.me.uk/mscgen/
Fixes: https://gitlab.freedesktop.org/wayland/weston/issues/25
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Pekka Paalanen [Mon, 27 Jan 2020 10:15:20 +0000 (12:15 +0200)]
tests: test-runner needs wayland-client
weston-test-runner.h includes wayland-util.h, therefore it needs
wayland-client. A partial dependency with just compile_args might have been
enough as it does not seem to use functions from wayland-util.c, but safer this
way and no harm.
Fixes: https://lists.freedesktop.org/archives/wayland-devel/2020-January/041149.html
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Simon Ser [Fri, 24 Jan 2020 20:20:02 +0000 (21:20 +0100)]
build: re-open master for regular development
Simon Ser [Fri, 24 Jan 2020 20:04:40 +0000 (21:04 +0100)]
build: bump to version 8.0.0 for the official release
Pekka Paalanen [Fri, 24 Jan 2020 13:11:13 +0000 (15:11 +0200)]
build: avoid Xlib.h via EGL headers
This should make EGL headers not pull in Xlib headers when no specific platform
define is in effect.
Use both the old Mesa-specific hack and the new official define EGL_NO_X11 to
have this work on both old and new EGL headers.
Fixes: https://gitlab.freedesktop.org/wayland/weston/issues/350
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Veeresh Kadasani [Fri, 24 Jan 2020 08:18:44 +0000 (17:18 +0900)]
ivi-application: fix typo
Signed-off-by: Veeresh Kadasani <external.vkadasani@jp.adit-jv.com>
Simon Ser [Fri, 17 Jan 2020 22:18:24 +0000 (23:18 +0100)]
build: bump to version 7.0.93 for the RC1 release
Marius Vlad [Fri, 17 Jan 2020 10:32:55 +0000 (12:32 +0200)]
desktop-shell: Do not try to add a child to a non-existent parent
Introduced with
a8da2084, it seems that there are cases when there's no
parent available (zenity, for instance).
Removes any potential child and re-initialize it, in case the parent is
not set. (Simon Ser)
Fixes: #340
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Reported-by: n3rdopolis <bluescreenavenger@gmail.com>
Stefan Agner [Thu, 20 Jun 2019 20:54:54 +0000 (22:54 +0200)]
backend-rdp: unref keymap after associating with seat
The function weston_seat_init_keyboard makes sure that it has its
own reference to keymap, hence we can safely drop our reference.
This is similarly done in the X11 backend. It avoids leaking a
struct xkb_keymap per connection.
Signed-off-by: Stefan Agner <stefan@agner.ch>
Stefan Agner [Thu, 20 Jun 2019 20:45:49 +0000 (22:45 +0200)]
backend-rdp: use compositor wide struct xkb_context
Instead of allocating our own copy of struct xkb_context use the
compositor wide instance. This avoids leaking of a struct
xkb_context per connection as well.
Signed-off-by: Stefan Agner <stefan@agner.ch>
Stefan Agner [Thu, 20 Jun 2019 20:45:02 +0000 (22:45 +0200)]
backend-rdp: constify keyboard layout information
Those information remain constant during execution, so mark them
as const.
Signed-off-by: Stefan Agner <stefan@agner.ch>
Stefan Agner [Thu, 20 Jun 2019 15:39:36 +0000 (17:39 +0200)]
backend-rdp: disconnect and free peers on compositor shutdown
Properly disconnect and free all RDP peers on compositor shutdown.
This makes sure that all events are disabled, which should avoid
any race conditions with pending events.
Signed-off-by: Stefan Agner <stefan@agner.ch>
Stefan Agner [Thu, 20 Jun 2019 15:34:00 +0000 (17:34 +0200)]
backend-rdp: unregister events before shuting down compositor
Like the other backends we should unregister events before
shutting down the compositor.
Signed-off-by: Stefan Agner <stefan@agner.ch>
Stefan Agner [Sun, 23 Jun 2019 12:53:59 +0000 (14:53 +0200)]
desktop-shell: make sure child window stays active
If a xdg_toplevel surface has a child (or multiple), the desktop shell
still allows to activate the parent. This can be problematic with
modal dialogs such as message boxes which then are hidden behind the
main window, which might be non-responsive to inputs at this this
point.
The protocol specifies set_parent as follows: "Set the 'parent' of
this surface. This surface should be stacked above the parent surface
and all other ancestor surfaces."
Track parent/child relationship in desktop-shell. Follow the protocol
recommendation and make sure the child stays stacked above the parent.
Fixes: #231
Signed-off-by: Stefan Agner <stefan@agner.ch>
Simon Ser [Fri, 20 Dec 2019 17:39:33 +0000 (18:39 +0100)]
build: bump to version 7.0.92 for the beta release
Michael Forney [Wed, 18 Dec 2019 10:54:39 +0000 (02:54 -0800)]
clients/presentation-shm: Add missing dependency on xdg-shell protocol
Signed-off-by: Michael Forney <mforney@mforney.org>
Leandro Ribeiro [Fri, 13 Dec 2019 03:05:09 +0000 (00:05 -0300)]
backend-rdp: report a zero physical size to compositor
The RDP-backend is reporting a non-zero physical size
value, and there are some clients that get the resolution
in pixels directly from the physical size reported. This
leads to a resolution of 25.4 PPI (or 1px/1mm), which is too
small.
But there's no need for that. The physical size is reported
on enabling the output (in the case of RDP-backend we have
no information about it before this), and the resolution is
already set in this moment.
Report a zero physical size to compositor, what makes frontend
and clients use their default values and applications become
readable.
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
Pekka Paalanen [Wed, 11 Dec 2019 11:12:52 +0000 (13:12 +0200)]
gitlab-ci: install xwayland
The reason the Xwayland test skips is that Xwayland was not installed. We
should exercise Xwayland as well in CI, so install it.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Pekka Paalanen [Thu, 21 Nov 2019 13:04:28 +0000 (15:04 +0200)]
gitlab-ci: wrap and alphabetize apt-get line
This line is far too long, it makes it really had to see in a diff what
changed. Wrap it into multiple lines and sort them alphabetically. If a piece
of it changes in the future, it will be easy to see in a diff.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Pekka Paalanen [Thu, 21 Nov 2019 13:03:03 +0000 (15:03 +0200)]
gitlab-ci: image build should fail on failed commands
Ensure that no command in the script fails silently. If any command fails, the
image is likely broken.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Pekka Paalanen [Thu, 5 Dec 2019 14:09:11 +0000 (16:09 +0200)]
xwm: debug ConfigureWindow
Print all ConfigureWindow messages XWM sends. Helps debugging XWM why
fullscreening doesn't work right.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>