present: add PresentOptionAsyncMayTear

This commit is contained in:
Xaver Hugl 2022-08-30 12:22:35 +02:00
parent 6c3a7302fc
commit 5a3d5d624e
2 changed files with 40 additions and 9 deletions

View file

@ -45,11 +45,15 @@
#define PresentOptionCopy (1 << 1) #define PresentOptionCopy (1 << 1)
#define PresentOptionUST (1 << 2) #define PresentOptionUST (1 << 2)
#define PresentOptionSuboptimal (1 << 3) #define PresentOptionSuboptimal (1 << 3)
#define PresentOptionAsyncMayTear (1 << 4)
#define PresentAllOptions (PresentOptionAsync | \ #define PresentAllOptions (PresentOptionAsync | \
PresentOptionCopy | \ PresentOptionCopy | \
PresentOptionUST | \ PresentOptionUST | \
PresentOptionSuboptimal) PresentOptionSuboptimal | \
PresentOptionAsyncMayTear)
#define PresentAllAsyncOptions (PresentOptionAsync | PresentOptionAsyncMayTear)
/* Present capabilities */ /* Present capabilities */
@ -57,10 +61,14 @@
#define PresentCapabilityAsync 1 #define PresentCapabilityAsync 1
#define PresentCapabilityFence 2 #define PresentCapabilityFence 2
#define PresentCapabilityUST 4 #define PresentCapabilityUST 4
#define PresentCapabilityAsyncMayTear 8
#define PresentAllCapabilities (PresentCapabilityAsync | \ #define PresentAllCapabilities (PresentCapabilityAsync | \
PresentCapabilityFence | \ PresentCapabilityFence | \
PresentCapabilityUST) PresentCapabilityUST | \
PresentCapabilityAsyncMayTear)
#define PresentAllAsyncCapabilities (PresentCapabilityAsync | PresentCapabilityAsyncMayTear)
/* Events */ /* Events */
#define PresentConfigureNotify 0 #define PresentConfigureNotify 0

View file

@ -57,11 +57,13 @@ PRESENTEVENTMASK { PresentConfigureNotifyMask,
PRESENTOPTION { PresentOptionAsync, PRESENTOPTION { PresentOptionAsync,
PresentOptionCopy, PresentOptionCopy,
PresentOptionUST, PresentOptionUST,
PresentOptionSuboptimal } PresentOptionSuboptimal,
PresentOptionAsyncMayTear }
PRESENTCAPABILITY { PresentCapabilityAsync, PRESENTCAPABILITY { PresentCapabilityAsync,
PresentCapabilityFence, PresentCapabilityFence,
PresentCapabilityUST } PresentCapabilityUST,
PresentCapabilityAsyncMayTear }
PRESENTCOMPLETEKIND { PresentCompleteKindPixmap, PRESENTCOMPLETEKIND { PresentCompleteKindPixmap,
PresentCompleteKindMSCNotify } PresentCompleteKindMSCNotify }
@ -215,7 +217,16 @@ The name of this extension is "Present"
If 'options' contains PresentOptionAsync, and the 'target-msc' If 'options' contains PresentOptionAsync, and the 'target-msc'
is less than or equal to the current msc for 'window', then is less than or equal to the current msc for 'window', then
the operation will be performed as soon as possible, not the operation will be performed as soon as possible, not
necessarily waiting for the next vertical blank interval. necessarily waiting for the next vertical blank interval. If
the target-crtc does not support PresentCapabilityAsyncMayTear,
this may result in tearing.
If the target-crtc supports PresentCapabilityAsyncMayTear,
'options' contains PresentOptionAsyncMayTear, and the 'target-msc'
is less than or equal to the current msc for 'window', then
the operation will be performed as soon as possible, not
necessarily waiting for the next vertical blank interval, and
possibly resulting in tearing.
If 'options' contains PresentOptionCopy, then 'pixmap' will be If 'options' contains PresentOptionCopy, then 'pixmap' will be
idle, and 'idle-fence' triggered as soon as the operation occurs. idle, and 'idle-fence' triggered as soon as the operation occurs.
@ -315,13 +326,23 @@ The name of this extension is "Present"
'target' is a WINDOW, then the target CRTC is selected by the 'target' is a WINDOW, then the target CRTC is selected by the
X server from among the CRTCs on the screen specified by the window. X server from among the CRTCs on the screen specified by the window.
PresentCapabilityAsync means that the target device can flip PresentCapabilityAsyncMayTear means that the target device may be
the scanout buffer mid-frame instead of waiting for a vertical able to flip the scanout buffer mid-frame instead of waiting for
blank interval. The precise latency between the flip request a vertical blank interval. The precise latency between the flip
and the actual scanout transition is not defined by this request and the actual scanout transition is not defined by this
specification, but is intended to be no more than a few specification, but is intended to be no more than a few
scanlines. scanlines.
If PresentCapabilityAsyncMayTear is not supported,
PresentCapabilityAsync means the same as
PresentCapabilityAsyncMayTear described above.
If PresentCapabilityAsyncMayTear is supported,
PresentCapabilityAsync means that even if there is already a flip
pending in the target device, it may be possible to replace that
flip before the next vertical blank interval. The scanout buffer
does not change mid-frame though, i.e. there is no tearing.
PresentCapabilityFence means that the target device can take PresentCapabilityFence means that the target device can take
advantage of SyncFences in the Present operations to improve advantage of SyncFences in the Present operations to improve
GPU throughput. The driver must operate correctly in the GPU throughput. The driver must operate correctly in the
@ -584,6 +605,7 @@ A.1 Common Types
2 PresentOptionCopy; 2 PresentOptionCopy;
4 PresentOptionUST 4 PresentOptionUST
8 PresentOptionSuboptimal 8 PresentOptionSuboptimal
16 PresentOptionAsyncMayTear
└─── └───
┌─── ┌───
@ -591,6 +613,7 @@ A.1 Common Types
1 PresentCapabilityAsync 1 PresentCapabilityAsync
2 PresentCapabilityFence 2 PresentCapabilityFence
4 PresentCapabilityUST 4 PresentCapabilityUST
8 PresentCapabilityAsyncMayTear
└─── └───
┌─── ┌───