Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!pasteur!dent.Berkeley.EDU!davidh From: davidh@dent.Berkeley.EDU (David S. Harrison) Newsgroups: comp.windows.x Subject: Using Multiple Graphics Contexts Keywords: graphics contexts, GC Message-ID: <8404@pasteur.Berkeley.EDU> Date: 17 Dec 88 23:14:47 GMT Sender: news@pasteur.Berkeley.EDU Reply-To: davidh@ic.Berkeley.EDU Followup-To: comp.windows.x Organization: Electronics Research Lab, UC Berkeley Lines: 58 [X11] A co-worker and I recently had an argument about appropriate use of graphics contexts in X11. I dimly recall a similar discussion in this news group about this subject but I cannot recall the final recommendation. Should an application maintain many graphics contexts and swap between them when appropriate or maintain a few graphics contexts and change fields when appropriate? My co-worker advocates the first approach. 1. The application will run well on hardware that supports multiple graphics contexts. 2. Even if the hardware does not support multiple graphics contexts, the server could optimize the swap between contexts by comparing the currently loaded context with the new context. 3. Traffic between client and server is reduced. The (rather large) amount of information in the graphics context structure is shipped only once for each context. From that point on, the contexts are maintained on the server and no further modifications are required. 4. In some sense, the complexity of the application is reduced. No code has to be written to change existing graphics contexts. However, I vaguely remember that Robert Scheifler posted a message encouraging applications to maintain a small number of graphics contexts and change them when necessary. The reasons I came up with are: 1. Currently, very few hardware platforms truly support multiple graphics contexts. Those that do will often have very few. This means updates to hardware contexts will occur anyway. 2. In a graphics intensive application (like the one we are porting to X11), changes in graphics contexts are not frequent. Thus, the increased client-server communication caused by the occasional request to change a graphics context is insignificant compared to the number of graphics requests issued by the application. 3. It is possible for the server to optimize changes to the current graphics context by noting the fields that change in the request from the application. No comparison of all graphics context fields is required. 4. Using many graphics contexts consumes resources in the server. Many servers may have very strict limits on resources. The best example is X terminals. These devices may have very little extra memory for storing many graphics contexts. Can those with greater knowledge of X11 design shed some light on this issue? David Harrison UC Berkeley Electronics Research Lab (davidh@ic.Berkely.EDU, ...!ucbvax!davidh)