11 The Present extension provides a way for applications to update their
12 window contents from a pixmap in a well defined fashion, synchronizing
13 with the display refresh and potentially using a more efficient
14 mechanism than copying the contents of the source pixmap.
18 Eric Anholt <eric@anholt.net>
19 Owen Taylor <otaylor@redhat.com>
20 James Jones <janomes@nvidia.com>
26 PRESENTEVENTID { XID }
28 Defines a unique event delivery target for Present
29 events. Multiple event IDs can be allocated to provide
30 multiple distinct event delivery contexts.
37 A list of these is passed to PresentPixmap; when the indicated
38 PresentPixmap completes, PresentCompletNotify events will be
39 delivered both to the PresentPixmap window/serial parameter as
40 well as each of the entries in the list of PRESENTNOTIFY parameter.
42 PRESENTEVENTTYPE { PresentConfigureNotify,
43 PresentCompleteNotify,
45 PresentRedirectNotify }
47 PRESENTEVENTMASK { PresentConfigureNotifyMask,
48 PresentCompleteNotifyMask,
49 PresentIdleNotifyMask,
50 PresentSubredirectNotifyMask }
52 PRESENTOPTION { PresentOptionAsync,
56 PRESENTCAPABILITY { PresentCapabilityAsync,
57 PresentCapabilityFence,
58 PresentCapabilityUST }
60 PRESENTCOMPLETEKIND { PresentCompleteKindPixmap,
61 PresentCompleteKindMSCNotify }
63 PRESENTCOMPLETEMODE { PresentCompleteModeCopy,
64 PresentCompleteModeFlip,
65 PresentCompleteModeSkip }
67 The Present extension also uses the Sync extension Fence data type to
68 provide synchronization for pixmaps.
75 A value for an EventID argument does not name a defined EventID
81 ConfigureNotify events inform clients about window configuration
82 changes which can affect the allocation of window-related buffers.
84 CompleteNotify events inform clients about the completion of a pending
85 PresentPixmap request.
87 IdleNotify events inform clients when pixmaps are available for re-use.
89 RedirectNotify events inform clients about other clients PresentPixmap
94 6. Extension Initialization
96 The name of this extension is "Present"
100 client-major-version: CARD32
101 client-minor-version: CARD32
103 major-version: CARD32
104 minor-version: CARD32
107 The client sends the highest supported version to the server
108 and the server sends the highest version it supports, but no
109 higher than the requested version. Major versions changes can
110 introduce incompatibilities in existing functionality, minor
111 version changes introduce only backward compatible changes.
112 It is the clients responsibility to ensure that the server
113 supports a version which is compatible with its expectations.
115 Backwards compatible changes included addition of new
120 7. Extension Requests
127 valid-area: REGION or None
128 update-area: REGION or None
130 target-crtc: CRTC or None
133 options: SETofPRESENTOPTION
137 notifies: LISTofPRESENTNOTIFY
139 Errors: Window, Pixmap, Match
141 Provides new content for the specified window, to be made
142 visible at the specified time (defined by 'target-msc', 'divisor'
143 and 'remainder'). If the depth of 'pixmap' and 'window' do not
144 match, a Match error will be generated.
146 'serial' is an arbitrary client-specified value which will
147 be returned in the associated PresentCompleteNotify event so
148 that the client can associate the event and request.
150 'valid-area' defines the portion of 'pixmap' which contains
151 valid window contents, or None if the pixmap contains valid
152 contents for the whole window.
154 'update-area' defines the subset of the window to be updated,
155 or None if the whole window is to be updated.
157 PresentPixmap may use any region of 'pixmap' which contains
158 'update-area' and which is contained by 'valid-area'. In other
159 words, areas inside 'update-area' will be presented from
160 'pixmap', areas outside 'valid-area' will not be presented
161 from 'pixmap' and areas inside 'valid-area' but outside
162 'update-area' may or may not be presented at the discretion of
165 'x-off' and 'y-off' define the location in the window where
166 the 0,0 location of the pixmap will be presented. valid-area
167 and update-area are relative to the pixmap.
169 PresentPixmap will block until 'wait-fence' is triggered.
171 When the X server has finished using 'pixmap' for this
172 operation, it will send a PresentIdleNotify event and arrange
173 for any 'idle-fence' to be triggered. This may be at any time
174 following the PresentPixmap request -- the contents may be
175 immediately copied to another buffer, copied just in time for
176 the vblank interrupt or the pixmap may be used directly for
177 display (in which case it will be busy until some future
178 PresentPixmap operation).
180 If 'idle-fence' is not None, then the client guarantees to the
181 X server that it will wait for that fence to be signalled
182 before it uses the pixmap again. If 'idle-fence' is None, then
183 the X server must arrange for the pixmap to be re-usable by
184 the client as soon as the PresentIdleNotify event has been
185 received. Note that if PresentCapabilityFence is set for the
186 associated CRTC, then clients should use fences to improve
187 overall systme performance. If PresentCapabilityFence is not
188 set, then using fences offers no benefit, but also no cost.
190 If 'target-msc' is greater than the current msc for 'window',
191 the presentation will occur at (or after) the 'target-msc'
192 field. Otherwise, the presentation will occur after the next
193 field where msc % 'divisor' == 'remainder'.
195 If 'target-crtc' is None, then the X server will choose a
196 suitable CRTC for synchronization.
198 If 'options' contains PresentOptionAsync, and the 'target-msc'
199 is less than or equal to the current msc for 'window', then
200 the operation will be performed as soon as possible, not
201 necessarily waiting for the next vertical blank interval.
203 If 'options' contains PresentOptionCopy, then 'pixmap' will be
204 idle, and 'idle-fence' triggered as soon as the operation occurs.
206 If 'options' contains PresentOptionUST, then target-msc,
207 divisor and remainder will all be interpreted as UST values
208 instead of MSC values and the frame update will be scheduled
209 for the specified UST time, If the target-crtc supports
210 PresentCapabilityUST, then the swap time will be as close to
211 the target time as the driver can manage. Otherwise, the
212 server will take the target UST time and convert it to a
213 suitable target MSC value.
215 After the presentation occurs, a PresentCompleteNotify event
216 with kind PresentCompleteKindPixmap will be generated, both to
217 'window' as well as all members of 'notifies'.
219 If 'window' is destroyed before the presentation occurs, then
220 the presentation action will not be completed.
222 PresentPixmap holds a reference to 'pixmap' until the
223 presentation occurs, so 'pixmap' may be immediately freed
224 after the request executes, even if that is before the
227 If 'idle-fence' is destroyed before the presentation occurs,
228 then idle-fence will not be signaled but the presentation will
231 If 'wait-fence' is destroyed before it becomes triggered, then
232 the presentation operation will no longer wait for it and will
233 occur when the other conditions are satisfied.
245 Delivers a PresentCompleteNotifyEvent with kind
246 PresentCompleteKindNotifyMSC after the time specified by
247 'target-msc', 'divisor' and 'remainder').
249 'serial' is an arbitrary client-specified value which will be
250 returned in the event so that the client can associate the
253 If 'target-msc' is greater than the current msc for 'window',
254 the event will be delivered at (or after) the 'target-msc'
255 field. Otherwise, the event delivery will occur after the next
256 field where msc % 'divisor' == 'remainder'.
258 If 'window' is destroyed before the event is delivered, then
259 the event delivery will not be completed.
263 event-id: PRESENTEVENTID
265 eventMask: SETofPRESENTEVENT
267 Errors: Window, Value, Match, IDchoice, Access
269 Selects the set of Present events to be delivered for the
270 specified window and event context. PresentSelectInput can
271 create, modifiy or delete event contexts. An event context is
272 associated with a specific window; using an existing event
273 context with a different window generates a Match error.
275 If eventContext specifies an existing event context, then if
276 eventMask is empty, PresentSelectInput deletes the specified
277 context, otherwise the specified event context is changed to
278 select a different set of events.
280 If eventContext is an unused XID, then if eventMask is empty
281 no operation is performed. Otherwise, a new event context is
282 created selecting the specified events.
284 Specifying PresentSubredirectNotify Mask causes PresentPixmap
285 requests on any child of 'window' from other clients to
286 generate PresentRedirectNotify events to 'window' instead of
287 actually performing the operation. However, only one client at
288 a time can select for PresentRedirect on a window. An attempt
289 to violate this restriction results in an Access error.
292 PresentQueryCapabilities
293 target: CRTC or WINDOW
295 capabilities: SETofPRESENTCAPABILITY
299 Returns the supported capabilities for the target CRTC. If
300 'target' is a CRTC, then it is used as the target CRTC. If
301 'target' is a WINDOW, then the target CRTC is selected by the
302 X server from among the CRTCs on the screen specified by the window.
304 PresentCapabilityAsync means that the target device can flip
305 the scanout buffer mid-frame instead of waiting for a vertical
306 blank interval. The precise latency between the flip request
307 and the actual scanout transition is not defined by this
308 specification, but is intended to be no more than a few
311 PresentCapabilityFence means that the target device can take
312 advantage of SyncFences in the Present operations to improve
313 GPU throughput. The driver must operate correctly in the
314 absense of fences, but may have reduced performance. Using
315 fences for drivers not advertising this capability should have
316 no performance impact.
318 PresentCapabilityUST means that the target device can scanout
319 the image at an arbitrary UST time value, and is not driven by
320 a periodic scanout timer. Applications specifying UST times
321 for PresentPixmap can expect that their image will appear to
322 the user within a short amount of time from that specified in
323 the request. The precise accuracy of the scanout time is not
324 defined by the extension, but is expected to be on the order
325 of milliseconds or less.
332 PresentConfigureNotify
333 type: CARD8 XGE event type (35)
334 extension: CARD8 Present extension request number
335 sequence-number: CARD16
337 evtype: CARD16 Present_ConfigureNotify
338 eventID: PRESENTEVENTID
347 pixmap_height: CARD16
351 PresentConfigureNotify events are sent when the window
352 configuration changes if PresentSelectInput has requested
353 it. PresentConfigureNotify events are XGE events and so do not
354 have a unique event type.
356 'x' and 'y' are the parent-relative location of 'window'.
359 PresentCompleteNotify
360 type: CARD8 XGE event type (35)
361 extension: CARD8 Present extension request number
362 sequence-number: CARD16
364 evtype: PRESENTEVENTTYPE PresentCompleteNotify
365 eventID: PRESENTEVENTID
367 kind: PRESENTCOMPLETEKIND
368 mode: PRESENTCOMPLETEMODE
374 CompleteNotify events are delivered when a PresentPixmap or
375 PresentNotifyMSC operation has completed.
377 'kind' is PresentCompleteKindPixmap when generated by a
378 PresentPixmap operation completion or
379 PresentCompleteKindNotifyMsc when generated by a
380 PresentNotifyMSC operation completion.
382 'mode' is PresentCompleteModeCopy when the source pixmap
383 contents are taken from the pixmap and the pixmap is idle
384 immediately after the presentation completes. 'mode' is
385 PresentCompleteModeFlip when the pixmap remains in-use even
386 after the presentation completes. It will become idle no later
387 than when the next PresentPixmap operation targeting the same
388 window by any client completes. If the presentation operation
389 was skipped because some later operation made it irrelevant,
390 then 'mode' will be PresentCompleteModeSkip.
392 'serial' is the value provided in the generating PresentPixmap
395 'msc' and 'ust' indicate the frame count and system time when
396 the presentation actually occurred.
400 type: CARD8 XGE event type (35)
401 extension: CARD8 Present extension request number
402 sequence-number: CARD16
404 evtype: PRESENTEVENTTYPE PresentIdleNotify
405 eventID: PRESENTEVENTID
412 IdleNotify events are delivered when a pixmap used in a
413 PresentPixmap operation may be re-used by the client.
415 'window' is the window from the PresentPixmap to which this
418 'serial' is the value provided in the associated PresentPixmap
421 'pixmap' is the pixmap which is ready for re-use.
423 'idle-fence' is the fence which was provided in the
424 originating PresentPixmap request and is used to synchronize
425 rendering between the client and the X server's use of the
426 buffer. If not None, then the client must wait for the fence
427 to be signaled before using the pixmap.
430 PresentRedirectNotify
431 type: CARD8 XGE event type (35)
432 extension: CARD8 Present extension request number
433 sequence-number: CARD16
434 length: CARD32 17 + 2 n
435 evtype: CARD16 Present_RedirectNotify
438 eventID: PRESENTEVENTID
446 valid-rect: RECTANGLE
447 update-rect: RECTANGLE
452 options: SETofPRESENTOPTION
456 notifies: LISTofPRESENTNOTIFY
459 RedirectNotify events are delivered when the client has
460 selected for SubredirectNotify the parent of the target
461 window. All of the values provided to the PresentPixmap
462 request are provided. If the client simply passes these
463 parameters back to the X server, the effect will be as if the
464 original client executed the request.
466 If 'update-window' is TRUE, then there are clients who have
467 requested composite automatic redirect on the window and who
468 presumably expect the window buffer to eventually contain
469 the application provided contents. The compositing manager
470 should at least occasionally update the window buffer with
471 suitable contents. The precise update interval is left to the
472 discretion of the client receiving this event.
476 9. Extension Versioning
478 1.0: First published version
483 10. Relationship with other extensions
485 As an extension designed to support other extensions, there is
486 naturally some interactions with other extensions.
490 GLX is both an application interface and an X extension. OpenGL
491 applications using the GLX API will use the GLX extension and may use
492 the Present extension to display application contents.
496 The DRI3 extension provides a way to share direct rendered pixel data
497 with the X server as X pixmaps. When used in conjunction with Present,
498 they provide a complete direct rendering solution for OpenGL or other
503 Present provides similar functionality to the DRI2SwapBuffers and
504 requests, however Present uses X pixmaps to refer to the new window
505 contents instead of the DRI2 buffer attachments.
507 Present and DRI3 are designed in conjunction to replace DRI2
511 It might be nice to be able to use YUV formatted objects as Present
516 Appendix A. Protocol Encoding
518 Syntactic Conventions
520 This document uses the same syntactic conventions as the core X
521 protocol encoding document.
527 0 PresentConfigureNotify
528 1 PresentCompleteNotify
530 3 PresentRedirectNotify
535 1 PresentConfigureNotifyMask
536 2 PresentCompleteNotifyMask
537 4 PresentIdleNotifyMask
538 8 PresentRedirectNotifyMask
550 1 PresentCapabilityAsync
551 2 PresentCapabilityFence
552 4 PresentCapabilityUST
557 0 PresentCompleteKindPixmap
558 1 PresentCompleteKindMSCNotify
563 0 PresentCompleteModeCopy
564 1 PresentCompleteModeFlip
565 2 PresentCompleteModeSkip
574 A.2 Protocol Requests
581 4 CARD32 major version
582 4 CARD32 minor version
586 2 CARD16 sequence number
588 4 CARD32 major version
589 4 CARD32 minor version
606 4 SyncFence wait-fence
607 4 SyncFence idle-fence
613 8n LISTofPresentNotify notifies
636 4 SETofPRESENTEVENTMASK event-mask
640 PresentQueryCapabilities
644 4 CRTC or Window target
648 2 CARD16 sequence number
650 4 SETofPRESENTCAPABILITY capabilities
656 PresentConfigureNotify
658 1 CARD8 Present extension opcode
659 2 CARD16 sequence number
661 2 0 PresentConfigureNotify
672 2 CARD16 pixmap width
673 2 CARD16 pixmap height
674 4 CARD32 pixmap flags
678 PresentCompleteNotify
680 1 CARD8 Present extension opcode
681 2 CARD16 sequence number
683 2 1 PresentCompleteNotify
697 1 CARD8 Present extension opcode
698 2 CARD16 sequence number
700 2 2 PresentIdleNotify
706 4 SyncFence idle-fence
710 PresentRedirectNotify
712 1 CARD8 Present extension opcode
713 2 CARD16 sequence number
715 2 3 PresentRedirectNotify
719 4 Window event-window
726 8 Rectangle valid-rect
727 8 Rectangle update-rect
731 4 SyncFence wait-fence
732 4 SyncFence idle-fence
738 8n LISTofPRESENTNOTIFY notifies
743 The DRI3 extension defines no errors.