Commit graph

7340 commits

Author SHA1 Message Date
Marius Vlad a86b590fea backend-drm: Fix ignoring config 'require-input' option
Without this patch, the DRM-backend would rewrite the 'require-input',
core section option given by the user.

This removes 'continue_without_input' DRM-backend option and takes into
consideration the cmd line option only if that was passed (Pekka Paalanen).

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2020-12-07 12:49:38 +02:00
Marius Vlad e630d2d0d0 gitlab-ci.yml: Have a doc job
This helps identify if we have actually have a build issue or if we have
a documentation build failure. Notifications sent out are specifying the
name of the build, making things much easier to figure out what actually
failed.

Uses another job w/o the need to run the tests (again).

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2020-12-04 14:23:46 +02:00
Pekka Paalanen 49399806a0 config-parser: use zalloc()
While the code looks fine, clang 7 memory sanitizer complains about
things like:

==26052==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x7f4f4d003327 in weston_config_get_section /home/pq/build/weston-clang/../../git/weston/shared/config-parser.c:141:2
    #1 0x7f4f4cfce11a in wet_main /home/pq/build/weston-clang/../../git/weston/compositor/main.c:3266:12

==26683==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x7f09ebd638e2 in config_section_get_entry /home/pq/build/weston-clang/../../git/weston/shared/config-parser.c:125:2
    #1 0x7f09ebd661c4 in weston_config_section_get_bool /home/pq/build/weston-clang/../../git/weston/shared/config-parser.c:310:10
    #2 0x7f09ebd2e1e5 in wet_main /home/pq/build/weston-clang/../../git/weston/compositor/main.c:3269:3

In all cases, the errors point to wl_list_for_each().

Making these allocations use zalloc() avoids these errors. Since using
zalloc() is a good habit in any case, I didn't dig deeper.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-11-27 14:44:10 +02:00
Pekka Paalanen 94bf0a6463 tests: do not save PNG on success
Do not write out PNG files for successful screenshot tests. It clutters
the build directory, but the biggest reason is to keep the CI artifacts
smaller.

internal-screenshot test still writes a PNG, it's good to keep one PNG
written so that we exercise the PNG writing code always.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-11-18 16:14:33 +02:00
Pekka Paalanen d73b10916d CI: store test images in artifacts
If a screenshooting test fails, it quite likely writes not only the screenshot
but also a diff image highlighting the failed pixels. These would be good to
have in the CI artifacts for postmortem.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-11-18 16:14:33 +02:00
Veeresh Kadasani 9490a9893f pipewire/meson: fix option in user_hint
Signed-off-by: Veeresh Kadasani <veereshkadasani88@gmail.com>
2020-11-17 09:48:59 -05:00
Leandro Ribeiro cdb7218daf compositor: move tests quirks initialization to weston_compositor_create()
Until now we had the test quirks initialization in wet_main(),
just after calling weston_compositor_create(). But there are
some cases that require the quirks during struct weston_compositor
creation time.

Move test quirks initialization to weston_compositor_create()
in order to cover more use cases for the test quirks mechanism.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2020-11-17 12:38:42 +00:00
Marius Vlad bb7ed37a89 remoting,pipewire: Use the connector and the output name for the head name
Makes the client's life much easier to identify between multiple remote
outputs. xdg_output is advertising (in later versions) the head name,
but in case we have different plug-ins or multiple remote
outputs created, it would only repeat/advertise the same name
for all (remoting) outputs.

This instead uses a string that uses both the connector and name to
derive a more easier identifier a client can choose from.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2020-11-09 11:36:12 +02:00
bnlrnz cf83b48be4 backend-headless: NULL check after wl_event_loop_add_timer
Running weston with headless backend will segfault if wl_event_loop_add_timer fails
   Closes #102

   Signed-off-by: Ben Lorenz <bnlrnz@gmail.com>
