Page 1 of 1

Linux compatibility layer for porting proprietary drivers?

Posted: Tue Aug 11, 2009 9:12 am
by AndrewAPrice
I was thinking, if the proprietary NVidia drivers link with the Linux kernel symbols on your system, then would it be possible, to say, imitate the functionality of these symbols and link with them instead? Then doing the same with libGLcore.so, so it just has enough functionality to communicate back and forth with /dev/nvidiactl and /dev/nvidia0.

As my OS is a microkernel, so the driver will be running in userland, it should be possible for me to set up a fake Linux-like compatibility layer. The overhead of the compatibility layer ("efficiently done" that is) should outweigh the benefits of having 3D accelleration.

Any thoughts?

Re: Linux compatibility layer for porting proprietary drivers?

Posted: Tue Aug 11, 2009 9:31 am
by gravaera
Seeing as I'm actually interested directly in porting things like drivers, I'd simply suggest that for drivers that imply the user would want full, absolute performance, you should probably put some work into it and actually port it fully to your OS.

Re: Linux compatibility layer for porting proprietary drivers?

Posted: Tue Aug 11, 2009 9:48 am
by Brynet-Inc
gravaera wrote:Seeing as I'm actually interested directly in porting things like drivers, I'd simply suggest that for drivers that imply the user would want full, absolute performance, you should probably put some work into it and actually port it fully to your OS.
Didn't notice he said "proprietary" eh? Nvidia's Linux driver is not open source.. thus you cannot "fully port" it.

I do not believe a Linux compatibility layer for kernel modules is realistic either, even if you manage to satisfy the requirements of the Nvidia blob.. the higher level API that is exposed to the X server is also likely undocumented.

A lot of effort has gone into the Nouveau project.. you may be able to gleam enough information from that, or the accelerated 2D drivers from Xorg or Haiku (..as done by JamesM).

Re: Linux compatibility layer for porting proprietary drivers?

Posted: Tue Aug 11, 2009 10:34 am
by gravaera
Oh right. I did kind of gloss over that part. :? Come to think of it, the Linux source, (I finally started going through it yesterday. Started from <root>/arch/x86/boot) is extraordinarily helpful! I mean...I just started going through yesterday and already I've had like... tons of questions answered.

It might even be a good idea to advise newcomers to RTFSource. =P~ Honestly, it was like...amazingly helpful.

Re: Linux compatibility layer for porting proprietary drivers?

Posted: Wed Aug 19, 2009 4:56 pm
by Kitsune
Can't comment on difficulty, really (I'd guess somewhere in the range of 'extremely hard' to 'blood shooting out of your eyes'), but it should be possible. Some developers have done a similar thing to add support to the Linux kernel (via a third party module, mind you) for Windows NDIS binary drivers, and at least for some drivers it works rather well (I know I had to use it in the past) so the concept isn't really all that crazy.

Although, even if you get it working, you shouldn't expect all that great stability or performance (compared to running natively, of course). It sounds like it'd be a fun-yet-challenging project... I'd say give it a shot, it's not like you can't dump it later if it turns out to not be practical (and maybe you'll learn something!).


As an alternative, you could try porting Gallium3D, which'll eventually get you support for Intel/Cell for mostly free (IIRC,both are currently supported), and eventually Radeon and (if Nouveau pulls it off) nVidia. Gallium3D was actually designed to be a framework to ease the development of graphics drivers that should run on multiple platforms.