Skip to content

Commit

Permalink
Bind dmabuf v5
Browse files Browse the repository at this point in the history
This makes creating a dmabuf with different modifiers for different
planes a protocol error.

This *could* be considered a breaking API change, but I don't think we
need a semver bump for it because:
* Callers should never have actually used different modifiers for
  different planes, since this was never valid.
* Most users of this protocol tend to use `create_immed`, in which case
  they would get a protocol error.
So it's "breaking" if an application calls `create` with non-sense
params and then expects to get `failed`.

When we do have an API break, the API should probably be changed to only
allow a single modifier.

This change isn't important, but will be needed for future updates to
dmabuf.
  • Loading branch information
ids1024 authored and wash2 committed Mar 1, 2024
1 parent 8708dd5 commit 72f98e7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ thiserror = "1.0.30"
wayland-backend = "0.3.0"
wayland-client = "0.31.1"
wayland-cursor = "0.31.0"
wayland-protocols = { version = "0.31.0", features = ["client", "staging", "unstable"] }
wayland-protocols = { version = "0.31.2", features = ["client", "staging", "unstable"] }
wayland-protocols-wlr = { version = "0.2.0", features = ["client"] }
wayland-scanner = "0.31.0"
wayland-csd-frame = "0.3.0"
Expand Down
4 changes: 2 additions & 2 deletions examples/dmabuf_formats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ fn main() {

return;
}
Some(4..) => {
println!("Version `4` of `zwp_linux_dmabuf_v1` supported. Showing default dmabuf feedback.\n");
Some(ver @ 4..) => {
println!("Version `{}` of `zwp_linux_dmabuf_v1` supported. Showing default dmabuf feedback.\n", ver);

app_data.dmabuf_state.get_default_feedback(&qh).unwrap();

Expand Down
5 changes: 4 additions & 1 deletion src/dmabuf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ impl DmabufState {
D: Dispatch<zwp_linux_dmabuf_v1::ZwpLinuxDmabufV1, GlobalData> + 'static,
{
// Mesa (at least the latest version) also requires version 3 or 4
let zwp_linux_dmabuf = GlobalProxy::from(globals.bind(qh, 3..=4, GlobalData));
let zwp_linux_dmabuf = GlobalProxy::from(globals.bind(qh, 3..=5, GlobalData));
Self { zwp_linux_dmabuf, modifiers: Vec::new() }
}

Expand Down Expand Up @@ -230,6 +230,9 @@ impl DmabufParams {
///
/// In version `4`, it is a protocol error if `format`/`modifier` pair wasn't
/// advertised as supported.
///
/// `modifier` should be the same for all planes. It is a protocol error in version `5` if
/// they differ.
pub fn add(&self, fd: BorrowedFd<'_>, plane_idx: u32, offset: u32, stride: u32, modifier: u64) {
let modifier_hi = (modifier >> 32) as u32;
let modifier_lo = (modifier & 0xffffffff) as u32;
Expand Down

0 comments on commit 72f98e7

Please sign in to comment.