Commit graph

44 commits

Author SHA1 Message Date
Simon Ser
e8d56ca415 backend/session: allow wlr_session_find_gpus to return an error
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.
2021-01-04 19:46:44 +01:00
Simon Ser
754179dacd backend/session: add a timeout waiting for GPUs
If a GPU doesn't show up in 10s, bail out and return zero GPUs.
2020-11-19 22:47:49 +01:00
Simon Ser
0e76f92de7 backend/session: replace session_signal with events.active
This is more idiomatic wlroots API. The new name makes it clear that the
signal is emitted when wlr_session.active changes.
2020-11-19 22:47:49 +01:00
Simon Ser
fbf11a41e1 backend/session: wait for DRM device if none found
Wait for a DRM device if none is found in wlr_session_find_gpus. This
can happen if the compositor is loaded before the display kernel driver.

This supersedes the logind CanGraphical property.

To test, e.g. with i915 and sway:

    rmmod -f i915
    sway &
    modprobe i915

Closes: https://github.com/swaywm/wlroots/issues/2093
2020-11-19 22:47:49 +01:00
Simon Ser
76bcddf071 backend/session: introduce wlr_session.events.add_drm_card
This is triggered when a new DRM card is added.

An easy way to test this patch is `modprobe vkms`.
2020-11-19 22:47:49 +01:00
Simon Ser
768fbaad54 backend/session: filter udev events by sysname
We're only interested in card devices. The loop over wlr_session.devices
would take care of ignoring non-card events, but a future patch will
listen to udev "add" events as well.
2020-11-19 22:47:49 +01:00
Simon Ser
44a4792fd8 backend/session: operate on wlr_device
Instead of operating on FDs in {open,close}_device, operate on
wlr_devices. This avoids the device lookup in wlr_session and allows
callers to have access to wlr_device fields.

For now, we use it to remove wlr_session_signal_add and replace it with
a more idiomatic wlr_session.events.change field. In the future, other
events will be added.
2020-11-19 22:47:49 +01:00
Simon Ser
63df2bcbe6 backend/session: don't return FD on failure in open_file
When wlr_session_open_file fails, don't return the FD, otherwise the
caller will think the call succeeded.
2020-11-19 22:47:49 +01:00
Kenny Levinsen
bad1e9afa8 session: Add libseat backend 2020-08-24 11:13:55 +02:00
Jan Beich
2bad34e024 backend/session: allow GPU enumeration on FreeBSD
f11ee5b418
2020-02-17 10:43:58 +01:00
Antonin Décimo
68b4a5305e backend/session: non-void function should return a value
With assertions disabled, it should make sense to return NULL.
2019-08-12 09:37:21 +09:00
Simon Ser
ca45f4490c Remove all wayland-server.h includes
The documentation for wayland-server.h says:

> Use of this header file is discouraged. Prefer including
> wayland-server-core.h instead, which does not include the server protocol
> header and as such only defines the library PI, excluding the deprecated API
> below.

Replacing wayland-server.h with wayland-server-core.h allows us to drop the
WL_HIDE_DEPRECATED declaration.
2019-07-27 15:49:32 -04:00
emersion
8efeca528f backend/session: add noop session
This is the first step towards being able to run via DRM leasing and on render
nodes.

Test with:

    export WLR_BACKENDS=drm
    export WLR_SESSION=noop
    export WLR_DRM_DEVICES=/dev/dri/renderD128
