Merge branch 'fix_multiple_virtio_displays' into 'master'

graphics/virtio-gpud: Don't crash when multiple displays are attached

See merge request redox-os/drivers!224
This commit is contained in:
Jeremy Soller
2024-12-27 14:13:00 +00:00
+14 -4
View File
@@ -263,10 +263,20 @@ impl<'a> GpuScheme<'a> {
info.rect().height
);
result.push(Display {
width: info.rect().width,
height: info.rect().height,
});
if info.rect().width == 0 || info.rect().height == 0 {
// QEMU gives all displays other than the first a zero width and height, but trying
// to attach a zero sized framebuffer to the display will result an error, so
// default to 640x480px.
result.push(Display {
width: 640,
height: 480,
});
} else {
result.push(Display {
width: info.rect().width,
height: info.rect().height,
});
}
}
Ok(result)