diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2015-02-06 17:15:13 +0100 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2015-02-13 09:35:35 +0100 |
commit | 09b8211d4136d6f7767652ddf73dfb0b7c1213a2 (patch) | |
tree | 13b64b232c9d995c43acfe6932bd247976fbf601 /lib/ioctl_wrappers.c | |
parent | 8d21b39251615d3516522a9fe56f77e9bf9fdc62 (diff) |
lib/ioctl: Add gem_context_destroy helpers
We also need a raw version for some tests.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'lib/ioctl_wrappers.c')
-rw-r--r-- | lib/ioctl_wrappers.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c index c8c0e1c1..e86b3c2b 100644 --- a/lib/ioctl_wrappers.c +++ b/lib/ioctl_wrappers.c @@ -630,6 +630,38 @@ uint32_t gem_context_create(int fd) return create.ctx_id; } +int __gem_context_destroy(int fd, uint32_t ctx_id) +{ + struct drm_i915_gem_context_destroy destroy; + int ret; + + memset(&destroy, 0, sizeof(destroy)); + destroy.ctx_id = ctx_id; + + ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_DESTROY, &destroy); + if (ret) + return -errno; + return 0; +} + +/** + * gem_context_create: + * @fd: open i915 drm file descriptor + * @ctx_id: i915 hw context id + * + * This is a wraps the CONTEXT_DESTROY ioctl, which is used to free a hardware + * context. + */ +void gem_context_destroy(int fd, uint32_t ctx_id) +{ + struct drm_i915_gem_context_destroy destroy; + + memset(&destroy, 0, sizeof(destroy)); + destroy.ctx_id = ctx_id; + + do_ioctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_DESTROY, &destroy); +} + /** * gem_sw_finish: * @fd: open i915 drm file descriptor |