Commit Graph

7210 Commits

Author SHA1 Message Date
Igor Matheus Andrade Torrente d8e09afc9f tests: Convert ivi-shell-app-test.c to use `weston_ini_setup`
Convert ivi-shell-app-test.c to use `weston_ini_setup`. It also removes
the pre-made weston.ini and all the related code in the meson files.

Signed-off-by: Igor Matheus Andrade Torrente <igormtorrente@gmail.com>
2020-09-30 09:41:34 -03:00
David Fort 495a892190 rdp-backend: unify creation of pixman_renderer_output
As pointed by Daniel Stone in #372, creation of pixman renderer outputs in the
rdp backend were inconsistant regarding use_shadow.
2020-09-30 09:55:56 +02:00
Leandro Ribeiro 96bef0517e drm-backend: add support for writeback connectors
Recognize writeback connectors and add 'struct drm_writeback'
objects in order to store them.

These objects are created and stored in a list by the time
that DRM-backend is initialized. This list is updated if a
writeback connector dynamically appears or is disconnected.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2020-09-16 14:03:18 +00:00
Leandro Ribeiro 7243022b38 drm-backend: add function drm_backend_add_connector() to create drm_head for connectors that appear
Instead of directly creating heads for the connectors in functions
drm_backend_create_heads() and drm_backend_update_connectors(),
add drm_backend_add_connector() that will handle this.

This split makes the code look better and will also make our lives
easier when we introduce writeback connectors.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2020-09-16 14:03:18 +00:00
Leandro Ribeiro 99611c8788 drm-backend: add helper function resources_has_connector()
Add helper function resources_has_connector(), what makes
the function drm_backend_update_connectors() look better.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2020-09-16 14:03:18 +00:00
Leandro Ribeiro 993920dd81 drm-backend: rename drm_backend_update_heads() to drm_backend_update_connectors()
To deal with appearing/disappearing connectors we have the
function drm_backend_update_heads(). Rename it to
drm_backend_update_connectors(), as it is more in line with
what it does.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2020-09-16 14:03:18 +00:00
Leandro Ribeiro 4a5b67a5db drm-backend: update description of drm_head_create() and drm_head_update_info()
In case of success, drm_head_create() and drm_head_update_info()
take ownership of a connector. As this is an important
information, update the description of these functions
to include this.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2020-09-16 14:03:18 +00:00
Leandro Ribeiro 6794164bd9 drm-backend: move drm_head management from drm_connector_assign_connector_info() to drm_head_update_info()
The function drm_connector_assign_connector_info() should
not be calling functions to handle drm_head, as connectors
and heads are not the same thing after patch "drm-backend:
move connector data from struct drm_head to struct drm_connector".

Move drm_head specific calls to drm_head_update_info(). This
is more in line with the hierarchy of the objects and also
allow us to drop drm_head pointer from drm_connector.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2020-09-16 14:03:18 +00:00
Leandro Ribeiro 7086396f75 drm-backend: reduce number of drmModeGetConnector() calls
Instead of calling drmModeGetConnector() in drm_head_create()
and drm_head_update_info(), it is better to call it in
drm_backend_create_heads() and drm_backend_update_heads().
Then we can pass the drmModeConnector object as parameter.
This does not change the behavior of the code, but help us
to avoid unnecessarily calling drmModeGetConnector().

Besides that, in the future we will have support for writeback
connectors. And so drm_backend_create_heads() will be reworked
to also populate a list of writeback connectors. To make this
work, we are going to need to know if a connector is of the
writeback type or not, to know if we should call drm_head_create()
or drm_writeback_create(). We can only tell the type of connector
if we have the drmModeConnector object.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2020-09-16 14:03:18 +00:00
Leandro Ribeiro 702fbf7282 drm-backend: cache drmModeObjectProperties for connectors
Instead of calling drmModeObjectGetProperties() each time that we need
the connector properties, it is better to keep a reference for it in
struct drm_connector. This reference is only updated when is necessary.
E.g. hotplug events.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2020-09-16 14:03:18 +00:00
Leandro Ribeiro e636990de3 drm-backend: move connector data from struct drm_head to struct drm_connector
This is the first step in order to add support for writeback
connector in Weston. We don't want writeback connectors data
to be stored in 'struct drm_head' objects, as these objects are
used to output content and we should not use writeback connectors
for this purpose.

