Jump to content

Drivers (Modules) in Linux


Recommended Posts

Hey everyone I have a question (*sets up the Cooper beacon*)

In regards to linux/unix, let's say you have some crap video card.. from some unknown company.. They have some backwards driver that's not written to work with x11... and x11 has no idea about it.. what will it do? Will it load a generic driver for you and hope for the best? Will x11 just not start, and you're presented with a console?

Also... How does x11 search for the graphics card driver that you need. So let's say again, you have a lesser known graphics card. Is there a stored library of drivers installed on linux that has a list of all drivers? OR, does the card present the driver to x11 in software upon install? It seems like storing a massive list of drivers on linux is a huge waste of space since you'll probably only need to use one or two of them...

Link to comment
Share on other sites

some backwards driver that's not written to work with x11... and x11 has no idea about it.. what will it do?

Unless someone tells you or you read and grok the source code, it could do anything from making the card work to brewing your coffee to turning your computer into a brick.

Will it load a generic driver for you and hope for the best? Will x11 just not start, and you're presented with a console?

There's something of a protocol at play. X11, when it loads a graphics driver, will assume certain operations are implemented within this library and it will try to invoke them. Some operations are optional (optimised/accelerated versions of operations for instance), some aren't. If any of the required operations are missing, it will (attempt to) unload the library and possibly present you with an error in its log file.

Also... How does x11 search for the graphics card driver that you need. So let's say again, you have a lesser known graphics card. Is there a stored library of drivers installed on linux that has a list of all drivers?

In a way, yes, it does have that. When you install X11 you would normally install one or more graphics adapter drivers. Depending on your distro that can be all of them, none of them or some value in between. When you install 0, X won't be able to start (but since you have all the drivers you could start an X11 program and, using the DISPLAY environment variable, have a different machine's X11 draw the window(s) of this program on its screen).

Some drivers are fairly specific (AMD, NVidia, Intel...) and some are rather more generic (fb, vga...). Some distro's like Gentoo require you to specify which you want so it'll only install those, reducing compilation time. For many other distro's it's just a bit of harddisk space wasted which very few people care about.

I would assume one of the functions in a graphics driver is some sort of init method that will check if a supported piece of hardware is on your system and report this back to the main X11 program. X11 invokes this on each of the drivers it finds (on my system they're in /usr/lib64/xorg/modules/drivers) and can then select 1 of the drivers from the set that did detect their hardware.

OR, does the card present the driver to x11 in software upon install? It seems like storing a massive list of drivers on linux is a huge waste of space since you'll probably only need to use one or two of them...

The card cannot provide the OS with its driver because you need a driver to talk to the device. Chicken vs egg problem.

You typically have a combination of kernel support, where a driver detects a graphics adapter at a very, very low level (like PCI enumeration) and exposes an interface to userland. Your X11 driver for that card knows which operations are exposed by this kernel driver and hand in hand they make it work.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...