Commit graph

7091 commits

Author SHA1 Message Date
Pekka Paalanen dd13498862 tests: migrate linux-explicit-synchronization
Moved to the new test harness.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-01-30 10:10:35 +00:00
Pekka Paalanen 701676d8c6 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>
2020-01-30 10:10:35 +00:00
Pekka Paalanen 3fb67936a9 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>
2020-01-30 10:10:35 +00:00
Pekka Paalanen af18eb0b5c 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>
2020-01-30 10:10:35 +00:00
Pekka Paalanen 99c536db91 tests: migrate surface, surface-global
These are normal plugin tests, moved to the new harness.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-01-30 10:10:35 +00:00
Pekka Paalanen 9615ad8b91 tests: migrate internal-screenshot
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-01-30 10:10:35 +00:00
Pekka Paalanen 431ec067cb 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>
2020-01-30 10:10:35 +00:00
Pekka Paalanen ad1a4102fe 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>
2020-01-30 10:10:35 +00:00
Pekka Paalanen 7f840b721a 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>
2020-01-30 10:10:34 +00:00
Pekka Paalanen 57a4508ee4 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>
2020-01-30 10:10:34 +00:00
Pekka Paalanen c22f357464 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>
2020-01-30 10:10:34 +00:00
Pekka Paalanen 82dd6ce830 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>
2020-01-30 10:10:34 +00:00
Pekka Paalanen babb3b3bc2 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>
2020-01-30 10:10:34 +00:00
Pekka Paalanen 2c8203dcb0 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>
2020-01-30 10:10:34 +00:00
Pekka Paalanen 61a6b03d6f 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>
2020-01-30 10:10:34 +00:00
Leandro Ribeiro ca640d5120 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>
2020-01-29 12:15:16 -03:00
Leandro Ribeiro 4ec38d18b3 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>
2020-01-29 12:08:54 -03:00
Leandro Ribeiro 4f13595aa7 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>
2020-01-29 12:08:54 -03:00
Leandro Ribeiro bd9c0a6ff5 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>
2020-01-29 12:08:54 -03:00
Marius Vlad dd718b0788 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>
2020-01-29 14:39:04 +00:00
Marius Vlad ab2c72b05c 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>
2020-01-29 14:39:04 +00:00
Marius Vlad b6d1509d63 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>
2020-01-29 14:39:04 +00:00
Marius Vlad 3345452c1b 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>
2020-01-29 14:39:04 +00:00
Marius Vlad baa1ef22e8 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>
2020-01-29 14:39:04 +00:00
Marius Vlad 4960955e0f 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>
2020-01-29 14:39:04 +00:00
Pekka Paalanen 83fb745ccf 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 3f53d9179b. 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>
2020-01-29 11:31:11 +00:00
Pekka Paalanen 2add217690 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>
2020-01-29 11:31:11 +00:00
Pekka Paalanen dcd2b420a6 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>
2020-01-29 11:31:11 +00:00
Pekka Paalanen a24989e47b 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>
2020-01-29 11:31:11 +00:00
Pekka Paalanen 134e14969f xwm: fix initially-fullscreen windows
It looks like commit ad0da4596d 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 7ace831ca6
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, f568968f8a 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>
2020-01-29 11:31:11 +00:00
Leandro Ribeiro bdd45d6262 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>
2020-01-29 09:55:24 +00:00
Leandro Ribeiro 23289358af 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>
2020-01-29 09:55:24 +00:00
Leandro Ribeiro fa505c588f 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>
2020-01-29 09:55:24 +00:00
Leandro Ribeiro ce1001966e 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>
2020-01-29 09:55:24 +00:00
Leandro Ribeiro 172afc2178 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>
2020-01-29 09:55:24 +00:00
Leandro Ribeiro f66685d9db 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>
2020-01-29 09:55:24 +00:00
Leandro Ribeiro ac691a89cd 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>
2020-01-29 09:55:24 +00:00
Guillaume Champagne 556afd1482 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>
2020-01-29 09:49:41 +00:00
Guillaume Champagne f1e8fc9dbf 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>
2020-01-29 09:49:41 +00:00
Guillaume Champagne 1cb09480e2 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>
2020-01-29 09:49:41 +00:00
Guillaume Champagne b4bd12b738 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>
2020-01-29 09:49:41 +00:00
Scott Anderson 60b6572b35 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>
2020-01-28 12:30:56 +00:00
Leandro Ribeiro f014964f6f 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>
2020-01-27 13:43:24 -03:00
Leandro Ribeiro 5976dbbbb5 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>
2020-01-27 13:42:42 -03:00
Leandro Ribeiro ee73105f50 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>
2020-01-27 13:31:01 -03:00
Leandro Ribeiro 861d93ff8d 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>
2020-01-27 13:31:01 -03:00
Pekka Paalanen 9dccfd1ef3 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>
2020-01-27 12:14:14 +00:00
Pekka Paalanen 1f3615f3cc 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>
2020-01-27 12:15:20 +02:00
Simon Ser 3938b06159
build: re-open master for regular development 2020-01-24 21:20:02 +01:00
Simon Ser 33b06bdece
build: bump to version 8.0.0 for the official release 2020-01-24 21:04:40 +01:00