XServer

From The Neuros Technology Wiki

Jump to: navigation, search

Contents

[edit] Introduction

So, last saturday we had this interesting conversation in IRC with crweb et al. after Gao left the house after a meeting. We basically asked ourselves if it was such a proposterous idea to run a real X server of some kind on the OSD. And the usual mantra of "X is bloated" came up, so for the sake of finding out the truth, I embarked in building us an X server.

Keep in mind i'm no X guru, and that I found out lots of new interesting but scary things from this brief excursion. If nothing in here sounds new to you, then you're the right person to help me out in bringing this to a decent state (see at bottom)

For the server, I did some research and picked up from fdo.org the terribly named "xserver", which is based on Keith Packard's KDrive and Xfbdev. Basically it's an X server that simply picks up and uses /dev/fb for display.

[edit] Memory and disk footprint analisys

I'll spare you the pain i went throug to build this (if you want details just ask), but i'll give you some good news fist:

  ./bin: total 772K
  772K Xfbdev
  ./lib: total 1.5M
   12K libfontcache.so.0.0.0
  948K libX11.so.6.2.1
  8.0K libXau.so.6.0.0
  8.0K libXdamage.so.0.1.0
   20K libXdmcp.so.6.0.0
   68K libXext.so.6.4.1
   20K libXfixes.so.0.2.0
  148K libXfont.so.1.4.1
  136K libxkbfile.so.1.0.1
   12K libXrandr.so.2.0.1
   36K libXrender.so.1.3.0
   84K libz.so.1.2.3
  2.3M    total

Not that bad, even considering that everything is already stripped (--strip-unneeded). I'm not sure if everything that's needed for a decent X installation is included either, there was an awful lot of stuff installed under share, but at the point where i'm now it seems to kind of run without it, so who knows ?

Now, let's have a look at memory footprint.

Using ps we get this figure, which i find already encouraging:

  PID  Uid        VmSize Stat Command
  1702 root       1532   S   ./Xfbdev vt0 -screen 320x240

Now let's look at that memory a bit more closely with pmap:

  ./Xfbdev(1702)
  00008000 (748 KB)      r-xp (00:0c 100380)   /opt/fdo/bin/Xfbdev
  000cb000 (12 KB)       rw-p (00:0c 100380)   /opt/fdo/bin/Xfbdev
  000ce000 (296 KB)      rwxp (00:00 0)        [heap]
  40000000 (84 KB)       r-xp (00:0c 100339)   /lib/ld-2.3.6.so
  40015000 (8 KB)        rw-p (00:00 0)
  4001c000 (4 KB)        r--p (00:0c 100339)   /lib/ld-2.3.6.so
  4001d000 (4 KB)        rw-p (00:0c 100339)   /lib/ld-2.3.6.so
  4001e000 (60 KB)       r-xp (00:0c 100442)   /opt/fdo/lib/libXext.so.6.4.1
  4002d000 (28 KB)       ---p (00:0c 100442)   /opt/fdo/lib/libXext.so.6.4.1
  40034000 (4 KB)        rw-p (00:0c 100442)   /opt/fdo/lib/libXext.so.6.4.1
  40035000 (904 KB)      r-xp (00:0c 100437)   /opt/fdo/lib/libX11.so.6.2.1
  40117000 (28 KB)       ---p (00:0c 100437)   /opt/fdo/lib/libX11.so.6.2.1
  4011e000 (20 KB)       rw-p (00:0c 100437)   /opt/fdo/lib/libX11.so.6.2.1
  40123000 (12 KB)       r-xp (00:0c 100432)   /opt/fdo/lib/libXdmcp.so.6.0.0
  40126000 (28 KB)       ---p (00:0c 100432)   /opt/fdo/lib/libXdmcp.so.6.0.0
  4012d000 (8 KB)        rw-p (00:0c 100432)   /opt/fdo/lib/libXdmcp.so.6.0.0
  4012f000 (8 KB)        r-xp (00:0c 99823)    /lib/libdl-2.3.6.so
  40131000 (28 KB)       ---p (00:0c 99823)    /lib/libdl-2.3.6.so
  40138000 (4 KB)        r--p (00:0c 99823)    /lib/libdl-2.3.6.so
  40139000 (4 KB)        rw-p (00:0c 99823)    /lib/libdl-2.3.6.so
  4013a000 (132 KB)      r-xp (00:0c 100427)   /opt/fdo/lib/libXfont.so.1.4.1
  4015b000 (28 KB)       ---p (00:0c 100427)   /opt/fdo/lib/libXfont.so.1.4.1
  40162000 (12 KB)       rw-p (00:0c 100427)   /opt/fdo/lib/libXfont.so.1.4.1
  40165000 (8 KB)        r-xp (00:0c 100422)   /opt/fdo/lib/libfontcache.so.0.0.0
  40167000 (32 KB)       ---p (00:0c 100422)   /opt/fdo/lib/libfontcache.so.0.0.0
  4016f000 (4 KB)        rw-p (00:0c 100422)   /opt/fdo/lib/libfontcache.so.0.0.0
  40170000 (8 KB)        r-xp (00:0c 100417)   /opt/fdo/lib/libXau.so.6.0.0
  40172000 (28 KB)       ---p (00:0c 100417)   /opt/fdo/lib/libXau.so.6.0.0
  40179000 (4 KB)        rw-p (00:0c 100417)   /opt/fdo/lib/libXau.so.6.0.0
  4017a000 (76 KB)       r-xp (00:0c 100385)   /opt/fdo/lib/libz.so.1.2.3
  4018d000 (32 KB)       ---p (00:0c 100385)   /opt/fdo/lib/libz.so.1.2.3
  40195000 (4 KB)        rw-p (00:0c 100385)   /opt/fdo/lib/libz.so.1.2.3
  40196000 (456 KB)      r-xp (00:0c 99850)    /lib/libm-2.3.6.so
  40208000 (28 KB)       ---p (00:0c 99850)    /lib/libm-2.3.6.so
  4020f000 (4 KB)        r--p (00:0c 99850)    /lib/libm-2.3.6.so
  40210000 (4 KB)        rw-p (00:0c 99850)    /lib/libm-2.3.6.so
  40211000 (1032 KB)     r-xp (00:0c 99893)    /lib/libc-2.3.6.so
  40313000 (28 KB)       ---p (00:0c 99893)    /lib/libc-2.3.6.so
  4031a000 (8 KB)        r--p (00:0c 99893)    /lib/libc-2.3.6.so
  4031c000 (12 KB)       rw-p (00:0c 99893)    /lib/libc-2.3.6.so
  4031f000 (8 KB)        rw-p (00:00 0)
  40321000 (600 KB)      rw-s (00:0c 100144)   /dev/fb0
  be97c000 (84 KB)       rwxp (00:00 0)        [stack]
  mapped:   4924 KB writable/private: 488 KB shared: 600 KB