2020-11-06 16:13:24 +00:00
Pekka Paalanen a79c917466 CI: expose built docs preview
This adds a link in any MR to the documentation from the CI build, making it
easy to preview the documentation.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-11-05 16:09:32 +02:00
Marius Vlad 092130c4bf kiosk-shell: Keep track of seats created and destroy them at end
kiosk_shell_destroy() will free up weston_desktop, but still keeping
listeners set-up (keyboard/seat/caps), which will fire
when the the compositor is stopped/shutdown by clients still connected.

This patch maintains a list of seats and uses it to remove any listeners
when calling kiosk_shell_destroy(). desktop-shell and ivi-shell do not
appear to be using weston_desktop_destroy() in their respective destroy
parts.

This avoids an illegal access happening when calling one of the
listeners, after weston_desktop has been free'ed, like the following:

==2002==    at 0x10F3F8FD: weston_desktop_get_display (libweston-desktop.c:125)
==2002==    by 0x10F450A7: weston_desktop_xdg_surface_schedule_configure (xdg-shell.c:1022)
==2002==    by 0x10F44793: weston_desktop_xdg_toplevel_set_activated (xdg-shell.c:643)
==2002==    by 0x10F41AA5: weston_desktop_surface_set_activated (surface.c:468)
==2002==    by 0x10F32E7E: kiosk_shell_seat_handle_keyboard_focus (kiosk-shell.c:329)
==2002==    by 0x4A726A7: wl_signal_emit (wayland-server-core.h:478)
==2002==    by 0x4A75BD1: weston_keyboard_set_focus (input.c:1586)
==2002==    by 0x4A776FE: notify_keyboard_focus_out (input.c:2314)
==2002==    by 0x5902BC1: udev_seat_destroy (libinput-seat.c:469)
==2002==    by 0x59028C5: udev_input_destroy (libinput-seat.c:375)
==2002==    by 0x58F0449: drm_destroy (drm.c:2571)
==2002==    by 0x4A6EE39: weston_compositor_destroy (compositor.c:7814)
==2002==  Address 0x10bd1780 is 0 bytes inside a block of size 152 free'd
==2002==    at 0x48399AB: free (vg_replace_malloc.c:538)
==2002==    by 0x10F3F8DA: weston_desktop_destroy (libweston-desktop.c:112)
==2002==    by 0x10F34357: kiosk_shell_destroy (kiosk-shell.c:1009)
==2002==    by 0x4A5F618: wl_signal_emit (wayland-server-core.h:478)
==2002==    by 0x4A6EE06: weston_compositor_destroy (compositor.c:7809)
==2002==    by 0x4855548: wet_main (main.c:3420)
==2002==    by 0x109154: main (executable.c:33)
==2002==  Block was alloc'd at
==2002==    at 0x483AB65: calloc (vg_replace_malloc.c:760)
==2002==    by 0x10F3F681: zalloc (zalloc.h:38)
==2002==    by 0x10F3F724: weston_desktop_create (libweston-desktop.c:65)
==2002==    by 0x10F34458: wet_shell_init (kiosk-shell.c:1045)
==2002==    by 0x484F83D: wet_load_shell (main.c:924)
==2002==    by 0x48552D3: wet_main (main.c:3361)
==2002==    by 0x109154: main (executable.c:33)

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2020-11-04 14:34:30 +02:00
Leandro Ribeiro 79491b41f5 tests: drop test suite screenshooter implementation and protocol extension
This is a follow-up of commit "tests: start to use Weston's
default screenshooter in the test suite".

As we've started to use Weston's default screenshooter
implementation and protocol extension in the test suite,
we don't need what we've created specifically for the test
suite anymore.

Drop test suite screenshooter implementation and protocol
extension.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2020-10-27 12:19:39 +00:00
Leandro Ribeiro 9e90760ab0 tests: start to use Weston's default screenshooter in the test suite
Until now we had two different protocol extensions: one for the
test suite screenshooter and other for the screenshooter client.
As they are identical and this won't change, make the test suite
use the same protocol that the screenshooter client uses.

