Totem vs. XV_CONTRAST
For some time, I had noticed that after a few days on my laptop, the Xv extension would break. For those who don’t know: Xv lets Unix programs use hardware acceleration for displaying video. You can go without Xv — for instance, you could use Xshm to set up a shared-memory pixbuf between your X and your media player — but Xv is by far the highest-performing method. Full-screen, high-resolution video played back without Xv will almost certainly be jittery, even on high-end machines.
In any case, I noticed that after keeping my laptop on for a few days, Xv would become unusable. The picture, when played back, would be washed out, very bright, and would lose subtleties of shade and color. Basically, videos would become unwatchable. On the other hand, if I reverted to ancient Xshm, DVDs would become jittery. The only solution seemed to be to restart the X server…
At first, I thought it was a bug in the i810 driver (I am using pre-beta i810 drivers, because they are the only ones that would give me hardware-accelerated OpenGL). Fortunately, after browsing through innumerable mailing lists, I discovered a simpler reason: Totem. You see, the way Xv plays back video on your screen is governed by a number of “attributes”: XV_COLORKEY, XV_BRIGHTNESS, XV_CONTRAST, XV_GAMMA0, XV_GAMMA1, XV_GAMMA2, XV_GAMMA3, XV_GAMMA4, and XV_GAMMA5. These attributes affect all clients connected to a given X display. When you start X, the values are initialized to something sensible, but any X program is free to alter these values as it sees fit. Sensible programs like Xine and Mplayer will leave these alone, by default. Not so with Totem.
To see the values of the Xv attributes, you can use the program xvinfo (comes standard with X) or xvattr (which allows you to set the attributes as well). When I would start Gnome, xvinfo would output something like
"XV_CONTRAST" (range 0 to 255)
client settable attribute
client gettable attribute (current value is 64)
and after opening Totem, it would switch to
"XV_CONTRAST" (range 0 to 255)
client settable attribute
client gettable attribute (current value is 126)
Apparently, Totem was resetting XV_CONTRAST from its origninal value to the middle of its legal range (0 to 255), and that was screwing up my video. One would think that to resolve this, one would need to press “Reset To Defaults” in Preferences -> Display. However, that does not actually help (seems that Totem doesn’t pick good default values). So, instead, I deleted the Totem settings directory entirely (rm -ri ~/.gconf/apps/totem/) and restarted Gnome. That seemed to do the trick.