From 2fc5da4da12c8fa36044acc58856b0e460e70621 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Fri, 29 Jul 2011 19:57:04 +0900 Subject: close bo on unregister() Not sure if a remote process ever destroys a bo. But let register() opens a bo and unregister() closes it. --- gralloc.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'gralloc.c') diff --git a/gralloc.c b/gralloc.c index 850a39e..fd4f848 100644 --- a/gralloc.c +++ b/gralloc.c @@ -114,13 +114,24 @@ static int drm_mod_perform(const struct gralloc_module_t *mod, int op, ...) static int drm_mod_register_buffer(const gralloc_module_t *mod, buffer_handle_t handle) { - return (gralloc_drm_handle(handle)) ? 0 : -EINVAL; + struct drm_module_t *dmod = (struct drm_module_t *) mod; + + return (gralloc_drm_bo_register(dmod->drm, handle, 1)) ? 0 : -EINVAL; } static int drm_mod_unregister_buffer(const gralloc_module_t *mod, buffer_handle_t handle) { - return (gralloc_drm_handle(handle)) ? 0 : -EINVAL; + struct drm_module_t *dmod = (struct drm_module_t *) mod; + struct gralloc_drm_bo_t *bo; + + bo = gralloc_drm_bo_validate(dmod->drm, handle); + if (!bo) + return -EINVAL; + + gralloc_drm_bo_unregister(bo); + + return 0; } static int drm_mod_lock(const gralloc_module_t *mod, buffer_handle_t handle, -- cgit v1.1