blob: 8c49bacd4ae3d96b74d2e5c79fb65c2332ddcb2a [file] [log] [blame]
Kristian Høgsberg97f1ebe2008-09-30 09:46:10 -04001
2KEYWORDS:
3
4Wayland is a nano display server, relying on drm modesetting, gem
Kristian Høgsberg23fceb12008-10-13 22:51:56 -04005batchbuffer submission and hw initialization generally in the kernel.
6Wayland puts the compositing manager and display server in the same
7process. Window management is largely pushed to the clients, they
8draw their own decorations and move and resize themselves, typically
9implemented in a toolkit library. More of the core desktop could be
10pushed into wayland, for example, stock desktop components such as the
11panel or the desktop background.
12
13The actual compositor will define a fair bit of desktop policy and it
14is expected that different use cases (desktop environments, devices,
15appliances) will provide their own custom compositor.
Kristian Høgsberg97f1ebe2008-09-30 09:46:10 -040016
17It is still designed with a windowed type of desktop in mind, as
Kristian Høgsberg23fceb12008-10-13 22:51:56 -040018opposed to fullscreen-all-the-time type of interface, but should be
19useful wherever several processes contribute content to be composited.
Kristian Høgsberg97f1ebe2008-09-30 09:46:10 -040020
Kristian Høgsberg33bea962008-09-30 22:21:49 -040021Current trends goes towards less and less rendering in X server, more
22hardware setup and management in kernel and shared libraries allow
23code sharing without putting it all in a server. freetype,
24fontconfig, cairo all point in this direction, as does direct
25rendering mesa.
Kristian Høgsberg97f1ebe2008-09-30 09:46:10 -040026
27Client allocates DRM buffers, draws decorations, and full window
28contents and posts entire thing to server along with dimensions.
29
30Everything is direct rendered and composited. No cliprects, no
31drawing api/protocl between server and client. No
32pixmaps/windows/drawables, only surfaces (essentially pixmaps). No
33gcs/fonts, no nested windows. OpenGL is already direct rendered,
34pixman may be direct rendered which adds the cairo API, or cairo
35may gain a GL backend.
36
Kristian Høgsberg33bea962008-09-30 22:21:49 -040037Could be a "shell" for launching gdm X server, user session servers,
38safe mode xservers, graphics text console. From gdm, we could also
39launch a rdp session, solid ice sessions.
40
Kristian Høgsberga67a71a2008-10-07 10:10:36 -040041All surface commands (copy, attach, map=set quads) are buffered until
42the client sends a commit command, which executes everything
Kristian Høgsberg23fceb12008-10-13 22:51:56 -040043atomically. The commit command includes a cookie, which will be
44returned in an event generated by the server once the commit has been
45executed. This allows clients to throttle themselves against the
46server and implement smooth animations.
Kristian Høgsberga67a71a2008-10-07 10:10:36 -040047
Kristian Høgsberg33bea962008-09-30 22:21:49 -040048
Kristian Høgsberg97f1ebe2008-09-30 09:46:10 -040049ISSUES:
50
51Include panel and desktop background in wayland?
52
53How does clients move their surfaces? set a full tri-mesh every time?
54
55How does the server apply transformations to a surface behind the
56clients back? (wobbly, minimize, zoom) Maybe wobble is client side?
57
58How do apps share the glyph cache?
59
60Input handling - keyboard focus, multiple input devices, multiple
61pointers, multi touch.
62
63Drawing cursors, moving them, cursor themes, attaching surfaces to
64cursors. How do you change cursors when you mouse over a text
65field if you don't have subwindows?
66
67synaptics, 3-button emulation, xkb, scim
68
Kristian Høgsberg33bea962008-09-30 22:21:49 -040069changing screen resolution, adding monitors.
70
Kristian Høgsberg427524a2008-10-08 13:32:07 -040071What to do when protocol out buffer fills up? Just block on write
72would work I guess. Clients are supposed to throttle using the bread
73crumb events, so we shouldn't get into this situation.
74
Kristian Høgsberg23fceb12008-10-13 22:51:56 -040075When a surface is the size of the screen and on top, we can set the
76scanout buffer to that surface directly. Like compiz unredirect
77top-level window feature. Except it won't have any protocol state
78side-effects and the client that owns the surface won't know. We lose
79control of updates. Should work well for X server root window under
80wayland.
81
Kristian Høgsberg19a0ac22008-10-11 19:40:01 -040082Throttling/scheduling - there is currently no mechanism for scheduling
83clients to prevent greedy clients from spamming the server and
84starving other clients. On the other hand, now that recompositing is
85done in the idle handler (and eventually at vertical retrace time),
86there's nothing a client can do to hog the server. Unless we include
87a copyregion type request, to let a client update it's surface
88contents by asking the server to atomically copy a region from some
89other buffer to the surface buffer.
90
91Atomicity - we have the map and the attach requests which sometimes
92will have to be executed atomically. Moving the window is done using
93the map request and will not involve an attach requet. Updating the
94window contents will use an attach request but no map. Resizing,
95however, will use both and in that case must be executed atomically.
96One way to do this is to have the server always batch up requests and
97then introduce a kind of "commit" request, which will push the batched
98changes into effect. This is easier than it sounds, since we only
99have to remember the most recent map and most recent attach. The
100commit request will generate an corresponding commit event once the
101committed changes become visible on screen. The client can provide a
102bread-crumb id in the commit request, which will be sent back in the
103commit event.
104
105 - is batching+commit per client or per surface? Much more convenient
106 if per-client, since a client can batch up a bunch of stuff and get
107 atomic updates to multiple windows. Also nice to only get one
108 commit event for changes to a bunch of windows. Is a little more
109 tricky server-side, since we now have to keep a list of windows
110 with pending changes in the wl_client struct.
111
112 - batching+commit also lets a client reuse parts of the surface
113 buffer without allocating a new full-size back buffer. For
114 scrolling, for example, the client can render just the newly
115 exposed part of the page to a smaller temporary buffer, then issue
116 a copy request to copy the preserved part of the page up, and the
117 new part of the page into the exposed area.
118
Kristian Høgsberg23fceb12008-10-13 22:51:56 -0400119 - This does let a client batch up an uncontrolled amount of copy
Kristian Høgsberg19a0ac22008-10-11 19:40:01 -0400120 requests that the server has to execute when it gets the commit
121 request. This could potentially lock up the server for a while,
122 leading to lost frames. Should never cause tearing though, we're
123 changing the surface contents, not the server back buffer which is
124 what is scheduled for blitting at vsync time.
125
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400126
Kristian Høgsberg97f1ebe2008-09-30 09:46:10 -0400127RMI
128
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400129The wayland protocol is a async object oriented protocol. All
130requests are method invocations on some object. The request include
131an object id that uniquely identifies an object on the server. Each
132object implements an interface and the requests include an opcode that
133identifies which method in the interface to invoke.
134
135The server sends back events to the client, each event is emitted from
136an object. Events can be error conditions. The event includes the
137object id and the event opcode, from which the client can determine
138the type of event. Events are generated both in repsonse to a request
Kristian Høgsberg23fceb12008-10-13 22:51:56 -0400139(in which case the request and the event constitutes a round trip) or
Kristian Høgsberga67a71a2008-10-07 10:10:36 -0400140spontanously when the server state changes.
141
Kristian Høgsberg97f1ebe2008-09-30 09:46:10 -0400142the get_interface method is called on an object to get an object
143handle that implements the specified interface.