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>
drmGetLock
drmGetMagic
drmGetMap
+drmGetNodeTypeFromDevId
drmGetNodeTypeFromFd
drmGetPrimaryDeviceNameFromFd
drmGetRenderDeviceNameFromFd
#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
*
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 drmSyncobjCreate(int fd, uint32_t flags, uint32_t *handle);