The writeback connectors will be stored in a new 'struct
drm_writeback', but the connector data is common between
'struct drm_head' and 'struct drm_writeback'.

So move connector data from 'struct drm_head' to 'struct
drm_connector'. This helps to avoid code duplication and makes
the code clearer.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2020-09-16 14:03:18 +00:00
Leandro Ribeiro bb33f90658 drm-backend: free old connector props before replacing it with newer data
In commit c1e89ba2 "compositor-drm: move connector fields into
drm_head" the function drm_head_assign_connector_info() was
introduced. By that time it was being used only at drm_head
creation, and not to handle connector changes.

In d2e6242e "compositor-drm: create heads for all connectors"
it started to be used also to handle connector changes. In
this scenario we replace old connector props with newer data.
Before doing this, free the old connector data to avoid memory
leak.

Note that as drm_property_info_free() is safe to be called on
a zero-initialized struct, we can call it even in the case where
the head is being created and there are no props yet.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2020-09-16 14:03:18 +00:00
Pekka Paalanen 3d6721eb15 drm-backend: fix deinit_planes
Commit "drm-backend: move code to init/deinit planes to specific
functions" lost a chunk of drm_output_deinit() when moving code into
drm_output_deinit_planes(). Reinstate the missing chunk.

This fixes an endless loop over weston_compositor::plane_list when you
start with three monitors connected, unplug and re-plug one.

Fixes: 3be23eff99

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-09-16 15:04:04 +03:00
Manuel Stoeckl ae69381b6e compositor: avoid setting WAYLAND_DISPLAY=wayland-0
This commit alters the way that Weston picks a Wayland display socket
name. Instead of using wl_display_add_socket_auto to look for the first
available name in wayland-0, wayland-1, .... to wayland-32, the code now
checks names wayland-1, wayland-2, .... up to wayland-32.

This change is a workaround for a suboptimal behavior of
libwayland-client. If a client program calls wl_display_connect(NULL) and
the WAYLAND_DISPLAY environment variable is not set, then the program will
by default try to connect to 'wayland-0'. This is a problem when a
computer has a running Wayland compositor but is being accessed in some
other fashion, such as through an X session on a different virtual
terminal, over ssh, etc. Client programs launched through those means may
attempt to connect to an unrelated compositor. Changing libwayland
behavior to remove the default would also work, but a) libraries have
stronger backward compatibility expectations b) that would likely break
more people's setups than just changing Weston would.

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
2020-09-15 11:03:18 +00:00
Denys Dmytriyenko b10c0e843d tests: include fcntl.h for open(), O_RDWR, O_CLOEXEC and O_CREAT
musl libc (unlike glibc) requires explicitly incuding fcntl.h to define open(),
O_RDWR, O_CLOEXEC and O_CREAT. Otherwise the build fails with the errors:

| ../weston-9.0.0/tests/weston-test-fixture-compositor.c: In function 'wait_for_lock':
| ../weston-9.0.0/tests/weston-test-fixture-compositor.c:135:7: warning: implicit declaration of function 'open'; did you mean 'popen'? [-Wimplicit-function-declaration]
|   135 |  fd = open(lock_path, O_RDWR | O_CLOEXEC | O_CREAT, 00700);
|       |       ^~~~
|       |       popen
| ../weston-9.0.0/tests/weston-test-fixture-compositor.c:135:23: error: 'O_RDWR' undeclared (first use in this function)
|   135 |  fd = open(lock_path, O_RDWR | O_CLOEXEC | O_CREAT, 00700);
|       |                       ^~~~~~
| ../weston-9.0.0/tests/weston-test-fixture-compositor.c:135:23: note: each undeclared identifier is reported only once for each function it appears in
| ../weston-9.0.0/tests/weston-test-fixture-compositor.c:135:32: error: 'O_CLOEXEC' undeclared (first use in this function)
|   135 |  fd = open(lock_path, O_RDWR | O_CLOEXEC | O_CREAT, 00700);
|       |                                ^~~~~~~~~
| ../weston-9.0.0/tests/weston-test-fixture-compositor.c:135:44: error: 'O_CREAT' undeclared (first use in this function)
|   135 |  fd = open(lock_path, O_RDWR | O_CLOEXEC | O_CREAT, 00700);
|       |                                            ^~~~~~~

