From c0d8103667dd7689a7f8a55bf594d9115a932603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduardo=20S=C3=A1nchez=20Mu=C3=B1oz?= Date: Tue, 16 Apr 2024 18:56:18 +0200 Subject: [PATCH] Update vendored xcb-proto to 1.17.0 --- Makefile | 2 +- README.md | 4 +- x11rb-async/src/protocol/composite.rs | 12 +- x11rb-async/src/protocol/dri3.rs | 38 +++ x11rb-async/src/protocol/present.rs | 37 +++ x11rb-async/src/protocol/shm.rs | 8 +- x11rb-protocol/src/protocol/composite.rs | 6 +- x11rb-protocol/src/protocol/dri3.rs | 126 ++++++++- x11rb-protocol/src/protocol/mod.rs | 24 ++ x11rb-protocol/src/protocol/present.rs | 239 +++++++++++++++++- x11rb-protocol/src/protocol/shm.rs | 4 +- x11rb/src/protocol/composite.rs | 12 +- x11rb/src/protocol/dri3.rs | 40 +++ x11rb/src/protocol/present.rs | 35 +++ x11rb/src/protocol/shm.rs | 8 +- .../.gitignore | 0 .../.gitlab-ci.yml | 0 .../COPYING | 0 .../HACKING | 0 .../INSTALL | 0 .../Makefile.am | 0 .../NEWS | 0 .../README.md | 0 .../TODO | 0 .../autogen.sh | 0 .../configure.ac | 2 +- .../doc/xml-xcb.txt | 0 .../src/.gitattributes | 0 .../src/Makefile.am | 0 .../src/bigreq.xml | 0 .../src/composite.xml | 6 +- .../src/damage.xml | 0 .../src/dbe.xml | 0 .../src/dpms.xml | 0 .../src/dri2.xml | 0 .../src/dri3.xml | 14 +- .../src/ge.xml | 0 .../src/glx.xml | 0 .../src/present.xml | 28 +- .../src/randr.xml | 0 .../src/record.xml | 0 .../src/render.xml | 0 .../src/res.xml | 0 .../src/screensaver.xml | 0 .../src/shape.xml | 0 .../src/shm.xml | 4 +- .../src/sync.xml | 0 .../src/xc_misc.xml | 0 .../src/xcb.xsd | 0 .../src/xevie.xml | 0 .../src/xf86dri.xml | 0 .../src/xf86vidmode.xml | 0 .../src/xfixes.xml | 0 .../src/xinerama.xml | 0 .../src/xinput.xml | 0 .../src/xkb.xml | 0 .../src/xprint.xml | 0 .../src/xproto.xml | 0 .../src/xselinux.xml | 0 .../src/xtest.xml | 0 .../src/xv.xml | 0 .../src/xvmc.xml | 0 .../xcb-proto.pc.in | 0 .../xcbgen/Makefile.am | 0 .../xcbgen/__init__.py | 0 .../xcbgen/align.py | 0 .../xcbgen/error.py | 0 .../xcbgen/expr.py | 0 .../xcbgen/matcher.py | 0 .../xcbgen/state.py | 0 .../xcbgen/xtypes.py | 0 71 files changed, 611 insertions(+), 38 deletions(-) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/.gitignore (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/.gitlab-ci.yml (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/COPYING (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/HACKING (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/INSTALL (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/Makefile.am (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/NEWS (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/README.md (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/TODO (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/autogen.sh (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/configure.ac (97%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/doc/xml-xcb.txt (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/.gitattributes (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/Makefile.am (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/bigreq.xml (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/composite.xml (97%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/damage.xml (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/dbe.xml (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/dpms.xml (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/dri2.xml (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/dri3.xml (94%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/ge.xml (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/glx.xml (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/present.xml (87%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/randr.xml (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/record.xml (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/render.xml (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/res.xml (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/screensaver.xml (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/shape.xml (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/shm.xml (99%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/sync.xml (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/xc_misc.xml (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/xcb.xsd (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/xevie.xml (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/xf86dri.xml (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/xf86vidmode.xml (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/xfixes.xml (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/xinerama.xml (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/xinput.xml (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/xkb.xml (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/xprint.xml (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/xproto.xml (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/xselinux.xml (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/xtest.xml (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/xv.xml (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/src/xvmc.xml (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/xcb-proto.pc.in (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/xcbgen/Makefile.am (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/xcbgen/__init__.py (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/xcbgen/align.py (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/xcbgen/error.py (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/xcbgen/expr.py (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/xcbgen/matcher.py (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/xcbgen/state.py (100%) rename {xcb-proto-1.15.2-13-gb016df1 => xcb-proto-1.17.0}/xcbgen/xtypes.py (100%) diff --git a/Makefile b/Makefile index d7086317..8faeea4b 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -PROTO=xcb-proto-1.15.2-13-gb016df1 +PROTO=xcb-proto-1.17.0 PROTO_OUT=x11rb-protocol/src/protocol X11RB_OUT=x11rb/src/protocol ASYNC_OUT=x11rb-async/src/protocol diff --git a/README.md b/README.md index 685c48c5..eae6b7d7 100644 --- a/README.md +++ b/README.md @@ -58,9 +58,9 @@ Licensed under either of at your option. -The subdirectory xcb-proto-1.15.2-gb016df1 contains a vendored copy of the +The subdirectory xcb-proto-1.17.0 contains a vendored copy of the package of the same name. It is covered by the MIT license. See -[xcb-proto-1.15.2-gb016df1/COPYING](xcb-proto-1.15.2/COPYING) for details. +[xcb-proto-1.17.0/COPYING](xcb-proto-1.17.0/COPYING) for details. ## Contribution diff --git a/x11rb-async/src/protocol/composite.rs b/x11rb-async/src/protocol/composite.rs index ab559145..240afff0 100644 --- a/x11rb-async/src/protocol/composite.rs +++ b/x11rb-async/src/protocol/composite.rs @@ -60,7 +60,7 @@ where assert_eq!(slices.len(), bytes.len()); conn.send_request_with_reply(&slices, fds).await } -/// Redirect the heirarchy starting at “window” to off-screen storage.. +/// Redirect the hierarchy starting at "window" to off-screen storage.. /// /// The hierarchy starting at 'window' is directed to off-screen /// storage. When all clients enabling redirection terminate, @@ -71,7 +71,7 @@ where /// /// # Fields /// -/// * `window` - The root of the heirarchy to redirect to off-screen storage. +/// * `window` - The root of the hierarchy to redirect to off-screen storage. /// * `update` - Whether contents are automatically mirrored to the parent window. If one client /// already specifies an update type of Manual, any attempt by another to specify a /// mode of Manual so will result in an Access error. @@ -97,7 +97,7 @@ where /// /// # Fields /// -/// * `window` - The root of the heirarchy to redirect to off-screen storage. +/// * `window` - The root of the hierarchy to redirect to off-screen storage. /// * `update` - Whether contents are automatically mirrored to the parent window. If one client /// already specifies an update type of Manual, any attempt by another to specify a /// mode of Manual so will result in an Access error. @@ -227,7 +227,7 @@ pub trait ConnectionExt: RequestConnection { { Box::pin(query_version(self, client_major_version, client_minor_version)) } - /// Redirect the heirarchy starting at “window” to off-screen storage.. + /// Redirect the hierarchy starting at "window" to off-screen storage.. /// /// The hierarchy starting at 'window' is directed to off-screen /// storage. When all clients enabling redirection terminate, @@ -238,7 +238,7 @@ pub trait ConnectionExt: RequestConnection { /// /// # Fields /// - /// * `window` - The root of the heirarchy to redirect to off-screen storage. + /// * `window` - The root of the hierarchy to redirect to off-screen storage. /// * `update` - Whether contents are automatically mirrored to the parent window. If one client /// already specifies an update type of Manual, any attempt by another to specify a /// mode of Manual so will result in an Access error. @@ -255,7 +255,7 @@ pub trait ConnectionExt: RequestConnection { /// /// # Fields /// - /// * `window` - The root of the heirarchy to redirect to off-screen storage. + /// * `window` - The root of the hierarchy to redirect to off-screen storage. /// * `update` - Whether contents are automatically mirrored to the parent window. If one client /// already specifies an update type of Manual, any attempt by another to specify a /// mode of Manual so will result in an Access error. diff --git a/x11rb-async/src/protocol/dri3.rs b/x11rb-async/src/protocol/dri3.rs index 87e5262e..509ae673 100644 --- a/x11rb-async/src/protocol/dri3.rs +++ b/x11rb-async/src/protocol/dri3.rs @@ -193,6 +193,34 @@ where assert_eq!(slices.len(), bytes.len()); conn.send_request_without_reply(&slices, fds).await } +pub async fn import_syncobj(conn: &Conn, syncobj: Syncobj, drawable: xproto::Drawable, syncobj_fd: A) -> Result, ConnectionError> +where + Conn: RequestConnection + ?Sized, + A: Into + Send, +{ + let syncobj_fd: RawFdContainer = syncobj_fd.into(); + let request0 = ImportSyncobjRequest { + syncobj, + drawable, + syncobj_fd, + }; + let (bytes, fds) = request0.serialize(major_opcode(conn).await?); + let slices = [IoSlice::new(&bytes[0])]; + assert_eq!(slices.len(), bytes.len()); + conn.send_request_without_reply(&slices, fds).await +} +pub async fn free_syncobj(conn: &Conn, syncobj: Syncobj) -> Result, ConnectionError> +where + Conn: RequestConnection + ?Sized, +{ + let request0 = FreeSyncobjRequest { + syncobj, + }; + let (bytes, fds) = request0.serialize(major_opcode(conn).await?); + let slices = [IoSlice::new(&bytes[0])]; + assert_eq!(slices.len(), bytes.len()); + conn.send_request_without_reply(&slices, fds).await +} /// Extension trait defining the requests of this extension. pub trait ConnectionExt: RequestConnection { fn dri3_query_version(&self, major_version: u32, minor_version: u32) -> Pin, ConnectionError>> + Send + '_>> @@ -239,6 +267,16 @@ pub trait ConnectionExt: RequestConnection { { Box::pin(set_drm_device_in_use(self, window, drm_major, drm_minor)) } + fn dri3_import_syncobj(&self, syncobj: Syncobj, drawable: xproto::Drawable, syncobj_fd: A) -> Pin, ConnectionError>> + Send + '_>> + where + A: Into + Send + 'static, + { + Box::pin(import_syncobj(self, syncobj, drawable, syncobj_fd)) + } + fn dri3_free_syncobj(&self, syncobj: Syncobj) -> Pin, ConnectionError>> + Send + '_>> + { + Box::pin(free_syncobj(self, syncobj)) + } } impl ConnectionExt for C {} diff --git a/x11rb-async/src/protocol/present.rs b/x11rb-async/src/protocol/present.rs index 557564f9..ec0fa038 100644 --- a/x11rb-async/src/protocol/present.rs +++ b/x11rb-async/src/protocol/present.rs @@ -25,6 +25,8 @@ use crate::errors::ReplyOrIdError; use std::future::Future; use std::pin::Pin; #[allow(unused_imports)] +use super::dri3; +#[allow(unused_imports)] use super::randr; #[allow(unused_imports)] use super::sync; @@ -123,6 +125,34 @@ where assert_eq!(slices.len(), bytes.len()); conn.send_request_with_reply(&slices, fds).await } +pub async fn pixmap_synced<'c, 'input, Conn>(conn: &'c Conn, window: xproto::Window, pixmap: xproto::Pixmap, serial: u32, valid: xfixes::Region, update: xfixes::Region, x_off: i16, y_off: i16, target_crtc: randr::Crtc, acquire_syncobj: dri3::Syncobj, release_syncobj: dri3::Syncobj, acquire_point: u64, release_point: u64, options: u32, target_msc: u64, divisor: u64, remainder: u64, notifies: &'input [Notify]) -> Result, ConnectionError> +where + Conn: RequestConnection + ?Sized, +{ + let request0 = PixmapSyncedRequest { + window, + pixmap, + serial, + valid, + update, + x_off, + y_off, + target_crtc, + acquire_syncobj, + release_syncobj, + acquire_point, + release_point, + options, + target_msc, + divisor, + remainder, + notifies: Cow::Borrowed(notifies), + }; + let (bytes, fds) = request0.serialize(major_opcode(conn).await?); + let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])]; + assert_eq!(slices.len(), bytes.len()); + conn.send_request_without_reply(&slices, fds).await +} /// Extension trait defining the requests of this extension. pub trait ConnectionExt: RequestConnection { fn present_query_version(&self, major_version: u32, minor_version: u32) -> Pin, ConnectionError>> + Send + '_>> @@ -148,6 +178,13 @@ pub trait ConnectionExt: RequestConnection { { Box::pin(query_capabilities(self, target)) } + fn present_pixmap_synced<'c, 'input, 'future>(&'c self, window: xproto::Window, pixmap: xproto::Pixmap, serial: u32, valid: xfixes::Region, update: xfixes::Region, x_off: i16, y_off: i16, target_crtc: randr::Crtc, acquire_syncobj: dri3::Syncobj, release_syncobj: dri3::Syncobj, acquire_point: u64, release_point: u64, options: u32, target_msc: u64, divisor: u64, remainder: u64, notifies: &'input [Notify]) -> Pin, ConnectionError>> + Send + 'future>> + where + 'c: 'future, + 'input: 'future, + { + Box::pin(pixmap_synced(self, window, pixmap, serial, valid, update, x_off, y_off, target_crtc, acquire_syncobj, release_syncobj, acquire_point, release_point, options, target_msc, divisor, remainder, notifies)) + } } impl ConnectionExt for C {} diff --git a/x11rb-async/src/protocol/shm.rs b/x11rb-async/src/protocol/shm.rs index 37032ca0..7de886c0 100644 --- a/x11rb-async/src/protocol/shm.rs +++ b/x11rb-async/src/protocol/shm.rs @@ -121,10 +121,10 @@ where /// * `dst_y` - The Y coordinate on the destination drawable to copy to. /// * `depth` - The depth to use. /// * `format` - The format of the image being drawn. If it is XYBitmap, depth must be 1, or a -/// “BadMatch” error results. The foreground pixel in the GC determines the source +/// "BadMatch" error results. The foreground pixel in the GC determines the source /// for the one bits in the image, and the background pixel determines the source /// for the zero bits. For XYPixmap and ZPixmap, the depth must match the depth of -/// the drawable, or a “BadMatch” error results. +/// the drawable, or a "BadMatch" error results. /// * `send_event` - True if the server should send an XCB_SHM_COMPLETION event when the blit /// completes. /// * `offset` - The offset that the source image starts at. @@ -338,10 +338,10 @@ pub trait ConnectionExt: RequestConnection { /// * `dst_y` - The Y coordinate on the destination drawable to copy to. /// * `depth` - The depth to use. /// * `format` - The format of the image being drawn. If it is XYBitmap, depth must be 1, or a - /// “BadMatch” error results. The foreground pixel in the GC determines the source + /// "BadMatch" error results. The foreground pixel in the GC determines the source /// for the one bits in the image, and the background pixel determines the source /// for the zero bits. For XYPixmap and ZPixmap, the depth must match the depth of - /// the drawable, or a “BadMatch” error results. + /// the drawable, or a "BadMatch" error results. /// * `send_event` - True if the server should send an XCB_SHM_COMPLETION event when the blit /// completes. /// * `offset` - The offset that the source image starts at. diff --git a/x11rb-protocol/src/protocol/composite.rs b/x11rb-protocol/src/protocol/composite.rs index 256b38e4..3359641d 100644 --- a/x11rb-protocol/src/protocol/composite.rs +++ b/x11rb-protocol/src/protocol/composite.rs @@ -268,7 +268,7 @@ impl Serialize for QueryVersionReply { /// Opcode for the RedirectWindow request pub const REDIRECT_WINDOW_REQUEST: u8 = 1; -/// Redirect the heirarchy starting at “window” to off-screen storage.. +/// Redirect the hierarchy starting at "window" to off-screen storage.. /// /// The hierarchy starting at 'window' is directed to off-screen /// storage. When all clients enabling redirection terminate, @@ -279,7 +279,7 @@ pub const REDIRECT_WINDOW_REQUEST: u8 = 1; /// /// # Fields /// -/// * `window` - The root of the heirarchy to redirect to off-screen storage. +/// * `window` - The root of the hierarchy to redirect to off-screen storage. /// * `update` - Whether contents are automatically mirrored to the parent window. If one client /// already specifies an update type of Manual, any attempt by another to specify a /// mode of Manual so will result in an Access error. @@ -358,7 +358,7 @@ pub const REDIRECT_SUBWINDOWS_REQUEST: u8 = 2; /// /// # Fields /// -/// * `window` - The root of the heirarchy to redirect to off-screen storage. +/// * `window` - The root of the hierarchy to redirect to off-screen storage. /// * `update` - Whether contents are automatically mirrored to the parent window. If one client /// already specifies an update type of Manual, any attempt by another to specify a /// mode of Manual so will result in an Access error. diff --git a/x11rb-protocol/src/protocol/dri3.rs b/x11rb-protocol/src/protocol/dri3.rs index 324c29e7..9ace3054 100644 --- a/x11rb-protocol/src/protocol/dri3.rs +++ b/x11rb-protocol/src/protocol/dri3.rs @@ -34,7 +34,9 @@ pub const X11_EXTENSION_NAME: &str = "DRI3"; /// by this build of x11rb. For most things, it does not make sense to use this /// information. If you need to send a `QueryVersion`, it is recommended to instead /// send the maximum version of the extension that you need. -pub const X11_XML_VERSION: (u32, u32) = (1, 3); +pub const X11_XML_VERSION: (u32, u32) = (1, 4); + +pub type Syncobj = u32; /// Opcode for the QueryVersion request pub const QUERY_VERSION_REQUEST: u8 = 0; @@ -1348,3 +1350,125 @@ impl Request for SetDRMDeviceInUseRequest { impl crate::x11_utils::VoidRequest for SetDRMDeviceInUseRequest { } +/// Opcode for the ImportSyncobj request +pub const IMPORT_SYNCOBJ_REQUEST: u8 = 10; +#[cfg_attr(feature = "extra-traits", derive(Debug))] +pub struct ImportSyncobjRequest { + pub syncobj: Syncobj, + pub drawable: xproto::Drawable, + pub syncobj_fd: RawFdContainer, +} +impl_debug_if_no_extra_traits!(ImportSyncobjRequest, "ImportSyncobjRequest"); +impl ImportSyncobjRequest { + /// Serialize this request into bytes for the provided connection + pub fn serialize(self, major_opcode: u8) -> BufWithFds<[Cow<'static, [u8]>; 1]> { + let length_so_far = 0; + let syncobj_bytes = self.syncobj.serialize(); + let drawable_bytes = self.drawable.serialize(); + let mut request0 = vec![ + major_opcode, + IMPORT_SYNCOBJ_REQUEST, + 0, + 0, + syncobj_bytes[0], + syncobj_bytes[1], + syncobj_bytes[2], + syncobj_bytes[3], + drawable_bytes[0], + drawable_bytes[1], + drawable_bytes[2], + drawable_bytes[3], + ]; + let length_so_far = length_so_far + request0.len(); + assert_eq!(length_so_far % 4, 0); + let length = u16::try_from(length_so_far / 4).unwrap_or(0); + request0[2..4].copy_from_slice(&length.to_ne_bytes()); + ([request0.into()], vec![self.syncobj_fd]) + } + /// Parse this request given its header, its body, and any fds that go along with it + #[cfg(feature = "request-parsing")] + pub fn try_parse_request_fd(header: RequestHeader, value: &[u8], fds: &mut Vec) -> Result { + if header.minor_opcode != IMPORT_SYNCOBJ_REQUEST { + return Err(ParseError::InvalidValue); + } + let (syncobj, remaining) = Syncobj::try_parse(value)?; + let (drawable, remaining) = xproto::Drawable::try_parse(remaining)?; + if fds.is_empty() { return Err(ParseError::MissingFileDescriptors) } + let syncobj_fd = fds.remove(0); + let _ = remaining; + Ok(ImportSyncobjRequest { + syncobj, + drawable, + syncobj_fd, + }) + } +} +impl Request for ImportSyncobjRequest { + const EXTENSION_NAME: Option<&'static str> = Some(X11_EXTENSION_NAME); + + fn serialize(self, major_opcode: u8) -> BufWithFds> { + let (bufs, fds) = self.serialize(major_opcode); + // Flatten the buffers into a single vector + let buf = bufs.iter().flat_map(|buf| buf.iter().copied()).collect(); + (buf, fds) + } +} +impl crate::x11_utils::VoidRequest for ImportSyncobjRequest { +} + +/// Opcode for the FreeSyncobj request +pub const FREE_SYNCOBJ_REQUEST: u8 = 11; +#[derive(Clone, Copy, Default)] +#[cfg_attr(feature = "extra-traits", derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash))] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct FreeSyncobjRequest { + pub syncobj: Syncobj, +} +impl_debug_if_no_extra_traits!(FreeSyncobjRequest, "FreeSyncobjRequest"); +impl FreeSyncobjRequest { + /// Serialize this request into bytes for the provided connection + pub fn serialize(self, major_opcode: u8) -> BufWithFds<[Cow<'static, [u8]>; 1]> { + let length_so_far = 0; + let syncobj_bytes = self.syncobj.serialize(); + let mut request0 = vec![ + major_opcode, + FREE_SYNCOBJ_REQUEST, + 0, + 0, + syncobj_bytes[0], + syncobj_bytes[1], + syncobj_bytes[2], + syncobj_bytes[3], + ]; + let length_so_far = length_so_far + request0.len(); + assert_eq!(length_so_far % 4, 0); + let length = u16::try_from(length_so_far / 4).unwrap_or(0); + request0[2..4].copy_from_slice(&length.to_ne_bytes()); + ([request0.into()], vec![]) + } + /// Parse this request given its header, its body, and any fds that go along with it + #[cfg(feature = "request-parsing")] + pub fn try_parse_request(header: RequestHeader, value: &[u8]) -> Result { + if header.minor_opcode != FREE_SYNCOBJ_REQUEST { + return Err(ParseError::InvalidValue); + } + let (syncobj, remaining) = Syncobj::try_parse(value)?; + let _ = remaining; + Ok(FreeSyncobjRequest { + syncobj, + }) + } +} +impl Request for FreeSyncobjRequest { + const EXTENSION_NAME: Option<&'static str> = Some(X11_EXTENSION_NAME); + + fn serialize(self, major_opcode: u8) -> BufWithFds> { + let (bufs, fds) = self.serialize(major_opcode); + // Flatten the buffers into a single vector + let buf = bufs.iter().flat_map(|buf| buf.iter().copied()).collect(); + (buf, fds) + } +} +impl crate::x11_utils::VoidRequest for FreeSyncobjRequest { +} + diff --git a/x11rb-protocol/src/protocol/mod.rs b/x11rb-protocol/src/protocol/mod.rs index 21ab7fcb..77935fd5 100644 --- a/x11rb-protocol/src/protocol/mod.rs +++ b/x11rb-protocol/src/protocol/mod.rs @@ -346,6 +346,8 @@ fn get_request_name_internal( dri3::PIXMAP_FROM_BUFFERS_REQUEST => RequestInfo::KnownExt("DRI3::PixmapFromBuffers"), dri3::BUFFERS_FROM_PIXMAP_REQUEST => RequestInfo::KnownExt("DRI3::BuffersFromPixmap"), dri3::SET_DRM_DEVICE_IN_USE_REQUEST => RequestInfo::KnownExt("DRI3::SetDRMDeviceInUse"), + dri3::IMPORT_SYNCOBJ_REQUEST => RequestInfo::KnownExt("DRI3::ImportSyncobj"), + dri3::FREE_SYNCOBJ_REQUEST => RequestInfo::KnownExt("DRI3::FreeSyncobj"), _ => RequestInfo::UnknownRequest(Some("DRI3"), minor_opcode), } } @@ -470,6 +472,7 @@ fn get_request_name_internal( present::NOTIFY_MSC_REQUEST => RequestInfo::KnownExt("Present::NotifyMSC"), present::SELECT_INPUT_REQUEST => RequestInfo::KnownExt("Present::SelectInput"), present::QUERY_CAPABILITIES_REQUEST => RequestInfo::KnownExt("Present::QueryCapabilities"), + present::PIXMAP_SYNCED_REQUEST => RequestInfo::KnownExt("Present::PixmapSynced"), _ => RequestInfo::UnknownRequest(Some("Present"), minor_opcode), } } @@ -1244,6 +1247,10 @@ pub enum Request<'input> { Dri3BuffersFromPixmap(dri3::BuffersFromPixmapRequest), #[cfg(feature = "dri3")] Dri3SetDRMDeviceInUse(dri3::SetDRMDeviceInUseRequest), + #[cfg(feature = "dri3")] + Dri3ImportSyncobj(dri3::ImportSyncobjRequest), + #[cfg(feature = "dri3")] + Dri3FreeSyncobj(dri3::FreeSyncobjRequest), GeQueryVersion(ge::QueryVersionRequest), #[cfg(feature = "glx")] GlxRender(glx::RenderRequest<'input>), @@ -1457,6 +1464,8 @@ pub enum Request<'input> { PresentSelectInput(present::SelectInputRequest), #[cfg(feature = "present")] PresentQueryCapabilities(present::QueryCapabilitiesRequest), + #[cfg(feature = "present")] + PresentPixmapSynced(present::PixmapSyncedRequest<'input>), #[cfg(feature = "randr")] RandrQueryVersion(randr::QueryVersionRequest), #[cfg(feature = "randr")] @@ -2452,6 +2461,8 @@ impl<'input> Request<'input> { dri3::PIXMAP_FROM_BUFFERS_REQUEST => return Ok(Request::Dri3PixmapFromBuffers(dri3::PixmapFromBuffersRequest::try_parse_request_fd(header, remaining, fds)?)), dri3::BUFFERS_FROM_PIXMAP_REQUEST => return Ok(Request::Dri3BuffersFromPixmap(dri3::BuffersFromPixmapRequest::try_parse_request(header, remaining)?)), dri3::SET_DRM_DEVICE_IN_USE_REQUEST => return Ok(Request::Dri3SetDRMDeviceInUse(dri3::SetDRMDeviceInUseRequest::try_parse_request(header, remaining)?)), + dri3::IMPORT_SYNCOBJ_REQUEST => return Ok(Request::Dri3ImportSyncobj(dri3::ImportSyncobjRequest::try_parse_request_fd(header, remaining, fds)?)), + dri3::FREE_SYNCOBJ_REQUEST => return Ok(Request::Dri3FreeSyncobj(dri3::FreeSyncobjRequest::try_parse_request(header, remaining)?)), _ => (), } } @@ -2576,6 +2587,7 @@ impl<'input> Request<'input> { present::NOTIFY_MSC_REQUEST => return Ok(Request::PresentNotifyMSC(present::NotifyMSCRequest::try_parse_request(header, remaining)?)), present::SELECT_INPUT_REQUEST => return Ok(Request::PresentSelectInput(present::SelectInputRequest::try_parse_request(header, remaining)?)), present::QUERY_CAPABILITIES_REQUEST => return Ok(Request::PresentQueryCapabilities(present::QueryCapabilitiesRequest::try_parse_request(header, remaining)?)), + present::PIXMAP_SYNCED_REQUEST => return Ok(Request::PresentPixmapSynced(present::PixmapSyncedRequest::try_parse_request(header, remaining)?)), _ => (), } } @@ -3325,6 +3337,10 @@ impl<'input> Request<'input> { Request::Dri3BuffersFromPixmap(_) => Some(parse_reply_fds::), #[cfg(feature = "dri3")] Request::Dri3SetDRMDeviceInUse(_) => None, + #[cfg(feature = "dri3")] + Request::Dri3ImportSyncobj(_) => None, + #[cfg(feature = "dri3")] + Request::Dri3FreeSyncobj(_) => None, Request::GeQueryVersion(_) => Some(parse_reply::), #[cfg(feature = "glx")] Request::GlxRender(_) => None, @@ -3538,6 +3554,8 @@ impl<'input> Request<'input> { Request::PresentSelectInput(_) => None, #[cfg(feature = "present")] Request::PresentQueryCapabilities(_) => Some(parse_reply::), + #[cfg(feature = "present")] + Request::PresentPixmapSynced(_) => None, #[cfg(feature = "randr")] Request::RandrQueryVersion(_) => Some(parse_reply::), #[cfg(feature = "randr")] @@ -4534,6 +4552,10 @@ impl<'input> Request<'input> { Request::Dri3BuffersFromPixmap(req) => Request::Dri3BuffersFromPixmap(req), #[cfg(feature = "dri3")] Request::Dri3SetDRMDeviceInUse(req) => Request::Dri3SetDRMDeviceInUse(req), + #[cfg(feature = "dri3")] + Request::Dri3ImportSyncobj(req) => Request::Dri3ImportSyncobj(req), + #[cfg(feature = "dri3")] + Request::Dri3FreeSyncobj(req) => Request::Dri3FreeSyncobj(req), Request::GeQueryVersion(req) => Request::GeQueryVersion(req), #[cfg(feature = "glx")] Request::GlxRender(req) => Request::GlxRender(req.into_owned()), @@ -4747,6 +4769,8 @@ impl<'input> Request<'input> { Request::PresentSelectInput(req) => Request::PresentSelectInput(req), #[cfg(feature = "present")] Request::PresentQueryCapabilities(req) => Request::PresentQueryCapabilities(req), + #[cfg(feature = "present")] + Request::PresentPixmapSynced(req) => Request::PresentPixmapSynced(req.into_owned()), #[cfg(feature = "randr")] Request::RandrQueryVersion(req) => Request::RandrQueryVersion(req), #[cfg(feature = "randr")] diff --git a/x11rb-protocol/src/protocol/present.rs b/x11rb-protocol/src/protocol/present.rs index f33dc450..b69782af 100644 --- a/x11rb-protocol/src/protocol/present.rs +++ b/x11rb-protocol/src/protocol/present.rs @@ -23,6 +23,8 @@ use crate::utils::{RawFdContainer, pretty_print_bitmask, pretty_print_enum}; #[allow(unused_imports)] use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd}; #[allow(unused_imports)] +use super::dri3; +#[allow(unused_imports)] use super::randr; #[allow(unused_imports)] use super::sync; @@ -40,7 +42,7 @@ pub const X11_EXTENSION_NAME: &str = "Present"; /// by this build of x11rb. For most things, it does not make sense to use this /// information. If you need to send a `QueryVersion`, it is recommended to instead /// send the maximum version of the extension that you need. -pub const X11_XML_VERSION: (u32, u32) = (1, 3); +pub const X11_XML_VERSION: (u32, u32) = (1, 4); #[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] @@ -236,6 +238,7 @@ impl Capability { pub const FENCE: Self = Self(1 << 1); pub const UST: Self = Self(1 << 2); pub const ASYNC_MAY_TEAR: Self = Self(1 << 3); + pub const SYNCOBJ: Self = Self(1 << 4); } impl From for u8 { #[inline] @@ -287,6 +290,7 @@ impl core::fmt::Debug for Capability { (Self::FENCE.0.into(), "FENCE", "Fence"), (Self::UST.0.into(), "UST", "UST"), (Self::ASYNC_MAY_TEAR.0.into(), "ASYNC_MAY_TEAR", "AsyncMayTear"), + (Self::SYNCOBJ.0.into(), "SYNCOBJ", "Syncobj"), ]; pretty_print_bitmask(fmt, self.0.into(), &variants) } @@ -1091,6 +1095,239 @@ impl Serialize for QueryCapabilitiesReply { } } +/// Opcode for the PixmapSynced request +pub const PIXMAP_SYNCED_REQUEST: u8 = 5; +#[derive(Clone, Default)] +#[cfg_attr(feature = "extra-traits", derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash))] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct PixmapSyncedRequest<'input> { + pub window: xproto::Window, + pub pixmap: xproto::Pixmap, + pub serial: u32, + pub valid: xfixes::Region, + pub update: xfixes::Region, + pub x_off: i16, + pub y_off: i16, + pub target_crtc: randr::Crtc, + pub acquire_syncobj: dri3::Syncobj, + pub release_syncobj: dri3::Syncobj, + pub acquire_point: u64, + pub release_point: u64, + pub options: u32, + pub target_msc: u64, + pub divisor: u64, + pub remainder: u64, + pub notifies: Cow<'input, [Notify]>, +} +impl_debug_if_no_extra_traits!(PixmapSyncedRequest<'_>, "PixmapSyncedRequest"); +impl<'input> PixmapSyncedRequest<'input> { + /// Serialize this request into bytes for the provided connection + pub fn serialize(self, major_opcode: u8) -> BufWithFds<[Cow<'input, [u8]>; 3]> { + let length_so_far = 0; + let window_bytes = self.window.serialize(); + let pixmap_bytes = self.pixmap.serialize(); + let serial_bytes = self.serial.serialize(); + let valid_bytes = self.valid.serialize(); + let update_bytes = self.update.serialize(); + let x_off_bytes = self.x_off.serialize(); + let y_off_bytes = self.y_off.serialize(); + let target_crtc_bytes = self.target_crtc.serialize(); + let acquire_syncobj_bytes = self.acquire_syncobj.serialize(); + let release_syncobj_bytes = self.release_syncobj.serialize(); + let acquire_point_bytes = self.acquire_point.serialize(); + let release_point_bytes = self.release_point.serialize(); + let options_bytes = self.options.serialize(); + let target_msc_bytes = self.target_msc.serialize(); + let divisor_bytes = self.divisor.serialize(); + let remainder_bytes = self.remainder.serialize(); + let mut request0 = vec![ + major_opcode, + PIXMAP_SYNCED_REQUEST, + 0, + 0, + window_bytes[0], + window_bytes[1], + window_bytes[2], + window_bytes[3], + pixmap_bytes[0], + pixmap_bytes[1], + pixmap_bytes[2], + pixmap_bytes[3], + serial_bytes[0], + serial_bytes[1], + serial_bytes[2], + serial_bytes[3], + valid_bytes[0], + valid_bytes[1], + valid_bytes[2], + valid_bytes[3], + update_bytes[0], + update_bytes[1], + update_bytes[2], + update_bytes[3], + x_off_bytes[0], + x_off_bytes[1], + y_off_bytes[0], + y_off_bytes[1], + target_crtc_bytes[0], + target_crtc_bytes[1], + target_crtc_bytes[2], + target_crtc_bytes[3], + acquire_syncobj_bytes[0], + acquire_syncobj_bytes[1], + acquire_syncobj_bytes[2], + acquire_syncobj_bytes[3], + release_syncobj_bytes[0], + release_syncobj_bytes[1], + release_syncobj_bytes[2], + release_syncobj_bytes[3], + acquire_point_bytes[0], + acquire_point_bytes[1], + acquire_point_bytes[2], + acquire_point_bytes[3], + acquire_point_bytes[4], + acquire_point_bytes[5], + acquire_point_bytes[6], + acquire_point_bytes[7], + release_point_bytes[0], + release_point_bytes[1], + release_point_bytes[2], + release_point_bytes[3], + release_point_bytes[4], + release_point_bytes[5], + release_point_bytes[6], + release_point_bytes[7], + options_bytes[0], + options_bytes[1], + options_bytes[2], + options_bytes[3], + 0, + 0, + 0, + 0, + target_msc_bytes[0], + target_msc_bytes[1], + target_msc_bytes[2], + target_msc_bytes[3], + target_msc_bytes[4], + target_msc_bytes[5], + target_msc_bytes[6], + target_msc_bytes[7], + divisor_bytes[0], + divisor_bytes[1], + divisor_bytes[2], + divisor_bytes[3], + divisor_bytes[4], + divisor_bytes[5], + divisor_bytes[6], + divisor_bytes[7], + remainder_bytes[0], + remainder_bytes[1], + remainder_bytes[2], + remainder_bytes[3], + remainder_bytes[4], + remainder_bytes[5], + remainder_bytes[6], + remainder_bytes[7], + ]; + let length_so_far = length_so_far + request0.len(); + let notifies_bytes = self.notifies.serialize(); + let length_so_far = length_so_far + notifies_bytes.len(); + let padding0 = &[0; 3][..(4 - (length_so_far % 4)) % 4]; + let length_so_far = length_so_far + padding0.len(); + assert_eq!(length_so_far % 4, 0); + let length = u16::try_from(length_so_far / 4).unwrap_or(0); + request0[2..4].copy_from_slice(&length.to_ne_bytes()); + ([request0.into(), notifies_bytes.into(), padding0.into()], vec![]) + } + /// Parse this request given its header, its body, and any fds that go along with it + #[cfg(feature = "request-parsing")] + pub fn try_parse_request(header: RequestHeader, value: &'input [u8]) -> Result { + if header.minor_opcode != PIXMAP_SYNCED_REQUEST { + return Err(ParseError::InvalidValue); + } + let (window, remaining) = xproto::Window::try_parse(value)?; + let (pixmap, remaining) = xproto::Pixmap::try_parse(remaining)?; + let (serial, remaining) = u32::try_parse(remaining)?; + let (valid, remaining) = xfixes::Region::try_parse(remaining)?; + let (update, remaining) = xfixes::Region::try_parse(remaining)?; + let (x_off, remaining) = i16::try_parse(remaining)?; + let (y_off, remaining) = i16::try_parse(remaining)?; + let (target_crtc, remaining) = randr::Crtc::try_parse(remaining)?; + let (acquire_syncobj, remaining) = dri3::Syncobj::try_parse(remaining)?; + let (release_syncobj, remaining) = dri3::Syncobj::try_parse(remaining)?; + let (acquire_point, remaining) = u64::try_parse(remaining)?; + let (release_point, remaining) = u64::try_parse(remaining)?; + let (options, remaining) = u32::try_parse(remaining)?; + let remaining = remaining.get(4..).ok_or(ParseError::InsufficientData)?; + let (target_msc, remaining) = u64::try_parse(remaining)?; + let (divisor, remaining) = u64::try_parse(remaining)?; + let (remainder, remaining) = u64::try_parse(remaining)?; + let mut remaining = remaining; + // Length is 'everything left in the input' + let mut notifies = Vec::new(); + while !remaining.is_empty() { + let (v, new_remaining) = Notify::try_parse(remaining)?; + remaining = new_remaining; + notifies.push(v); + } + let _ = remaining; + Ok(PixmapSyncedRequest { + window, + pixmap, + serial, + valid, + update, + x_off, + y_off, + target_crtc, + acquire_syncobj, + release_syncobj, + acquire_point, + release_point, + options, + target_msc, + divisor, + remainder, + notifies: Cow::Owned(notifies), + }) + } + /// Clone all borrowed data in this PixmapSyncedRequest. + pub fn into_owned(self) -> PixmapSyncedRequest<'static> { + PixmapSyncedRequest { + window: self.window, + pixmap: self.pixmap, + serial: self.serial, + valid: self.valid, + update: self.update, + x_off: self.x_off, + y_off: self.y_off, + target_crtc: self.target_crtc, + acquire_syncobj: self.acquire_syncobj, + release_syncobj: self.release_syncobj, + acquire_point: self.acquire_point, + release_point: self.release_point, + options: self.options, + target_msc: self.target_msc, + divisor: self.divisor, + remainder: self.remainder, + notifies: Cow::Owned(self.notifies.into_owned()), + } + } +} +impl<'input> Request for PixmapSyncedRequest<'input> { + const EXTENSION_NAME: core::option::Option<&'static str> = Some(X11_EXTENSION_NAME); + + fn serialize(self, major_opcode: u8) -> BufWithFds> { + let (bufs, fds) = self.serialize(major_opcode); + // Flatten the buffers into a single vector + let buf = bufs.iter().flat_map(|buf| buf.iter().copied()).collect(); + (buf, fds) + } +} +impl<'input> crate::x11_utils::VoidRequest for PixmapSyncedRequest<'input> { +} + /// Opcode for the Generic event pub const GENERIC_EVENT: u8 = 0; #[derive(Clone, Copy, Default)] diff --git a/x11rb-protocol/src/protocol/shm.rs b/x11rb-protocol/src/protocol/shm.rs index 5588d67a..4308f8b4 100644 --- a/x11rb-protocol/src/protocol/shm.rs +++ b/x11rb-protocol/src/protocol/shm.rs @@ -532,10 +532,10 @@ pub const PUT_IMAGE_REQUEST: u8 = 3; /// * `dst_y` - The Y coordinate on the destination drawable to copy to. /// * `depth` - The depth to use. /// * `format` - The format of the image being drawn. If it is XYBitmap, depth must be 1, or a -/// “BadMatch” error results. The foreground pixel in the GC determines the source +/// "BadMatch" error results. The foreground pixel in the GC determines the source /// for the one bits in the image, and the background pixel determines the source /// for the zero bits. For XYPixmap and ZPixmap, the depth must match the depth of -/// the drawable, or a “BadMatch” error results. +/// the drawable, or a "BadMatch" error results. /// * `send_event` - True if the server should send an XCB_SHM_COMPLETION event when the blit /// completes. /// * `offset` - The offset that the source image starts at. diff --git a/x11rb/src/protocol/composite.rs b/x11rb/src/protocol/composite.rs index 9c9e912b..7af8c083 100644 --- a/x11rb/src/protocol/composite.rs +++ b/x11rb/src/protocol/composite.rs @@ -59,7 +59,7 @@ where conn.send_request_with_reply(&slices, fds) } -/// Redirect the heirarchy starting at “window” to off-screen storage.. +/// Redirect the hierarchy starting at "window" to off-screen storage.. /// /// The hierarchy starting at 'window' is directed to off-screen /// storage. When all clients enabling redirection terminate, @@ -70,7 +70,7 @@ where /// /// # Fields /// -/// * `window` - The root of the heirarchy to redirect to off-screen storage. +/// * `window` - The root of the hierarchy to redirect to off-screen storage. /// * `update` - Whether contents are automatically mirrored to the parent window. If one client /// already specifies an update type of Manual, any attempt by another to specify a /// mode of Manual so will result in an Access error. @@ -97,7 +97,7 @@ where /// /// # Fields /// -/// * `window` - The root of the heirarchy to redirect to off-screen storage. +/// * `window` - The root of the hierarchy to redirect to off-screen storage. /// * `update` - Whether contents are automatically mirrored to the parent window. If one client /// already specifies an update type of Manual, any attempt by another to specify a /// mode of Manual so will result in an Access error. @@ -234,7 +234,7 @@ pub trait ConnectionExt: RequestConnection { { query_version(self, client_major_version, client_minor_version) } - /// Redirect the heirarchy starting at “window” to off-screen storage.. + /// Redirect the hierarchy starting at "window" to off-screen storage.. /// /// The hierarchy starting at 'window' is directed to off-screen /// storage. When all clients enabling redirection terminate, @@ -245,7 +245,7 @@ pub trait ConnectionExt: RequestConnection { /// /// # Fields /// - /// * `window` - The root of the heirarchy to redirect to off-screen storage. + /// * `window` - The root of the hierarchy to redirect to off-screen storage. /// * `update` - Whether contents are automatically mirrored to the parent window. If one client /// already specifies an update type of Manual, any attempt by another to specify a /// mode of Manual so will result in an Access error. @@ -262,7 +262,7 @@ pub trait ConnectionExt: RequestConnection { /// /// # Fields /// - /// * `window` - The root of the heirarchy to redirect to off-screen storage. + /// * `window` - The root of the hierarchy to redirect to off-screen storage. /// * `update` - Whether contents are automatically mirrored to the parent window. If one client /// already specifies an update type of Manual, any attempt by another to specify a /// mode of Manual so will result in an Access error. diff --git a/x11rb/src/protocol/dri3.rs b/x11rb/src/protocol/dri3.rs index 90140d49..8bd8b3ef 100644 --- a/x11rb/src/protocol/dri3.rs +++ b/x11rb/src/protocol/dri3.rs @@ -201,6 +201,36 @@ where conn.send_request_without_reply(&slices, fds) } +pub fn import_syncobj(conn: &Conn, syncobj: Syncobj, drawable: xproto::Drawable, syncobj_fd: A) -> Result, ConnectionError> +where + Conn: RequestConnection + ?Sized, + A: Into, +{ + let syncobj_fd: RawFdContainer = syncobj_fd.into(); + let request0 = ImportSyncobjRequest { + syncobj, + drawable, + syncobj_fd, + }; + let (bytes, fds) = request0.serialize(major_opcode(conn)?); + let slices = [IoSlice::new(&bytes[0])]; + assert_eq!(slices.len(), bytes.len()); + conn.send_request_without_reply(&slices, fds) +} + +pub fn free_syncobj(conn: &Conn, syncobj: Syncobj) -> Result, ConnectionError> +where + Conn: RequestConnection + ?Sized, +{ + let request0 = FreeSyncobjRequest { + syncobj, + }; + let (bytes, fds) = request0.serialize(major_opcode(conn)?); + let slices = [IoSlice::new(&bytes[0])]; + assert_eq!(slices.len(), bytes.len()); + conn.send_request_without_reply(&slices, fds) +} + /// Extension trait defining the requests of this extension. pub trait ConnectionExt: RequestConnection { fn dri3_query_version(&self, major_version: u32, minor_version: u32) -> Result, ConnectionError> @@ -247,6 +277,16 @@ pub trait ConnectionExt: RequestConnection { { set_drm_device_in_use(self, window, drm_major, drm_minor) } + fn dri3_import_syncobj(&self, syncobj: Syncobj, drawable: xproto::Drawable, syncobj_fd: A) -> Result, ConnectionError> + where + A: Into, + { + import_syncobj(self, syncobj, drawable, syncobj_fd) + } + fn dri3_free_syncobj(&self, syncobj: Syncobj) -> Result, ConnectionError> + { + free_syncobj(self, syncobj) + } } impl ConnectionExt for C {} diff --git a/x11rb/src/protocol/present.rs b/x11rb/src/protocol/present.rs index 8e74aeee..a337959b 100644 --- a/x11rb/src/protocol/present.rs +++ b/x11rb/src/protocol/present.rs @@ -23,6 +23,8 @@ use crate::errors::ConnectionError; #[allow(unused_imports)] use crate::errors::ReplyOrIdError; #[allow(unused_imports)] +use super::dri3; +#[allow(unused_imports)] use super::randr; #[allow(unused_imports)] use super::sync; @@ -126,6 +128,35 @@ where conn.send_request_with_reply(&slices, fds) } +pub fn pixmap_synced<'c, 'input, Conn>(conn: &'c Conn, window: xproto::Window, pixmap: xproto::Pixmap, serial: u32, valid: xfixes::Region, update: xfixes::Region, x_off: i16, y_off: i16, target_crtc: randr::Crtc, acquire_syncobj: dri3::Syncobj, release_syncobj: dri3::Syncobj, acquire_point: u64, release_point: u64, options: u32, target_msc: u64, divisor: u64, remainder: u64, notifies: &'input [Notify]) -> Result, ConnectionError> +where + Conn: RequestConnection + ?Sized, +{ + let request0 = PixmapSyncedRequest { + window, + pixmap, + serial, + valid, + update, + x_off, + y_off, + target_crtc, + acquire_syncobj, + release_syncobj, + acquire_point, + release_point, + options, + target_msc, + divisor, + remainder, + notifies: Cow::Borrowed(notifies), + }; + let (bytes, fds) = request0.serialize(major_opcode(conn)?); + let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])]; + assert_eq!(slices.len(), bytes.len()); + conn.send_request_without_reply(&slices, fds) +} + /// Extension trait defining the requests of this extension. pub trait ConnectionExt: RequestConnection { fn present_query_version(&self, major_version: u32, minor_version: u32) -> Result, ConnectionError> @@ -148,6 +179,10 @@ pub trait ConnectionExt: RequestConnection { { query_capabilities(self, target) } + fn present_pixmap_synced<'c, 'input>(&'c self, window: xproto::Window, pixmap: xproto::Pixmap, serial: u32, valid: xfixes::Region, update: xfixes::Region, x_off: i16, y_off: i16, target_crtc: randr::Crtc, acquire_syncobj: dri3::Syncobj, release_syncobj: dri3::Syncobj, acquire_point: u64, release_point: u64, options: u32, target_msc: u64, divisor: u64, remainder: u64, notifies: &'input [Notify]) -> Result, ConnectionError> + { + pixmap_synced(self, window, pixmap, serial, valid, update, x_off, y_off, target_crtc, acquire_syncobj, release_syncobj, acquire_point, release_point, options, target_msc, divisor, remainder, notifies) + } } impl ConnectionExt for C {} diff --git a/x11rb/src/protocol/shm.rs b/x11rb/src/protocol/shm.rs index b4a8a26b..aafabdde 100644 --- a/x11rb/src/protocol/shm.rs +++ b/x11rb/src/protocol/shm.rs @@ -122,10 +122,10 @@ where /// * `dst_y` - The Y coordinate on the destination drawable to copy to. /// * `depth` - The depth to use. /// * `format` - The format of the image being drawn. If it is XYBitmap, depth must be 1, or a -/// “BadMatch” error results. The foreground pixel in the GC determines the source +/// "BadMatch" error results. The foreground pixel in the GC determines the source /// for the one bits in the image, and the background pixel determines the source /// for the zero bits. For XYPixmap and ZPixmap, the depth must match the depth of -/// the drawable, or a “BadMatch” error results. +/// the drawable, or a "BadMatch" error results. /// * `send_event` - True if the server should send an XCB_SHM_COMPLETION event when the blit /// completes. /// * `offset` - The offset that the source image starts at. @@ -344,10 +344,10 @@ pub trait ConnectionExt: RequestConnection { /// * `dst_y` - The Y coordinate on the destination drawable to copy to. /// * `depth` - The depth to use. /// * `format` - The format of the image being drawn. If it is XYBitmap, depth must be 1, or a - /// “BadMatch” error results. The foreground pixel in the GC determines the source + /// "BadMatch" error results. The foreground pixel in the GC determines the source /// for the one bits in the image, and the background pixel determines the source /// for the zero bits. For XYPixmap and ZPixmap, the depth must match the depth of - /// the drawable, or a “BadMatch” error results. + /// the drawable, or a "BadMatch" error results. /// * `send_event` - True if the server should send an XCB_SHM_COMPLETION event when the blit /// completes. /// * `offset` - The offset that the source image starts at. diff --git a/xcb-proto-1.15.2-13-gb016df1/.gitignore b/xcb-proto-1.17.0/.gitignore similarity index 100% rename from xcb-proto-1.15.2-13-gb016df1/.gitignore rename to xcb-proto-1.17.0/.gitignore diff --git a/xcb-proto-1.15.2-13-gb016df1/.gitlab-ci.yml b/xcb-proto-1.17.0/.gitlab-ci.yml similarity index 100% rename from xcb-proto-1.15.2-13-gb016df1/.gitlab-ci.yml rename to xcb-proto-1.17.0/.gitlab-ci.yml diff --git a/xcb-proto-1.15.2-13-gb016df1/COPYING b/xcb-proto-1.17.0/COPYING similarity index 100% rename from xcb-proto-1.15.2-13-gb016df1/COPYING rename to xcb-proto-1.17.0/COPYING diff --git a/xcb-proto-1.15.2-13-gb016df1/HACKING b/xcb-proto-1.17.0/HACKING similarity index 100% rename from xcb-proto-1.15.2-13-gb016df1/HACKING rename to xcb-proto-1.17.0/HACKING diff --git a/xcb-proto-1.15.2-13-gb016df1/INSTALL b/xcb-proto-1.17.0/INSTALL similarity index 100% rename from xcb-proto-1.15.2-13-gb016df1/INSTALL rename to xcb-proto-1.17.0/INSTALL diff --git a/xcb-proto-1.15.2-13-gb016df1/Makefile.am b/xcb-proto-1.17.0/Makefile.am similarity index 100% rename from xcb-proto-1.15.2-13-gb016df1/Makefile.am rename to xcb-proto-1.17.0/Makefile.am diff --git a/xcb-proto-1.15.2-13-gb016df1/NEWS b/xcb-proto-1.17.0/NEWS similarity index 100% rename from xcb-proto-1.15.2-13-gb016df1/NEWS rename to xcb-proto-1.17.0/NEWS diff --git a/xcb-proto-1.15.2-13-gb016df1/README.md b/xcb-proto-1.17.0/README.md similarity index 100% rename from xcb-proto-1.15.2-13-gb016df1/README.md rename to xcb-proto-1.17.0/README.md diff --git a/xcb-proto-1.15.2-13-gb016df1/TODO b/xcb-proto-1.17.0/TODO similarity index 100% rename from xcb-proto-1.15.2-13-gb016df1/TODO rename to xcb-proto-1.17.0/TODO diff --git a/xcb-proto-1.15.2-13-gb016df1/autogen.sh b/xcb-proto-1.17.0/autogen.sh similarity index 100% rename from xcb-proto-1.15.2-13-gb016df1/autogen.sh rename to xcb-proto-1.17.0/autogen.sh diff --git a/xcb-proto-1.15.2-13-gb016df1/configure.ac b/xcb-proto-1.17.0/configure.ac similarity index 97% rename from xcb-proto-1.15.2-13-gb016df1/configure.ac rename to xcb-proto-1.17.0/configure.ac index 27a85da3..60a1b783 100644 --- a/xcb-proto-1.15.2-13-gb016df1/configure.ac +++ b/xcb-proto-1.17.0/configure.ac @@ -3,7 +3,7 @@ AC_PREREQ(2.57) AC_INIT([XCB Proto], - 1.15.2, + 1.17.0, [xcb@lists.freedesktop.org]) AC_CONFIG_SRCDIR([xcb-proto.pc.in]) AM_INIT_AUTOMAKE([foreign dist-xz]) diff --git a/xcb-proto-1.15.2-13-gb016df1/doc/xml-xcb.txt b/xcb-proto-1.17.0/doc/xml-xcb.txt similarity index 100% rename from xcb-proto-1.15.2-13-gb016df1/doc/xml-xcb.txt rename to xcb-proto-1.17.0/doc/xml-xcb.txt diff --git a/xcb-proto-1.15.2-13-gb016df1/src/.gitattributes b/xcb-proto-1.17.0/src/.gitattributes similarity index 100% rename from xcb-proto-1.15.2-13-gb016df1/src/.gitattributes rename to xcb-proto-1.17.0/src/.gitattributes diff --git a/xcb-proto-1.15.2-13-gb016df1/src/Makefile.am b/xcb-proto-1.17.0/src/Makefile.am similarity index 100% rename from xcb-proto-1.15.2-13-gb016df1/src/Makefile.am rename to xcb-proto-1.17.0/src/Makefile.am diff --git a/xcb-proto-1.15.2-13-gb016df1/src/bigreq.xml b/xcb-proto-1.17.0/src/bigreq.xml similarity index 100% rename from xcb-proto-1.15.2-13-gb016df1/src/bigreq.xml rename to xcb-proto-1.17.0/src/bigreq.xml diff --git a/xcb-proto-1.15.2-13-gb016df1/src/composite.xml b/xcb-proto-1.17.0/src/composite.xml similarity index 97% rename from xcb-proto-1.15.2-13-gb016df1/src/composite.xml rename to xcb-proto-1.17.0/src/composite.xml index a998e6e3..dcbf9a6d 100644 --- a/xcb-proto-1.15.2-13-gb016df1/src/composite.xml +++ b/xcb-proto-1.17.0/src/composite.xml @@ -112,7 +112,7 @@ other requests using Composite. Failure to do so will cause a BadRequest error. - Redirect the heirarchy starting at “window” to off-screen storage. + Redirect the hierarchy starting at "window" to off-screen storage. The hierarchy starting at 'window' is directed to off-screen storage. When all clients enabling redirection terminate, @@ -121,7 +121,7 @@ other requests using Composite. Failure to do so will cause a BadRequest error. The root window may not be redirected. Doing so results in a Match error. - The root of the heirarchy to redirect to off-screen storage. + The root of the hierarchy to redirect to off-screen storage. Whether contents are automatically mirrored to the parent window. If one client already specifies an update type of Manual, any attempt by another to specify a @@ -142,7 +142,7 @@ other requests using Composite. Failure to do so will cause a BadRequest error. then painting of the window background during window manipulation and ClearArea requests is inhibited. - The root of the heirarchy to redirect to off-screen storage. + The root of the hierarchy to redirect to off-screen storage. Whether contents are automatically mirrored to the parent window. If one client already specifies an update type of Manual, any attempt by another to specify a diff --git a/xcb-proto-1.15.2-13-gb016df1/src/damage.xml b/xcb-proto-1.17.0/src/damage.xml similarity index 100% rename from xcb-proto-1.15.2-13-gb016df1/src/damage.xml rename to xcb-proto-1.17.0/src/damage.xml diff --git a/xcb-proto-1.15.2-13-gb016df1/src/dbe.xml b/xcb-proto-1.17.0/src/dbe.xml similarity index 100% rename from xcb-proto-1.15.2-13-gb016df1/src/dbe.xml rename to xcb-proto-1.17.0/src/dbe.xml diff --git a/xcb-proto-1.15.2-13-gb016df1/src/dpms.xml b/xcb-proto-1.17.0/src/dpms.xml similarity index 100% rename from xcb-proto-1.15.2-13-gb016df1/src/dpms.xml rename to xcb-proto-1.17.0/src/dpms.xml diff --git a/xcb-proto-1.15.2-13-gb016df1/src/dri2.xml b/xcb-proto-1.17.0/src/dri2.xml similarity index 100% rename from xcb-proto-1.15.2-13-gb016df1/src/dri2.xml rename to xcb-proto-1.17.0/src/dri2.xml diff --git a/xcb-proto-1.15.2-13-gb016df1/src/dri3.xml b/xcb-proto-1.17.0/src/dri3.xml similarity index 94% rename from xcb-proto-1.15.2-13-gb016df1/src/dri3.xml rename to xcb-proto-1.17.0/src/dri3.xml index 9549fd4b..d681aae8 100644 --- a/xcb-proto-1.15.2-13-gb016df1/src/dri3.xml +++ b/xcb-proto-1.17.0/src/dri3.xml @@ -23,10 +23,11 @@ OF THIS SOFTWARE. --> + major-version="1" minor-version="4"> xproto + @@ -170,4 +171,15 @@ OF THIS SOFTWARE. + + + + + + + + + + + diff --git a/xcb-proto-1.15.2-13-gb016df1/src/ge.xml b/xcb-proto-1.17.0/src/ge.xml similarity index 100% rename from xcb-proto-1.15.2-13-gb016df1/src/ge.xml rename to xcb-proto-1.17.0/src/ge.xml diff --git a/xcb-proto-1.15.2-13-gb016df1/src/glx.xml b/xcb-proto-1.17.0/src/glx.xml similarity index 100% rename from xcb-proto-1.15.2-13-gb016df1/src/glx.xml rename to xcb-proto-1.17.0/src/glx.xml diff --git a/xcb-proto-1.15.2-13-gb016df1/src/present.xml b/xcb-proto-1.17.0/src/present.xml similarity index 87% rename from xcb-proto-1.15.2-13-gb016df1/src/present.xml rename to xcb-proto-1.17.0/src/present.xml index 7233eb1f..bae445f5 100644 --- a/xcb-proto-1.15.2-13-gb016df1/src/present.xml +++ b/xcb-proto-1.17.0/src/present.xml @@ -23,11 +23,12 @@ OF THIS SOFTWARE. --> + major-version="1" minor-version="4"> xproto randr xfixes sync + dri3 @@ -61,6 +62,8 @@ OF THIS SOFTWARE. 1 2 3 + + 4 @@ -137,6 +140,29 @@ OF THIS SOFTWARE. + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xcb-proto-1.15.2-13-gb016df1/src/randr.xml b/xcb-proto-1.17.0/src/randr.xml similarity index 100% rename from xcb-proto-1.15.2-13-gb016df1/src/randr.xml rename to xcb-proto-1.17.0/src/randr.xml diff --git a/xcb-proto-1.15.2-13-gb016df1/src/record.xml b/xcb-proto-1.17.0/src/record.xml similarity index 100% rename from xcb-proto-1.15.2-13-gb016df1/src/record.xml rename to xcb-proto-1.17.0/src/record.xml diff --git a/xcb-proto-1.15.2-13-gb016df1/src/render.xml b/xcb-proto-1.17.0/src/render.xml similarity index 100% rename from xcb-proto-1.15.2-13-gb016df1/src/render.xml rename to xcb-proto-1.17.0/src/render.xml diff --git a/xcb-proto-1.15.2-13-gb016df1/src/res.xml b/xcb-proto-1.17.0/src/res.xml similarity index 100% rename from xcb-proto-1.15.2-13-gb016df1/src/res.xml rename to xcb-proto-1.17.0/src/res.xml diff --git a/xcb-proto-1.15.2-13-gb016df1/src/screensaver.xml b/xcb-proto-1.17.0/src/screensaver.xml similarity index 100% rename from xcb-proto-1.15.2-13-gb016df1/src/screensaver.xml rename to xcb-proto-1.17.0/src/screensaver.xml diff --git a/xcb-proto-1.15.2-13-gb016df1/src/shape.xml b/xcb-proto-1.17.0/src/shape.xml similarity index 100% rename from xcb-proto-1.15.2-13-gb016df1/src/shape.xml rename to xcb-proto-1.17.0/src/shape.xml diff --git a/xcb-proto-1.15.2-13-gb016df1/src/shm.xml b/xcb-proto-1.17.0/src/shm.xml similarity index 99% rename from xcb-proto-1.15.2-13-gb016df1/src/shm.xml rename to xcb-proto-1.17.0/src/shm.xml index 41fb1c16..0f93a2cd 100644 --- a/xcb-proto-1.15.2-13-gb016df1/src/shm.xml +++ b/xcb-proto-1.17.0/src/shm.xml @@ -196,10 +196,10 @@ The Y coordinate on the destination drawable to copy to. The depth to use.