tomba/kmsxx

Ability to open DRI card by name

Closed this issue · 4 comments

On systems with more than one graphics card, the main way to identify them at runtime is to refer to their well-known names. This takes the form of using drmOpen(name) rather than directly calling open("/dev/dri/cardXXX").

kms::Card does not currently offer a constructor that maps to drmOpen(). Would a patch to add it be well-received?

tomba commented

What are "well-known" names? I haven't really used drmOpen() much.

I think one clear addition to Card would be a constructor that takes an fd. Then one can use any way he wants to find and open the DRM device.

Probably there can't be a constructor that uses drmOpen (due to similar parameters for other constructors). But a static helper function should be fine.

The well-known name is the thing returned by kms::Card::version().name right now.

On a desktop system, it's going to basically be the name of your kernel DRM driver. Something like "i915" or whatnot. On an embedded system it can either be that (if you have a no-frills KMS implementation) or something fancier that you've configured in DeviceTree to allow uniquely identifying one of many graphics devices.

tomba commented

Closing, as this was merged quite a while ago...