Signed-off-by: Denys Dmytriyenko <denys@ti.com>
2020-09-08 22:10:06 -04:00
Leandro Ribeiro de1b77e7cd drm-backend: do not set output->crtc to NULL in drm_output_init_planes() failure
After commit "drm-backend: move code to init/deinit planes to specific
functions" we have a specific function to init planes. As this function
does not set output->crtc, it should not set it to NULL in case of
failure. This is caller's responsibility.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2020-09-08 10:05:26 -03:00
Leandro Ribeiro 05cecc8ef3 drm-backend: cosmetic changes to make the code easier to read
There are some places where we can make some cosmetic changes
to make code simpler and easier to read. Make these cosmetic
changes. Note that they do not change the code behavior.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2020-09-07 13:08:18 -03:00
Leandro Ribeiro 3be23eff99 drm-backend: move code to init/deinit planes to specific functions
The code to init/deinit scanout and cursor planes was in
drm_output_init() and drm_output_deinit(). Move this code
to specific functions drm_output_init_planes() and
drm_output_deinit_planes(), as it makes the code clearer
and easier to maintain.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2020-09-07 13:06:14 -03:00
Leandro Ribeiro 744c0cbb32 drm-backend: drop unused_crtcs from struct drm_backend
Now that we have a CRTC list in the DRM-backend, we can
iterate through it and look for the CRTCs that do not have
assigned outputs in order to find unused CRTCS.

So we can drop unused_crtcs from struct drm_backend and also
drop the functions drm_backend_update_unused_outputs() and
wl_array_remove_uint32().

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2020-09-07 13:04:06 -03:00
Leandro Ribeiro b00d1a2efb drm-backend: move CRTC data from struct drm_output to new struct drm_crtc
There are no 'struct drm_output' for CRTCs that are not active.
Also, CRTC data lives in 'struct drm_output'. This is causing
us some trouble, as the DRM-backend needs to program those
unnactive CRTCs to be off.

If the DRM-backend had the reference for every CRTC (being
active or not), it would make certain functions (e.g.
drm_pending_state_apply_atomic()) more simple and efficient.

Move CRTC data from 'struct drm_output' to 'struct drm_crtc',
as this is the first step to allow the DRM-backend to have
references for every CRTC.

Also, add list of CRTCs to DRM-backend object. Now the
DRM-backend is responsible for allocating/deallocating the CRTC
objects. The outputs will only reference, init and fini the CRTCs
in this list.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2020-09-07 12:39:10 -03:00
Igor Matheus Andrade Torrente ad41a88535 tests: Add a way to write a Weston.ini inside the test
Currently doesn't exist a standard way to write a weston.ini inside a test.

Here, two new functions `weston_ini_setup` and `cfgln` are introduced to
help the test writer to write a weston.ini file and load it to the test.
And `internal-screenshot-test` is converted to use the new method of write
a weston.ini. This conversion serves as example and initial API test.

The tester needs to call `weston_test_harness_execute_as_client` or
`weston_test_harness_execute_as_plugin` in the same way as before.
The `weston_ini_setup` will fill the setup->config_file with the
correct path to the weston.ini file.

The main design goal is to avoid pre-made or build-made weston.ini(s)
and keep the test as self-contained as possible.

Closes:#410
Signed-off-by: Igor Matheus Andrade Torrente <igormtorrente@gmail.com>
2020-09-05 07:14:49 +00:00
Daniel Stone ebcf4f35b4 drm/state-propose: Flatten and clarify control flow
Try to make drm_output_state_propose a little more clear by reducing
divergence between plane and renderer modes towards the end, removing
a possibly-surprising conditional continue.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2020-09-04 11:04:26 +00:00
Daniel Stone 71e6ba5c06 drm/state-propose: Fix fix typo typo
Signed-off-by: Daniel Stone <daniels@collabora.com>
2020-09-04 11:04:26 +00:00
Daniel Stone 8ca5d73355 drm/state-propose: Reduce variable scope
Reduce the scope of surface_overlap to where it's actually used, which
is only in the per-view loop, where it gets initialised and destroyed
every time.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2020-09-04 11:04:26 +00:00
Daniel Stone b625cdcf20 drm/state-propose: Remove special casing for cursor plane
Previously we assumed that cursor planes occluded nothing and would
always be blended, but overlay and scanout planes would always occlude
what's behind them. This is not actually true, as we can support alpha
blending on any kind of plane type now.

Remove the special case, which might hopefully fix some weird display
issues along the way. (Noticed by inspection.)

