design for newgdm consolekit multiseat multidisplay
From Genunix
Contents |
Why need multi-seat and multi-display support
- Multi-seat means support multiple input/output devices, typically case is SunRay
- Current ConsoleKit don't really support Multi-seat. In other words, there's only two available seats in ConsoleKit. All the local sessions are regards as Seat1 and other remote sessions are Seat2. It's good time to define something Solaris needs.
- Multi-display means support multiple graphics cards, or a terminal server.
Supposing
- This design is based on following supposing
1 * 1 1
Seat ------ Session ------ Display
1. One seat can attach multiple sessions
2. One session in ConsoleKit is attaching one display in GDM
Design
Multi seat can support adding seats statically and dynamically.
For static seats:
Need .seat .session and .display, the whole logic is as following:
- For each .seat under seats.d/ , get value of key "Sessions",
- For each session defined in "Sessions", open corresponding .session file under sessions.d/
- Get value of "DisplayTemplate", open corresponding .display file under displays.d, get value of "Type" and "Exec"
- Get values under group "[<DisplayTemplate>]", replace the variables in Exec
- Add a new session with "Exec" for this seat
For dynamic seats:
ck-seat-tool is equal to .seat + .session Use similar logic as static ones
Design for .seat
- located in <etc>/ConsoleKit/seat.d/
- Each seat file stand for a static seat need to be created at init time
- Example of 00-primary.seat
[Seat Entry] Version=1.0 Name=Primary seat # Specified Seat ID, if this value is NULL, ConsoleKit will decide one. # The ID only contain the ASICC characters "[A-Z][a-z][0-9]_" ID=StaticSeat1 Description=start one static local display at :0 # Indicate whether to create this seat or not. If it is set true, then CK will # not create this seat. Default value is false. Hidden=false # Indicate input/output devices including keyboard-pointer-video # card-monitor-sound-usb devices, # This key will not implemented now, it might need be divided into # several keys in the future: # Pointer= # Monitor= # VideoCard= # Monitor= # UsbHub= Devices= # List of sessions to start on the seat, separated by ';' # Each session is defined in sessions.d/ Sessions=Local;
Design for .session
- located in <etc>/ConsoleKit/displays.d/
- Each .session file stands for one static session
- Example of Local.display
[Session Entry] Name=Local Type=LoginWindow Description=Local Login Screen DisplayTemplate=Local [Local] display=:0
Design for .display
- located in <etc>/ConsoleKit/displays.d/
- Each .display file stands for one display type
- Variables (starting with '$') like $display $vt and $auth will be substituted at run-time, might by .session(ck-seat-tool). If not substituted like $auth, the display manager will substitute it.
- Example of Local.display
[Display] Type=X11 [X11] Exec=/usr/X11/bin/Xorg $display -br -verbose -auth $auth -nolisten tcp $vt
ck-seat-tool
- The ck-seat-tool tells ConsoleKit to add or delete a session on a given parameters.
Command Line Options
--add --session-type=SESSION_TYPE --display-type=DISPLAY_TYPE [--seat-id=SEAT_ID] [variables...]
Add a new session. For example, "-a --display-type=LoginWindow display=110,vt=vt7"
+ If --seat-id=SEAT_ID is given and this seat is existing, a new
session will be append on that seat.
+ If --seat-id=SEAT_ID is given but this seat is not existing, a new
seat with given seat id created, and a new session append on that
seat.
+ If --seat-id=SEAT_ID is not given, a new seat with generated seat
id (Seat#) will be created, and a new session append on that seat.
--delete --session-id=SESSION_ID
Delete a session. For example, "-d Session2".
Diagrams
Diagram to start static seats
GDM ConsoleKit
=============================================================
ck_init()
gdm_init()
GetUnmanagedSeats (&seat_list)
----------------------------------->
for each seat in seat_list
do
ManageSeat (sid)
----------------------------------->
for unmanaged session for this seat
do
signal OpenSessionRequest (ssid)
<----------------------------------
OpenSessionWithParameter()
----------------------------------->
open a new session
done
SessionAdded(ssid)
<------------------------------------------
done
Diagram when create a session
Xserver
^
| (5)
--------------------------------------
gdm-binary
(Listen for signals from ConsoleKit)
--------------------------------------
^ |
|(4) | (6)
| v
--------------------------------------
console-kit-daemon (3)
--------------------------------------
^
| (2)
ck-seat-tool
^
| (1)
Xmgr/gdm Script
Steps:
(1): Call "ck-seat-tool -a --display-type=Headless --seat-id=TestSeat display=:101"
If Seat "TestSeat" is not existing, call "AddSeatById" by TestSeat
(2): Call CK method to AddSession
(3): CK search DisplayType=Headless in /etc/ConsoleKit/displays.d/
to get Exec value, suppose it is "Exec=/usr/X11/bin/Xvfb $display -auth $auth".
The Exec will be substituted as "/usr/bin/Xvfb :101 -auth $auth"
Then add a new session with parameters, and emit signal OpenSessionRequest
(4): GDM is invoked by signal OpenSessionRequest, then create a object GdmDynamicDisplay,
it will create a Xsession xserver_command "/usr/bin/Xvfb :101".
(5): GDM call CK method OpenSessionWithParameters to create session
(6): Ck create a new session, then emit signal "SessionAdded" with session_id
Diagram when remove a session
Xserver
^
| (5)
--------------------------------------
gdm-binary
(Listen for signals from ConsoleKit)
--------------------------------------
^ | ^
|(4) | (5) | (6)
| v |
--------------------------------------
console-kit-daemon (3)
--------------------------------------
^
| (2)
ck-seat-tool
^
| (1)
Xmgr/gdm Script
Steps:
(1) Call "ck-seat-tool -d --session-id=Session1"
(2) Call CK method to RemoveSession
(3) CK search Session1 in database then emit signal RemoveSessionRequest with ssid "Session1"
(4) GDM is invoked by signal RemoveSessionRequest with ssid "Session1",
then GDM query get the display by ssid and unregister it
(5) GDM call CK method CloseSession to close session
(6) CK emit signal "SessionRemoved" with session_id
Interface changes
- Add method GetUnmanagedSeats in org.freedesktop.ConsoleKit.Manager to get unmanaged seats list
- Add method AddSeat/AddSeatById/RemoveSeat in org.freedesktop.ConsoleKit.Manager to add or remove a seat
- Add methods AddSession/RemoveSession to org.freedesktop.ConsoleKit.Manager to let ck-seat-tool to create session dynamically
- Add method Manage/Unmanage in org.freedesktop.ConsoleKit.Seat to notify ConsoleKit to create displays for this seat
- Add signals OpenSessionRequest/RemoveSessionRequest in org.freedesktop.ConsoleKit.Seat to notify display manager (GDM, KDM, etc.) to create or delete session for this seat
