Re: making window managers faster
Carsten Haitzler (The Rasterman) <[email protected]> Mon, 28 Oct 2002 15:05:05 +1100
| Newsgroups | gmane.comp.xfree86.render |
|---|---|
| Organization | You expect me to be organized? |
| Message-ID | <[email protected]> |
On Sat, 26 Oct 2002 16:27:05 +0300 (EET DST) Jouni Tulkki <[email protected]> babbled: > I have seen people complaining about slow window redraw when moving/resizing > windows. I had noticed this problem myself and have found one way to reduce > it. X server sends a lot of mouse events when moving the mouse. I haven't > calculated how much but it could be something like 100 - 200 or more per > second. This is way too much for window moving. > > The solution is to add a time check to the window manager that makes sure that > windows are not moved more often then (for example) 50 times per second. Same > applies to window resize, but because window resize is more expensive the > maximum refresh rate should be lower, maybe about 25 1/s. this isn't x's job. the wm should handle this. ie it should be a state machine and only evaluate its when it goes idle. since X is a buffered protocol, what shoudl be happening is loop: read_events() move... move... move... move... move... move... end_read_events() move_window() wait_for_events() so all the move events come in in 1 read, since they are buffered. the window move only happens when all the events have been read and processed and the wm has evaluated its current state. this way the system never fal;ls behind the user on processing events and 2, will only update as fast as the system is able to handle (disclaimer: the above loop is an overly simplified version of the event loop. it's missing other state processing, other event handling and synchronization at idle handling) now there are a LOT of window managers. do you want to add the check to all of them? and what's the point? 10 mouse events come in. they result in 1 window move (if the wm is written well). all events are buffered in a pipeline of protocol requests/replies. same applies to resizes. often applications and some widget sets aren't well written and don't compress configurenotify events sent by the wm and only re-evaluate their redraw on idle. apps should do things this way for optimum performance. this is more a result of lack of knowledge of how x really works and how to best work within its design to achieve optimal results. -- --------------- Codito, ergo sum - "I code, therefore I am" -------------------- The Rasterman (Carsten Haitzler) [email protected] [email protected] Mobile Phone: +61 (0)413 451 899 Home Phone: 02 9698 8615