2019-03-02 08:40:27 -07:00
emersion
51bfdd620e
Use #if instead of #ifdef for wlroots config data
This prevents some annoying issues when e.g. not including wlr/config.h or
making a typo in the guard name.
2018-11-12 10:12:46 +01:00
random human
572dfcdba7
Add support for WLR_SESSION env variable
Valid values are "logind"/"systemd" and "direct". If WLR_SESSION is set,
only its value is potentially tried; it will not try any other option.
2018-09-18 05:06:32 +05:30
Alexander Bakker
221d412824 Init the new destroy signals added by #1200 2018-08-27 18:21:36 +02:00
Alexander Bakker
20db29779e Add destroy signals to types that are destroyed by wl_display_destroy 2018-08-26 23:23:12 +02:00
Ilia Bozhinov
cb42e16f64 session: load GPU devices even if they have zero crtcs/connectors/encoders
On some systems (most notably laptops with two GPUs) there are GPUs that
don't have attached outputs. However, we still want to load those GPUs
because they could still be used by the compositor for rendering.
2018-08-08 07:34:12 +03:00
Drew DeVault
4b096fc114 Revert "Merge pull request #1153 from emersion/include-config"
This reverts commit ef0a6ea4d2, reversing
changes made to 8d03bc9178.
2018-07-21 09:44:20 -04:00
emersion
41094a7df5 Always include config.h 2018-07-21 13:08:23 +01:00
emersion
7cbef15206
util: add wlr_ prefix to log symbols 2018-07-09 22:49:54 +01:00
Scott Anderson
47985d2dc5 Multiseat fixes 2018-06-14 20:46:16 +12:00
Drew DeVault
1d9be89e2d
Revert "ELF Visibility" 2018-02-19 18:01:27 -05:00
Scott Anderson
86269052eb Explicitly export EFL symbols 2018-02-19 14:26:40 +13:00
emersion
c2e1474010
Reformat all #include directives 2018-02-12 21:29:23 +01:00
emersion
36ead80cd1
Make wlr_signal_emit_safe private 2018-02-12 19:52:47 +01:00
emersion
5e58d46cc1
Add wlr_signal_emit_safe 2018-02-12 09:12:31 +01:00
Johannes Schramm
dcc743047b style: include brackets for if/while/for, even if it's a single statement 2018-01-21 16:28:21 +01:00
PoroCYon
7574e27c6a fix build without systemd 2018-01-02 16:39:58 +01:00
Björn Esser
ff13849624
config: Avoid clash with other config-headers 2017-12-27 17:13:58 +01:00
Björn Esser
57a09c8ca4
config: Put all defines into config.h 2017-12-26 18:51:27 +01:00
emersion
6001235b04
Listen to display destroy in session
It's not the backend's responsibility to destroy the session anymore.
2017-12-08 11:17:56 +01:00
emersion
bb79ada49f
Fix a bunch of mistakes detected with scan-build 2017-11-16 10:30:54 +01:00
Eric Molitor
5be11a5c95 Remove VLA from session.h
VLAs are optional C11 features and not supported by C++.
2017-11-10 15:12:00 +00:00
Greg V
a5fe9aa736 Add FreeBSD compatibility 2017-10-11 00:07:21 +03:00
Scott Anderson
9ec9edc40d Check for fd failure properly 2017-10-02 22:01:09 +13:00
Scott Anderson
6cfe47d1d8 Add explicitly picking GPUs with environment var 2017-10-02 21:57:14 +13:00
Scott Anderson
fa3d0ed929 Change wlr_session to open every GPU 2017-10-01 16:47:05 +13:00
dudemanguy
175f89f4ff Add elogind support
Resolves SirCmpwn/wlroots#146
2017-09-22 12:02:55 -05:00
Scott Anderson
d16b2977f6 Remove single GPU assumptions from wlr_session 2017-08-26 14:50:16 +12:00
Scott Anderson
fb93628bda Merge wlr_udev into wlr_session 2017-08-26 14:02:04 +12:00
Scott Anderson
46823152ea Rename functions to be consistent with #93 2017-08-26 11:56:43 +12:00
Scott Anderson
cb4d50e22c Changed header paths. 2017-08-06 13:25:26 +12:00
Scott Anderson
2ae5cd6539 Moved session/ into backend/ 2017-08-06 13:25:26 +12:00
Renamed from session/session.c (Browse further)