Howto to get openGL working on Debian (for Google Earth)

3D drivers (openGL) have awlays been a source of problem on Linux.
A lot of people just don’t care, since they don’t use there computer
to play games. But yesterday, something change this fact: Google released
a native version of Google Earth for Linux[1]. As I already played with
Google Earth before, I really want to test this new toy.[2]

Fine, except that I’m unable to get hardware openGL working and Google Earth is
really slow, so I decided to fix that. (done on two computers..)

1) Configure your kernel

Be sure to have AGP (Device drivers->Character device) and DRM (Device
drivers ->Graphic drivers) enabled for your card. Now rebuild it using
the usual way.. and reboot.

After the boot look at dmesg, you should find something like this:

agpgart: Detected 892K stolen memory.
agpgart: AGP aperture is 128M @ 0xf0000000
[drm] Initialized drm 1.0.1 20051102
...
[drm] Initialized i915 1.4.0 20060119 on minor 0
[drm] Initialized i915 1.4.0 20060119 on minor 1
(If you have a Dell computer like D400 with Intel 855GM, you need to
choose the i915 driver for DRM, edit the linux/.config since it doesn’t
appear in common menuconfig)

2) Install the latest Xorg

This is the tricky part, since Xorg update are not really easy this days.

sudo apt-get install xserver-xorg

Let’s go, for a long update… (I’m switching from 6.9 to Xorg 7.0)..
I spent a little time to fix some errors here.. but nothing really important.

3) Install Mesa

Now, you need to install the openGL libs, simple apt-get this packages:

  • xlibmesa-dri
  • xlibmesa-gl
  • xlibmesa-glu
  • mesa-utils
  • libgl1-mesa-dri
  • libgl1-mesa-glx

4) Tests

Start your Xserver, and look in /var/log/Xorg.0.log, you should fine stuff like
this:

(II) I810(0): [drm] created "i915" driver at busid "pci:0000:00:02.0"
(II) I810(0): [drm] added 8192 byte SAREA at 0xe0b2f000

So we can test check with glxinfo

display: :0  screen: 0
direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.2

Be sure to have direct rendering ok.. if this is ok, .. you can start glxgears..
and Google Earth :) ..

http://jkx.larsen-b.com/photos/blog/google_earth.sized.jpg

5) Issues

