diff options
author | Deepak Rawat <drawat@vmware.com> | 2018-10-16 15:23:37 -0700 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2018-10-17 09:40:51 +0200 |
commit | 4ca3d1de874bd269b37055f1a4cc6de04ea2d050 (patch) | |
tree | 4d618d24b802f2e10d71525d4b46e4c9bf739296 /lib/igt_kms.c | |
parent | 0ac43db33e116b546e5704fe0b4dde21f391e09c (diff) |
lib/igt_fb: Call dumb_destroy ioctl in case of dumb buffers
vmwgfx does not support GEM interface so calling gem_close on vmwgfx
results in error.
v2: Use drmIoctl with error when ioctl() failed.
v3: Seperate ioctl wrapper.
Signed-off-by: Deepak Rawat <drawat@vmware.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'lib/igt_kms.c')
-rw-r--r-- | lib/igt_kms.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/igt_kms.c b/lib/igt_kms.c index b2cbaa11..6e499f48 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -641,6 +641,28 @@ void *kmstest_dumb_map_buffer(int fd, uint32_t handle, uint64_t size, return ptr; } +static int __kmstest_dumb_destroy(int fd, uint32_t handle) +{ + struct drm_mode_destroy_dumb arg = { handle }; + int err = 0; + + if (drmIoctl(fd, DRM_IOCTL_MODE_DESTROY_DUMB, &arg)) + err = -errno; + + errno = 0; + return err; +} + +/** + * kmstest_dumb_destroy: + * @fd: Opened drm file descriptor + * @handle: Offset in the file referred to by fd + */ +void kmstest_dumb_destroy(int fd, uint32_t handle) +{ + igt_assert_eq(__kmstest_dumb_destroy(fd, handle), 0); +} + /* * Returns: the previous mode, or KD_GRAPHICS if no /dev/tty0 was * found and nothing was done. |