Besides the cleanup, this change will also allow us to use the
DRM writeback screenshooter in the test suite, as the test suite
implementation is hardcoded to use a renderer based screenshooter.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2020-10-27 12:19:39 +00:00
Leandro Ribeiro bc56729ffe screenshooter: rename some functions to avoid conflicts
We have two functions with the name weston_screenshooter_shoot():

    1. screenshot protocol function that the screenshooter
    client uses to request screenshots to the compositor

    2. libweston function used by the compositor to take
    screenshots as requested by the screenshooter client

Until now we had no problem with that, but in the next commits
we are going to use the screenshot protocol in the test suite,
which is also user of libweston. So rename screenshot protocol
function to weston_screenshooter_take_shot() to avoid the conflict.

For consistency, also rename screenshooter_shoot() to
screenshooter_take_shot() in compositor/weston-screenshooter.c

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2020-10-27 12:19:39 +00:00
Leandro Ribeiro 6c7dc70d86 tests: change type of int buffer_copy_done to bool
The 'struct test' has a field 'int buffer_copy_done', but it
is in a fact a boolean. Change it to 'bool buffer_copy_done'.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2020-10-27 12:19:39 +00:00
Leandro Ribeiro 6b4d48736f tests: remove has_wl_drm from struct client
The wl_drm protocol is not being used by the test client. So
remove 'bool has_wl_drm' from 'struct client' and also the
branch that initializes this variable in handle_global().

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2020-10-27 12:19:39 +00:00
Leandro Ribeiro a7e0e717a9 tests: remove destroy_listener when destroying test-desktop-shell
When destroying the shell we need to remove the listeners
as well. The test-desktop-shell was forgetting to do this.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2020-10-27 12:19:39 +00:00
Pekka Paalanen a0f4a16132 libweston: bump major version to 10
Commit 32a5acde5b
"tests: add mechanism to change Weston's behavior when running certain
tests"

added a new field to struct weston_compositor. Since that struct is
still in the public header, this breaks ABI. Bump the library version
accordingly.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-10-27 13:27:05 +02:00
Leandro Ribeiro 2d4dd70ff5 libweston: drop opaque struct wet_testsuite_data
Until now we had struct wet_testsuite_data as an opaque
struct that should be defined by the testsuite of libweston
users. Instead, keep the data as a void * and document that
users are responsible for defining the data type.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2020-10-27 11:21:55 +00:00
Leandro Ribeiro 32a5acde5b tests: add mechanism to change Weston's behavior when running certain tests
There are some specific cases in which we need Weston to
behave differently when running in the test suite. This
adds a new API to allow the tests to select these behaviors.

For instance, in the DRM backend we plan to add a writeback
connector screenshooter. In case it fails for some
reason, it should fallback to the renderer screenshooter
that all other backends use. But if we add a test to
ensure the correctness of the writeback screenshooter,
we don't want it to fallback to the renderer one, we
want it to fail. With this new API we can choose to
disable the fallback behavior specifically for this test.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2020-10-27 11:21:55 +00:00
Heiko Thiery 526765ddfd Add EGL_NO_PLATFORM_SPECIFIC_TYPES to avoid Xlib.h via EGL headers
See: https://github.com/KhronosGroup/EGL-Registry/pull/111 discussion.

Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
2020-10-26 15:44:34 +01:00
Heiko Thiery ea0b03dff0 libweston/backend/drm: might need EGL
gbm-drm.c includes gl-renderer.h. When EGL is enabled, that in turns
includes egl.h. As such, dependencies for drm should include EGL if
it is available.

This condition is modelled after a similar one in libweston/meson.build