Some users have some trouble w/ DRI not working with strange messages
( sizeof(I830DRIRec) does not match …), or strange display updates (out of syncr
windows .. ). This seems to be bugs in Mesa, you can try the latest experimental
(which fix all issues for me). Simply install this packages:

  • libgl1-mesa-dri_6.5.0.cvs
  • libglu1-mesa_6.5.0.cvs
  • libgl1-mesa-glx_6.5.0.cvs
  • Update: Added issues w/ my Dell Latitude D400

    Update2: The latest mesa from the Debian SID is working right now (no more experimental)



    Related Posts

    30 thoughts on “Howto to get openGL working on Debian (for Google Earth)

    1. I have a intel 915 card and glxgears works fine (615 fps) but GoogleEarth is very slow. I get the following:

      $ googleearth
      libGL warning: 3D driver claims to not support visual 0x23
      libGL warning: 3D driver claims to not support visual 0x25
      libGL warning: 3D driver claims to not support visual 0x27
      libGL warning: 3D driver claims to not support visual 0x29
      libGL warning: 3D driver claims to not support visual 0x2b
      libGL warning: 3D driver claims to not support visual 0x2d
      libGL warning: 3D driver claims to not support visual 0x2f
      libGL warning: 3D driver claims to not support visual 0x31
      do_wait: drmWaitVBlank returned -1, IRQs don't seem to be working correctly.
      Try running with LIBGL_THROTTLE_REFRESH and LIBL_SYNC_REFRESH unset.
      

      Neither LIBGL_THROTTLE_REFRESH nor LIBL_SYNC_REFRESH is set…

      I’m running gentoo though. http://panela.blog-city.com/googleearth_on_linux__give_me_back_my_web.htm

    2. dh check the link, you will find a answer:

      export LIBGL_ALWAYS_INDIRECT=true

      I don’t have this issue on my i915, I guess you missed something..

    3. Jkx,
      after "export LIBGL_ALWAYS_INDIRECT=true" GE say that it running with opengl mod with software emulation and works wery slow.

      and glxgears slow too.. and $ glxinfo say direct rendering: No

    4. If you do my step by step config, you doesn’t need to use the indirect hack. This is for broken one..

    5. Same problem here: (i915)

      do_wait: drmWaitVBlank returned -1, IRQs don’t seem to be working correctly.

      Try running with LIBGL_THROTTLE_REFRESH and LIBL_SYNC_REFRESH unset.

      > If you do my step by step config, you doesn’t need to use the indirect hack. This is for broken one..

      No, this isn’t true – the problem still exists, even with cvs-debian-packages from expermiental. All prerequisites are okay though.

      Nico

      • Hum, which kernel are you using ? (mesa-cvs require at least 2.6.16)
      • Are you sure DRM/DRI is enable (check the messages/log..)

      This is really working fine for me.

    6. Hi
      The log file "Xorg.0.log" says I have the wrong version of the i915 kernel module:

      (II) I810(0): [drm] DRM interface version 1.2
      (II) I810(0): [drm] created "i915" driver at busid "pci:0000:00:02.0"
      (II) I810(0): [drm] added 8192 byte SAREA at 0xf8bdd000
      (II) I810(0): [drm] mapped SAREA 0xf8bdd000 to 0xb78b5000
      (II) I810(0): [drm] framebuffer handle = 0xc0020000
      (II) I810(0): [drm] added 1 reserved context for kernel
      (EE) I810(0): [dri] I830DRIScreenInit failed because of a version mismatch.
      [dri] i915 kernel module version is 1.1.0 but version 1.4 or greater is needed.
      [dri] Disabling DRI.
      (II) I810(0): [drm] removed 1 reserved context for kernel
      (II) I810(0): [drm] unmapping 8192 bytes of SAREA 0xf8bdd000 at 0xb78b5000

      I have no idea how to correct this problem. Any help whatsoever gratefully received.
      Nick

    7. Nick: You are using the wrong kernel module for your card. Check /usr/src/linux/.config and be sure you enable the i915 module (not the i810.. the kernel config setup seems to be buggy about this stuff)

    8. Direct rendering is now ON after I did two things:

      1. installed kernel 2.6.16 (from sid/unstable);

      2. installed these three mesa packages (from experimental):

      libgl1-mesa-dri_6.5.0.cvs

      libglu1-mesa_6.5.0.cvs

      libgl1-mesa-glx_6.5.0.cvs

      Thanks very much!!

    9. I’ve had the “drmWaitVBlank returned -1″ problem here, also (In a Dell Latitude 120L). glxinfo is ok and glxgears was around 1000fps. However, Google Earth was drawing the screen only once every 3 seconds, hence totally unusable.

      Debugging the problem, I’ve found that the vblank_wait() function in the i915 module was always returning error, but only after a timeout. I’ve changed the function to always return error, here, and now Google Earth is working. This is only a hack, as it simply make vblank_wait() not work anymore, even on machines where it was working, but it may solve the problem for some people. Here is the hack:


      diff --git a/drivers/char/drm/i915_irq.c b/drivers/char/drm/i915_irq.c
      index d3879ac..f1a8cea 100644
      --- a/drivers/char/drm/i915_irq.c
      +++ b/drivers/char/drm/i915_irq.c
      @@ -117,6 +117,8 @@ int i915_driver_vblank_wait(drm_device_t
              unsigned int cur_vblank;
              int ret = 0;

      +      return DRM_ERR(EINVAL);
      +
              if (!dev_priv) {
                      DRM_ERROR("%s called with no initialization ", __FUNCTION__);
                      return DRM_ERR(EINVAL);

      Good luck.  :)

    10. Try this:

      —- cut here —-

      #include

      #include

      #include

      #define DELAY 33333

      int drmWaitVBlank(void)

      {

      static struct timeval last = { 0, 0 };

      static struct timeval now  = { 0, 0 };

      int udiff;

      gettimeofday(&now, NULL);

      udiff = (int)now.tv_usec – (int)last.tv_usec;

      if (udiff < 0)

      udiff += 1000000;

      udiff -= DELAY;

      if (udiff < 0)

      usleep(-udiff);

      memcpy(&last, &now, sizeof(struct timeval));

      return 0;

      }

      —- cut here —-

      Save this text as drm_nowaitVblank.c, then compile it:

      gcc -o drm_nowaitVblank.so -shared -fPIC -ldl drm_nowaitVblank.c

      Copy the file drm_nowaitVblank.so to a directory where GoogleEarth is installed (where googleearth-bin is located).

      Edit file googleearth and change

      # Let’s boogie!

      if [ -x "${GOOGLEEARTH_DATA_PATH}/googleearth-bin" ]

      then

      cd “${GOOGLEEARTH_DATA_PATH}/”

      exec “./googleearth-bin” $*

      fi

      to

      # Let’s boogie!

      if [ -x "${GOOGLEEARTH_DATA_PATH}/googleearth-bin" ]

      then

      cd “${GOOGLEEARTH_DATA_PATH}/”

      LD_PRELOAD=”./drm_nowaitVblank.so” exec “./googleearth-bin” $*

      fi

    11. You may try to adjust speed by DELAY, it is in microseconds. But remember that very short delay will make Google Earth to calculate new position more frequently and this may saturate X server with too many redraw requests. It might be that you can find some optimal DELAY value for your machine. A good thing is to run “top” in terminal window and see how googleearth-bin and X server use CPU to find the best balance.

      Good luck!

    12. Hi people, i am also having trouble setting this up, here is my current system status:

      dfuentes@raziel:~$ dmesg |grep agp

      Linux agpgart interface v0.101 (c) Dave Jones

      agpgart: Detected an Intel 915GM Chipset.

      agpgart: Detected 7932K stolen memory.

      agpgart: AGP aperture is 256M @ 0xb0000000

      dfuentes@raziel:~$ dmesg |grep drm

      [drm] Initialized drm 1.0.1 20051102

      [drm] Initialized i915 1.4.0 20060119 on minor 0

      dfuentes@raziel:~$ glxinfo

      name of display: :0.0

      display: :0  screen: 0

      direct rendering: No

      server glx vendor string: SGI

      server glx version string: 1.2

      I am using the mesa packages from the Testing branch of Debian; and it just seems not to do anything… i am currently trying to download the cvs ones from Experimental just as nick did; but i am having trouble finding the correct apt mirrors.

      Any pointers that anyone can give me?

    13. I just updated the mesa packages just as nick did and no cigar…. i forgot to post this info before:

      dfuentes@raziel:~$ uname -a

      Linux raziel 2.6.17.3 #1 PREEMPT Fri Jun 30 14:56:32 CDT 2006 i686 GNU/Linux

      dfuentes@raziel:~$ lspci

      00:00.0 Host bridge: Intel Corporation Mobile 915GM/PM/GMS/910GML Express Processor to DRAM Controller (rev 03)

      00:02.0 VGA compatible controller: Intel Corporation Mobile 915GM/GMS/910GML Express Graphics Controller (rev 03)

      X.org ver 7.0.22

      It is an IBM T43 Laptop

      Thanks in advance for any help

    14. You must use Mesa from experimental (-cvs version). Even the unstable version doesn’t support the i915 chipset well.

    15. Actually i have the cvs version of Mesa installed since my second post, i was not explicit enough about that.

      I am trying to set this up in order to play games with cedega and Google Earth as well of course, any other suggestions?

    16. Solved it, i had to create a link like this:

      root@raziel:/usr/X11R6/lib/modules/dri# ln -s /usr/lib/dri/i915_dri.so ./i915_dri.so

      Otherwise X.org didnt fint the dri module now my shiny glxinfo looks like this:

      dfuentes@raziel:~$ glxinfo

      name of display: :0.0

      libGL: XF86DRIGetClientDriverName: 1.5.1 i915 (screen 0)

      libGL: OpenDriver: trying /usr/X11R6/lib/modules/dri/i915_dri.so

      drmOpenByBusid: Searching for BusID pci:0000:00:02.0

      drmOpenDevice: node name is /dev/dri/card0

      drmOpenDevice: open result is 4, (OK)

      drmOpenByBusid: drmOpenMinor returns 4

      drmOpenByBusid: drmGetBusid reports pci:0000:00:02.0

      libGL error:

      Can’t open configuration file /etc/drirc: No such file or directory.

      display: :0  screen: 0

      direct rendering: Yes

      server glx vendor string: SGI

      server glx version string: 1.2

      server glx extensions:

    17. I also struggled with direct rendering being off on a different system. In my environment, teh solution was trivial, but hard to guess: adding the following lines to xorg.conf:

      Section "DRI"
      Mode 0666
      EndSection

      (Perhaps, this note can help someone. Probably that’s a problem of my environment and permission managing there.)

      IZ

    18. try switching off xinerama in case u use it in /etc/X11/xorg.conf

      to enable direct rendering, helped on my i915

      cya

    19. Needed 3d accelaration for GoogleEarth also, and managed to get it working by updating the libraries mentioned in the article, upgrading the kernel from 2.6.15-1 to 2.6.17-2 and uncommenting the Section "DRI" Mode 0666 EndSection in xorg.conf. I am running debian testing, with an embedded i82865G on an Asus Terminator 2 box. Thanks for helping!

    20. How do I even tell if Google Earth is utilizing my 3d hardware?

      Though I don’t know whether it’s using it or not, it did speed up a lot when I switched to "16-bit color" mode

    21. hi! i want to start google earth in opengl mode on my laptop i have installed googleeath but it does not work in open gl mode.please guide me.

    22. Hi, I don’t have a /usr/src/linux folder. I’m running Debian Etch and the only folders there are linux-headers-2.6.18-4 linux-headers-2.6.18-4-686 linux-kbuild-2.6.18. Can’t find .config! Still at beginning of steps; Only i810; haven’t enabled i915 in X server or DRI/DRM.

    23. Hi, I had the same
      "do_wait: drmWaitVBlank returned -1, IRQs don’t seem to be working correctly.
      Try running with LIBGL_THROTTLE_REFRESH and LIBL_SYNC_REFRESH unset."
      problem with google earth after going from kernel.org 2.6.18.1 to 2.6.22.6. I have a Tecra A4 (i915).

      After much tinkering with kernel options (I already had irq problems in this computer before, which prevented the USB mouse to work), I found the ones that work for me.

      I had this with 2.6.18.1:

      kernel /boot/vmlinuz-2.6.18.1 root=/dev/sda3 ro idebus=66 vga=791 irqpoll pci=assign-busses

      which worked ok.

      This (and several others) got me the error with google earth, (no irq options)

      kernel /boot/vmlinuz-2.6.22.6 root=/dev/sda3 ro idebus=66 vga=791 video=intelfb:mode=1280×800,accel,drm

      These (and several others) worked, but with very sloppy performance:

      kernel /boot/vmlinuz-2.6.22.6 root=/dev/sda3 ro idebus=66 vga=791 video=intelfb:mode=1280×800,accel,drm irqpoll pci=assign-busses

      What finally worked fine was:

      kernel /boot/vmlinuz-2.6.22.6 root=/dev/sda3 ro idebus=66 vga=791 video=intelfb:mode=1280×800,accel,drm pci=assign-busses routeirq acpi=noirq

      (note: maybe you don’t need all of them; try only the acpi=noirq first. I need the routeirq or my USB mouse doesn’t turn on).

      BR,

      Joao S Veiga

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>