xf86drm: add drmGetNodeTypeFromDevId
This is useful to figure out whether the dev_t refers to a primary node or a render node. Indeed, drmGetDeviceFromDevId returns a drmDevice, which holds both the primary and render nodes. Signed-off-by: Simon Ser <contact@emersion.fr>main
parent
6acadd495c
commit
15b7fbf3e7
|
@ -70,6 +70,7 @@ drmGetLibVersion
|
||||||
drmGetLock
|
drmGetLock
|
||||||
drmGetMagic
|
drmGetMagic
|
||||||
drmGetMap
|
drmGetMap
|
||||||
|
drmGetNodeTypeFromDevId
|
||||||
drmGetNodeTypeFromFd
|
drmGetNodeTypeFromFd
|
||||||
drmGetPrimaryDeviceNameFromFd
|
drmGetPrimaryDeviceNameFromFd
|
||||||
drmGetRenderDeviceNameFromFd
|
drmGetRenderDeviceNameFromFd
|
||||||
|
|
17
xf86drm.c
17
xf86drm.c
|
@ -4687,6 +4687,23 @@ drm_public int drmGetDeviceFromDevId(dev_t find_rdev, uint32_t flags, drmDeviceP
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
drm_public int drmGetNodeTypeFromDevId(dev_t devid)
|
||||||
|
{
|
||||||
|
int maj, min, node_type;
|
||||||
|
|
||||||
|
maj = major(devid);
|
||||||
|
min = minor(devid);
|
||||||
|
|
||||||
|
if (!drmNodeIsDRM(maj, min))
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
node_type = drmGetMinorType(maj, min);
|
||||||
|
if (node_type == -1)
|
||||||
|
return -ENODEV;
|
||||||
|
|
||||||
|
return node_type;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get information about the opened drm device
|
* Get information about the opened drm device
|
||||||
*
|
*
|
||||||
|
|
|
@ -919,6 +919,13 @@ extern int drmGetDevices2(uint32_t flags, drmDevicePtr devices[], int max_device
|
||||||
|
|
||||||
extern int drmGetDeviceFromDevId(dev_t dev_id, uint32_t flags, drmDevicePtr *device);
|
extern int drmGetDeviceFromDevId(dev_t dev_id, uint32_t flags, drmDevicePtr *device);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the node type (DRM_NODE_PRIMARY or DRM_NODE_RENDER) from a device ID.
|
||||||
|
*
|
||||||
|
* Returns negative errno on error.
|
||||||
|
*/
|
||||||
|
extern int drmGetNodeTypeFromDevId(dev_t devid);
|
||||||
|
|
||||||
extern int drmDevicesEqual(drmDevicePtr a, drmDevicePtr b);
|
extern int drmDevicesEqual(drmDevicePtr a, drmDevicePtr b);
|
||||||
|
|
||||||
extern int drmSyncobjCreate(int fd, uint32_t flags, uint32_t *handle);
|
extern int drmSyncobjCreate(int fd, uint32_t flags, uint32_t *handle);
|
||||||
|
|
Loading…
Reference in New Issue