In my previous release, I tested how much memory XWindows was using in a virtualized environment running Fedora 13. This time, I first tweaked xorg.conf in a VM. After talking to Chris, I found out that there were some extensions that could be turned off to save memory usage. After running some tests on disabling these extensions, I proceeded to replicate my process on the Raspberry Pi.
Initially, I had troubles starting the Pi with the X Server. I found out that the Pi could boot into a GUI mode by eliminating some layers inside the X Windows.
Normally, I could generate an xorg.conf template with the command:
X –configure :1
However, this would crash the Pi so I could not build a template to use. In the end, I built an xorg.conf from scratch, including only sections that I want to configure. After X7 windows, the developers made it so that X would probe for values needed to configure X Windows. Therefore, the sections that were missing from my configuration would be filled in automatically.
I ran this command to open up just a terminal window in X to see how much memory was being used:
X :0 -ac & sleep 2; xterm -display :0 & metacity
Around 36mb memory was used.
I found out what extensions were enabled on the Pi after I started X Windows using:
Xdpyinfo
This generated an output of what X was using. I’ve included a part of the output below:
name of display: :0.0
version number: 11.0
vendor string: Fedora Project
vendor release number: 10802000
maximum request size: 16777212 bytes
motion buffer size: 256
bitmap unit, bit order, padding: 32, LSBFirst, 32
image byte order: LSBFirst
number of supported pixmap formats: 7
supported pixmap formats:
depth 1, bits_per_pixel 1, scanline_pad 32
depth 4, bits_per_pixel 8, scanline_pad 32
depth 8, bits_per_pixel 8, scanline_pad 32
depth 15, bits_per_pixel 16, scanline_pad 32
depth 16, bits_per_pixel 16, scanline_pad 32
depth 24, bits_per_pixel 32, scanline_pad 32
depth 32, bits_per_pixel 32, scanline_pad 32
keycode range: minimum 8, maximum 255
focus: window 0x1000004, revert to Parent
number of extensions: 26
BIG-REQUESTS
Composite
DAMAGE
DOUBLE-BUFFER
DPMS
DRI2
GLX
Generic Event Extension
MIT-SCREEN-SAVER
MIT-SHM
RANDR
RECORD
RENDER
SGI-GLX
SHAPE
SYNC
X-Resource
XC-MISC
XFIXES
XFree86-DGA
XFree86-VidModeExtension
XINERAMA
XInputExtension
XKEYBOARD
XTEST
XVideo
default screen number: 0
number of screens: 1
screen #0:
dimensions: 1920×1080 pixels (508×286 millimeters)
resolution: 96×96 dots per inch
depths (7): 16, 1, 4, 8, 15, 24, 32
root window id: 0xe3
depth of root window: 16 planes
number of colormaps: minimum 1, maximum 1
default colormap: 0x20
default number of colormap cells: 64
preallocated pixels: black 0, white 65535
options: backing-store NO, save-unders NO
largest cursor: 1920×1080
The output showed that the Pi used 26 extensions. Running top command, the default X Windows used around 43mb of memory and 5% of CPU when idle with one terminal window open. The CPU would spike to around 50 to 60% if I frantically dragged the terminal window around. I used this as a base for comparing the results after I changed my configuration.
After researching on what the extensions are used for, there are several that seemed unnecessary for the Pi.
MIT-SCREEN-SAVER
This is used to inform screensavers when to start and stop.
RANDR
This stands for rotate and resize. Useful for display setting changes. Not useful for the Pi because it will be connected to a 1080p screen.
RECORD
This is used for application testing as it records X events.
SHAPE
This enables nonrectangular windows. It can be disabled if the Pi only has rectangular windows.
XInputExtension
This provides support for specialized input devices like tablets etc.
XTEST
Used for performance benchmarking.
XINERAMA
Used for single screen, multimonitor support.
XVideo
Enables video streams (ie. from video camera) to be converted, transformed on X. Improves video performance.
After turning off these extensions, I started X and ran ‘top’ to see memory usage. It still idled at 42mb memory used and 5% CPU used. This was surprising because I initially thought that this would decrease memory usage.
As a final test, I wanted to see what would happen if I tried to disable all the extensions. Here was the configuration I made to disable all the extensions.
Section “Screen”
Identifier “Screen0”
Device “Card0”
Monitor “Monitor0”
Subsection “Display”
Depth 24
Modes “1920×1080”
EndSubsection
Subsection “Display”
Depth 32
Modes “1920×1080”
EndSubsection
EndSection
Section “Extensions”
Option “BIG-REQUESTS” “off”
Option “Composite” “off”
Option “DAMAGE” “off”
Option “DOUBLE-BUFFER” “off”
Option “DPMS” “off”
Option “DRI2” “off”
Option “GLX” “off”
Option “Generic Event Extension” “off”
Option “MIT-SCREEN-SAVER” “off”
Option “MIT-SHM” “off”
Option “RANDR” “off”
Option “RECORD” “off”
Option “RENDER” “off”
Option “SGI-GLX” “off”
Option “SHAPE” “off”
Option “SYNC” “off”
Option “X-Resource” “off”
Option “XC-MISC” “off”
Option “XFIXES” “off”
Option “XFree86-DGA” “off”
Option “XFree86-VidModeExtension” “off”
Option “XINERAMA”
Option “XInputExtension” “off”
Option “XKEYBOARD” “off”
Option “XTEST” “off”
Option “XVideo” “off
EndSection
I started X and ran ‘xdpyinfo’ again.
name of display: :0.0
version number: 11.0
vendor string: Fedora Project
vendor release number: 10802000
maximum request size: 16777212 bytes
motion buffer size: 256
bitmap unit, bit order, padding: 32, LSBFirst, 32
image byte order: LSBFirst
number of supported pixmap formats: 7
supported pixmap formats:
depth 1, bits_per_pixel 1, scanline_pad 32
depth 4, bits_per_pixel 8, scanline_pad 32
depth 8, bits_per_pixel 8, scanline_pad 32
depth 15, bits_per_pixel 16, scanline_pad 32
depth 16, bits_per_pixel 16, scanline_pad 32
depth 24, bits_per_pixel 32, scanline_pad 32
depth 32, bits_per_pixel 32, scanline_pad 32
keycode range: minimum 8, maximum 255
focus: window 0x1000004, revert to Parent
number of extensions: 8
BIG-REQUESTS
DRI2
Generic Event Extension
SHAPE
SYNC
XC-MISC
XInputExtension
XKEYBOARD
default screen number: 0
number of screens: 1
Some extensions were still used. These were probably left on because they were needed for X to function properly. I ran the ‘top’ command and it still used around 42mb of memory and 5% CPU when idle. An interesting observation was that when I tried to drag and open new windows, the CPU would go up to 70%. The changes I made actually increased CPU usage. This was probably because X Windows had to redraw the windows that were overlaid which the CPU does.
In conclusion, the disabling extensions didn’t really help save memory usage. I would try to test out specific functions that pertain to each extension to see what happens as a result. As of now, I have only tested with terminal windows.