Skip to content

Commit

Permalink
assert on unexpected image format from wlroots
Browse files Browse the repository at this point in the history
  • Loading branch information
maximbaz committed Oct 21, 2024
1 parent b3fe2a7 commit 80b41ba
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/frame/capturer/wlroots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,10 @@ impl Capturer {
width,
height,
num_objects,
format,
..
} => {
frame.set_metadata(width, height, num_objects);
frame.set_metadata(width, height, num_objects, format);
}

Event::Object {
Expand Down
4 changes: 3 additions & 1 deletion src/frame/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ pub struct Object {
pub width: u32,
pub height: u32,
pub num_objects: u32,
pub format: u32,
pub fds: Vec<RawFd>,
pub sizes: Vec<u32>,
}

impl Object {
pub fn set_metadata(&mut self, width: u32, height: u32, num_objects: u32) {
pub fn set_metadata(&mut self, width: u32, height: u32, num_objects: u32, format: u32) {
self.width = width;
self.height = height;
self.num_objects = num_objects;
self.format = format;
self.fds.resize(num_objects as usize, 0);
self.sizes.resize(num_objects as usize, 0);
}
Expand Down
4 changes: 4 additions & 0 deletions src/frame/vulkan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ impl Vulkan {
1, frame.num_objects,
"Frames with multiple objects are not supported yet, use WLR_DRM_NO_MODIFIERS=1 as described in README and follow issue #8"
);
assert_eq!(
875713112, frame.format,
"Frame with formats other than DRM_FORMAT_XRGB8888 are not supported yet (yours is {}). If you see this issue, please open a GitHub issue (unless there's one already open) and share your format value", frame.format
);

if self.image.borrow().is_none() {
self.init_image(frame)?;
Expand Down

0 comments on commit 80b41ba

Please sign in to comment.