fcmr's picture

OpenTK + Fedora

Does OpenTK actually work on Fedora systems? I have had a few people I work with reporting strange issues and I'm not sure if it's related to Fedora, how mono is set up or the overall structure.

This is the basic error:

Unhandled Exception: System.TypeInitializationException: An exception was thrown by the type initializer for OpenTK.Graphics.DisplayDevice ---> System.TypeInitializationException: An exception was thrown by the type initializer for OpenTK.Platform.X11.X11XrandrDisplayDevice ---> System.ArgumentOutOfRangeException: Must be greater than zero.
Parameter name: width

It's really strange and we can't pinpoint it. The funny thing is that the software seems to work in Windows, Mac OSX, Gentoo Linux and several other flavors but not Fedora.

I don't really have a lot of information to go on and I'll take what I can get.



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

Can you please find out the exact version of Fedora, Xorg and video card / drivers in use?

OpenTK relies on the XRandR protocol to obtain information about available display devices and it seems that this specific implementation is either returning invalid data (a monitor with width = 0). It is relatively easy to turn off monitor detection when OpenTK receives invalid data, but it would be nice to pinpoint the exact culprit before adding any workarounds.

fcmr's picture

Those affected were using the 32-bit version of Fedora 11.

The Xorg version should be the latest fetchable via yum (in this case

The video card was an ATI powered by the open source drivers (I'm unsure of the exact versions).

Hope this helps.

the Fiddler's picture

Thank you, I am downloading a version of Fedora 11 to test with. OpenTK is tested and known to work on Arch, Gentoo, Debian, Ubuntu, (open)SUSE and RHEL. I have also used it successfully on older Fedora versions, but this distribution is not tested regularly as it contains way too much unstable software for its own good.

fcmr's picture

Out of curiosity, why does OpenTK rely the XRandR protocol?

Oh, if you have a quick and dirty fix I'd appreciate it if you share. :)

Thanks again for looking into this.

the Fiddler's picture

XRandR provides a way to query available display devices and control their resolutions. It is used by the DisplayDevice class (which is used by the GameWindow constructor, in turn). It is an essential part of OpenTK and a broken XRandR implementation is bound to cause problems.

I don't think this can be worked around without modifying OpenTK (if I had an easy solution, I'd have posted it). I have installed a Fedora virtual machine, but it is still installing updates after a whole day (haven't had a chance to even install mono).

Edit: I cannot confirm the issue. The samples included in Examples.exe 0.9.8-1 seem to work fine on Fedora 11.

Which version of OpenTK are you using?

fcmr's picture

Now that you mention it, I don't know if they tried running any of the samples. I'll have them do that and see what happens.

We are using OpenTK 0.9.9-0 by the way...

the Fiddler's picture

I just tested 0.9.9-0 and it seems to behave identically to 0.9.8-1 in this regard. You could be hitting a driver or Xorg bug.

Are you using multiple monitors?

fcmr's picture

One of my team got back to me. He tried running the Examples.exe and got the same error as reported above.

So I'm thinking it might be what you said, a driver or Xorg bug or something else along those lines.

You mentioned multiple monitors... I just recalled he was using a laptop. Could that be the problem?

the Fiddler's picture

I doubt it, but I don't have any way to test that (I am using a virtual machine for Fedora and the OS cannot access the actual monitor).

Two suggestions:

  • Try running "xrandr" from a terminal. If XRandR is working correctly, this command should return a list of supported resolutions. Try switching resolutions with "xrandr -s n", where n is a number like 0, 1, 2, ... (0 restores the original resolution).
  • If the above fails, you should definitely log a bug report against the video card drivers. Ati's OSS developers are pretty good in fixing issues like this.

Edit: Fedora 11 shipped with unstable OSS drivers for Ati. To give you an idea of how unstable, they used code that wouldn't be merged to mainline for at least 6 more months.

Fedora has always been notorious for shipping bleeding edge software, but this specific release was pretty reckless: experimental Xorg, Mesa and kernel DRM versions, various WIP branches for Radeon and Nouveau... Hopefully, 3d drivers will be much more stable once Fedora 12 comes around.

fcmr's picture

Should have thought of running "xrandr" from the terminal. It led us to:

strange "0x0" mode in xrandr mode list --> https://bugs.launchpad.net/ubuntu/+source/linux/+bug/398188
"0x0" mode in xrandr mode list with KMS --> https://bugs.freedesktop.org/show_bug.cgi?id=22778

Also of note is --> https://bugzilla.redhat.com/show_bug.cgi?format=multiple&id=497070 <-- especially comment #16

Looks to be a kernel issue.