diff options
author | Hoegeun Kwon <hoegeun.kwon@samsung.com> | 2017-04-03 17:31:58 +0900 |
---|---|---|
committer | Hoegeun Kwon <hoegeun.kwon@samsung.com> | 2017-04-17 19:18:23 +0900 |
commit | cbd3aeda6aae02fcc9ba9f61942ef991b2a46332 (patch) | |
tree | 4fa04a024fab960d4fd9479ca11c6e3c8df82361 | |
parent | 5ac1479e51bfcb28392092277ac6bfff69eceea2 (diff) | |
download | libdrm-cbd3aeda6aae02fcc9ba9f61942ef991b2a46332.tar.gz libdrm-cbd3aeda6aae02fcc9ba9f61942ef991b2a46332.tar.bz2 libdrm-cbd3aeda6aae02fcc9ba9f61942ef991b2a46332.zip |
ipptest: Refactor to call unmap and destroy together for struct kms_bo
This fixes to use unmap and destroy together from util.c to match with
util_kms_gem_create_mmap().
Change-Id: Ibf17d70949a8ceb2edde224e8fbbc870f6ffbf38
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
-rw-r--r-- | tests/ipptest/fimc.c | 17 | ||||
-rw-r--r-- | tests/ipptest/util.c | 17 | ||||
-rw-r--r-- | tests/ipptest/util.h | 1 |
3 files changed, 21 insertions, 14 deletions
diff --git a/tests/ipptest/fimc.c b/tests/ipptest/fimc.c index fddd3b85..3c1d5047 100644 --- a/tests/ipptest/fimc.c +++ b/tests/ipptest/fimc.c @@ -670,7 +670,7 @@ void fimc_m2m_set_mode(struct device *dev, struct connector *c, int count, struct drm_gem_close args; uint32_t handles[4], pitches[4], offsets[4] = {0}; unsigned int fb_id_dst; - struct kms_bo *bo_src[MAX_BUF], *bo_dst; + struct kms_bo *bo_src[MAX_BUF] = { NULL, }, *bo_dst = NULL; struct pipe_arg pipe; int ret, i, j; @@ -944,20 +944,13 @@ err_ipp_quque_close: "failed to ipp ctrl IPP_CMD_M2M stop\n"); } err_ipp_dst_buff_close: - /* Close destination buffer */ - munmap(usr_addr2[0], gem2[0].size); - memset(&args, 0x00, sizeof(struct drm_gem_close)); - args.handle = gem2[0].handle; - exynos_gem_close(dev->fd, &args); - kms_bo_destroy(&bo_dst); + util_kms_gem_destroy_mmap(&bo_dst); err_ipp_src_buff_close: /* Close source buffer */ for (i = 0; i < MAX_BUF; i++) { - munmap(usr_addr1[i], gem1[i].size); - memset(&args, 0, sizeof(struct drm_gem_close)); - args.handle = gem1[i].handle; - exynos_gem_close(dev->fd, &args); - kms_bo_destroy(&bo_src[i]); + ret = util_kms_gem_destroy_mmap(&bo_src[i]); + if (ret < 0) + break; } } diff --git a/tests/ipptest/util.c b/tests/ipptest/util.c index c274f21e..4b22a19d 100644 --- a/tests/ipptest/util.c +++ b/tests/ipptest/util.c @@ -306,11 +306,24 @@ struct kms_bo *util_kms_gem_create_mmap(struct kms_driver *kms, break; } - kms_bo_unmap(bo); - return bo; } +int util_kms_gem_destroy_mmap(struct kms_bo **bo) +{ + int ret; + + if (!(*bo)) + return -1; + kms_bo_unmap(*bo); + + ret = kms_bo_destroy(bo); + if (ret < 0) + fprintf(stderr, "failed kms bo destroy: %s\n", strerror(errno)); + + return ret; +} + #define MAKE_RGBA(rgb, r, g, b, a) \ ((((r) >> (8 - (rgb)->red.length)) << (rgb)->red.offset) | \ (((g) >> (8 - (rgb)->green.length)) << (rgb)->green.offset) | \ diff --git a/tests/ipptest/util.h b/tests/ipptest/util.h index 2ad9f735..8b79d787 100644 --- a/tests/ipptest/util.h +++ b/tests/ipptest/util.h @@ -27,6 +27,7 @@ extern struct kms_bo *util_kms_gem_create_mmap(struct kms_driver *kms, unsigned int format, unsigned int width, unsigned int height, unsigned int handles[4], unsigned int pitches[4], unsigned int offsets[4]); +extern int util_kms_gem_destroy_mmap(struct kms_bo **bo); extern void fill_smpte_rgb32(unsigned char *mem, unsigned int width, unsigned int height, unsigned int stride); extern void util_draw_buffer(void *addr, unsigned int stripe, |