Signed-off-by: Daniel Stone <daniels@collabora.com>
2020-09-04 11:04:26 +00:00
Daniel Stone 9217ec9c6c drm/state-propose: Remove unused planes_region member
We used to use planes_region for the output regions which were being
displayed on hardware planes; before we grew zpos awareness, we couldn't
have any planes overlapping with each other, since the ordering would be
undefined.

Since the zpos awareness though, this region is unused, so we can just
remove it.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2020-09-04 11:04:26 +00:00
Michael Olbrich 0e4f097d08 compositor: clip the opaque region with the scissor area
The opaque region is used to determine where the views underneath the current
view must be drawn. If the opaque is not clipped, then the area that is part of
the opaque region but not part of the scissor area is not drawn at all.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2020-09-04 11:01:26 +00:00
Michael Olbrich cb04f9894f compositor: update scissor region before using it
Subsurfaces inherit the scissor region from the parent surface. Currently
the region is updated at the end of weston_view_update_transform(). As a
result, the old region is used to clip the transform.boundingbox of the
subsurface.

Change the order to update the scissor region after the transform.matrix is
updated but before it is used.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2020-09-04 11:01:26 +00:00
Simon Ser bce7450040 releasing: make sure to add release artifacts to wayland.fdo
I forget those too often.

Signed-off-by: Simon Ser <contact@emersion.fr>
2020-09-04 10:46:03 +00:00
James Hilliard 80b585f8d2 pipewire: add support for 0.3 API
Fixes: #369

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
2020-09-04 10:39:15 +00:00
Marius Vlad c4076ef88a plug-ins: Migrate pipewire and remoting plug-ins headers to public header
directory

Weston is also a user of the plug-ins, so make use of it. With this
change we unconditionally install the plug-in headers even though
libweston might not be built with support for them.

Suggested-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2020-09-04 10:36:48 +00:00
Simon Ser a5570695c5
build: re-open master for regular development 2020-09-04 12:32:26 +02:00
Simon Ser 04d3ae265d
build: bump to version 9.0.0 for the official release 2020-09-04 12:20:00 +02:00
Simon Ser 13f501c51b
build: bump to version 8.0.93 for the RC1 release 2020-08-27 22:58:53 +02:00
Marius Vlad 380ceee6a1 remoting, pipewire: Install pipewire and remoting plug-ins headers
Required for other users of libweston.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2020-08-27 14:32:26 +03:00
Marius Vlad e0b937af28 remoting: Add DPMS support in remoting pluging
Just like pipewire, add DPMS support in remoting plug-in. Mechanical
change mimicking a24a326bb1.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2020-08-27 14:14:27 +03:00
Leandro Ribeiro 2ac73a8b53 exposay: delete outer padding from struct exposay_output
After some changes in the exposay layout, the outer padding makes
no sense anymore. It was used to avoid the panel to get overlapped
by the exposay surfaces and to keep distance from the borders
of the window.

Currently, the exposay is centralized and the panel cannot get
overlapped. The outer padding just creates unnecessary unused
space, what makes exposay's surfaces smaller.

Delete outer padding from struct exposay_output.

Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
2020-08-26 14:10:50 +00:00
Leandro Ribeiro 82b4d42943 exposay: centralize surfaces of the last row when we don't have enough surfaces
The exposay grid is square, but we don't always have enough surfaces
to fill all the columns of the last row. The code to centralize
the surfaces of the last row is not working.

Fix the code that centralizes the surfaces in the last row, making
it more visually pleasant.

Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
2020-08-26 14:10:50 +00:00
Leandro Ribeiro 55b4b47ec1 exposay: centralize exposay's surfaces in their own square
Commit "exposay: add margins to centralize exposay" has centralized
the whole exposay, but that's not enough. The internal surfaces of
exposay are not centralized.

Each internal surface of exposay is a square, but most of the windows
are rectangular. Add margin to centralize exposay's surfaces in their
own square.

Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
2020-08-26 14:10:50 +00:00
Leandro Ribeiro 048c628139 exposay: add margins to centralize exposay
The exposay is being rendered in the top-left corner of the
screen. Add margins to render it in the center, making it
more visually pleasant.

Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
2020-08-26 14:10:50 +00:00
Leandro Ribeiro 33e29d88cc exposay: make inner border dependent of exposay's surfaces size
We've been using an inner border of fixed size (80px), but this
is dangerous. If you have too many open applications or a small
window, the surface size computed will be negative, crashing
the exposay: "error: weston_view transformation not invertible".

