drm: add interface to get drm devices on the system v3

Graphics / Mesa 3D Graphics Library / libdrm - Emil Velikov [gmail.com] - 24 August 2015 11:36 UTC

For mutiple GPU support, the devices on the system should be enumerated to get necessary information about each device, and the drmGetDevices interface is added for this. Currently only PCI devices are supported for the enumeration.

Typical usage: int count; drmDevicePtr *foo; count = drmGetDevices(NULL, 0); foo = calloc(count, sizeof(drmDevicePtr)); count = drmGetDevices(foo, count); /* find proper device, open correct device node, etc */ drmFreeDevices(foo, count); free(foo);

v2: [Jammy Zhou]- return a list of devices, rather than nodes
v3: [Jammy Zhou]- fix the signed extension for PCI device info

b556ea1 drm: add interface to get drm devices on the system v3
xf86drm.c | 351 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
xf86drm.h | 34 ++++++
2 files changed, 385 insertions(+)

Upstream: cgit.freedesktop.org


  • Share