ref: ca5cc6519de2b515e64775de4126dae29b3a1bde
parent: 858d3e39ab7e792c1d6e853ed699aeb5faf7d47c
author: mischief <[email protected]>
date: Sun Jun 8 20:22:11 EDT 2014
pc: clip rectangles before sending them to the hardware in flushmemscreen the vmware svga video card emulated by qemu (qemu -vga vmware) complains and eventually causes a panic if the rectangles aren't clipped. messages like the following can be observed from qemu before the kernel panics: vmsvga_update_rect: update h was < 0 (-20000) vmsvga_update_rect: update height too large y: 10000, h: 0 vmsvga_update_rect: update w was < 0 (-20000) vmsvga_update_rect: update width too large x: 10000, w: 0 i could only reproduce this in qemu 2.0.50 on the master branch, when using the ui and had selected 'Zoom To Fit' from the View menu.
--- a/sys/src/9/pc/screen.c
+++ b/sys/src/9/pc/screen.c
@@ -179,12 +179,12 @@
scr = &vgascreen[0];
if(scr->gscreen == nil || scr->useflush == 0)
return;
+ if(rectclip(&r, scr->gscreen->r) == 0)
+ return;
if(scr->dev && scr->dev->flush){
scr->dev->flush(scr, r);
return;
}
- if(rectclip(&r, scr->gscreen->r) == 0)
- return;
disp = scr->vaddr;
incs = scr->gscreen->width*sizeof(ulong);
off = (r.min.x*scr->gscreen->depth) / 8;