Skip to content

Commit a8c62e8

Browse files
committed
Major rebase and updates to the original proposal
This change rebases the original extension on main. It also brings many modifications from discussions within the Khronos SI group and this MR: - Add a proposal document - Rely on VK_KHR_present_id to identify presents - Split out VK_PRESENT_MODE_FIFO_LATEST_READY_EXT - Add physical device and surface capabilities - Define "presentation" as a set of well-defined multiple steps - Explicitly describe the internal results queue interactions - Add many per-present parameters, allowing to remove swapchain state - Refine VRR support - Cleanup appendix and update contributors - Replace present slop with a flag to round to nearest refresh cycle - Refine mechanisms for feedback about time domains and timing properties updates - Allow timing results to be returned incomplete and out of order
1 parent 1812fde commit a8c62e8

File tree

10 files changed

+1143
-528
lines changed

10 files changed

+1143
-528
lines changed

appendices/VK_EXT_present_timing.adoc

Lines changed: 44 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
// Copyright (c) 2017-2022 Khronos Group.
1+
// Copyright (c) 2017-2024 Khronos Group.
22
//
33
// SPDX-License-Identifier: CC-BY-4.0
44

55
include::{generated}/meta/{refprefix}VK_EXT_present_timing.adoc[]
66

7+
=== Other Extension Metadata
8+
79
*Last Modified Date*::
8-
2020-07-06
10+
2024-05-30
911
*IP Status*::
1012
No known IP claims.
1113
*Contributors*::
@@ -21,9 +23,15 @@ include::{generated}/meta/{refprefix}VK_EXT_present_timing.adoc[]
2123
- Alon Or-Bach, Samsung
2224
- Niklas Smedberg, Unity Technologies
2325
- Tobias Hector, AMD
26+
- Lionel Duc, NVIDIA
27+
- Lina Versace, Google
28+
- Sebastian Wick, Red Hat
29+
- Jakob Bornecrantz, Collabora
30+
31+
=== Description
2432

2533
This device extension allows an application that uses the
26-
`<<VK_KHR_swapchain>>` extension to obtain information about the
34+
`apiext:VK_KHR_swapchain` extension to obtain information about the
2735
presentation engine's display, to obtain timing information about each
2836
present, and to schedule a present to happen no earlier than a desired time.
2937
An application can use this to minimize various visual anomalies (e.g.
@@ -41,7 +49,6 @@ no sooner than a given time.
4149
This allows the application to avoid stuttering, so the animation looks
4250
smooth to the user.
4351

44-
4552
include::{generated}/interfaces/VK_EXT_present_timing.adoc[]
4653

4754
=== Issues
@@ -61,7 +68,7 @@ pname:refreshDuration is non-zero, at which point the FRR vs. VRR
6168
indication will also be valid.
6269

6370
If the presentation engine's pname:refreshDuration is a fixed value,
64-
the application's image present duration (IPD) must be a multiple of
71+
the application's image present duration (IPD) should be a multiple of
6572
pname:refreshDuration.
6673
That is, the quanta for changing the IPD is pname:refreshDuration.
6774
For example, if pname:refreshDuration is 16.67ms, the IPD can be
@@ -85,8 +92,6 @@ fixed; but can change over time.
8592
For example, if a full-screen video player application is visible, the display
8693
may operate at a 24Hz refresh cycle; and then later switch to 60Hz when
8794
multiple windows are visible.
88-
The special value of zero for pname:refreshDuration is used to
89-
indicate the condition where the platform cannot yet answer the query.
9095

9196
VRR displays on some platforms can also be seen as having different
9297
characteristics over time.
@@ -96,11 +101,11 @@ display (however that is defined).
96101
If the application's window is not full-screen-exclusive (e.g. a normal
97102
multi-window case), the display can look like an FRR display (i.e. because the
98103
compositor is trying to treat all windows in a consistent manner).
99-
A different issue will deal with these how the timing characteristics
100-
can change over time.
104+
A different issue will deal with how the timing characteristics can change
105+
over time.
101106

102107

103-
2) Do we return min/max Values for Refresh Duration for VRR?
108+
2) Do we return min/max values for refresh duration for VRR?
104109

105110
*PROPOSED*: return only the minimum value of refreshDuration for a VRR.
106111

@@ -119,8 +124,8 @@ artifacts.
119124
3) How to deal with changes in timing properties?
120125

121126
*RESOLVED*: The slink:VkPastPresentationTimingEXT structure that is
122-
returned by flink:vkGetPastPresentationTimingEXT will contain
123-
pname:timeDomainChanged, which will be ename:VK_TRUE if the time
127+
returned by flink:vkGetPastPresentationTimingEXT contains
128+
pname:timeDomainChanged, which is ename:VK_TRUE if the time
124129
domain enabled for the swapchain is not currently available.
125130

126131
An example of why display timing properties can change is if a surface
@@ -140,34 +145,33 @@ visible and VRR otherwise.
140145
4) One Query for all Timing info vs. an initial query to determine FRR vs. VRR,
141146
and then FRR-specific vs VRR-specific queries?
142147

143-
*PROPOSED*: Have one query, as described in issue 1, that can be
148+
*RESOLVED*: Have one query, as described in issue 1, that can be
144149
called whenever the application needs to obtain the timing properties
145150
of the surface.
146151

147152

148-
5) Query to Determine Time Domain?
153+
5) Query to determine time domain?
149154

