From 23ba26ce997f352e215842f00d146cc1859317da Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Wed, 24 Aug 2022 23:24:37 +0000 Subject: [PATCH] protocol: Add tearing control protocol --- .../gamescope-tearing-control-unstable-v1.xml | 142 ++++++++++++++++++ protocol/meson.build | 1 + 2 files changed, 143 insertions(+) create mode 100644 protocol/gamescope-tearing-control-unstable-v1.xml diff --git a/protocol/gamescope-tearing-control-unstable-v1.xml b/protocol/gamescope-tearing-control-unstable-v1.xml new file mode 100644 index 000000000..3c7cfb09e --- /dev/null +++ b/protocol/gamescope-tearing-control-unstable-v1.xml @@ -0,0 +1,142 @@ + + + + + Copyright © 2021 Xaver Hugl + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice (including the next + paragraph) shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + + + + This global is a factory interface, allowing clients to request + the compositor to use asynchronous page flips on a per-surface basis. + + Graphics APIs, like EGL or Vulkan, that manage the buffer queue and + commits of a wl_surface themselves, are likely to be using this + extension internally. If a client is using such an API for a + wl_surface, it should not directly use this extension on that surface, + to avoid raising a tearing_control_exists protocol error. + + Warning! The protocol described in this file is experimental and + backward incompatible changes may be made. Backward compatible changes + may be added together with the corresponding interface version bump. + Backward incompatible changes are done by bumping the version number in + the protocol and interface names and resetting the interface version. + Once the protocol is to be declared stable, the 'z' prefix and the + version number in the protocol and interface names are removed and the + interface version number is reset. + + + + + Destroy this tearing control factory object. Other objects, including + gamescope_surface_tearing_control_v1 objects created by this factory, + shall not be affected by this request. + + + + + + + + + + Instantiate an interface extension for the given wl_surface to + request asynchronous page flips for presentation. + + If the given wl_surface already has a gamescope_surface_tearing_control_v1 + object associated, the tearing_control_exists protocol error is raised. + + + + + + + + + + An additional interface to a wl_surface object, which allows the client + to hint to the compositor if and when it should use asynchronous page + flips for presentation. + + + + + This enum provides information for if and when submitted frames from + the client may be presented with tearing. The possible values are: + + VSYNC: + Presentation should be synchronized to the vertical retrace by the + display hardware so that tearing doesn't happen. + + VSYNC_RELAXED: + Presentation should be synchronized to the vertical retrace by the + display hardware so that tearing doesn't happen as long as the client + submits new frame fast enough. If a frame is late for presentation, + that is, if more than one vertical retrace has occurred since the last + commit then the compositor should use asynchronous page flips to + immediately present the frame. This may cause visible tearing. + The compositor is encouraged to send requested frame callbacks as soon + as possible after such a late commit to make sure clients have as much + time as possible to render their next frame. + + ASYNC: + Presentation should not be synchronized to the vertical retrace, + committed frames are meant to be immediately presented with asynchronous + page flips with as little delay as possible. Tearing will be visible. + The compositor is encouraged to send requested frame callbacks as soon + as possible after every commit. + + + + + + + + + Set the presentation hint for the associated wl_surface. See + presentation_hint for the description. This state is double-buffered + and is applied on the next wl_surface.commit. + + The compositor is free to dynamically respect or ignore this hint based + on various conditions, including GPU capabilities and surface window + state. + + + + + + + Destroy this surface tearing object and remove the presentation hint. + The change will be applied on the next wl_surface.commit. + + + + + + diff --git a/protocol/meson.build b/protocol/meson.build index 712a753aa..35fbcf370 100644 --- a/protocol/meson.build +++ b/protocol/meson.build @@ -6,6 +6,7 @@ protocols = [ 'gamescope-xwayland', 'gamescope-pipewire', 'gamescope-input-method', + 'gamescope-tearing-control-unstable-v1', ] foreach name : protocols