presentproto.txt revision 17ca54c3
117ca54c3Smrg The Present Extension 217ca54c3Smrg Version 1.2 317ca54c3Smrg 2018-02-26 417ca54c3Smrg 517ca54c3Smrg Keith Packard 617ca54c3Smrg keithp@keithp.com 717ca54c3Smrg Intel Corporation 817ca54c3Smrg 917ca54c3Smrg1. Introduction 1017ca54c3Smrg 1117ca54c3SmrgThe Present extension provides a way for applications to update their 1217ca54c3Smrgwindow contents from a pixmap in a well defined fashion, synchronizing 1317ca54c3Smrgwith the display refresh and potentially using a more efficient 1417ca54c3Smrgmechanism than copying the contents of the source pixmap. 1517ca54c3Smrg 1617ca54c3Smrg1.1. Future Present extension versions 1717ca54c3Smrg 1817ca54c3SmrgThis document includes speculation about future 'redirect' support 1917ca54c3Smrgwithin the Present extension. All such information is subject to 2017ca54c3Smrgchange and is provided only as an aid to further Present development. 2117ca54c3Smrg 2217ca54c3Smrg1.2. Acknowledgments 2317ca54c3Smrg 2417ca54c3SmrgEric Anholt <eric@anholt.net> 2517ca54c3SmrgOwen Taylor <otaylor@redhat.com> 2617ca54c3SmrgJames Jones <jajones@nvidia.com> 2717ca54c3SmrgLouis-Francis Ratté-Boulianne <lfrb@collabora.com> 2817ca54c3Smrg 2917ca54c3Smrg ❄ ❄ ❄ ❄ ❄ ❄ ❄ 3017ca54c3Smrg 3117ca54c3Smrg2. Data Types 3217ca54c3Smrg 3317ca54c3SmrgPRESENTEVENTID { XID } 3417ca54c3Smrg 3517ca54c3Smrg Defines a unique event delivery target for Present 3617ca54c3Smrg events. Multiple event IDs can be allocated to provide 3717ca54c3Smrg multiple distinct event delivery contexts. 3817ca54c3Smrg 3917ca54c3SmrgPRESENTNOTIFY { 4017ca54c3Smrg window: WINDOW 4117ca54c3Smrg serial: CARD32 4217ca54c3Smrg } 4317ca54c3Smrg 4417ca54c3Smrg A list of these is passed to PresentPixmap; when the indicated 4517ca54c3Smrg PresentPixmap completes, PresentCompletNotify events will be 4617ca54c3Smrg delivered both to the PresentPixmap window/serial parameter as 4717ca54c3Smrg well as each of the entries in the list of PRESENTNOTIFY parameter. 4817ca54c3Smrg 4917ca54c3SmrgPRESENTEVENTTYPE { PresentConfigureNotify, 5017ca54c3Smrg PresentCompleteNotify, 5117ca54c3Smrg PresentIdleNotify } 5217ca54c3Smrg 5317ca54c3SmrgPRESENTEVENTMASK { PresentConfigureNotifyMask, 5417ca54c3Smrg PresentCompleteNotifyMask, 5517ca54c3Smrg PresentIdleNotifyMask } 5617ca54c3Smrg 5717ca54c3SmrgPRESENTOPTION { PresentOptionAsync, 5817ca54c3Smrg PresentOptionCopy, 5917ca54c3Smrg PresentOptionUST, 6017ca54c3Smrg PresentOptionSuboptimal } 6117ca54c3Smrg 6217ca54c3SmrgPRESENTCAPABILITY { PresentCapabilityAsync, 6317ca54c3Smrg PresentCapabilityFence, 6417ca54c3Smrg PresentCapabilityUST } 6517ca54c3Smrg 6617ca54c3SmrgPRESENTCOMPLETEKIND { PresentCompleteKindPixmap, 6717ca54c3Smrg PresentCompleteKindMSCNotify } 6817ca54c3Smrg 6917ca54c3SmrgPRESENTCOMPLETEMODE { PresentCompleteModeCopy, 7017ca54c3Smrg PresentCompleteModeFlip, 7117ca54c3Smrg PresentCompleteModeSkip, 7217ca54c3Smrg PresentCompleteModeSuboptimalCopy } 7317ca54c3Smrg 7417ca54c3SmrgThe Present extension also uses the Sync extension Fence data type to 7517ca54c3Smrgprovide synchronization for pixmaps. 7617ca54c3Smrg 7717ca54c3Smrg2.1. Data Types proposed for a later Present extension version 7817ca54c3Smrg 7917ca54c3SmrgPRESENTEVENTTYPE { ... 8017ca54c3Smrg PresentRedirectNotify } 8117ca54c3Smrg 8217ca54c3SmrgPRESENTEVENTMASK { ... 8317ca54c3Smrg PresentSubredirectNotifyMask } 8417ca54c3Smrg 8517ca54c3Smrg ❄ ❄ ❄ ❄ ❄ ❄ ❄ 8617ca54c3Smrg 8717ca54c3Smrg3. Errors 8817ca54c3Smrg 8917ca54c3SmrgEventID 9017ca54c3Smrg A value for an EventID argument does not name a defined EventID 9117ca54c3Smrg 9217ca54c3Smrg ❄ ❄ ❄ ❄ ❄ ❄ ❄ 9317ca54c3Smrg 9417ca54c3Smrg5. Events 9517ca54c3Smrg 9617ca54c3SmrgConfigureNotify events inform clients about window configuration 9717ca54c3Smrgchanges which can affect the allocation of window-related buffers. 9817ca54c3Smrg 9917ca54c3SmrgCompleteNotify events inform clients about the completion of a pending 10017ca54c3SmrgPresentPixmap request. 10117ca54c3Smrg 10217ca54c3SmrgIdleNotify events inform clients when pixmaps are available for re-use. 10317ca54c3Smrg 10417ca54c3Smrg5.1. Events proposed for a later Present extension version 10517ca54c3Smrg 10617ca54c3SmrgRedirectNotify events inform clients about other clients PresentPixmap 10717ca54c3Smrgrequests. 10817ca54c3Smrg 10917ca54c3Smrg ❄ ❄ ❄ ❄ ❄ ❄ ❄ 11017ca54c3Smrg 11117ca54c3Smrg6. Extension Initialization 11217ca54c3Smrg 11317ca54c3SmrgThe name of this extension is "Present" 11417ca54c3Smrg 11517ca54c3Smrg┌─── 11617ca54c3Smrg PresentQueryVersion 11717ca54c3Smrg client-major-version: CARD32 11817ca54c3Smrg client-minor-version: CARD32 11917ca54c3Smrg ▶ 12017ca54c3Smrg major-version: CARD32 12117ca54c3Smrg minor-version: CARD32 12217ca54c3Smrg└─── 12317ca54c3Smrg 12417ca54c3Smrg The client sends the highest supported version to the server 12517ca54c3Smrg and the server sends the highest version it supports, but no 12617ca54c3Smrg higher than the requested version. Major versions changes can 12717ca54c3Smrg introduce incompatibilities in existing functionality, minor 12817ca54c3Smrg version changes introduce only backward compatible changes. 12917ca54c3Smrg It is the clients responsibility to ensure that the server 13017ca54c3Smrg supports a version which is compatible with its expectations. 13117ca54c3Smrg 13217ca54c3Smrg Backwards compatible changes included addition of new 13317ca54c3Smrg requests. 13417ca54c3Smrg 13517ca54c3Smrg ❄ ❄ ❄ ❄ ❄ ❄ ❄ 13617ca54c3Smrg 13717ca54c3Smrg7. Extension Requests 13817ca54c3Smrg 13917ca54c3Smrg┌─── 14017ca54c3Smrg PresentPixmap 14117ca54c3Smrg window: WINDOW 14217ca54c3Smrg pixmap: PIXMAP 14317ca54c3Smrg serial: CARD32 14417ca54c3Smrg valid-area: REGION or None 14517ca54c3Smrg update-area: REGION or None 14617ca54c3Smrg x-off, y-off: INT16 14717ca54c3Smrg target-crtc: CRTC or None 14817ca54c3Smrg wait-fence: FENCE 14917ca54c3Smrg idle-fence: FENCE 15017ca54c3Smrg options: SETofPRESENTOPTION 15117ca54c3Smrg target-msc: CARD64 15217ca54c3Smrg divisor: CARD64 15317ca54c3Smrg remainder: CARD64 15417ca54c3Smrg notifies: LISTofPRESENTNOTIFY 15517ca54c3Smrg└─── 15617ca54c3Smrg Errors: Window, Pixmap, Match 15717ca54c3Smrg 15817ca54c3Smrg Provides new content for the specified window, to be made 15917ca54c3Smrg visible at the specified time (defined by 'target-msc', 'divisor' 16017ca54c3Smrg and 'remainder'). If the depth of 'pixmap' and 'window' do not 16117ca54c3Smrg match, a Match error will be generated. 16217ca54c3Smrg 16317ca54c3Smrg 'serial' is an arbitrary client-specified value which will 16417ca54c3Smrg be returned in the associated PresentCompleteNotify event so 16517ca54c3Smrg that the client can associate the event and request. 16617ca54c3Smrg 16717ca54c3Smrg 'valid-area' defines the portion of 'pixmap' which contains 16817ca54c3Smrg valid window contents, or None if the pixmap contains valid 16917ca54c3Smrg contents for the whole window. 17017ca54c3Smrg 17117ca54c3Smrg 'update-area' defines the subset of the window to be updated, 17217ca54c3Smrg or None if the whole window is to be updated. 17317ca54c3Smrg 17417ca54c3Smrg PresentPixmap may use any region of 'pixmap' which contains 17517ca54c3Smrg 'update-area' and which is contained by 'valid-area'. In other 17617ca54c3Smrg words, areas inside 'update-area' will be presented from 17717ca54c3Smrg 'pixmap', areas outside 'valid-area' will not be presented 17817ca54c3Smrg from 'pixmap' and areas inside 'valid-area' but outside 17917ca54c3Smrg 'update-area' may or may not be presented at the discretion of 18017ca54c3Smrg the X server. 18117ca54c3Smrg 18217ca54c3Smrg 'x-off' and 'y-off' define the location in the window where 18317ca54c3Smrg the 0,0 location of the pixmap will be presented. valid-area 18417ca54c3Smrg and update-area are relative to the pixmap. 18517ca54c3Smrg 18617ca54c3Smrg PresentPixmap will block until 'wait-fence' is triggered. 18717ca54c3Smrg 18817ca54c3Smrg When the X server has finished using 'pixmap' for this 18917ca54c3Smrg operation, it will send a PresentIdleNotify event and arrange 19017ca54c3Smrg for any 'idle-fence' to be triggered. This may be at any time 19117ca54c3Smrg following the PresentPixmap request -- the contents may be 19217ca54c3Smrg immediately copied to another buffer, copied just in time for 19317ca54c3Smrg the vblank interrupt or the pixmap may be used directly for 19417ca54c3Smrg display (in which case it will be busy until some future 19517ca54c3Smrg PresentPixmap operation). 19617ca54c3Smrg 19717ca54c3Smrg If 'idle-fence' is not None, then the client guarantees to the 19817ca54c3Smrg X server that it will wait for that fence to be signalled 19917ca54c3Smrg before it uses the pixmap again. If 'idle-fence' is None, then 20017ca54c3Smrg the X server must arrange for the pixmap to be re-usable by 20117ca54c3Smrg the client as soon as the PresentIdleNotify event has been 20217ca54c3Smrg received. Note that if PresentCapabilityFence is set for the 20317ca54c3Smrg associated CRTC, then clients should use fences to improve 20417ca54c3Smrg overall systme performance. If PresentCapabilityFence is not 20517ca54c3Smrg set, then using fences offers no benefit, but also no cost. 20617ca54c3Smrg 20717ca54c3Smrg If 'target-msc' is greater than the current msc for 'window', 20817ca54c3Smrg the presentation will occur at (or after) the 'target-msc' 20917ca54c3Smrg field. Otherwise, the presentation will occur after the next 21017ca54c3Smrg field where msc % 'divisor' == 'remainder'. 21117ca54c3Smrg 21217ca54c3Smrg If 'target-crtc' is None, then the X server will choose a 21317ca54c3Smrg suitable CRTC for synchronization. 21417ca54c3Smrg 21517ca54c3Smrg If 'options' contains PresentOptionAsync, and the 'target-msc' 21617ca54c3Smrg is less than or equal to the current msc for 'window', then 21717ca54c3Smrg the operation will be performed as soon as possible, not 21817ca54c3Smrg necessarily waiting for the next vertical blank interval. 21917ca54c3Smrg 22017ca54c3Smrg If 'options' contains PresentOptionCopy, then 'pixmap' will be 22117ca54c3Smrg idle, and 'idle-fence' triggered as soon as the operation occurs. 22217ca54c3Smrg 22317ca54c3Smrg If 'options' contains PresentOptionUST, then target-msc, 22417ca54c3Smrg divisor and remainder will all be interpreted as UST values 22517ca54c3Smrg instead of MSC values and the frame update will be scheduled 22617ca54c3Smrg for the specified UST time, If the target-crtc supports 22717ca54c3Smrg PresentCapabilityUST, then the swap time will be as close to 22817ca54c3Smrg the target time as the driver can manage. Otherwise, the 22917ca54c3Smrg server will take the target UST time and convert it to a 23017ca54c3Smrg suitable target MSC value. 23117ca54c3Smrg 23217ca54c3Smrg If 'options' contains PresentOptionSuboptimal, then the 23317ca54c3Smrg PresentCompleteNotify event can have mode 23417ca54c3Smrg PresentCompleteModeSuboptimalCopy as the client supports it. 23517ca54c3Smrg 23617ca54c3Smrg After the presentation occurs, a PresentCompleteNotify event 23717ca54c3Smrg with kind PresentCompleteKindPixmap will be generated, both to 23817ca54c3Smrg 'window' as well as all members of 'notifies'. 23917ca54c3Smrg 24017ca54c3Smrg If 'window' is destroyed before the presentation occurs, then 24117ca54c3Smrg the presentation action will not be completed. 24217ca54c3Smrg 24317ca54c3Smrg PresentPixmap holds a reference to 'pixmap' until the 24417ca54c3Smrg presentation occurs, so 'pixmap' may be immediately freed 24517ca54c3Smrg after the request executes, even if that is before the 24617ca54c3Smrg presentation occurs. 24717ca54c3Smrg 24817ca54c3Smrg If 'idle-fence' is destroyed before the presentation occurs, 24917ca54c3Smrg then idle-fence will not be signaled but the presentation will 25017ca54c3Smrg occur normally. 25117ca54c3Smrg 25217ca54c3Smrg If 'wait-fence' is destroyed before it becomes triggered, then 25317ca54c3Smrg the presentation operation will no longer wait for it and will 25417ca54c3Smrg occur when the other conditions are satisfied. 25517ca54c3Smrg 25617ca54c3Smrg┌─── 25717ca54c3Smrg PresentNotifyMSC 25817ca54c3Smrg window: WINDOW 25917ca54c3Smrg serial: CARD32 26017ca54c3Smrg target-msc: CARD64 26117ca54c3Smrg divisor: CARD64 26217ca54c3Smrg remainder: CARD64 26317ca54c3Smrg└─── 26417ca54c3Smrg Errors: Window 26517ca54c3Smrg 26617ca54c3Smrg Delivers a PresentCompleteNotifyEvent with kind 26717ca54c3Smrg PresentCompleteKindNotifyMSC after the time specified by 26817ca54c3Smrg 'target-msc', 'divisor' and 'remainder'). 26917ca54c3Smrg 27017ca54c3Smrg 'serial' is an arbitrary client-specified value which will be 27117ca54c3Smrg returned in the event so that the client can associate the 27217ca54c3Smrg event and request. 27317ca54c3Smrg 27417ca54c3Smrg If 'target-msc' is greater than the current msc for 'window', 27517ca54c3Smrg the event will be delivered at (or after) the 'target-msc' 27617ca54c3Smrg field. Otherwise, the event delivery will occur after the next 27717ca54c3Smrg field where msc % 'divisor' == 'remainder'. 27817ca54c3Smrg 27917ca54c3Smrg If 'window' is destroyed before the event is delivered, then 28017ca54c3Smrg the event delivery will not be completed. 28117ca54c3Smrg 28217ca54c3Smrg┌─── 28317ca54c3Smrg PresentSelectInput 28417ca54c3Smrg event-id: PRESENTEVENTID 28517ca54c3Smrg window: WINDOW 28617ca54c3Smrg eventMask: SETofPRESENTEVENT 28717ca54c3Smrg└─── 28817ca54c3Smrg Errors: Window, Value, Match, IDchoice, Access 28917ca54c3Smrg 29017ca54c3Smrg Selects the set of Present events to be delivered for the 29117ca54c3Smrg specified window and event context. PresentSelectInput can 29217ca54c3Smrg create, modify, or delete event contexts. An event context is 29317ca54c3Smrg associated with a specific window; using an existing event 29417ca54c3Smrg context with a different window generates a Match error. 29517ca54c3Smrg 29617ca54c3Smrg If eventContext specifies an existing event context, then if 29717ca54c3Smrg eventMask is empty, PresentSelectInput deletes the specified 29817ca54c3Smrg context, otherwise the specified event context is changed to 29917ca54c3Smrg select a different set of events. 30017ca54c3Smrg 30117ca54c3Smrg If eventContext is an unused XID, then if eventMask is empty 30217ca54c3Smrg no operation is performed. Otherwise, a new event context is 30317ca54c3Smrg created selecting the specified events. 30417ca54c3Smrg 30517ca54c3Smrg┌─── 30617ca54c3Smrg PresentQueryCapabilities 30717ca54c3Smrg target: CRTC or WINDOW 30817ca54c3Smrg ▶ 30917ca54c3Smrg capabilities: SETofPRESENTCAPABILITY 31017ca54c3Smrg└─── 31117ca54c3Smrg Errors: Window, CRTC 31217ca54c3Smrg 31317ca54c3Smrg Returns the supported capabilities for the target CRTC. If 31417ca54c3Smrg 'target' is a CRTC, then it is used as the target CRTC. If 31517ca54c3Smrg 'target' is a WINDOW, then the target CRTC is selected by the 31617ca54c3Smrg X server from among the CRTCs on the screen specified by the window. 31717ca54c3Smrg 31817ca54c3Smrg PresentCapabilityAsync means that the target device can flip 31917ca54c3Smrg the scanout buffer mid-frame instead of waiting for a vertical 32017ca54c3Smrg blank interval. The precise latency between the flip request 32117ca54c3Smrg and the actual scanout transition is not defined by this 32217ca54c3Smrg specification, but is intended to be no more than a few 32317ca54c3Smrg scanlines. 32417ca54c3Smrg 32517ca54c3Smrg PresentCapabilityFence means that the target device can take 32617ca54c3Smrg advantage of SyncFences in the Present operations to improve 32717ca54c3Smrg GPU throughput. The driver must operate correctly in the 32817ca54c3Smrg absence of fences, but may have reduced performance. Using 32917ca54c3Smrg fences for drivers not advertising this capability should have 33017ca54c3Smrg no performance impact. 33117ca54c3Smrg 33217ca54c3Smrg PresentCapabilityUST means that the target device can scanout 33317ca54c3Smrg the image at an arbitrary UST time value, and is not driven by 33417ca54c3Smrg a periodic scanout timer. Applications specifying UST times 33517ca54c3Smrg for PresentPixmap can expect that their image will appear to 33617ca54c3Smrg the user within a short amount of time from that specified in 33717ca54c3Smrg the request. The precise accuracy of the scanout time is not 33817ca54c3Smrg defined by the extension, but is expected to be on the order 33917ca54c3Smrg of milliseconds or less. 34017ca54c3Smrg 34117ca54c3Smrg 34217ca54c3Smrg7.1 Requests proposed for a later Present extension version 34317ca54c3Smrg 34417ca54c3Smrg These are not part of the standard and represent future plans 34517ca54c3Smrg for the Present extension. 34617ca54c3Smrg 34717ca54c3Smrg┌─── 34817ca54c3Smrg PresentSelectInput 34917ca54c3Smrg ... 35017ca54c3Smrg└─── 35117ca54c3Smrg ... 35217ca54c3Smrg 35317ca54c3Smrg Specifying PresentSubredirectNotify Mask causes PresentPixmap 35417ca54c3Smrg requests on any child of 'window' from other clients to 35517ca54c3Smrg generate PresentRedirectNotify events to 'window' instead of 35617ca54c3Smrg actually performing the operation. However, only one client at 35717ca54c3Smrg a time can select for PresentRedirect on a window. An attempt 35817ca54c3Smrg to violate this restriction results in an Access error. 35917ca54c3Smrg 36017ca54c3Smrg ❄ ❄ ❄ ❄ ❄ ❄ ❄ 36117ca54c3Smrg 36217ca54c3Smrg8. Extension Events 36317ca54c3Smrg 36417ca54c3Smrg┌─── 36517ca54c3Smrg PresentConfigureNotify 36617ca54c3Smrg type: CARD8 XGE event type (35) 36717ca54c3Smrg extension: CARD8 Present extension request number 36817ca54c3Smrg sequence-number: CARD16 36917ca54c3Smrg length: CARD32 2 37017ca54c3Smrg evtype: CARD16 Present_ConfigureNotify 37117ca54c3Smrg eventID: PRESENTEVENTID 37217ca54c3Smrg window: WINDOW 37317ca54c3Smrg x: INT16 37417ca54c3Smrg y: INT16 37517ca54c3Smrg width: CARD16 37617ca54c3Smrg height: CARD16 37717ca54c3Smrg off_x: INT16 37817ca54c3Smrg off_y: INT16 37917ca54c3Smrg pixmap_width: CARD16 38017ca54c3Smrg pixmap_height: CARD16 38117ca54c3Smrg pixmap_flags: CARD32 38217ca54c3Smrg└─── 38317ca54c3Smrg 38417ca54c3Smrg PresentConfigureNotify events are sent when the window 38517ca54c3Smrg configuration changes if PresentSelectInput has requested 38617ca54c3Smrg it. PresentConfigureNotify events are XGE events and so do not 38717ca54c3Smrg have a unique event type. 38817ca54c3Smrg 38917ca54c3Smrg 'x' and 'y' are the parent-relative location of 'window'. 39017ca54c3Smrg 39117ca54c3Smrg┌─── 39217ca54c3Smrg PresentCompleteNotify 39317ca54c3Smrg type: CARD8 XGE event type (35) 39417ca54c3Smrg extension: CARD8 Present extension request number 39517ca54c3Smrg sequence-number: CARD16 39617ca54c3Smrg length: CARD32 2 39717ca54c3Smrg evtype: PRESENTEVENTTYPE PresentCompleteNotify 39817ca54c3Smrg eventID: PRESENTEVENTID 39917ca54c3Smrg window: WINDOW 40017ca54c3Smrg kind: PRESENTCOMPLETEKIND 40117ca54c3Smrg mode: PRESENTCOMPLETEMODE 40217ca54c3Smrg serial: CARD32 40317ca54c3Smrg ust: CARD64 40417ca54c3Smrg msc: CARD64 40517ca54c3Smrg└─── 40617ca54c3Smrg 40717ca54c3Smrg CompleteNotify events are delivered when a PresentPixmap or 40817ca54c3Smrg PresentNotifyMSC operation has completed. 40917ca54c3Smrg 41017ca54c3Smrg 'kind' is PresentCompleteKindPixmap when generated by a 41117ca54c3Smrg PresentPixmap operation completion or 41217ca54c3Smrg PresentCompleteKindNotifyMsc when generated by a 41317ca54c3Smrg PresentNotifyMSC operation completion. 41417ca54c3Smrg 41517ca54c3Smrg 'mode' is PresentCompleteModeCopy when the source pixmap 41617ca54c3Smrg contents are taken from the pixmap and the pixmap is idle 41717ca54c3Smrg immediately after the presentation completes. 'mode' is 41817ca54c3Smrg PresentCompleteModeSuboptimalCopy when the source pixmap 41917ca54c3Smrg contents are copied but it would be possible to flip the 42017ca54c3Smrg pixmap if the buffer format/modifier was different (options 42117ca54c3Smrg given to PresentPixmap must contain PresentOptionSuboptimal). 42217ca54c3Smrg 'mode' is PresentCompleteModeFlip when the pixmap remains in-use 42317ca54c3Smrg even after the presentation completes. It will become idle no 42417ca54c3Smrg later than when the next PresentPixmap operation targeting the 42517ca54c3Smrg same window by any client completes. If the presentation 42617ca54c3Smrg operation was skipped because some later operation made it 42717ca54c3Smrg irrelevant, then 'mode' will be PresentCompleteModeSkip. 42817ca54c3Smrg 42917ca54c3Smrg 'serial' is the value provided in the generating PresentPixmap 43017ca54c3Smrg request. 43117ca54c3Smrg 43217ca54c3Smrg 'msc' and 'ust' indicate the frame count and system time when 43317ca54c3Smrg the presentation actually occurred. 43417ca54c3Smrg 43517ca54c3Smrg┌─── 43617ca54c3Smrg PresentIdleNotify 43717ca54c3Smrg type: CARD8 XGE event type (35) 43817ca54c3Smrg extension: CARD8 Present extension request number 43917ca54c3Smrg sequence-number: CARD16 44017ca54c3Smrg length: CARD32 0 44117ca54c3Smrg evtype: PRESENTEVENTTYPE PresentIdleNotify 44217ca54c3Smrg eventID: PRESENTEVENTID 44317ca54c3Smrg window: WINDOW 44417ca54c3Smrg serial: CARD32 44517ca54c3Smrg pixmap: PIXMAP 44617ca54c3Smrg idle-fence: FENCE 44717ca54c3Smrg└─── 44817ca54c3Smrg 44917ca54c3Smrg IdleNotify events are delivered when a pixmap used in a 45017ca54c3Smrg PresentPixmap operation may be re-used by the client. 45117ca54c3Smrg 45217ca54c3Smrg 'window' is the window from the PresentPixmap to which this 45317ca54c3Smrg event is delivered. 45417ca54c3Smrg 45517ca54c3Smrg 'serial' is the value provided in the associated PresentPixmap 45617ca54c3Smrg request. 45717ca54c3Smrg 45817ca54c3Smrg 'pixmap' is the pixmap which is ready for re-use. 45917ca54c3Smrg 46017ca54c3Smrg 'idle-fence' is the fence which was provided in the 46117ca54c3Smrg originating PresentPixmap request and is used to synchronize 46217ca54c3Smrg rendering between the client and the X server's use of the 46317ca54c3Smrg buffer. If not None, then the client must wait for the fence 46417ca54c3Smrg to be signaled before using the pixmap. 46517ca54c3Smrg 46617ca54c3Smrg8.1. Extension Events proposed for a later Present extension version 46717ca54c3Smrg 46817ca54c3Smrg┌─── 46917ca54c3Smrg PresentRedirectNotify 47017ca54c3Smrg type: CARD8 XGE event type (35) 47117ca54c3Smrg extension: CARD8 Present extension request number 47217ca54c3Smrg sequence-number: CARD16 47317ca54c3Smrg length: CARD32 17 + 2 n 47417ca54c3Smrg evtype: CARD16 Present_RedirectNotify 47517ca54c3Smrg update-window: BOOL 47617ca54c3Smrg 47717ca54c3Smrg eventID: PRESENTEVENTID 47817ca54c3Smrg event-window: WINDOW 47917ca54c3Smrg window: WINDOW 48017ca54c3Smrg pixmap: PIXMAP 48117ca54c3Smrg serial: CARD32 48217ca54c3Smrg 48317ca54c3Smrg valid-area: REGION 48417ca54c3Smrg update-area: REGION 48517ca54c3Smrg valid-rect: RECTANGLE 48617ca54c3Smrg update-rect: RECTANGLE 48717ca54c3Smrg x-off, y-off: INT16 48817ca54c3Smrg target-crtc: CRTC 48917ca54c3Smrg wait-fence: FENCE 49017ca54c3Smrg idle-fence: FENCE 49117ca54c3Smrg options: SETofPRESENTOPTION 49217ca54c3Smrg target-msc: CARD64 49317ca54c3Smrg divisor: CARD64 49417ca54c3Smrg remainder: CARD64 49517ca54c3Smrg notifies: LISTofPRESENTNOTIFY 49617ca54c3Smrg└─── 49717ca54c3Smrg 49817ca54c3Smrg RedirectNotify events are delivered when the client has 49917ca54c3Smrg selected for SubredirectNotify the parent of the target 50017ca54c3Smrg window. All of the values provided to the PresentPixmap 50117ca54c3Smrg request are provided. If the client simply passes these 50217ca54c3Smrg parameters back to the X server, the effect will be as if the 50317ca54c3Smrg original client executed the request. 50417ca54c3Smrg 50517ca54c3Smrg If 'update-window' is TRUE, then there are clients who have 50617ca54c3Smrg requested composite automatic redirect on the window and who 50717ca54c3Smrg presumably expect the window buffer to eventually contain 50817ca54c3Smrg the application provided contents. The compositing manager 50917ca54c3Smrg should at least occasionally update the window buffer with 51017ca54c3Smrg suitable contents. The precise update interval is left to the 51117ca54c3Smrg discretion of the client receiving this event. 51217ca54c3Smrg 51317ca54c3Smrg ❄ ❄ ❄ ❄ ❄ ❄ ❄ 51417ca54c3Smrg 51517ca54c3Smrg9. Extension Versioning 51617ca54c3Smrg 51717ca54c3Smrg 1.0: First published version 51817ca54c3Smrg 51917ca54c3Smrg 1.2: Added PresentCompleteModeSuboptimalCopy flag and 52017ca54c3Smrg PresentOptionSuboptimal option 52117ca54c3Smrg 52217ca54c3Smrg ❄ ❄ ❄ ❄ ❄ ❄ ❄ 52317ca54c3Smrg 52417ca54c3Smrg 52517ca54c3Smrg10. Relationship with other extensions 52617ca54c3Smrg 52717ca54c3SmrgAs an extension designed to support other extensions, there is 52817ca54c3Smrgnaturally some interactions with other extensions. 52917ca54c3Smrg 53017ca54c3Smrg10.1 GLX 53117ca54c3Smrg 53217ca54c3SmrgGLX is both an application interface and an X extension. OpenGL 53317ca54c3Smrgapplications using the GLX API will use the GLX extension and may use 53417ca54c3Smrgthe Present extension to display application contents. 53517ca54c3Smrg 53617ca54c3Smrg10.2 DRI3 53717ca54c3Smrg 53817ca54c3SmrgThe DRI3 extension provides a way to share direct rendered pixel data 53917ca54c3Smrgwith the X server as X pixmaps. When used in conjunction with Present, 54017ca54c3Smrgthey provide a complete direct rendering solution for OpenGL or other 54117ca54c3SmrgAPIs. 54217ca54c3Smrg 54317ca54c3Smrg10.3 DRI2 54417ca54c3Smrg 54517ca54c3SmrgPresent provides similar functionality to the DRI2SwapBuffers and 54617ca54c3Smrgrequests, however Present uses X pixmaps to refer to the new window 54717ca54c3Smrgcontents instead of the DRI2 buffer attachments. 54817ca54c3Smrg 54917ca54c3SmrgPresent and DRI3 are designed in conjunction to replace DRI2 55017ca54c3Smrg 55117ca54c3Smrg10.4 XvMC / Xv 55217ca54c3Smrg 55317ca54c3SmrgIt might be nice to be able to use YUV formatted objects as Present 55417ca54c3Smrgsources. 55517ca54c3Smrg 55617ca54c3Smrg ❄ ❄ ❄ ❄ ❄ ❄ ❄ 55717ca54c3Smrg 55817ca54c3SmrgAppendix A. Protocol Encoding 55917ca54c3Smrg 56017ca54c3SmrgSyntactic Conventions 56117ca54c3Smrg 56217ca54c3SmrgThis document uses the same syntactic conventions as the core X 56317ca54c3Smrgprotocol encoding document. 56417ca54c3Smrg 56517ca54c3Smrg 56617ca54c3SmrgA.1 Common Types 56717ca54c3Smrg┌─── 56817ca54c3Smrg PresentEventType 56917ca54c3Smrg 0 PresentConfigureNotify 57017ca54c3Smrg 1 PresentCompleteNotify 57117ca54c3Smrg 2 PresentIdleNotify 57217ca54c3Smrg└─── 57317ca54c3Smrg 57417ca54c3Smrg┌─── 57517ca54c3Smrg PresentEventMask 57617ca54c3Smrg 1 PresentConfigureNotifyMask 57717ca54c3Smrg 2 PresentCompleteNotifyMask 57817ca54c3Smrg 4 PresentIdleNotifyMask 57917ca54c3Smrg└─── 58017ca54c3Smrg 58117ca54c3Smrg┌─── 58217ca54c3Smrg PresentOption 58317ca54c3Smrg 1 PresentOptionAsync 58417ca54c3Smrg 2 PresentOptionCopy; 58517ca54c3Smrg 4 PresentOptionUST 58617ca54c3Smrg 8 PresentOptionSuboptimal 58717ca54c3Smrg└─── 58817ca54c3Smrg 58917ca54c3Smrg┌─── 59017ca54c3Smrg PresentCapability 59117ca54c3Smrg 1 PresentCapabilityAsync 59217ca54c3Smrg 2 PresentCapabilityFence 59317ca54c3Smrg 4 PresentCapabilityUST 59417ca54c3Smrg└─── 59517ca54c3Smrg 59617ca54c3Smrg┌─── 59717ca54c3Smrg PresentCompleteKind 59817ca54c3Smrg 0 PresentCompleteKindPixmap 59917ca54c3Smrg 1 PresentCompleteKindMSCNotify 60017ca54c3Smrg└─── 60117ca54c3Smrg 60217ca54c3Smrg┌─── 60317ca54c3Smrg PresentCompleteMode 60417ca54c3Smrg 0 PresentCompleteModeCopy 60517ca54c3Smrg 1 PresentCompleteModeFlip 60617ca54c3Smrg 2 PresentCompleteModeSkip 60717ca54c3Smrg 3 PresentCompleteModeSuboptimalCopy 60817ca54c3Smrg└─── 60917ca54c3Smrg 61017ca54c3Smrg┌─── 61117ca54c3Smrg PresentNotify 61217ca54c3Smrg 4 Window window 61317ca54c3Smrg 4 CARD32 serial 61417ca54c3Smrg└─── 61517ca54c3Smrg 61617ca54c3SmrgA.1.1 Common Types proposed for a later Present extension version 61717ca54c3Smrg 61817ca54c3Smrg┌─── 61917ca54c3Smrg PresentEventType 62017ca54c3Smrg ... 62117ca54c3Smrg 3 PresentRedirectNotify 62217ca54c3Smrg└─── 62317ca54c3Smrg 62417ca54c3Smrg┌─── 62517ca54c3Smrg PresentEventMask 62617ca54c3Smrg ... 62717ca54c3Smrg 8 PresentSubredirectNotifyMask 62817ca54c3Smrg└─── 62917ca54c3Smrg 63017ca54c3SmrgA.2 Protocol Requests 63117ca54c3Smrg 63217ca54c3Smrg┌─── 63317ca54c3Smrg PresentQueryVersion 63417ca54c3Smrg 1 CARD8 major opcode 63517ca54c3Smrg 1 0 Present opcode 63617ca54c3Smrg 2 3 length 63717ca54c3Smrg 4 CARD32 major version 63817ca54c3Smrg 4 CARD32 minor version 63917ca54c3Smrg ▶ 64017ca54c3Smrg 1 1 Reply 64117ca54c3Smrg 1 unused 64217ca54c3Smrg 2 CARD16 sequence number 64317ca54c3Smrg 4 0 reply length 64417ca54c3Smrg 4 CARD32 major version 64517ca54c3Smrg 4 CARD32 minor version 64617ca54c3Smrg 16 unused 64717ca54c3Smrg└─── 64817ca54c3Smrg 64917ca54c3Smrg┌─── 65017ca54c3Smrg PresentPixmap 65117ca54c3Smrg 1 CARD8 major opcode 65217ca54c3Smrg 1 1 Present opcode 65317ca54c3Smrg 2 18+2n length 65417ca54c3Smrg 4 Window window 65517ca54c3Smrg 4 Pixmap pixmap 65617ca54c3Smrg 4 CARD32 serial 65717ca54c3Smrg 4 Region valid-area 65817ca54c3Smrg 4 Region update-area 65917ca54c3Smrg 2 INT16 x-off 66017ca54c3Smrg 2 INT16 y-off 66117ca54c3Smrg 4 CRTC target-crtc 66217ca54c3Smrg 4 SyncFence wait-fence 66317ca54c3Smrg 4 SyncFence idle-fence 66417ca54c3Smrg 4 CARD32 options 66517ca54c3Smrg 4 unused 66617ca54c3Smrg 8 CARD64 target-msc 66717ca54c3Smrg 8 CARD64 divisor 66817ca54c3Smrg 8 CARD64 remainder 66917ca54c3Smrg 8n LISTofPresentNotify notifies 67017ca54c3Smrg└─── 67117ca54c3Smrg 67217ca54c3Smrg┌─── 67317ca54c3Smrg PresentNotifyMSC 67417ca54c3Smrg 1 CARD8 major opcode 67517ca54c3Smrg 1 2 Present opcode 67617ca54c3Smrg 2 10 length 67717ca54c3Smrg 4 Window window 67817ca54c3Smrg 4 CARD32 serial 67917ca54c3Smrg 4 unused 68017ca54c3Smrg 8 CARD64 target-msc 68117ca54c3Smrg 8 CARD64 divisor 68217ca54c3Smrg 8 CARD64 remainder 68317ca54c3Smrg└─── 68417ca54c3Smrg 68517ca54c3Smrg┌─── 68617ca54c3Smrg PresentSelectInput 68717ca54c3Smrg 1 CARD8 major opcode 68817ca54c3Smrg 1 3 Present opcode 68917ca54c3Smrg 2 4 length 69017ca54c3Smrg 4 EventID event-id 69117ca54c3Smrg 4 Window window 69217ca54c3Smrg 4 SETofPRESENTEVENTMASK event-mask 69317ca54c3Smrg└─── 69417ca54c3Smrg 69517ca54c3Smrg┌─── 69617ca54c3Smrg PresentQueryCapabilities 69717ca54c3Smrg 1 CARD8 major opcode 69817ca54c3Smrg 1 4 Present opcode 69917ca54c3Smrg 2 2 length 70017ca54c3Smrg 4 CRTC or Window target 70117ca54c3Smrg ▶ 70217ca54c3Smrg 1 1 Reply 70317ca54c3Smrg 1 unused 70417ca54c3Smrg 2 CARD16 sequence number 70517ca54c3Smrg 4 0 reply length 70617ca54c3Smrg 4 SETofPRESENTCAPABILITY capabilities 70717ca54c3Smrg└─── 70817ca54c3Smrg 70917ca54c3SmrgA.3 Protocol Events 71017ca54c3Smrg 71117ca54c3Smrg┌─── 71217ca54c3Smrg PresentConfigureNotify 71317ca54c3Smrg 1 35 XGE 71417ca54c3Smrg 1 CARD8 Present extension opcode 71517ca54c3Smrg 2 CARD16 sequence number 71617ca54c3Smrg 4 2 length 71717ca54c3Smrg 2 0 PresentConfigureNotify 71817ca54c3Smrg 2 unused 71917ca54c3Smrg 4 CARD32 event id 72017ca54c3Smrg 4 Window window 72117ca54c3Smrg 2 INT16 x 72217ca54c3Smrg 2 INT16 y 72317ca54c3Smrg 2 CARD16 width 72417ca54c3Smrg 2 CARD16 height 72517ca54c3Smrg 2 INT16 off x 72617ca54c3Smrg 2 INT16 off y 72717ca54c3Smrg 72817ca54c3Smrg 2 CARD16 pixmap width 72917ca54c3Smrg 2 CARD16 pixmap height 73017ca54c3Smrg 4 CARD32 pixmap flags 73117ca54c3Smrg└─── 73217ca54c3Smrg 73317ca54c3Smrg┌─── 73417ca54c3Smrg PresentCompleteNotify 73517ca54c3Smrg 1 35 XGE 73617ca54c3Smrg 1 CARD8 Present extension opcode 73717ca54c3Smrg 2 CARD16 sequence number 73817ca54c3Smrg 4 2 length 73917ca54c3Smrg 2 1 PresentCompleteNotify 74017ca54c3Smrg 1 CARD8 kind 74117ca54c3Smrg 1 CARD8 mode 74217ca54c3Smrg 4 CARD32 event id 74317ca54c3Smrg 4 Window window 74417ca54c3Smrg 4 CARD32 serial 74517ca54c3Smrg 8 CARD64 ust 74617ca54c3Smrg 74717ca54c3Smrg 8 CARD64 msc 74817ca54c3Smrg└─── 74917ca54c3Smrg 75017ca54c3Smrg┌─── 75117ca54c3Smrg PresentIdleNotify 75217ca54c3Smrg 1 35 XGE 75317ca54c3Smrg 1 CARD8 Present extension opcode 75417ca54c3Smrg 2 CARD16 sequence number 75517ca54c3Smrg 4 0 length 75617ca54c3Smrg 2 2 PresentIdleNotify 75717ca54c3Smrg 2 unused 75817ca54c3Smrg 4 CARD32 event id 75917ca54c3Smrg 4 Window window 76017ca54c3Smrg 4 CARD32 serial 76117ca54c3Smrg 4 Pixmap pixmap 76217ca54c3Smrg 4 SyncFence idle-fence 76317ca54c3Smrg└─── 76417ca54c3Smrg 76517ca54c3SmrgA.3.1 Protocol Events proposed for later Present extension version 76617ca54c3Smrg 76717ca54c3Smrg┌─── 76817ca54c3Smrg PresentRedirectNotify 76917ca54c3Smrg 1 35 XGE 77017ca54c3Smrg 1 CARD8 Present extension opcode 77117ca54c3Smrg 2 CARD16 sequence number 77217ca54c3Smrg 4 18+2n length 77317ca54c3Smrg 2 3 PresentRedirectNotify 77417ca54c3Smrg 1 BOOL update-window 77517ca54c3Smrg 1 unused 77617ca54c3Smrg 4 CARD32 event id 77717ca54c3Smrg 4 Window event-window 77817ca54c3Smrg 4 Window window 77917ca54c3Smrg 4 Pixmap pixmap 78017ca54c3Smrg 4 CARD32 serial 78117ca54c3Smrg 78217ca54c3Smrg 4 Region valid-area 78317ca54c3Smrg 4 Region update-area 78417ca54c3Smrg 8 Rectangle valid-rect 78517ca54c3Smrg 8 Rectangle update-rect 78617ca54c3Smrg 2 INT16 x-off 78717ca54c3Smrg 2 INT16 y-off 78817ca54c3Smrg 4 CRTC target-crtc 78917ca54c3Smrg 4 SyncFence wait-fence 79017ca54c3Smrg 4 SyncFence idle-fence 79117ca54c3Smrg 4 CARD32 options 79217ca54c3Smrg 4 unused 79317ca54c3Smrg 8 CARD64 target-msc 79417ca54c3Smrg 8 CARD64 divisor 79517ca54c3Smrg 8 CARD64 remainder 79617ca54c3Smrg 8n LISTofPRESENTNOTIFY notifies 79717ca54c3Smrg└─── 79817ca54c3Smrg 79917ca54c3SmrgA.4 Protocol Errors 80017ca54c3Smrg 80117ca54c3SmrgThe Present extension defines no errors. 80217ca54c3Smrg 80317ca54c3Smrg ❄ ❄ ❄ ❄ ❄ ❄ ❄ 804