Lines Matching refs:fd

167 drmIoctl(int fd, unsigned long request, void *arg)  in drmIoctl()  argument
172 ret = ioctl(fd, request, arg); in drmIoctl()
177 static unsigned long drmGetKeyFromFd(int fd) in drmGetKeyFromFd() argument
182 fstat(fd, &st); in drmGetKeyFromFd()
186 drmHashEntry *drmGetEntry(int fd) in drmGetEntry() argument
188 unsigned long key = drmGetKeyFromFd(fd); in drmGetEntry()
197 entry->fd = fd; in drmGetEntry()
313 int fd; in drmOpenDevice() local
392 fd = open(buf, O_RDWR, 0); in drmOpenDevice()
394 fd, fd < 0 ? strerror(errno) : "OK"); in drmOpenDevice()
395 if (fd >= 0) in drmOpenDevice()
396 return fd; in drmOpenDevice()
412 fd = open(buf, O_RDWR, 0); in drmOpenDevice()
414 fd, fd < 0 ? strerror(errno) : "OK"); in drmOpenDevice()
415 if (fd >= 0) in drmOpenDevice()
416 return fd; in drmOpenDevice()
439 int fd; in drmOpenMinor() local
461 if ((fd = open(buf, O_RDWR, 0)) >= 0) in drmOpenMinor()
462 return fd; in drmOpenMinor()
481 int fd; in drmAvailable() local
483 if ((fd = drmOpenMinor(0, 1, DRM_NODE_PRIMARY)) < 0) { in drmAvailable()
492 if ((version = drmGetVersion(fd))) { in drmAvailable()
496 close(fd); in drmAvailable()
563 int fd; in drmOpenByBusid() local
573 fd = drmOpenMinor(i, 1, type); in drmOpenByBusid()
574 drmMsg("drmOpenByBusid: drmOpenMinor returns %d\n", fd); in drmOpenByBusid()
575 if (fd >= 0) { in drmOpenByBusid()
583 if (drmSetInterfaceVersion(fd, &sv)) { in drmOpenByBusid()
592 drmSetInterfaceVersion(fd, &sv); in drmOpenByBusid()
594 buf = drmGetBusid(fd); in drmOpenByBusid()
598 return fd; in drmOpenByBusid()
602 close(fd); in drmOpenByBusid()
627 int fd; in drmOpenByName() local
640 if ((fd = drmOpenMinor(i, 1, type)) >= 0) { in drmOpenByName()
641 if ((version = drmGetVersion(fd))) { in drmOpenByName()
644 id = drmGetBusid(fd); in drmOpenByName()
649 return fd; in drmOpenByName()
657 close(fd); in drmOpenByName()
669 if ((fd = open(proc_name, 0, 0)) >= 0) { in drmOpenByName()
670 retcode = read(fd, buf, sizeof(buf)-1); in drmOpenByName()
671 close(fd); in drmOpenByName()
745 int fd = drmOpenByBusid(busid, type); in drmOpenWithType() local
746 if (fd >= 0) in drmOpenWithType()
747 return fd; in drmOpenWithType()
845 drmVersionPtr drmGetVersion(int fd) in drmGetVersion() argument
852 if (drmIoctl(fd, DRM_IOCTL_VERSION, version)) { in drmGetVersion()
864 if (drmIoctl(fd, DRM_IOCTL_VERSION, version)) { in drmGetVersion()
895 drmVersionPtr drmGetLibVersion(int fd) in drmGetLibVersion() argument
916 int drmGetCap(int fd, uint64_t capability, uint64_t *value) in drmGetCap() argument
924 ret = drmIoctl(fd, DRM_IOCTL_GET_CAP, &cap); in drmGetCap()
932 int drmSetClientCap(int fd, uint64_t capability, uint64_t value) in drmSetClientCap() argument
940 return drmIoctl(fd, DRM_IOCTL_SET_CLIENT_CAP, &cap); in drmSetClientCap()
969 char *drmGetBusid(int fd) in drmGetBusid() argument
975 if (drmIoctl(fd, DRM_IOCTL_GET_UNIQUE, &u)) in drmGetBusid()
978 if (drmIoctl(fd, DRM_IOCTL_GET_UNIQUE, &u)) in drmGetBusid()
998 int drmSetBusid(int fd, const char *busid) in drmSetBusid() argument
1006 if (drmIoctl(fd, DRM_IOCTL_SET_UNIQUE, &u)) { in drmSetBusid()
1012 int drmGetMagic(int fd, drm_magic_t * magic) in drmGetMagic() argument
1019 if (drmIoctl(fd, DRM_IOCTL_GET_MAGIC, &auth)) in drmGetMagic()
1025 int drmAuthMagic(int fd, drm_magic_t magic) in drmAuthMagic() argument
1031 if (drmIoctl(fd, DRM_IOCTL_AUTH_MAGIC, &auth)) in drmAuthMagic()
1086 int drmAddMap(int fd, drm_handle_t offset, drmSize size, drmMapType type, in drmAddMap() argument
1096 if (drmIoctl(fd, DRM_IOCTL_ADD_MAP, &map)) in drmAddMap()
1103 int drmRmMap(int fd, drm_handle_t handle) in drmRmMap() argument
1110 if(drmIoctl(fd, DRM_IOCTL_RM_MAP, &map)) in drmRmMap()
1131 int drmAddBufs(int fd, int count, int size, drmBufDescFlags flags, in drmAddBufs() argument
1142 if (drmIoctl(fd, DRM_IOCTL_ADD_BUFS, &request)) in drmAddBufs()
1147 int drmMarkBufs(int fd, double low, double high) in drmMarkBufs() argument
1154 if (drmIoctl(fd, DRM_IOCTL_INFO_BUFS, &info)) in drmMarkBufs()
1163 if (drmIoctl(fd, DRM_IOCTL_INFO_BUFS, &info)) { in drmMarkBufs()
1172 if (drmIoctl(fd, DRM_IOCTL_MARK_BUFS, &info.list[i])) { in drmMarkBufs()
1198 int drmFreeBufs(int fd, int count, int *list) in drmFreeBufs() argument
1205 if (drmIoctl(fd, DRM_IOCTL_FREE_BUFS, &request)) in drmFreeBufs()
1219 int drmClose(int fd) in drmClose() argument
1221 unsigned long key = drmGetKeyFromFd(fd); in drmClose()
1222 drmHashEntry *entry = drmGetEntry(fd); in drmClose()
1225 entry->fd = 0; in drmClose()
1232 return close(fd); in drmClose()
1250 int drmMap(int fd, drm_handle_t handle, drmSize size, drmAddressPtr address) in drmMap() argument
1254 if (fd < 0) in drmMap()
1262 *address = drm_mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, handle); in drmMap()
1285 drmBufInfoPtr drmGetBufInfo(int fd) in drmGetBufInfo() argument
1293 if (drmIoctl(fd, DRM_IOCTL_INFO_BUFS, &info)) in drmGetBufInfo()
1300 if (drmIoctl(fd, DRM_IOCTL_INFO_BUFS, &info)) { in drmGetBufInfo()
1335 drmBufMapPtr drmMapBufs(int fd) in drmMapBufs() argument
1342 if (drmIoctl(fd, DRM_IOCTL_MAP_BUFS, &bufs)) in drmMapBufs()
1351 if (drmIoctl(fd, DRM_IOCTL_MAP_BUFS, &bufs)) { in drmMapBufs()
1410 int drmDMA(int fd, drmDMAReqPtr request) in drmDMA() argument
1427 ret = ioctl( fd, DRM_IOCTL_DMA, &dma ); in drmDMA()
1453 int drmGetLock(int fd, drm_context_t context, drmLockFlags flags) in drmGetLock() argument
1467 while (drmIoctl(fd, DRM_IOCTL_LOCK, &lock)) in drmGetLock()
1484 int drmUnlock(int fd, drm_context_t context) in drmUnlock() argument
1490 return drmIoctl(fd, DRM_IOCTL_UNLOCK, &lock); in drmUnlock()
1493 drm_context_t *drmGetReservedContextList(int fd, int *count) in drmGetReservedContextList() argument
1501 if (drmIoctl(fd, DRM_IOCTL_RES_CTX, &res)) in drmGetReservedContextList()
1515 if (drmIoctl(fd, DRM_IOCTL_RES_CTX, &res)) in drmGetReservedContextList()
1549 int drmCreateContext(int fd, drm_context_t *handle) in drmCreateContext() argument
1554 if (drmIoctl(fd, DRM_IOCTL_ADD_CTX, &ctx)) in drmCreateContext()
1560 int drmSwitchToContext(int fd, drm_context_t context) in drmSwitchToContext() argument
1566 if (drmIoctl(fd, DRM_IOCTL_SWITCH_CTX, &ctx)) in drmSwitchToContext()
1571 int drmSetContextFlags(int fd, drm_context_t context, drm_context_tFlags flags) in drmSetContextFlags() argument
1587 if (drmIoctl(fd, DRM_IOCTL_MOD_CTX, &ctx)) in drmSetContextFlags()
1592 int drmGetContextFlags(int fd, drm_context_t context, in drmGetContextFlags() argument
1599 if (drmIoctl(fd, DRM_IOCTL_GET_CTX, &ctx)) in drmGetContextFlags()
1626 int drmDestroyContext(int fd, drm_context_t handle) in drmDestroyContext() argument
1632 if (drmIoctl(fd, DRM_IOCTL_RM_CTX, &ctx)) in drmDestroyContext()
1637 int drmCreateDrawable(int fd, drm_drawable_t *handle) in drmCreateDrawable() argument
1642 if (drmIoctl(fd, DRM_IOCTL_ADD_DRAW, &draw)) in drmCreateDrawable()
1648 int drmDestroyDrawable(int fd, drm_drawable_t handle) in drmDestroyDrawable() argument
1654 if (drmIoctl(fd, DRM_IOCTL_RM_DRAW, &draw)) in drmDestroyDrawable()
1659 int drmUpdateDrawableInfo(int fd, drm_drawable_t handle, in drmUpdateDrawableInfo() argument
1671 if (drmIoctl(fd, DRM_IOCTL_UPDATE_DRAW, &update)) in drmUpdateDrawableInfo()
1689 int drmAgpAcquire(int fd) in drmAgpAcquire() argument
1691 if (drmIoctl(fd, DRM_IOCTL_AGP_ACQUIRE, NULL)) in drmAgpAcquire()
1707 int drmAgpRelease(int fd) in drmAgpRelease() argument
1709 if (drmIoctl(fd, DRM_IOCTL_AGP_RELEASE, NULL)) in drmAgpRelease()
1727 int drmAgpEnable(int fd, unsigned long mode) in drmAgpEnable() argument
1733 if (drmIoctl(fd, DRM_IOCTL_AGP_ENABLE, &m)) in drmAgpEnable()
1755 int drmAgpAlloc(int fd, unsigned long size, unsigned long type, in drmAgpAlloc() argument
1764 if (drmIoctl(fd, DRM_IOCTL_AGP_ALLOC, &b)) in drmAgpAlloc()
1785 int drmAgpFree(int fd, drm_handle_t handle) in drmAgpFree() argument
1791 if (drmIoctl(fd, DRM_IOCTL_AGP_FREE, &b)) in drmAgpFree()
1810 int drmAgpBind(int fd, drm_handle_t handle, unsigned long offset) in drmAgpBind() argument
1817 if (drmIoctl(fd, DRM_IOCTL_AGP_BIND, &b)) in drmAgpBind()
1835 int drmAgpUnbind(int fd, drm_handle_t handle) in drmAgpUnbind() argument
1841 if (drmIoctl(fd, DRM_IOCTL_AGP_UNBIND, &b)) in drmAgpUnbind()
1858 int drmAgpVersionMajor(int fd) in drmAgpVersionMajor() argument
1864 if (drmIoctl(fd, DRM_IOCTL_AGP_INFO, &i)) in drmAgpVersionMajor()
1881 int drmAgpVersionMinor(int fd) in drmAgpVersionMinor() argument
1887 if (drmIoctl(fd, DRM_IOCTL_AGP_INFO, &i)) in drmAgpVersionMinor()
1904 unsigned long drmAgpGetMode(int fd) in drmAgpGetMode() argument
1910 if (drmIoctl(fd, DRM_IOCTL_AGP_INFO, &i)) in drmAgpGetMode()
1927 unsigned long drmAgpBase(int fd) in drmAgpBase() argument
1933 if (drmIoctl(fd, DRM_IOCTL_AGP_INFO, &i)) in drmAgpBase()
1950 unsigned long drmAgpSize(int fd) in drmAgpSize() argument
1956 if (drmIoctl(fd, DRM_IOCTL_AGP_INFO, &i)) in drmAgpSize()
1973 unsigned long drmAgpMemoryUsed(int fd) in drmAgpMemoryUsed() argument
1979 if (drmIoctl(fd, DRM_IOCTL_AGP_INFO, &i)) in drmAgpMemoryUsed()
1996 unsigned long drmAgpMemoryAvail(int fd) in drmAgpMemoryAvail() argument
2002 if (drmIoctl(fd, DRM_IOCTL_AGP_INFO, &i)) in drmAgpMemoryAvail()
2019 unsigned int drmAgpVendorId(int fd) in drmAgpVendorId() argument
2025 if (drmIoctl(fd, DRM_IOCTL_AGP_INFO, &i)) in drmAgpVendorId()
2042 unsigned int drmAgpDeviceId(int fd) in drmAgpDeviceId() argument
2048 if (drmIoctl(fd, DRM_IOCTL_AGP_INFO, &i)) in drmAgpDeviceId()
2053 int drmScatterGatherAlloc(int fd, unsigned long size, drm_handle_t *handle) in drmScatterGatherAlloc() argument
2061 if (drmIoctl(fd, DRM_IOCTL_SG_ALLOC, &sg)) in drmScatterGatherAlloc()
2067 int drmScatterGatherFree(int fd, drm_handle_t handle) in drmScatterGatherFree() argument
2073 if (drmIoctl(fd, DRM_IOCTL_SG_FREE, &sg)) in drmScatterGatherFree()
2089 int drmWaitVBlank(int fd, drmVBlankPtr vbl) in drmWaitVBlank() argument
2102 ret = ioctl(fd, DRM_IOCTL_WAIT_VBLANK, vbl); in drmWaitVBlank()
2158 int drmCtlInstHandler(int fd, int irq) in drmCtlInstHandler() argument
2165 if (drmIoctl(fd, DRM_IOCTL_CONTROL, &ctl)) in drmCtlInstHandler()
2182 int drmCtlUninstHandler(int fd) in drmCtlUninstHandler() argument
2189 if (drmIoctl(fd, DRM_IOCTL_CONTROL, &ctl)) in drmCtlUninstHandler()
2194 int drmFinish(int fd, int context, drmLockFlags flags) in drmFinish() argument
2206 if (drmIoctl(fd, DRM_IOCTL_FINISH, &lock)) in drmFinish()
2225 int drmGetInterruptFromBusID(int fd, int busnum, int devnum, int funcnum) in drmGetInterruptFromBusID() argument
2233 if (drmIoctl(fd, DRM_IOCTL_IRQ_BUSID, &p)) in drmGetInterruptFromBusID()
2238 int drmAddContextTag(int fd, drm_context_t context, void *tag) in drmAddContextTag() argument
2240 drmHashEntry *entry = drmGetEntry(fd); in drmAddContextTag()
2249 int drmDelContextTag(int fd, drm_context_t context) in drmDelContextTag() argument
2251 drmHashEntry *entry = drmGetEntry(fd); in drmDelContextTag()
2256 void *drmGetContextTag(int fd, drm_context_t context) in drmGetContextTag() argument
2258 drmHashEntry *entry = drmGetEntry(fd); in drmGetContextTag()
2267 int drmAddContextPrivateMapping(int fd, drm_context_t ctx_id, in drmAddContextPrivateMapping() argument
2276 if (drmIoctl(fd, DRM_IOCTL_SET_SAREA_CTX, &map)) in drmAddContextPrivateMapping()
2281 int drmGetContextPrivateMapping(int fd, drm_context_t ctx_id, in drmGetContextPrivateMapping() argument
2289 if (drmIoctl(fd, DRM_IOCTL_GET_SAREA_CTX, &map)) in drmGetContextPrivateMapping()
2297 int drmGetMap(int fd, int idx, drm_handle_t *offset, drmSize *size, in drmGetMap() argument
2305 if (drmIoctl(fd, DRM_IOCTL_GET_MAP, &map)) in drmGetMap()
2316 int drmGetClient(int fd, int idx, int *auth, int *pid, int *uid, in drmGetClient() argument
2323 if (drmIoctl(fd, DRM_IOCTL_GET_CLIENT, &client)) in drmGetClient()
2333 int drmGetStats(int fd, drmStatsT *stats) in drmGetStats() argument
2339 if (drmIoctl(fd, DRM_IOCTL_GET_STATS, &s)) in drmGetStats()
2471 int drmSetInterfaceVersion(int fd, drmSetVersion *version) in drmSetInterfaceVersion() argument
2482 if (drmIoctl(fd, DRM_IOCTL_SET_VERSION, &sv)) { in drmSetInterfaceVersion()
2506 int drmCommandNone(int fd, unsigned long drmCommandIndex) in drmCommandNone() argument
2512 if (drmIoctl(fd, request, NULL)) { in drmCommandNone()
2533 int drmCommandRead(int fd, unsigned long drmCommandIndex, void *data, in drmCommandRead() argument
2541 if (drmIoctl(fd, request, data)) { in drmCommandRead()
2562 int drmCommandWrite(int fd, unsigned long drmCommandIndex, void *data, in drmCommandWrite() argument
2570 if (drmIoctl(fd, request, data)) { in drmCommandWrite()
2591 int drmCommandWriteRead(int fd, unsigned long drmCommandIndex, void *data, in drmCommandWriteRead() argument
2599 if (drmIoctl(fd, request, data)) in drmCommandWriteRead()
2607 int fd; member
2624 int fd; in drmOpenOnceWithType() local
2631 return connection[i].fd; in drmOpenOnceWithType()
2634 fd = drmOpenWithType(NULL, BusID, type); in drmOpenOnceWithType()
2635 if (fd < 0 || nr_fds == DRM_MAX_FDS) in drmOpenOnceWithType()
2636 return fd; in drmOpenOnceWithType()
2639 connection[nr_fds].fd = fd; in drmOpenOnceWithType()
2651 return fd; in drmOpenOnceWithType()
2654 void drmCloseOnce(int fd) in drmCloseOnce() argument
2659 if (fd == connection[i].fd) { in drmCloseOnce()
2661 drmClose(connection[i].fd); in drmCloseOnce()
2673 int drmSetMaster(int fd) in drmSetMaster() argument
2675 return drmIoctl(fd, DRM_IOCTL_SET_MASTER, NULL); in drmSetMaster()
2678 int drmDropMaster(int fd) in drmDropMaster() argument
2680 return drmIoctl(fd, DRM_IOCTL_DROP_MASTER, NULL); in drmDropMaster()
2683 char *drmGetDeviceNameFromFd(int fd) in drmGetDeviceNameFromFd() argument
2695 fstat(fd, &sbuf); in drmGetDeviceNameFromFd()
2709 int drmGetNodeTypeFromFd(int fd) in drmGetNodeTypeFromFd() argument
2714 if (fstat(fd, &sbuf)) in drmGetNodeTypeFromFd()
2731 int drmPrimeHandleToFD(int fd, uint32_t handle, uint32_t flags, int *prime_fd) in drmPrimeHandleToFD() argument
2737 args.fd = -1; in drmPrimeHandleToFD()
2740 ret = drmIoctl(fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &args); in drmPrimeHandleToFD()
2744 *prime_fd = args.fd; in drmPrimeHandleToFD()
2748 int drmPrimeFDToHandle(int fd, int prime_fd, uint32_t *handle) in drmPrimeFDToHandle() argument
2754 args.fd = prime_fd; in drmPrimeFDToHandle()
2755 ret = drmIoctl(fd, DRM_IOCTL_PRIME_FD_TO_HANDLE, &args); in drmPrimeFDToHandle()
2763 static char *drmGetMinorNameForFD(int fd, int type) in drmGetMinorNameForFD() argument
2780 if (fstat(fd, &sbuf)) in drmGetMinorNameForFD()
2825 char *drmGetPrimaryDeviceNameFromFd(int fd) in drmGetPrimaryDeviceNameFromFd() argument
2827 return drmGetMinorNameForFD(fd, DRM_NODE_PRIMARY); in drmGetPrimaryDeviceNameFromFd()
2830 char *drmGetRenderDeviceNameFromFd(int fd) in drmGetRenderDeviceNameFromFd() argument
2832 return drmGetMinorNameForFD(fd, DRM_NODE_RENDER); in drmGetRenderDeviceNameFromFd()
2869 int fd, ret; in drmParsePciBusInfo() local
2872 fd = open(path, O_RDONLY); in drmParsePciBusInfo()
2873 if (fd < 0) in drmParsePciBusInfo()
2876 ret = read(fd, data, sizeof(data)); in drmParsePciBusInfo()
2877 close(fd); in drmParsePciBusInfo()
2953 int fd, ret; in drmParsePciDeviceInfo() local
2956 fd = open(path, O_RDONLY); in drmParsePciDeviceInfo()
2957 if (fd < 0) in drmParsePciDeviceInfo()
2960 ret = read(fd, config, sizeof(config)); in drmParsePciDeviceInfo()
2961 close(fd); in drmParsePciDeviceInfo()
3077 int drmGetDevice(int fd, drmDevicePtr *device) in drmGetDevice() argument
3090 if (fd == -1 || device == NULL) in drmGetDevice()
3093 if (fstat(fd, &sbuf)) in drmGetDevice()