COMBAT: Video Programming 2
Double Buffering
- How to avoid flickering when updating the screen
- You do not want to write directly into "screen"
- Videocards sometimes use conventional RAM as screen buffer
- Solution: Reserve two areas in RAM for Videocard.
While one is diplayed update the other one.
Change displayed area during horizontal blank.
Problem: Unix/X-Windows keeps hardware protected
But: We have cycles to burn because machines are fast
Our Scheme
- Allocate a (hidden) bitmap on server as big as the window
- Change only this bitmap
- Once in a while flush this bitmap to the actual window
- This is like double buffering where we copy the contents
of the hidden buffer 1 to buffer2 which is displayed all the time.
- Copying the entire bitmap is expensive but not too expensive
because it represents a rectangular part of the screen.
- We do not want to overload the server so we will keep the
number of operations on the bitmap small.
Further Problem: Synchronization
Last Update: 08.03.96