ext-image-copy-capture-v1.xml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <protocol name="ext_image_copy_capture_v1">
  3. <copyright>
  4. Copyright © 2021-2023 Andri Yngvason
  5. Copyright © 2024 Simon Ser
  6. Permission is hereby granted, free of charge, to any person obtaining a
  7. copy of this software and associated documentation files (the "Software"),
  8. to deal in the Software without restriction, including without limitation
  9. the rights to use, copy, modify, merge, publish, distribute, sublicense,
  10. and/or sell copies of the Software, and to permit persons to whom the
  11. Software is furnished to do so, subject to the following conditions:
  12. The above copyright notice and this permission notice (including the next
  13. paragraph) shall be included in all copies or substantial portions of the
  14. Software.
  15. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  18. THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  20. FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  21. DEALINGS IN THE SOFTWARE.
  22. </copyright>
  23. <description summary="image capturing into client buffers">
  24. This protocol allows clients to ask the compositor to capture image sources
  25. such as outputs and toplevels into user submitted buffers.
  26. Warning! The protocol described in this file is currently in the testing
  27. phase. Backward compatible changes may be added together with the
  28. corresponding interface version bump. Backward incompatible changes can
  29. only be done by creating a new major version of the extension.
  30. </description>
  31. <interface name="ext_image_copy_capture_manager_v1" version="1">
  32. <description summary="manager to inform clients and begin capturing">
  33. This object is a manager which offers requests to start capturing from a
  34. source.
  35. </description>
  36. <enum name="error">
  37. <entry name="invalid_option" value="1" summary="invalid option flag"/>
  38. </enum>
  39. <enum name="options" bitfield="true">
  40. <entry name="paint_cursors" value="1" summary="paint cursors onto captured frames"/>
  41. </enum>
  42. <request name="create_session">
  43. <description summary="capture an image capture source">
  44. Create a capturing session for an image capture source.
  45. If the paint_cursors option is set, cursors shall be composited onto
  46. the captured frame. The cursor must not be composited onto the frame
  47. if this flag is not set.
  48. If the options bitfield is invalid, the invalid_option protocol error
  49. is sent.
  50. </description>
  51. <arg name="session" type="new_id" interface="ext_image_copy_capture_session_v1"/>
  52. <arg name="source" type="object" interface="ext_image_capture_source_v1"/>
  53. <arg name="options" type="uint" enum="options"/>
  54. </request>
  55. <request name="create_pointer_cursor_session">
  56. <description summary="capture the pointer cursor of an image capture source">
  57. Create a cursor capturing session for the pointer of an image capture
  58. source.
  59. </description>
  60. <arg name="session" type="new_id" interface="ext_image_copy_capture_cursor_session_v1"/>
  61. <arg name="source" type="object" interface="ext_image_capture_source_v1"/>
  62. <arg name="pointer" type="object" interface="wl_pointer"/>
  63. </request>
  64. <request name="destroy" type="destructor">
  65. <description summary="destroy the manager">
  66. Destroy the manager object.
  67. Other objects created via this interface are unaffected.
  68. </description>
  69. </request>
  70. </interface>
  71. <interface name="ext_image_copy_capture_session_v1" version="1">
  72. <description summary="image copy capture session">
  73. This object represents an active image copy capture session.
  74. After a capture session is created, buffer constraint events will be
  75. emitted from the compositor to tell the client which buffer types and
  76. formats are supported for reading from the session. The compositor may
  77. re-send buffer constraint events whenever they change.
  78. To advertise buffer constraints, the compositor must send in no
  79. particular order: zero or more shm_format and dmabuf_format events, zero
  80. or one dmabuf_device event, and exactly one buffer_size event. Then the
  81. compositor must send a done event.
  82. When the client has received all the buffer constraints, it can create a
  83. buffer accordingly, attach it to the capture session using the
  84. attach_buffer request, set the buffer damage using the damage_buffer
  85. request and then send the capture request.
  86. </description>
  87. <enum name="error">
  88. <entry name="duplicate_frame" value="1"
  89. summary="create_frame sent before destroying previous frame"/>
  90. </enum>
  91. <event name="buffer_size">
  92. <description summary="image capture source dimensions">
  93. Provides the dimensions of the source image in buffer pixel coordinates.
  94. The client must attach buffers that match this size.
  95. </description>
  96. <arg name="width" type="uint" summary="buffer width"/>
  97. <arg name="height" type="uint" summary="buffer height"/>
  98. </event>
  99. <event name="shm_format">
  100. <description summary="shm buffer format">
  101. Provides the format that must be used for shared-memory buffers.
  102. This event may be emitted multiple times, in which case the client may
  103. choose any given format.
  104. </description>
  105. <arg name="format" type="uint" enum="wl_shm.format" summary="shm format"/>
  106. </event>
  107. <event name="dmabuf_device">
  108. <description summary="dma-buf device">
  109. This event advertises the device buffers must be allocated on for
  110. dma-buf buffers.
  111. In general the device is a DRM node. The DRM node type (primary vs.
  112. render) is unspecified. Clients must not rely on the compositor sending
  113. a particular node type. Clients cannot check two devices for equality
  114. by comparing the dev_t value.
  115. </description>
  116. <arg name="device" type="array" summary="device dev_t value"/>
  117. </event>
  118. <event name="dmabuf_format">
  119. <description summary="dma-buf format">
  120. Provides the format that must be used for dma-buf buffers.
  121. The client may choose any of the modifiers advertised in the array of
  122. 64-bit unsigned integers.
  123. This event may be emitted multiple times, in which case the client may
  124. choose any given format.
  125. </description>
  126. <arg name="format" type="uint" summary="drm format code"/>
  127. <arg name="modifiers" type="array" summary="drm format modifiers"/>
  128. </event>
  129. <event name="done">
  130. <description summary="all constraints have been sent">
  131. This event is sent once when all buffer constraint events have been
  132. sent.
  133. The compositor must always end a batch of buffer constraint events with
  134. this event, regardless of whether it sends the initial constraints or
  135. an update.
  136. </description>
  137. </event>
  138. <event name="stopped">
  139. <description summary="session is no longer available">
  140. This event indicates that the capture session has stopped and is no
  141. longer available. This can happen in a number of cases, e.g. when the
  142. underlying source is destroyed, if the user decides to end the image
  143. capture, or if an unrecoverable runtime error has occurred.
  144. The client should destroy the session after receiving this event.
  145. </description>
  146. </event>
  147. <request name="create_frame">
  148. <description summary="create a frame">
  149. Create a capture frame for this session.
  150. At most one frame object can exist for a given session at any time. If
  151. a client sends a create_frame request before a previous frame object
  152. has been destroyed, the duplicate_frame protocol error is raised.
  153. </description>
  154. <arg name="frame" type="new_id" interface="ext_image_copy_capture_frame_v1"/>
  155. </request>
  156. <request name="destroy" type="destructor">
  157. <description summary="delete this object">
  158. Destroys the session. This request can be sent at any time by the
  159. client.
  160. This request doesn't affect ext_image_copy_capture_frame_v1 objects created by
  161. this object.
  162. </description>
  163. </request>
  164. </interface>
  165. <interface name="ext_image_copy_capture_frame_v1" version="1">
  166. <description summary="image capture frame">
  167. This object represents an image capture frame.
  168. The client should attach a buffer, damage the buffer, and then send a
  169. capture request.
  170. If the capture is successful, the compositor must send the frame metadata
  171. (transform, damage, presentation_time in any order) followed by the ready
  172. event.
  173. If the capture fails, the compositor must send the failed event.
  174. </description>
  175. <enum name="error">
  176. <entry name="no_buffer" value="1" summary="capture sent without attach_buffer"/>
  177. <entry name="invalid_buffer_damage" value="2" summary="invalid buffer damage"/>
  178. <entry name="already_captured" value="3" summary="capture request has been sent"/>
  179. </enum>
  180. <request name="destroy" type="destructor">
  181. <description summary="destroy this object">
  182. Destroys the frame. This request can be sent at any time by the
  183. client.
  184. </description>
  185. </request>
  186. <request name="attach_buffer">
  187. <description summary="attach buffer to session">
  188. Attach a buffer to the session.
  189. The wl_buffer.release request is unused.
  190. The new buffer replaces any previously attached buffer.
  191. This request must not be sent after capture, or else the
  192. already_captured protocol error is raised.
  193. </description>
  194. <arg name="buffer" type="object" interface="wl_buffer"/>
  195. </request>
  196. <request name="damage_buffer">
  197. <description summary="damage buffer">
  198. Apply damage to the buffer which is to be captured next. This request
  199. may be sent multiple times to describe a region.
  200. The client indicates the accumulated damage since this wl_buffer was
  201. last captured. During capture, the compositor will update the buffer
  202. with at least the union of the region passed by the client and the
  203. region advertised by ext_image_copy_capture_frame_v1.damage.
  204. When a wl_buffer is captured for the first time, or when the client
  205. doesn't track damage, the client must damage the whole buffer.
  206. This is for optimisation purposes. The compositor may use this
  207. information to reduce copying.
  208. These coordinates originate from the upper left corner of the buffer.
  209. If x or y are strictly negative, or if width or height are negative or
  210. zero, the invalid_buffer_damage protocol error is raised.
  211. This request must not be sent after capture, or else the
  212. already_captured protocol error is raised.
  213. </description>
  214. <arg name="x" type="int" summary="region x coordinate"/>
  215. <arg name="y" type="int" summary="region y coordinate"/>
  216. <arg name="width" type="int" summary="region width"/>
  217. <arg name="height" type="int" summary="region height"/>
  218. </request>
  219. <request name="capture">
  220. <description summary="capture a frame">
  221. Capture a frame.
  222. Unless this is the first successful captured frame performed in this
  223. session, the compositor may wait an indefinite amount of time for the
  224. source content to change before performing the copy.
  225. This request may only be sent once, or else the already_captured
  226. protocol error is raised. A buffer must be attached before this request
  227. is sent, or else the no_buffer protocol error is raised.
  228. </description>
  229. </request>
  230. <event name="transform">
  231. <description summary="buffer transform">
  232. This event is sent before the ready event and holds the transform that
  233. the compositor has applied to the buffer contents.
  234. </description>
  235. <arg name="transform" type="uint" enum="wl_output.transform"/>
  236. </event>
  237. <event name="damage">
  238. <description summary="buffer damaged region">
  239. This event is sent before the ready event. It may be generated multiple
  240. times to describe a region.
  241. The first captured frame in a session will always carry full damage.
  242. Subsequent frames' damaged regions describe which parts of the buffer
  243. have changed since the last ready event.
  244. These coordinates originate in the upper left corner of the buffer.
  245. </description>
  246. <arg name="x" type="int" summary="damage x coordinate"/>
  247. <arg name="y" type="int" summary="damage y coordinate"/>
  248. <arg name="width" type="int" summary="damage width"/>
  249. <arg name="height" type="int" summary="damage height"/>
  250. </event>
  251. <event name="presentation_time">
  252. <description summary="presentation time of the frame">
  253. This event indicates the time at which the frame is presented to the
  254. output in system monotonic time. This event is sent before the ready
  255. event.
  256. The timestamp is expressed as tv_sec_hi, tv_sec_lo, tv_nsec triples,
  257. each component being an unsigned 32-bit value. Whole seconds are in
  258. tv_sec which is a 64-bit value combined from tv_sec_hi and tv_sec_lo,
  259. and the additional fractional part in tv_nsec as nanoseconds. Hence,
  260. for valid timestamps tv_nsec must be in [0, 999999999].
  261. </description>
  262. <arg name="tv_sec_hi" type="uint"
  263. summary="high 32 bits of the seconds part of the timestamp"/>
  264. <arg name="tv_sec_lo" type="uint"
  265. summary="low 32 bits of the seconds part of the timestamp"/>
  266. <arg name="tv_nsec" type="uint"
  267. summary="nanoseconds part of the timestamp"/>
  268. </event>
  269. <event name="ready">
  270. <description summary="frame is available for reading">
  271. Called as soon as the frame is copied, indicating it is available
  272. for reading.
  273. The buffer may be re-used by the client after this event.
  274. After receiving this event, the client must destroy the object.
  275. </description>
  276. </event>
  277. <enum name="failure_reason">
  278. <entry name="unknown" value="0">
  279. <description summary="unknown runtime error">
  280. An unspecified runtime error has occurred. The client may retry.
  281. </description>
  282. </entry>
  283. <entry name="buffer_constraints" value="1">
  284. <description summary="buffer constraints mismatch">
  285. The buffer submitted by the client doesn't match the latest session
  286. constraints. The client should re-allocate its buffers and retry.
  287. </description>
  288. </entry>
  289. <entry name="stopped" value="2">
  290. <description summary="session is no longer available">
  291. The session has stopped. See ext_image_copy_capture_session_v1.stopped.
  292. </description>
  293. </entry>
  294. </enum>
  295. <event name="failed">
  296. <description summary="capture failed">
  297. This event indicates that the attempted frame copy has failed.
  298. After receiving this event, the client must destroy the object.
  299. </description>
  300. <arg name="reason" type="uint" enum="failure_reason"/>
  301. </event>
  302. </interface>
  303. <interface name="ext_image_copy_capture_cursor_session_v1" version="1">
  304. <description summary="cursor capture session">
  305. This object represents a cursor capture session. It extends the base
  306. capture session with cursor-specific metadata.
  307. </description>
  308. <enum name="error">
  309. <entry name="duplicate_session" value="1" summary="get_capture_session sent twice"/>
  310. </enum>
  311. <request name="destroy" type="destructor">
  312. <description summary="delete this object">
  313. Destroys the session. This request can be sent at any time by the
  314. client.
  315. This request doesn't affect ext_image_copy_capture_frame_v1 objects created by
  316. this object.
  317. </description>
  318. </request>
  319. <request name="get_capture_session">
  320. <description summary="get image copy capturer session">
  321. Gets the image copy capture session for this cursor session.
  322. The session will produce frames of the cursor image. The compositor may
  323. pause the session when the cursor leaves the captured area.
  324. This request must not be sent more than once, or else the
  325. duplicate_session protocol error is raised.
  326. </description>
  327. <arg name="session" type="new_id" interface="ext_image_copy_capture_session_v1"/>
  328. </request>
  329. <event name="enter">
  330. <description summary="cursor entered captured area">
  331. Sent when a cursor enters the captured area. It shall be generated
  332. before the "position" and "hotspot" events when and only when a cursor
  333. enters the area.
  334. The cursor enters the captured area when the cursor image intersects
  335. with the captured area. Note, this is different from e.g.
  336. wl_pointer.enter.
  337. </description>
  338. </event>
  339. <event name="leave">
  340. <description summary="cursor left captured area">
  341. Sent when a cursor leaves the captured area. No "position" or "hotspot"
  342. event is generated for the cursor until the cursor enters the captured
  343. area again.
  344. </description>
  345. </event>
  346. <event name="position">
  347. <description summary="position changed">
  348. Cursors outside the image capture source do not get captured and no
  349. event will be generated for them.
  350. The given position is the position of the cursor's hotspot and it is
  351. relative to the main buffer's top left corner in transformed buffer
  352. pixel coordinates. The coordinates may be negative or greater than the
  353. main buffer size.
  354. </description>
  355. <arg name="x" type="int" summary="position x coordinates"/>
  356. <arg name="y" type="int" summary="position y coordinates"/>
  357. </event>
  358. <event name="hotspot">
  359. <description summary="hotspot changed">
  360. The hotspot describes the offset between the cursor image and the
  361. position of the input device.
  362. The given coordinates are the hotspot's offset from the origin in
  363. buffer coordinates.
  364. Clients should not apply the hotspot immediately: the hotspot becomes
  365. effective when the next ext_image_copy_capture_frame_v1.ready event is received.
  366. Compositors may delay this event until the client captures a new frame.
  367. </description>
  368. <arg name="x" type="int" summary="hotspot x coordinates"/>
  369. <arg name="y" type="int" summary="hotspot y coordinates"/>
  370. </event>
  371. </interface>
  372. </protocol>