Comments on "x-rated"

[Hide] original entry

(The following rather dull notes on my recent trials and tribulations with the X Window System are mostly here just in case they help someone else having similar difficulties. If you find such things boring, please just ignore them.)

One · I found that certain web pages would send Firefox into a screaming tizzy, overwriting its window with a random tiling of rectangles grabbed from elsewhere on the screen. (The common denominator appeared to be the use of CSS background images. I don't know why.)

I thought at first that the cause might be some interaction between quirks in Firefox and in my (unorthodox) window manager. It turned out, however, that Firefox misbehaved similarly in ion and KDE's window manager. Time to upgrade some stuff and see if that helps.

Two · After upgrading X to the latest version known to the FreeBSD ports system, namely version 7.4 (server version 1.5.3), X would not start up:

MGA(0): Unable to map BAR 0. Invalid argument (22)

Apparently lots of people have had this problem when trying to run a dual-head setup, but I have only one head. (Er, that is, only one monitor.)

It turns out that this is a bug in x.org's Matrox driver: at various points it maps some memory and unmaps it again, and in one case it's possible for its idea of the size of its framebuffer to change in between the mapping and the unmapping; it gets confused, fails to unmap the memory, and then breaks the next time it tries to map it again. This bug was fixed more than a year ago, but for some doubtless excellent reason the release in the FreeBSD ports system is ancient, and in any case I only discovered that the bug had already been fixed after finding and fixing it myself.

Three · So, then my keyboard and mouse wouldn't work. There appear to have been two separate problems. The first is that they weren't being detected automatically when X thought they should be; adding

Option "AllowEmptyInput" "off"

to the ServerLayout section of my config file fixed that, though I'm sure that's not the right solution. Then it transpired that in the upgrade process the keyboard and mouse drivers (xf86-input-keyboard, xf86-input-mouse) had been built against the old version of the X server code. Forcing those to be rebuilt solved the problem. The FreeBSD ports system, convenient though it is, doesn't appear to have any way to express the fact "Any time you rebuild this port, you must also rebuild these others even if the versions you built before are still the latest versions".

Four · X was refusing to use the 1600x1200 resolution I wanted, preferring 1280x960. Since my monitor is an LCD panel whose native resolution is in fact 1600x1200, this was suboptimal. So, it turns out that if you put

Option "ModeDebug" "true"

into the Device section for your video card, your X log file contains a brief explanation of why each mode got rejected. It turns out that, for reasons I still don't understand, X was setting a maximum width and height for my display, and they were too small. I'm absolutely certain that what I've done to work around this is the wrong solution, but it works OK for me: I've put

Virtual 1600 1200

in each Display subsection of my config file.

Bletch · After 25 years of X, and 22 of X11, surely it should all be easier than this.

Anyway, Firefox no longer garbles those web pages; I don't know whether it's the X upgrade that fixed it, or something else that needed upgrading along the way. Yak successfully shaved.

(There are no comments on this entry yet.)

Post a comment:

Name:(will be shown with comment)
Email:(will be kept private)
Web page:(optional; will be linked from your name)
Secret word:(the secret word is two plus two)

You may use Markdown to format your comment, or just include HTML tags. All comments are moderated, so don't waste your time trying to abuse this.