Hands-on Projects for the Linux Graphics Subsystem
|
The first part of the xtrace output from section 2.4 provides another view of the X client-server initial connection at the X Protocol layer, that was discussed previously in section 1.5 and section 1.6. We again focus at the next figure:
Most important it displays the second part of the second read() info, which as we see in section 1.6, was left undecoded.
000:<: am lsb-first want 11:0 authorising with 'MIT-MAGIC-COOKIE-1' of length 16 000:>: Success, version is 11:0 vendor='The X.Org Foundation' release=10706000 resource-id=0x04000000 resource-mask=0x001fffff motion-buffer-size=256 max-request-len=65535 image-byte-order=LSBFirst(0x00) bitmap-bit-order=LeastSignificant(0x00) scanline-unit=32 scanline-pad=32 min-keycode=0x08 max-keycode=0x00 pixmap-formats={depth=1 bits/pixel=1 scanline-pad=32},{depth=4 bits/pixel=8 scanline-pad=32},{depth=8 bits/pixel=8 scanline-pad=32},{depth=15 bits/pixel=16 scanline-pad=32},{depth=16 bits/pixel=16 scanline-pad=32},{depth=24 bits/pixel=32 scanline-pad=32},{depth=32 bits/pixel=32 scanline-pad=32}; roots={root=0x00000101 default-colormap=0x00000020 white-pixel=0x00ffffff black-pixel=0x00000000 input-mask=KeyPress,KeyRelease,EnterWindow,LeaveWindow,Exposure,StructureNotify, SubstructureNotify,SubstructureRedirect,FocusChange,PropertyChange,ColormapChange width[pixel]=1024 height[pixel]=768 width[mm]=302 height[mm]=222 min-installed-maps=1 max-installed-maps=1 root=0x00000021 backing-stores=Never(0x00) save-unders=false(0x00) root-depth=24 allowed depths={depth=24 visuals={id=0x00000021 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000c2 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000c3 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000c4 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000c5 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000c6 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000c7 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000c8 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000c9 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000ca class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000cb class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000cc class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000cd class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000ce class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000cf class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000d0 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000d1 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000d2 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000d3 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000d4 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000d5 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000d6 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000d7 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000d8 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000d9 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000da class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000db class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000dc class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000dd class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000de class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000df class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000e0 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000e1 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000e2 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000e3 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000e4 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000e5 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000e6 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000e7 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000e8 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000e9 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000ea class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000eb class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000ec class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000ed class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000ee class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000ef class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000f0 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000f1 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000f2 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000f3 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000f4 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000f5 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000f6 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000f7 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000f8 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000f9 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000fa class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000fb class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000fc class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000fd class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000fe class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000ff class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff};},{depth=1 visuals=;},{depth=4 visuals=;},{depth=8 visuals=;},{depth=15 visuals=;},{depth=16 visuals=;},{depth=32 visuals={id=0x00000041 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff};};}; |
The first line highlighted with yellow color corresponds to the xConnClientPrefix:
000:<: am lsb-first want 11:0 authorising with 'MIT-MAGIC-COOKIE-1' of length 16 |
As we recall from the previous sections xConnClientPrefix is defined as:
typedef struct { CARD8 byteOrder; BYTE pad; CARD16 majorVersion B16, minorVersion B16; CARD16 nbytesAuthProto B16; /* Authorization protocol */ CARD16 nbytesAuthString B16; /* Authorization string */ CARD16 pad2 B16; } xConnClientPrefix; |
The next part of the xtrace output corresponds to the xConnSetupPrefix field values (linehighlighted in orange color):
000:>: Success, version is 11:0 |
As we notice the length field is missing. The value for this field was found to be 435 (or 1740 bytes) at section 1.6.
typedef struct { CARD8 success; BYTE lengthReason; /*num bytes in string following if failure */ CARD16 majorVersion B16, minorVersion B16; CARD16 length B16; /* 1/4 additional bytes in setup info */ } xConnSetupPrefix; |
The third and largest part of the xtrace output corresponds to the message received with the second read() call of the X Client. This includes the u union's members values (xConnSetup, vendor, xPixmapFormat, xWindowRoot, xDepth and xVisualType), discussed in section 1.6.
It starts with the vendor value, 'The X.Org Foundation', marked red. This is the value received by the X Client right after the xConnSetup field values, where the rest of the u members are read.
vendor='The X.Org Foundation' |
Probably for usability reasons the xtrace changes the order of the information it displays (vendor before xConnSetup).
union { xConnSetup *setup; char *failure; char *vendor; xPixmapFormat *sf; xWindowRoot *rp; xDepth *dp; xVisualType *vp; } u; |
The next part marked blue shows the values of the xConnSetup fields:
release=10706000 resource-id=0x04000000 resource-mask=0x001fffff motion-buffer-size=256 max-request-len=65535 image-byte-order=LSBFirst(0x00) bitmap-bit-order=LeastSignificant(0x00) scanline-unit=32 scanline-pad=32 min-keycode=0x08 max-keycode=0x00 |
As we recall from the previous sections xConnSetup is defined as:
typedef struct { CARD32 release B32; CARD32 ridBase B32, ridMask B32; CARD32 motionBufferSize B32; CARD16 nbytesVendor B16; /* number of bytes in vendor string */ CARD16 maxRequestSize B16; CARD8 numRoots; /* number of roots structs to follow */ CARD8 numFormats; /* number of pixmap formats */ CARD8 imageByteOrder; /* LSBFirst, MSBFirst */ CARD8 bitmapBitOrder; /* LeastSignificant, MostSign...*/ CARD8 bitmapScanlineUnit, /* 8, 16, 32 */ bitmapScanlinePad; /* 8, 16, 32 */ KeyCode minKeyCode, maxKeyCode; CARD32 pad2 B32; } xConnSetup; |
A pointer to xConnSetup (points to an array of xConnSetup) is the first member of union u. The members of u are the ones read by the second read().
union { xConnSetup *setup; char *failure; char *vendor; xPixmapFormat *sf; xWindowRoot *rp; xDepth *dp; xVisualType *vp; } u; |
Seven PixmapFormat values, marked Fuchsia, follows next in the xtrace output:
pixmap-formats={depth=1 bits/pixel=1 scanline-pad=32},{depth=4 bits/pixel=8 scanline-pad=32},{depth=8 bits/pixel=8 scanline-pad=32},{depth=15 bits/pixel=16 scanline-pad=32},{depth=16 bits/pixel=16 scanline-pad=32},{depth=24 bits/pixel=32 scanline-pad=32},{depth=32 bits/pixel=32 scanline-pad=32}; |
union { xConnSetup *setup; char *failure; char *vendor; xPixmapFormat *sf; xWindowRoot *rp; xDepth *dp; xVisualType *vp; } u; |
xPixmapFormat is defined as:
typedef struct { CARD8 depth; CARD8 bitsPerPixel; CARD8 scanLinePad; CARD8 pad1; CARD32 pad2 B32; } xPixmapFormat; |
struct xPixmapFormat
As we read in X.Org Manual pages "The screenInfo's pixmap format's depth, bits per pixel and scanline padding is also initialized at this stage." The stage referred here is InitOutput(), called by main(). This info is send to the X Client on client's connection as we see in the previous sections.
Depth (Color Depth) is the number of bit planes in the pixmap. From this
GTK+ link we read:
The following figure from Display Graphics shows (a) Display memory (b) The contents of two sample bit planes (c) The resulting display:
bitsPerPixel is the number of consecutive bits used to encode a single pixel. Also from the
GTK+ link we read:
The following figure from Display Graphics shows 8-bits per pixel and this value is mapped to a color value:
Notice that this is the simple case, where 'Indexed Color' is used (see Wikipedia). The other more powerful solution is 'Direct color'.
scanLinePad, according to RFC 1013 "Each scanline is padded to a multiple of bits as given by bitmap-format-scanline-pad." As we read from Wikipedia "A scan line or scanline is one line, or row, in a raster scanning pattern, such as a video line on a cathode ray tube (CRT) display of a television or computer.", "The term is used, by analogy, for a single row of pixels in a raster graphics image." |
The next part of info send by the X Server is a xWindowRoot struct:
roots={root=0x00000101 default-colormap=0x00000020 white-pixel=0x00ffffff black-pixel=0x00000000 input-mask=KeyPress,KeyRelease,EnterWindow,LeaveWindow,Exposure,StructureNotify, SubstructureNotify,SubstructureRedirect,FocusChange,PropertyChange,ColormapChange width[pixel]=1024 height[pixel]=768 width[mm]=302 height[mm]=222 min-installed-maps=1 max-installed-maps=1 root=0x00000021 backing-stores=Never(0x00) save-unders=false(0x00) root-depth=24 allowed depths= |
A pointer to xWindowRoot is also a member of union u:
union { xConnSetup *setup; char *failure; char *vendor; xPixmapFormat *sf; xWindowRoot *rp; xDepth *dp; xVisualType *vp; } u; |
xWindowRoot is defined as:
typedef struct { Window windowId B32; Colormap defaultColormap B32; CARD32 whitePixel B32, blackPixel B32; CARD32 currentInputMask B32; CARD16 pixWidth B16, pixHeight B16; CARD16 mmWidth B16, mmHeight B16; CARD16 minInstalledMaps B16, maxInstalledMaps B16; VisualID rootVisualID B32; CARD8 backingStore; BOOL saveUnders; CARD8 rootDepth; CARD8 nDepths; /* number of xDepth structures following */ } xWindowRoot; |
struct xWindowRoot
Struct xWindowRoot returns to the X client info about the root window.
For the root window we read from
Wikipedia:
windowId: is the window ID of the root window. currentInputMask: is the event mask of the root window. For the other xWindowRoot fields we read from RFC 1013: defaultColormap: The default-colormap is the one initially associated with the root window. Clients with minimal color requirements creating windows of the same depth as the root may want to allocate from this map by default.whitePixel and blackPixel: Black-pixel and white-pixel can be used in implementing a "monochrome" application. These pixel values are for permanently allocated entries in the default-colormap; the actual RGB values may be settable on some screens.rootDepth and rootVisualID: Root-depth and root-visual specify the depth and visual type of the root window.pixWidth and pixHeight: Width-in-pixels and height-in-pixels specify the size of the root window (which cannot be changed).mmWidth and mmHeight: Width-in-millimeters and height-in-millimeters can be used to determine the physical size and the aspect ratio.minInstalledMaps and maxInstalledMaps: Min-installed-maps specifies the number of maps that can be guaranteed to installed simultaneously (with InstallColormap), regardless of the number of entries allocated in each map. Max-installed-maps specifies the maximum number of maps that might possibly be installed simultaneously, depending on their allocations. For the typical case of a single hardware colormap, both values will be one.backingStore: Backing-stores indicates when the server supports backing stores for this screen, although it may be storage limited in the number of windows it can support at once.saveUnders: If save-unders is True, then the a server can support the save-under mode in CreateWindow and ChangeWindowAttributes, although again it may be storage limited. |
It follows then the xDepth info:
{depth=24 visuals={ |
A pointer to xDepth is also a member of u:
union { xConnSetup *setup; char *failure; char *vendor; xPixmapFormat *sf; xWindowRoot *rp; xDepth *dp; xVisualType *vp; } u; |
xDepth is defined as:
typedef struct { CARD8 depth; CARD8 pad1; CARD16 nVisuals B16; /* number of xVisualType structures following */ CARD32 pad2 B32; } xDepth; |
xtrace instead of printing the number of xVisualType structures following, as we read in the comment, it displays all xVisualType the X Server supports.
This number for the current case study is 64:
{id=0x00000021 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000c2 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000c3 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000c4 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000c5 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000c6 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000c7 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000c8 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000c9 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000ca class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000cb class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000cc class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000cd class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000ce class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000cf class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000d0 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000d1 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000d2 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000d3 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000d4 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000d5 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000d6 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000d7 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000d8 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000d9 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000da class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000db class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000dc class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000dd class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000de class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000df class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000e0 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000e1 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000e2 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000e3 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000e4 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000e5 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000e6 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000e7 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000e8 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000e9 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000ea class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000eb class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000ec class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000ed class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000ee class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000ef class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000f0 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000f1 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000f2 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000f3 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000f4 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000f5 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000f6 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000f7 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000f8 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000f9 class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000fa class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000fb class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000fc class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000fd class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000fe class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff},{id=0x000000ff class=DirectColor(0x05) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff};},{depth=1 visuals=;},{depth=4 visuals=;},{depth=8 visuals=;},{depth=15 visuals=;},{depth=16 visuals=;},{depth=32 visuals={id=0x00000041 class=TrueColor(0x04) bits/rgb-value=8 colormap-entries=256 red-mask=0x00ff0000 green-mask=0x0000ff00 blue-mask=0x000000ff} |
A pointer to xVisualType (actually an arrray of xVisualType) is the next member of u:
union { xConnSetup *setup; char *failure; char *vendor; xPixmapFormat *sf; xWindowRoot *rp; xDepth *dp; xVisualType *vp; } u; |
xVisualType is defined as:
typedef struct { VisualID visualID B32; #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; #else CARD8 class; #endif CARD8 bitsPerRGB; CARD16 colormapEntries B16; CARD32 redMask B32, greenMask B32, blueMask B32; CARD32 pad B32; } xVisualType; |
struct xVisualType
Struct xVisualType represents visual types. It has the following fields: class From Writing GNOME Applications we read: "To simplify and categorize the various color-mapping situations, X11 divides them into six major groups, called visuals. Each visual represents a different style for handling color maps. A visual is a conceptual abstraction that allows us to describe complex color-mapping arrangements in clear, simple language. The six common visuals in X are StaticGray, GrayScale, StaticColor, PseudoColor, TrueColor, and DirectColor. These visuals have many interesting relationships with each other (see Figure 10.2). Their two primary characteristics are color depth and read/write access. Visuals can use a monochrome color map (StaticGray and GrayScale), or use an RGB color map as we discussed in the previous section (StaticColor and PseudoColor), or write colors directly to the frame buffer for full-color displays (TrueColor and DirectColor)." As we see from the xtrace output the visual class supported by the X Server is TrueColor. For the visual classes read also the Basic X Concepts. From the Data Types page we read about the other xVisualType fields: bits-per-rgb Specifies the log base 2 of the approximate number of distinct color values ( individually) of red, green, and blue. Actual RGB values are unsigned 16-bit numbers. colormap-entries Defines the number of available colormap entries in a newly created colormap. For :direct-color and :true-color , this is the size of an individual pixel subfield. red-mask, green-mask, blue-mask The red-mask, green-mask, and blue-mask elements are only meaningful for the :direct-color and :true-color classes. Each mask has one contiguous set of bits with no intersections.
|
With xdpyinfo we verify some of the previous xtrace results concerning the display info of the X Server. As we read from the man page:
Xdpyinfo is a utility for displaying information about an X server. It is used to examine the capabilities of a server, the predefined values for various parameters used in communicating between clients and the server, and the different types of screens and visuals that are avail- able.From the command line we run xdpyinfo as:
xdpyinfoor because it returns an enormous output as:
xdpyinfo | moreTo find the details about the xPixmapFormat struct fields we enter in the command line:
xdpyinfo | grep scanlineThe result is illustrated in the following image:
xdpyinfo returns also info about the xWindowRoot struct:
Some of the previous info is also returned by the xwininfo utility when it runs with the -root argument:
Reading the xdpyinfo output we get info about the array of xVisualType structs (as we did with xtrace in the first part). The next figure shows the info about the first xVisualType struct:
Also if we continue with the xdpyinfo output we read the rest of the xVisualType structs info.