summaryrefslogtreecommitdiff
path: root/daemon/gdm-local-display-factory.c
Commit message (Collapse)AuthorAgeFilesLines
* local-display-factory: Only check current VT for respawn on seat0msizanoen2023-05-081-1/+1
| | | | | | There's no reason that seat0 having the initial VT on foreground should trigger ensuring display on unrelated seats. Fix this by only checking for the current VT if the newly ended session belongs to seat0.
* local-display-factory: Do not ensure login screen when a background user ↵msizanoen12023-05-081-1/+10
| | | | session terminates
* local-display-factory: Ensure greeter sessions on non-primary seats are ↵msizanoen12023-05-081-2/+18
| | | | | | | | | respawned on termination Trigger ensuring a greeter session for a non-primary seat when it terminates and only looking for displays with state of GDM_DISPLAY_MANAGED when checking for duplicates in ensure_display_for_seat on non-primary seats.
* local-display-factory: Only ensure display for the session's seat on logout ↵msizanoen12023-05-081-5/+3
| | | | | | | | instead of all seats An user logging out from another seat shouldn't affect other users on other seats. Limit ensuring a greeter session to the seat that have just been logged out.
* local-display-factory: Search for greeter sessions from logind before ↵msizanoen12023-05-081-7/+7
| | | | | | | | | | | looking up the display from display store On non-primary seats, GDM will look up the display from display store and abort ensuring a display for seat. This causes the seat to have no active session when a user logs out, instead of the login screen. Fix this by searching for greeter sessions from logind before looking up the display from display store.
* daemon: Allow Wayland sessions on non-primary seatsmsizanoen12023-05-081-22/+13
|
* local-display-factory: Acquire seat name properlymsizanoen12023-05-081-6/+26
| | | | | | | | | systemd-logind escapes the seat name prior to exposing as a DBus object. As a result, seat names like "seat-name" may be escaped to "seat_x2dname" when exposed as a DBus object. Use DBus to acquire the seat name instead of using the last component of the object path.
* gdm-local-display-factory: Remove unused variableAlessandro Bono2023-04-281-1/+0
|
* gdm-local-display-factory: Move variables to inner scopeAlessandro Bono2023-04-281-3/+4
|
* gdm-local-display-factory: Move early return on topAlessandro Bono2022-10-281-27/+29
| | | | | | There is no need to perform all the checks if the display is already created. While at it, add a debug message to make easier to understand the message when a display already exists.
* gdm-local-display-factory: Improve debug messageAlessandro Bono2022-10-281-1/+1
|
* gdm-local-display-factory: Move display existence check to its own functionAlessandro Bono2022-10-281-8/+22
|
* gdm-local-display-factory: Remove redundant checkAlessandro Bono2022-10-281-4/+6
| | | | | | | | | | There is no case where seat_supports_graphics is TRUE while session_types is NULL. Thus, after the following check: ``` if (!seat_supports_graphics) return; ``` we can assume that session_types won't be NULL.
* gdm-local-display-factory: Move variables to inner scopesAlessandro Bono2022-10-281-2/+4
|
* gdm-local-display-factory: Remove unused variablesAlessandro Bono2022-10-281-5/+0
|
* gdm-local-display-factory: Set is_seat0 right awayAlessandro Bono2022-10-281-5/+2
|
* gdm-local-display-factory: Remove unused variableAlessandro Bono2022-10-271-1/+0
| | | | Unused since eba8deb7f92f473a40a8e277203d86aeab879bd1.
* gdm-local-dispay-factory: Use g_clear_handle_idAlessandro Bono2022-10-271-8/+2
|
* gdm-local-display-factory: Plug a memory leakAlessandro Bono2022-09-271-3/+2
| | | | | The error was never freed. While at it, convert also the id to use g_autofree.
* local-display-factory: Fix typo in supported session typesRay Strode2022-08-191-1/+1
| | | | | | | | | There's a typo "tyes" instead of "types" leading to the wrong supported session types getting set in some cases. This commit fixes that. Closes https://gitlab.gnome.org/GNOME/gdm/-/issues/808
* local-display-factory: Stop listening to udev events when necessaryRay Strode2022-03-231-3/+4
| | | | | | | | | | At the moment we still listen for udev events after we've determined the system has settled (or a timeout has happened). This means if there is a udev event late, the login screen could get brought back up while the user is using the system. This commit fixes that.
* local-display-factory: Fix type of signal connection idRay Strode2022-03-231-1/+1
| | | | | | Signal connection ids are 64-bit not 32-bit. This commit fixes the type used.
* common: Reload settings when graphics initializeRay Strode2022-03-011-2/+5
| | | | | | | | | | | If GDM starts faster than graphics initialize, then the udev rules that write out /run/gdm/custom.conf might get run too late for GDM to notice. This commit changes GDM to reread its config after graphicals initialization completes. https://gitlab.gnome.org/GNOME/gdm/-/issues/763
* local-display-factory: Stall startup until main graphics card is readyRay Strode2022-03-011-12/+152
| | | | | | | | | | | | | | | | | | | | | | | | | At the moment, GDM waits until systemd says the system supports graphics (via the CanGraphical logind property). Unfortunately, this property isn't really what we need, since it flips to true when *any* graphics are available, not when the main graphics for the system are ready. This is a problem on hybrid graphics systems, if one card is slower to load than another. In particular, the vendor nvidia driver can be slow to load because it has multiple kernel modules it loads in series. Indeed on fast systems, that use the vendor nvidia driver, it's not unusual for boot to get to a point where all of userspace up to and including GDM is executed before the graphics are ready to go. This commit tries to mitigate the situation by adding an additional, check aside from CanGraphical to test if the system is ready. This check waits for the graphics card associated with boot to be fully up and running before proceeding to start a login screen. Closes: https://gitlab.gnome.org/GNOME/gdm/-/issues/763
* local-display-factory: restart greeter session when crashedXiaoguang Wang2022-01-111-1/+2
| | | | | | | When active vt is gdm initial vt, restart greeter session. Avoiding the blank screen when greeter session crashed. https://gitlab.gnome.org/GNOME/gdm/-/issues/735
* local-display-factory: Don't crash if Xorg and Wayland are both unavailableRay Strode2021-12-221-2/+7
| | | | | | | | | | | | At the moment if Wayland doesn't work, the login screen will fall back to Xorg, and if Xorg doesn't work the login screen will fall back to Wayland. But if the fall back choice is disabled explicitly, GDM will just crash. This commit fixes the crash. Closes: https://gitlab.gnome.org/GNOME/gdm/-/issues/739
* local-display-factory: Don't try to respawn displays on shutdownRay Strode2021-09-291-1/+10
| | | | | | | | | | | At the moment in the shutdown path we may try to respawn displays that just got killed. The respawning happens when things are half torn down leading to crashes. This commit makes sure we turn off the respawn logic in the shutdown path.
* daemon: Consolidate session-type and supported-session-types listRay Strode2021-09-061-77/+116
| | | | | | | | | | | | | | | | | | | | There's currently a bug in computing the session-type to use. The `i > 0` check means wayland will overwrite x11 in the transient session type list. Morever, the separation between "session-type" and "supported-session-types" is a little redundant. Since supported-session-types is a sorted list, the first item should always be the same as "session-type". This commit addresses the bug and the redundant logic, by computing the supported session types early in the function and indexing into it to get the session-type. A future cleanup could probably get rid of session-type entirely. https://gitlab.gnome.org/GNOME/gdm/-/merge_requests/153
* local-display-factory: Add missing continue statementsRay Strode2021-07-271-0/+2
| | | | | | | | | | | commit f4922c046607c45d76e2911aa8f133d0ad4f9223 tried to fix an overrun in the code, but it neglected to add "continue" statements to the loops, so it was stuffing two different values into the same element of an array, which leads to the wrong session type getting preference. This commit fixes that.
* local-display-factory: Fix overrun in session type list generationRay Strode2021-07-221-7/+9
| | | | | | | Some confusion in the session type list generation from GNOME/gdm!146, means we could actually overrun the list. This commit fixes that.
* daemon: Provide more flexibility for configuring display serverRay Strode2021-07-221-38/+182
| | | | | | | | | | | | | | | | | | | There's currently a way to disable wayland, but no way to disable Xorg. We currently prefer wayland if it's not disabled, but have no way to prefer Xorg without disabling wayland entirely. There's currently no way use legacy Xorg support at all if user display server support is enabled at a build time. This commit adds more flexibility to display server selection. It adds two new keys: XorgEnable and and PreferredDisplayServer. XorgEnable=false disables Xorg support entirely on seat 0. PreferredDisplayServer can be set to "wayland", "xorg", "legacy-xorg" or "none" to select which display server is used by default. If it's set to "wayland", it will fall back to "xorg". If it's set to "xorg" it will fall back to "wayland".
* local-display-factory: Fix wait for graphicalBenjamin Berg2021-03-151-1/+2
| | | | | | | | In commit a37e5a950fbd ("local-display-factory: Wait for seats to become graphical") we introduced logic to wait for up to 10s for the seat to become graphical before trying to use it. Unfortunately, the logic was slightly wrong, resulting us to immediately do the fallback rather than waiting.
* local-display-factory: Wait for seats to become graphicalBenjamin Berg2021-02-251-9/+168
| | | | | | | | | | | | | It may happen that seats are not graphical initially because the DRM device is not ready yet. In that case, ignore the seat and wait for the CanGraphical property notification in order to add it at that point. However, there are some rare cases where CanGraphical will never turn TRUE. To catch these, add a timeout and fall back to simply trying to bring seat0 up after 10 seconds. When we do so, go directly for the X11 fallback as wayland is unlikely to be functional. Fixes: #662
* local-display-factory: Move session type checking into create_displayBenjamin Berg2021-02-251-37/+20
| | | | | | | | | | | We used to check the session type when enumerating the seats at startup (and on VT switch). However, this misses cases where seats are added dynamically (such as at boot time). Simply move the check into create_display and pass in the failure count so that it can handle the X11 fallback when wayland failed to come up. Related: #662
* local-display-factory: Rename create_display to show it is idempotentBenjamin Berg2021-02-251-13/+13
| | | | Also drop the return value as it is never used.
* daemon,common,libgdm: Drop use of sd_seat_can_multi_sessionRay Strode2021-02-251-1/+1
| | | | It's deprecated now, and always returns TRUE.
* local-display-factory: again don't require wayland support to kill XRay Strode2020-07-241-4/+4
| | | | | | | | | | | | | | commit ac083ec2d3d663a48c4aa6693978669243880dd0 attempted fix killing X in the background even when wayland support is disabled. Unfortunately, it missed yet more places in the code that does ifdef ENABLE_WAYLAND_SUPPORT endif This commit fixes that. Closes: https://gitlab.gnome.org/GNOME/gdm/-/issues/614
* local-display-factory: don't require wayland support to kill XRay Strode2020-07-241-1/+1
| | | | | | | | | | | | | | | | | commit d35805116113acbf1e112962c54785c604b13181 changed GDM to kill X on login just like it does for wayland sessions. Unfortunately, that commit neglected to pull the code out of the ifdef ENABLE_WAYLAND_SUPPORT endif guards, so users who build without wayland support entirely, don't get the feature. This commit fixes that. Closes: https://gitlab.gnome.org/GNOME/gdm/-/issues/614
* local-display-factory: kill X on login just like waylandRay Strode2020-07-131-9/+0
| | | | | | | | | | | | | | These days we kill the wayland login screen during login to conserve system resources. We've been reluctant to do the same for X based login screens, because X didn't handle being killed in the background so well. This is no longer a problem, since this commit: https://gitlab.freedesktop.org/xorg/xserver/-/commit/ff91c696ff8f5f56da40e107cb5c321539758a81 So let's go ahead and kill it now.
* local-display-factory: Always force login screen to VT 1Ray Strode2020-05-151-0/+3
| | | | | | | | | | | | These days we always want the login screen on VT 1, even when it's created by user switching. Unfortunately, since commit f843233ad the login screen won't naturally pick VT 1 when user switching. This commit forces it to make the right choice. Closes https://gitlab.gnome.org/GNOME/gdm/-/issues/602
* local-display-factory: reap login session on vt switch to registered sessionRay Strode2019-09-041-5/+71
| | | | | | | | | | | | | Since commit 1c061b84ffc3e874da825982d18d970556ff74bb we reap the login screen after the user logs into a session, instead of after a timeout. Unfortunately, that means we no longer reap the login screen when unlocking a session. This commit adds back the timeout in the case seat0 is switched to a registered login session. Closes https://gitlab.gnome.org/GNOME/gdm/issues/509
* Allow sessions to register with GDMIain Lane2019-05-291-23/+27
| | | | | | | | | | | | | | | | | | | | | | Recording when sessions start, for Wayland → Xorg fallback or transitioning to the user session, is currently done with timeouts. This isn't ideal, because on some very slow machines the timeout can be hit before the session has had a chance to fail: if gnome-session takes more than 3 seconds to fail then the session will be considered to have exited rather than failed, and so we don't do Xorg fallback. We can do this more reliably if we allow sessions to optionally register themselves with GDM. Then we will know when they've started, so can shut down the greeter or fall back to Xorg as appropriate. The mechanism is that they specify X-GDM-SessionRegisters=true in their file, and then call RegsterSession on the DisplayManager interface on the bus (added in the previous commit) to say that they've started up. If X-GDM-SessionRegisters is missing or false, GDM will call the same method for them after 10 seconds. Closes: #483
* GdmLocalDisplayFactory: Store VT number, not tty identifierIain Lane2019-05-291-24/+26
| | | | This makes the code a fair bit simpler.
* local-display-factory: don't return value from foreach funcsRay Strode2019-02-211-4/+2
| | | | | | | | The local display factor code is returning FALSE from its display store foreach functions, which is useless since commit 47d01abe. This commit makes it return void instead.
* local-display-factory: use G_DECLARE_FINAL_TYPENiels De Graef2018-12-231-56/+52
|
* local-display-factory: handle reviving displays that are waiting to dieRay Strode2018-09-251-1/+4
| | | | | | | | We may end up re-using a display in waiting-to-finish state before it gets finished in this case reset its state to managed to avoid it getting finished while it is being used. Closes https://gitlab.gnome.org/GNOME/gdm/merge_requests/45
* local-display-factory: Remove same VT so don't switch checkRay Strode2018-09-251-26/+13
| | | | | | | | | We avoid changing to the login screen vt if we're already on it, but the call is racy since we react to vt changes concurrently with logind (who we query for the active vt). This check drops the active vt check since it's pointless and getting in the way.
* local-display-factory: Remove initial VT is in use checkHans de Goede2018-09-251-13/+0
| | | | | | | | | | | | | | | | | | | | | | The initial VT is in use check in on_vt_changed() is racy, when switching to VT1 from an active session, on_vt_changed() may run before logind has processed the VT change and then sd_seat_get_active() will return the active session which we are switching away from. This results in the greeter not being started on VT1. On my system gdm reliably wins the race resulting in not getting a greeter when manually switching from an active session to VT1. gdm already starts the greeter unconditionally from gdm_local_display_factory_sync_seats() on both startup and when an user session exits. gdm also starts it unconditionally when selecting "Switch user" from an user session. Now autologin sessions avoid the initial VT as well. So we now can assume that the initial VT is free for the login screen's use. And create_display already checks for and re-uses an existing greeter, so we can safely remove the racy check.
* local-display-factory: don't autoreap initial-setupRay Strode2018-09-251-0/+8
| | | | | | | | We automatically kill the login screen when switching VTs away from it, but we should never kill the initial-setup screen in that situation. This commit adds a check to prevent that from happening.
* daemon: Move the waiting the session to have taken over the fb to ↵Hans de Goede2018-09-121-3/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gdm-local-display-factory Commit 708618746683 ("gdm-wayland-session,gdm-x-session: register after delay") delayed displays changing their status from PREPARED to MANAGED so that their status would not change until the session has had a change to install its own framebuffer and tell the GPU to scanout this new fb. Commit 74ee77717df7 ("local-display-factory: defer killing greeter until new session registers") uses this to avoid a flicker when transitioning from the greeter to the user-session by deferring the stopping of the greeter-session until the new display moves to the MANAGED state. But this only works when transitioning to a new user-session, when moving to an existing user-session (fast user switching) the display already is in MANAGED state and instead of deferring the stopping of the greeter commit 74ee77717df7 causes us to now never stop the greeter-session. This commit fixes this by starting a timeout when switching away from the initial-vt and letting that timeout stop the greeter-session. This commit removes the finish_waiting_displays_on_seat() call when the display's status changes to MANAGED, so that we still only have one code path stopping the greeter and not two. This means we also no longer need to delay registering the display. So this commit removes the code adding the delay (reverts commit 74ee77717df7). Note this commit uses a delay of 10 seconds, rather then 2 seconds. The transition to a new user-session takes about 8 seconds on my budget Apollo Lake based laptop (with SSD). Note this all really is a workaround, the proper solution for this would be able to tell the kernel to keep the greeter framebuffer around until a new framebuffer is installed. There is a patch to add a new unref_fb ioctl for this: https://www.spinics.net/lists/dri-devel/msg140912.html . We need to get this patch upstream and teach mutter to use it.