Reported-by: Gary Bisson <gary.bisson@boundarydevices.com>
Reported-by: Heiko Thiery <heiko.thiery@gmail.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Refik Tuzakli <tuzakli.refik@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
2020-10-26 15:44:34 +01:00
Pekka Paalanen 8285005744 libweston: constify data_source_interface
Found mutable global variables with
 $ grep -P '^static (?!const).*[=;]' -- compositor libweston shared

Mutable global or static variables make it harder to run several
compositor instances in the same process. That is what the test suite
would probably need to do to test wayland-backend.

This one variable does not need to be mutable.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-10-21 14:18:30 +03:00
Pekka Paalanen 43141231a0 compositor: delete segv_compositor
This was forgotten in "weston: remove SEGV and ABRT handlers". It is
unused.

Fixes: bb707dc0fe

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-10-21 13:59:18 +03:00
Igor Matheus Andrade Torrente 6354455979 backend-drm: Reuse drmModeRes in drm_backend_create
Rework some functions in `drm.c` to reuse the `drmModeRes` and
reduce the usage of `drmModeGetResources` and `drmModeGetResources`.

Signed-off-by: Igor Matheus Andrade Torrente <igormtorrente@gmail.com>
2020-10-19 09:12:02 +00:00
Tanmay Shah 8ef3ce5c67 clients: Fix shell background image setting.
If weston.ini is not setting background-image path,
then desktop-shell sets ${DATDIR}/weston/pattern.png
as background. However in this case  width and height
is set to 1 during background config and is being
scaled to avoid allocation of buffer.

This behavior is not right. Along with background-image
path, we should also check if background-color is set.
If background color is set, then only scale 1x1 buffer.

This would allow to set pattern.png as default wallpaper
of weston correctly, if background-color is also not set
in weston.ini file.

Fixes: 3623e46dc5
Signed-off-by: Tanmay Shah <tanmay@codeaurora.org>
2020-10-19 07:23:43 +00:00
Harsha M M 1b470f96d2 ivi-shell: clean up remaining ivisurface during de-init
Signed-off-by: Harsha M M <harsha.manjulamallikarjun@in.bosch.com>
2020-10-16 16:23:25 +00:00
Pekka Paalanen 9b94a7d833 Bump libdrm dependency to 2.4.95
96bef0517e "drm-backend: add support for
writeback connectors" started using DRM_MODE_CONNECTOR_WRITEBACK and
DRM_CLIENT_CAP_WRITEBACK_CONNECTORS. These were introduced in libdrm
2.4.95.

According to
https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/311
Ubunut Xenial is the only mentioned distribution that does not provide a
libdrm new enough. I think that is fine to drop now, 2016 was a good
while ago.

Libdrm 2.4.95 also introduced DRM_CLIENT_CAP_ASPECT_RATIO,
DRM_MODE_PICTURE_ASPECT_64_27, DRM_MODE_PICTURE_ASPECT_256_135.

The fallback definitions for the above are dropped.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-10-16 16:20:54 +00:00
Stefan Agner 7d2da94b05 backend-rdp: release seat on peer disconnect
Properly release the seat on RDP disconnect. Using current master
branch which is commit d93c0f7059 ("backend-rdp: fix memory leak")
I was not able to reproduce the crash on reconnect as mentioned in the
current comment. Using Weston with rdp-backend directly as well as
using the screen-share plug-in allowed to reconnect just fine. Hence
release the Weston seat properly using weston_seat_release and free
the seat structure. This also avoids mouse pointers displayed for
every RDP connection.

Signed-off-by: Stefan Agner <stefan@agner.ch>
2020-10-16 12:11:27 +00:00
David Fort e3f447eee8 rdp-backend: require FreeRDP >= 2.2 to remove all the version hacks
The stable FreeRDP 2.x branch has been released, so let's rely on that maintained
version and drop all the hacks for older versions. That makes the code and build
cleaner.

Signed-off-by: David Fort <contact@hardening-consulting.com>
2020-10-01 18:15:42 +02:00
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