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.
This commit is contained in:
mischief 2014-06-09 00:22:11 -07:00
parent 858d3e39ab
commit ca5cc6519d

View file

@ -179,12 +179,12 @@ flushmemscreen(Rectangle r)
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;