diff options
author | Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> | 2006-10-17 16:00:25 +0200 |
---|---|---|
committer | Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> | 2006-10-17 16:00:25 +0200 |
commit | 5443dbe35f182b9286a96d24d29037d5cb625e3d (patch) | |
tree | 053a23cf237b189775ccebe54070c9e0506b830f /libdrm | |
parent | db5c671e86c3db8c99ce5a4954632248e6f849aa (diff) |
Implement mm_lock and mm_unlock functions.
The mm_lock function is used when leaving vt. It evicts _all_ buffers.
Buffers with the DRM_BO_NO_MOVE attribute set will be guaranteed to
get the same offset when / if they are rebound.
Diffstat (limited to 'libdrm')
-rw-r--r-- | libdrm/xf86drm.c | 33 | ||||
-rw-r--r-- | libdrm/xf86mm.h | 3 |
2 files changed, 35 insertions, 1 deletions
diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c index 039c9b32..253ba690 100644 --- a/libdrm/xf86drm.c +++ b/libdrm/xf86drm.c @@ -3202,4 +3202,37 @@ int drmMMMaxLockedSize(int fd, unsigned long maxLockedSize) return 0; } +int drmMMLock(int fd, unsigned memType) +{ + drm_mm_init_arg_t arg; + int ret; + + memset(&arg, 0, sizeof(arg)); + arg.req.op = mm_lock; + arg.req.mem_type = memType; + + do{ + ret = ioctl(fd, DRM_IOCTL_MM_INIT, &arg); + } while (ret && errno == EAGAIN); + + return ret; +} + +int drmMMUnlock(int fd, unsigned memType) +{ + drm_mm_init_arg_t arg; + int ret; + + memset(&arg, 0, sizeof(arg)); + arg.req.op = mm_unlock; + arg.req.mem_type = memType; + + do{ + ret = ioctl(fd, DRM_IOCTL_MM_INIT, &arg); + } while (ret && errno == EAGAIN); + + return ret; +} + + #endif diff --git a/libdrm/xf86mm.h b/libdrm/xf86mm.h index b2ba24d5..c3112c90 100644 --- a/libdrm/xf86mm.h +++ b/libdrm/xf86mm.h @@ -199,7 +199,8 @@ extern int drmMMInit(int fd, unsigned long pOffset, unsigned long pSize, unsigned memType); extern int drmMMTakedown(int fd, unsigned memType); extern int drmMMMaxLockedSize(int fd, unsigned long maxLockedSize); - +extern int drmMMLock(int fd, unsigned memType); +extern int drmMMUnlock(int fd, unsigned memType); #endif |