XPresentQueryCapabilities(3)

πŸ“¦
version 1.0.2 Β· 2 versions
, in alpine 3.24, arch rolling, nixos 26.05, nixpkgs unstable

πŸ’… XPresentQueryCapabilities(3) β€” the "what can ur CRTC actually do" check ✨

okay so real talk, this is a page from the X Version 11 manual set (iykyk, the classics πŸ‘‘), and it's literally about asking a screen-thing what cool tricks it's capable of. bestie, buckle up πŸŽ€


🌸 NAME 🌸

XPresentQueryCapabilities β€” query capabilities of a CRTC πŸ’–

(yes. that's it. that's the whole vibe check. it asks a CRTC what it can do.)


✨ SYNTAX ✨

#include <X11/extensions/Xpresent.h>

uint32_t XPresentQueryCapabilities (Display *display,  XID target);

no cap, that's the entire signature. two args, one uint32_t coming back at u 🫢


πŸ’« DESCRIPTION πŸ’«

okay so XPresentQueryCapabilities returns a bitmask of the supported capabilities for the target CRTC. (a bitmask, bestie β€” meaning it's a bunch of flags OR'd together, so read it like a little checklist of yes/no's πŸ’…)

here's the cute part about how target works:

  • if target is a CRTC, then it is used as the target CRTC. straightforward, iconic, no notes.
  • if 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. so like… you hand it a window and the server picks the CRTC for you. main character energy from the server tbh πŸ‘‘

🌈 the capabilities themselves 🌈

  • PresentCapabilityAsync β€” this means the target device can flip the scanout buffer mid-frame instead of waiting for a vertical blank interval. the way that's so impatient of it 😭 but okay. the precise latency between the flip request and the actual scanout transition is not defined by this specification, but is intended to be no more than a few scanlines. so like, fast, but the spec is NOT committing to a number, don't @ it πŸ™ˆ
  • PresentCapabilityFence β€” this means the target device can take advantage of SyncFences in the Present operations to improve GPU throughput πŸ”₯. the driver must operate correctly in the absence of fences, but may have reduced performance. and here's the cute disclaimer: using fences for drivers not advertising this capability should have no performance impact. so if it doesn't advertise it, you're not missing out, promise 🫢
  • PresentCapabilityUST β€” this means the target device can scanout the image at an arbitrary UST time value, and is not driven by a periodic scanout timer ⏰ (it's giving "i live outside the clock" energy). applications specifying UST times for XPresentPixmap(3) can expect that their image will appear to the user within a short amount of time from that specified in the request. the precise accuracy of the scanout time is not defined by the extension, but is expected to be on the order of milliseconds or less ✨

πŸ¦‹ SEE ALSO πŸ¦‹

(go read them, they're the whole friend group πŸ’œ)


πŸŽ€ AUTHORS πŸŽ€

Keith Packard, Intel β€” absolute legend, we stan πŸ‘‘πŸŒΈ


ngl the whole point of this one is just: call it, get a uint32_t back, and check which of PresentCapabilityAsync, PresentCapabilityFence, and PresentCapabilityUST bits are set. that's the tea β˜•

this has been libXpresent 1.0.2, dated 2022-08-27 β€” mwah, go query some capabilities bestie, ily πŸ’…βœ¨πŸ’–

πŸ“¦ where this page comes from