Also, it creates a lot of unnecessary space, making the exposay
unusable when we have a small window or many applications open.

Make inner border to be 10% of surface size and surface size to
be 90% of its original size, avoiding the crashes and making it
more visually pleasant.

Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
2020-08-26 14:10:50 +00:00
Leandro Ribeiro b68454e893 exposay: do not account panel size to compute exposay area
Commit "desktop-shell: make get_output_work_area() global" allowed
the usage of get_output_work_area() in exposay. This is necessary to
avoid overlapping the panel when rendering exposay's surfaces.

Use get_output_work_area() to not take into account the panel size,
instead of considering that the whole screen is available to
render exposay's surfaces.

Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
2020-08-26 14:10:50 +00:00
Leandro Ribeiro 0c59e92f0c desktop-shell: make get_output_work_area() global
get_output_work_area() can be used by exposay to know the free space
where it can render its surfaces, what avoids overlapping the panel.

Currently this function is declared as static in
desktop-shell/shell.c, so it cannot be used by exposay.

Remove static from get_output_work_area() and add it to shell.h
so it can be used by exposay as well.

Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
2020-08-26 14:10:50 +00:00
Leandro Ribeiro fd874ff533 exposay: move constant value calculation out of loop
In exposay_layout(), int pad is being calculated within the
loop. This is unnecessary, as its value is constant. Move it
out of the loop.

Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
2020-08-26 14:10:50 +00:00
Marius Vlad 67b382ccdc compositor: Avoid using weston_log() in weston_view_is_opaque()
As from commit b7e5f10bf4, weston_view_is_opaque() is called from
debug_scene_graph_cb(), which on its own represents a (different)
scope. By default, we already have a subscriber for the 'log' scope,
which will cause a harmless, yet spurious, message.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2020-08-24 14:19:02 +03:00
Michael Olbrich a24a326bb1 pipewire: implement DPMS
Pipewire doesn't need to wait for any hardware. The finish_frame() callback is
just artifically delayed to generate the desired framerate.

So when the DPMS level changes, we can just call finish_frame() immediately if
necessary and cancel the timer.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2020-08-19 08:50:45 +02:00
Michael Olbrich d70e712c2f drm: always check the repaint_status in update_complete
Initially finish_frame() was never called in drm_output_update_complete() for
'dpms_off_pending = true'. This is wrong for repaint_status ==
REPAINT_AWAITING_COMPLETION and that was fixed in
68d49d772c ("compositor-drm: run finish_frame when
dpms is turned off in update_complete").
However finish_frame() may now be called for repaint_status !=
REPAINT_AWAITING_COMPLETION, which is not allowed and results in a failed
assertion.

Fix this by checking dpms and repaint_status unconditionally.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2020-08-19 07:35:14 +02:00
Marius Vlad 5130a8c21a backend-drm: Correctly tear down the DRM backend
It seem that we skipped to put back in TEXT mode the tty, in case a DRM
device node wasn't present at that time, or it isn't present at all. This
orders the destroy part correctly as to handle that case as well.

As a side effect, as the tty will still be set to GRAPHICS mode we will
require a manual change of the tty number, which might be not possible
on all systems. Properly putting back the tty to TEXT mode should avoid
that, and allows to re-use the same tty no in case the DRM device has
been created at a later point in time.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2020-08-18 12:59:50 +03:00
Andreas Heynig 2592d6591e libweston/launcher-direct.c: do not fail if already in graphics mode
In case of a crash tty remains in graphic mode. This change allows to restart weston without
taking care of the actual tty mode.

Signed-off-by: ahe <Andreas.Heynig@meetwise.com>
2020-08-17 11:59:39 +00:00
Stefan Agner 465ab2cd92 backend-drm: allow to disable GBM modifiers
Allow to disable GBM modifiers at runtime using the environment variable
WESTON_DISABLE_GBM_MODIFIERS.

This can be useful for debugging or when modifiers cause issues, e.g. in
case modifiers use higher memory bandwidth and hence impose a lower
resolution limit as it is the case with Intel Kaby Lake graphics.

Related to: https://gitlab.freedesktop.org/wayland/weston/-/issues/404
Signed-off-by: Stefan Agner <stefan@agner.ch>
2020-08-17 10:17:30 +00:00