If i'm reading these results correctly, the bulk of the memory is taken by shared X libraries and system libraries, which will be reused by all X further applications in the system. The rest is quite small.

I don't know you, but it seems pretty good to me so far.

[edit] Open problems

Now, on to the bad news: it doesn't quite work yet.

I am pointing the finger at 2 problems, both of which seem to originate from OSD-specific stuff.

1) The server tries to use /devt/tty0 ... we have this in our /dev , but actually trying to use it gives a "No such device" error.
All things related to terminals for some reason make me nauseous these days, so i just hacked it through by deleting the old /dev/tty0 and symlinking it to dev/ttyS0. Also i had to comment a piece in the server init where it tried to ioctl VT_ACTIVATE on it.
Anyone knows why the error on /dev/tty0 happens ?
/dev/ttyX are the pseudo-terminals normally used on monitors. I doubt they're enabled in the kernel. VT_ACTIVATE, if I remember correctly, switches the active virtual terminal, so is of course not going to work on a serial tty. The server can, I suspect, be compiled without virtual terminal support.Derobert 00:41, 24 February 2007 (CST)
2) The really thorny issue however is that of getting our framebuffer driver and xserver to agree on a decent resolution and other screen parameters and be able to use it.
For some reason the itfb framebuffer driver we use is extremely picky on which parameters if wants to accept from the FBIOPUT_VSCREENINFO ioctl, and I'm still trying to convince the server to pass the right ones.

You can see the progress I made so far in the screenshot at the bottom of this page. Ugly, eh ?

We're not really there yet, but hello world runs. And where there is hello world, there's hope !

Any comments, ideas etc are welcome. I would really want to bring the discussion on actually using real X on the OSD, so that we can leverage the huge amount of X based applications out there.

[edit] How to build it yourself

Here's a script and patches that you can copy inside a Scratchbox environment (details here and here)

  https://svn.neurosaudio.com/hackers/nerochiaro/xserver

Check out that directory inside sbox, then run the script in there and it will hopefully spit out an X server in a subdir called _packaging. You copy whatever is in there on the OSD under some dir (remeber to add the path to the libraries to LD_LIBRARY_PATH).

To run it, use these arguments:

  vt0 -screen 320x240

That's the only command line that it accepts for me. If it gives you an error about /dev/tty0, you need to remove /dev/tty0 and symlink /dev/ttyS0 in its place.

[edit] Screenshots

06-Jan-2006: Screen resolution troubles
06-Jan-2006: Screen resolution troubles
Personal tools