Search code examples
x11xlib

Why are XVisuals repeated in xdpyinfo


Looking into my output of xdpyinfo, I see a lot of Visuals of the exact same characteristics repeated. Why are they repeated?

For example,

visual:
visual id:    0x6e
class:    TrueColor
depth:    32 planes
available colormap entries:    256 per subfield
red, green, blue masks:    0xff0000, 0xff00, 0xff
significant bits in color specification:    8 bits

visual:
visual id:    0x6f
class:    TrueColor
depth:    32 planes
available colormap entries:    256 per subfield
red, green, blue masks:    0xff0000, 0xff00, 0xff
significant bits in color specification:    8 bits

0x6e and 0x6f are exactly the same.

A related question: A visual already has a concept of depth, so why is it required to pass both a depth and a visual to XCreateWindow?


Solution

    1. The two visuals are not necessarily exactly the same. They may have different GLX properties. Run glxinfo -v to see them.
    2. The depth of the visual is the maximal depth. My screen for instance has many visuals, all of them are of depth 24 or 32. The X server supports more depths, in my case 24, 1, 4, 8, 15, 16, and 32. In a visual of a given depth you can create a window of a smaller depth. The preceding is wrong. The depth of the visual is the only depth it supports. One cannot create a window of any other depth.