[Lcdproc] [Patch] Protect against overflow in do_mainloop()
Steve Hill
steve@nexusuk.org
Tue Sep 19 19:18:02 2006
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
--8323328-1300239550-1158693456=:6629
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
The attached patch protects against the t_diff calculations overflowing in
do_mainloop(). This can happen if the machine has been suspended (e.g.
ACPI S3 or S4).
If the calculations would overflow this patch causes the render_lag to be
reset to RENDER_FREQ and process_lag to be set to 1. The justification is
that if we've been suspended, the measured lag is going to be pretty
useless anyway so this should ensure we do a process and render pass
immediately.
Obviously most displays won't save state if they're powered down so this
code doesn't let you suspend a machine and then recover, although I've
been working on some HAL integration for the CFontz 635 which allows you
to suspend the machine or unplug the display and then restore the
display's state when the machine wakes up or your plug it back in again.
However, the HAL code is nowhere near ready for public consumption. :)
--
- Steve
xmpp:steve@nexusuk.org sip:steve@nexusuk.org http://www.nexusuk.org/
Servatis a periculum, servatis a maleficum - Whisper, Evanescence
--8323328-1300239550-1158693456=:6629
Content-Type: TEXT/PLAIN; charset=US-ASCII; name=lcdproc-overflow.patch
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.64.0609192017360.6629@rivendell.nexusuk.org>
Content-Description:
Content-Disposition: attachment; filename=lcdproc-overflow.patch
SW5kZXg6IHNlcnZlci9tYWluLmMNCj09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0N
Ci0tLSBzZXJ2ZXIvbWFpbi5jCShyZXZpc2lvbiAxMDcpDQorKysgc2VydmVy
L21haW4uYwkocmV2aXNpb24gMTE0KQ0KQEAgLTQzLDYgKzQzLDcgQEANCiAj
aW5jbHVkZSA8c3lzL3R5cGVzLmg+DQogI2luY2x1ZGUgPGZjbnRsLmg+DQog
I2luY2x1ZGUgPHN5cy90eXBlcy5oPg0KKyNpbmNsdWRlIDxsaW1pdHMuaD4N
CiANCiAja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