Age | Commit message (Collapse) | Author |
|
|
|
|
|
We can grab the event loop from the wlr_session instead.
|
|
|
|
|
|
We can grab the event loop from the wlr_session instead.
|
|
|
|
This makes it easy for compositors to handle situations where the
DRM or libinput backend becomes unavailable. Compositors can listen
the destroy event of the multi backend returned by
wlr_backend_autocreate() and decide what to do.
|
|
We'll need this in the next commit.
|
|
wl_display holds a lot more than wlr_session needs: wlr_session
only needs to wait for a FD to become readable, but wl_display
provides full access to the Wayland client and protocol objects.
Switch to wl_event_loop to better reflect the above.
|
|
We can just assume CLOCK_MONOTONIC everywhere.
Simplifies the backend API, and fixes clock mismatches when multiple
backends are used together with different clocks.
|
|
This is a bit more type-safe.
|
|
Instead of littering #ifdefs everywhere, move them to the dedicated
attempt_XXX_backend() functions. This makes the logic in
wlr_backend_autocreate() more readable, and provides better error
messages when the X11/Wayland backends are disabled at compile-time,
or when WLR_BACKENDS contains a backend disabled at compile-time.
|
|
When we change the required dependencies for the DRM backend,
Meson might auto-disable the backend for users missing the new
requirements. This results in confused users [1] because they don't
notice the "drm-backend: NO" line burried in the Meson logs, and
then get a black screen when starting the compositor.
Update wlr_backend_autocreate() to refuse to create a backend with
only libinput (without DRM).
Users really wanting to start their compositor with a libinput
backend and without a DRM backend can manually set WLR_BACKENDS.
[1]: https://github.com/swaywm/sway/issues/7457
|
|
WLR_DRM_DEVICES specifies a static list of DRM devices to open
at startup.
Do not create DRM backends for hotplugged DRM devices when it's
set.
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3595
|
|
|
|
|
|
Some compositors are not interested in wlr_session, for instance
nested compositors.
Disabling wlr_session removes the udev dependency.
|
|
Instead of hand-rolling get_current_time_msec(), let's just re-use
the helper we already have in "util/time.h".
|
|
Instead of returning an empty multi backend, fail with a clear
error when both the DRM and libinput backends are disabled.
|
|
This function deals with multiple kinds of backends. Make it more
obvious that this variable holds the multi backend which is returned
to the user.
|
|
This no longer has purpose.
|
|
Up until now, wlr_backend_autocreate() created the wlr_session and
then stuffed it into struct wlr_multi_backend so that compositors
can grab it later.
This is an abuse of wlr_multi_backend and the wlr_backend API:
wlr_backend_get_session() and wlr_multi_backend.session only exist
to accomodate the needs of wlr_backend_autocreate(). What's more,
the DRM and libinput backends don't implement
wlr_backend_impl.get_session.
Instead, return the struct wlr_session to the compositor in the
wlr_backend_autocreate() call. wlr_backend_get_session() will be
removed in the next commit.
|
|
|
|
|
|
Ensures there is no field left to its previous undefined value after
calling an init function.
|
|
The libinput backend is now optional. However, this means that a
user building wlroots without the correct libinput dependencies
will end up with a compositor which doesn't respond to input events.
wlr_backend_autocreate is supposed to return a sensible setup, so in
this case let's just error out and explain what happened. Users can
suppress the check by setting WLR_LIBINPUT_NO_DEVICES=1 (already used
to suppress the zero input device case inside the libinput backend).
Compositors which really want to create a bare DRM backend can easily
create it manually instead of using wlr_backend_autocreate.
|
|
This helper is responsible for listening for new DRM devices and
create new child DRM backends as necessary.
|
|
The multi backend was returned instead of the primary DRM backend.
|
|
|
|
|
|
|
|
|
|
|
|
Since libinput is an optional dependency the libinput backend is possibly undeclared.
wlr_backend_destroy(backend) below will clean up the child libinput backend if any.
|
|
This commit adds two error-handling cases to the function
attempt_dmr_backend. Specifically:
- In the case where the number of found GPUs is zero, we now
print a log message indicating this and return a NULL pointer
- In the case where we could not successfully create a backend
on any GPU, we now log a message indicating this and return
a NULL pointer
This allows us to provide more descriptive error messages,
as well as avoid a SEGFAULT (the function
`ensure_primary_backend_renderer_and_allocator` dereferences the pointer
given, which could be NULL until this patch) when these cases arise.
|
|
After 70fb21c35ba4 made libinput optional the include prevents
building without libinput package installed.
backend/backend.c:4:10: fatal error: 'libinput.h' file not found
#include <libinput.h>
^~~~~~~~~~~~
|
|
Instead of ensuring the renderer and allocator are initialized in each
backend, do it in wlr_backend_autocreate. This allows compositors to
create backends without any renderer/allocator if they side-step
wlr_backend_autocreate.
Since the wlr_backend_get_renderer and backend_get_allocator end up
calling wlr_renderer_autocreate and wlr_allocator_autocreate, it sounds
like a good idea to centralize all of the opimionated bits in one place.
|
|
|
|
Add render/allocator/ and include/render/allocator/ to hold
everything allocator-related.
|
|
We can now just rely on the common code for this.
|
|
Co-authored-by: Simon Ser <contact@emersion.fr>
|
|
Introduce a new backend_get_allocator function that automatically
creates an allocator for the backend if the backend has a renderer.
|
|
If a backend accepts buffers (as indicated by get_buffer_caps) but
doesn't implement get_renderer, automatically create a renderer.
|
|
This new functions cleans up the common backend state. While this
currently only emits the destroy signal, this will also clean up
the renderer and allocator in upcoming patches.
|
|
Makes it easier to figure out why a backend/renderer is picked.
|
|
|
|
The get_drm_fd was made available in an internal header with a53ab146f. Move it
now to the public header so consumers opting in to the unstable interfaces can
make use of it.
|
|
This function allows backends to return the DRM FD they are using. This
will allow the allocator and the renderer to use the right device.
|
|
Sometimes wlr_session_find_gpus will encounter an error. This is
different from finding zero GPUs.
On error, wlr_session_find_gpus already returns -1. However, this is
casted to size_t, so callers uncorrectly assume this is a success.
Instead, make wlr_session_find_gpus return a ssize_t and allow callers
to handle the error accordingly.
|