aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmil Velikov2015-03-06 18:58:39 -0600
committerEmil Velikov2015-03-10 13:14:40 -0500
commit0ca03a4087a550646de7f26b6b53a932e8546474 (patch)
tree38eb3eca83bdd1260767a437b1482a6d5bd9c736 /xf86drm.h
parentb374a59e0e2ef52fed737f6db9ee1e40caca46ea (diff)
downloadexternal-libdrm-0ca03a4087a550646de7f26b6b53a932e8546474.tar.gz
external-libdrm-0ca03a4087a550646de7f26b6b53a932e8546474.tar.xz
external-libdrm-0ca03a4087a550646de7f26b6b53a932e8546474.zip
drm: add drmGet(Primary|Render)DeviceNameFromFd functions
Currently most places assume reliable primary(master) <> render node mapping. Although this may work in some cases, it is not correct. Add a couple of helpers that hide the details and provide the name of the master or render device name, given an fd. The latter may belong to either the master, control or render node device. v2: - Rename Device and Primary to Master (aka the /dev/dri/cardX device). - Check for the file via readdir_r() rather than stat(). - Wrap the check into a single function. - Return NULL for non-linux platforms. v3: - Don't segfault if name is NULL. - Update function names, as suggested by Frank Binns. v4: - Update commit message to reflect the function name changes. Cc: Frank Binns <frank.binns@imgtec.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: David Herrmann <dh.herrmann@googlemail.com> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Diffstat (limited to 'xf86drm.h')
-rw-r--r--xf86drm.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/xf86drm.h b/xf86drm.h
index afd38a10..40c55c92 100644
--- a/xf86drm.h
+++ b/xf86drm.h
@@ -749,6 +749,9 @@ extern int drmGetNodeTypeFromFd(int fd);
749extern int drmPrimeHandleToFD(int fd, uint32_t handle, uint32_t flags, int *prime_fd); 749extern int drmPrimeHandleToFD(int fd, uint32_t handle, uint32_t flags, int *prime_fd);
750extern int drmPrimeFDToHandle(int fd, int prime_fd, uint32_t *handle); 750extern int drmPrimeFDToHandle(int fd, int prime_fd, uint32_t *handle);
751 751
752extern char *drmGetPrimaryDeviceNameFromFd(int fd);
753extern char *drmGetRenderDeviceNameFromFd(int fd);
754
752#if defined(__cplusplus) || defined(c_plusplus) 755#if defined(__cplusplus) || defined(c_plusplus)
753} 756}
754#endif 757#endif