diff options
author | Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> | 2006-10-17 11:05:37 +0200 |
---|---|---|
committer | Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> | 2006-10-17 11:05:37 +0200 |
commit | 5881ce1b91034fbdf81dda37a23215cfc1310cdf (patch) | |
tree | 41b4608b50b73df6bac657b914323350f47453f9 /libdrm | |
parent | 5b2a60f550090a41c13483ceaaa1a84d3a9257f8 (diff) |
Extend generality for more memory types.
Fix up init and destruction code.
Diffstat (limited to 'libdrm')
-rw-r--r-- | libdrm/xf86drm.c | 31 | ||||
-rw-r--r-- | libdrm/xf86mm.h | 9 |
2 files changed, 27 insertions, 13 deletions
diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c index c7683182..039c9b32 100644 --- a/libdrm/xf86drm.c +++ b/libdrm/xf86drm.c @@ -3155,19 +3155,16 @@ int drmBOFenceList(int fd, drmBOList *list, unsigned fenceHandle) return 0; } -int drmMMInit(int fd, unsigned long vramPOffset, unsigned long vramPSize, - unsigned long ttPOffset, unsigned long ttPSize, - unsigned long max_locked_size) +int drmMMInit(int fd, unsigned long pOffset, unsigned long pSize, + unsigned memType) { drm_mm_init_arg_t arg; memset(&arg, 0, sizeof(arg)); arg.req.op = mm_init; - arg.req.vr_p_offset = vramPOffset; - arg.req.vr_p_size = vramPSize; - arg.req.tt_p_offset = ttPOffset; - arg.req.tt_p_size = ttPSize; - arg.req.max_locked_pages = max_locked_size / getpagesize(); + arg.req.p_offset = pOffset; + arg.req.p_size = pSize; + arg.req.mem_type = memType; if (ioctl(fd, DRM_IOCTL_MM_INIT, &arg)) return -errno; @@ -3175,13 +3172,29 @@ int drmMMInit(int fd, unsigned long vramPOffset, unsigned long vramPSize, return 0; } -int drmMMTakedown(int fd) +int drmMMTakedown(int fd, unsigned memType) { drm_mm_init_arg_t arg; memset(&arg, 0, sizeof(arg)); arg.req.op = mm_takedown; + arg.req.mem_type = memType; + + if (ioctl(fd, DRM_IOCTL_MM_INIT, &arg)) + return -errno; + + return 0; +} + +int drmMMMaxLockedSize(int fd, unsigned long maxLockedSize) +{ + drm_mm_init_arg_t arg; + + + memset(&arg, 0, sizeof(arg)); + arg.req.op = mm_set_max_pages; + arg.req.p_size = maxLockedSize / getpagesize(); if (ioctl(fd, DRM_IOCTL_MM_INIT, &arg)) return -errno; diff --git a/libdrm/xf86mm.h b/libdrm/xf86mm.h index 78df37c3..b2ba24d5 100644 --- a/libdrm/xf86mm.h +++ b/libdrm/xf86mm.h @@ -195,10 +195,11 @@ extern int drmBOWaitIdle(int fd, drmBO *buf, unsigned hint); * Initialization functions. */ -extern int drmMMInit(int fd, unsigned long vramPOffset, unsigned long vramPSize, - unsigned long ttPOffset, unsigned long ttPSize, - unsigned long max_locked_size); -extern int drmMMTakedown(int fd); +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); + #endif |