150-
*PROPOSED*: Have a query to determine the time domain.
151-
This extension will define some return values, including some that are
152-
platform-specific.
153-
Other extensions can add other time domains.
155+
*RESOLVED*: Have a query to determine the time domain.
156+
This extension defines a basic swapchain-local time domain.
157+
Other extensions can add other platform-specific time domains.
154158

155159

156-
6) What Time to use for targetPresentTime for Early Images?
160+
6) What time to use for targetPresentTime for early images?
157161

158162
*PROPOSED*: Have no query for determining the current time in the PE’s time
159-
domain; and do allow the special value of zero for targetPresentTime and
160-
idealPresentTime, meaning that there is no target nor ideal time.
163+
domain; and do allow the special value of zero for targetPresentTime,
164+
meaning that there is no target.
161165

162166
On some platforms, there is no way to determine the current time, nor
163167
to determine surface timing properties until after at least one image
164168
has been presented.
165169

166170
In such cases, the special value of zero allows the application to
167171
indicate that timing feedback is desired, but that no
168-
targetPresentTime nor idealPresentTime is requested.
172+
targetPresentTime is requested.
169173
Later, once the application has obtained feedback, it can specify
170-
targetPresentTime and idealPresentTime.
174+
targetPresentTime by using the result's actualPresentTime.
171175

172176

173177
7) How long before an application’s request for new image duration is honored?
@@ -188,68 +192,48 @@ The first time (from the call till the image is presented) generally doesn’t
188192
matter, because the application will likely be providing a targetPresentTime
189193
(i.e. the application may have some indication for how long this will be).
190194
However, the latency between targetPresentTime until feedback is available may
191-
be much long.
195+
be much longer.
192196
For example, on Android on the 1st-generation Pixel phone (60Hz FRR display),
193197
the latency was approximately 5 refresh cycles (83.33ms).
194198
For higher-frequency displays, the latency may have a larger number of refresh
195199
cycles.
196200

197-
Is there value in having a query for the application to know how long it may
198-
have to wait for feedback?
199-
Can such a query be reasonably answered by the driver?
200-
201-
Is there other interesting information in this space that we may wish to
202-
capture?
201+
Can such a query be reasonably answered by the driver? Is there other
202+
interesting information in this space that we may wish to capture?
203203

204204

205205
9) Do we have a query(s) about the number of VkPastPresentationTimingEXT
206206
structs to keep?
207207

208-
*UNRESOLVED*: At the Montreal F2F, there was discussion about how much
209-
feedback that the driver needs to keep and/or how much feedback that
210-
the application needs to be able to query.
211-
212-
The way that the LunarG cube demo (official WSI example code) used
213-
VK_GOOGLE_display_timing, and what is proposed for the new extension is that
214-
the application query what feedback is available during every render-present
215-
loop.
216-
If the application never skips querying for feedback, and always obtains
217-
whatever feedback is available, there doesn’t seem much need for such a
218-
query(s).
219-
What I saw with the cube demo on a Pixel phone was that most of the time, the
220-
application obtained feedback for 1 previous present.
221-
Occasionally, it would get 2 VkPastPresentationTimingEXT structs on time and
222-
then 0 the next (or vice versa).
223-
224-
Perhaps, a video player application might present several images at once, and
225-
then later get feedback for several images at the same time.
226-
That would be the most-likely use-case that I can come up with for why a query
227-
might be useful.
228-
Is that compelling enough?
229-
230-
What might the model for the query(s) be?
231-
Potentially the application can tell the driver how many presents it might do
232-
at a time, and the driver can use that to size its internal buffer.
233-
Is there value in having a query that would influence the driver’s behavior
234-
(beyond what’s provided for in the currently-proposed API)?
208+
*PROPOSED*: Let the application specify at swapchain creation how many
209+
results the swapchain is allowed to store before querying them with
210+
vkGetPastPresentationTimingEXT.
211+
235212

236213
10) How is the SWAPCHAIN_LOCAL time domain used with the calibrated
237214
timestamps extension?
238215

239-
PROPOSED: Define a struct to chain into VkCalibratedTimestampInfoEXT::pNext
216+
*PROPOSED*: Define a struct to chain into VkCalibratedTimestampInfoEXT::pNext
240217
that specifies a swapchain.
241218
Is anything additional needed for
242219
vkGetPhysicalDeviceCalibrateableTimeDomainsEXT, or are swapchain-local
243220
timestamps always calibrateable or always not calibrateable for a given
244221
device?
245222

223+
246224
11) Should VK_PRESENT_MODE_FIFO_LATEST_READY_EXT be part of this extension,
247225
or split out into its own extension?
248226

249-
PROPOSED: It is only tangentially related.
227+
*RESOLVED*: It is only tangentially related.
250228
Split it out into its own extension and define the interaction here.
251229

252230
=== Version History
253231

254232
* Revision 1, 2018-05-11 (Ian Elliott)
255-
** Internal revisions
233+
** Internal revisions.
234+
235+
* Revision 2, 2022-11-30 (Lionel Duc)
236+
** Rebase for public discussions.
237+
238+
* Revision 3, 2024-05-29 (Lionel Duc)
239+
** Public revisions.

appendices/glossary.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,8 @@ Image Present Duration::
836836
Image Present Rate::
837837
The number of newly-presented images the application intends to present
838838
each second (a.k.a. frame rate).
839-
This value should: be a multiple of the refresh rate.
839+
On fixed refresh rate displays, this value should: be a multiple of
840+
the refresh rate.
840841
endif::VK_EXT_present_timing,VK_GOOGLE_display_timing[]
841842

842843
Image Subresource::

0 commit comments

Comments
 (0)