summaryrefslogtreecommitdiffstats
path: root/gralloc.c
diff options
context:
space:
mode:
authorChia-I Wu <olvaffe@gmail.com>2011-07-31 16:35:21 +0900
committerChia-I Wu <olvaffe@gmail.com>2011-07-31 17:59:01 +0900
commit8542de3915e6b8a88232a1f0f991a425e9289a96 (patch)
treeaeadde9fb536352611dbd151300c8cfb8e5b4b33 /gralloc.c
parentd5c39c961b11b314b6d13e79036e740cdefee67b (diff)
downloadexternal_drm_gralloc-8542de3915e6b8a88232a1f0f991a425e9289a96.zip
external_drm_gralloc-8542de3915e6b8a88232a1f0f991a425e9289a96.tar.gz
external_drm_gralloc-8542de3915e6b8a88232a1f0f991a425e9289a96.tar.bz2
revise gralloc_drm bo interface
Make it more intuitive to use.
Diffstat (limited to 'gralloc.c')
-rw-r--r--gralloc.c31
1 files changed, 6 insertions, 25 deletions
diff --git a/gralloc.c b/gralloc.c
index 0cf63e5..fec57be 100644
--- a/gralloc.c
+++ b/gralloc.c
@@ -121,41 +121,22 @@ static int drm_mod_register_buffer(const gralloc_module_t *mod,
if (err)
return err;
- return (gralloc_drm_bo_register(dmod->drm, handle, 1)) ? 0 : -EINVAL;
+ return gralloc_drm_handle_register(handle, dmod->drm);
}
static int drm_mod_unregister_buffer(const gralloc_module_t *mod,
buffer_handle_t handle)
{
- struct drm_module_t *dmod = (struct drm_module_t *) mod;
- struct gralloc_drm_bo_t *bo;
- int err;
-
- err = drm_init(dmod, 0);
- if (err)
- return err;
-
- bo = gralloc_drm_bo_validate(dmod->drm, handle);
- if (!bo)
- return -EINVAL;
-
- gralloc_drm_bo_unregister(bo);
-
- return 0;
+ return gralloc_drm_handle_unregister(handle);
}
static int drm_mod_lock(const gralloc_module_t *mod, buffer_handle_t handle,
int usage, int x, int y, int w, int h, void **ptr)
{
- struct drm_module_t *dmod = (struct drm_module_t *) mod;
struct gralloc_drm_bo_t *bo;
int err;
- err = drm_init(dmod, 0);
- if (err)
- return err;
-
- bo = gralloc_drm_bo_validate(dmod->drm, handle);
+ bo = gralloc_drm_bo_from_handle(handle);
if (!bo)
return -EINVAL;
@@ -167,7 +148,7 @@ static int drm_mod_unlock(const gralloc_module_t *mod, buffer_handle_t handle)
struct drm_module_t *dmod = (struct drm_module_t *) mod;
struct gralloc_drm_bo_t *bo;
- bo = gralloc_drm_bo_validate(dmod->drm, handle);
+ bo = gralloc_drm_bo_from_handle(handle);
if (!bo)
return -EINVAL;
@@ -190,7 +171,7 @@ static int drm_mod_free_gpu0(alloc_device_t *dev, buffer_handle_t handle)
struct drm_module_t *dmod = (struct drm_module_t *) dev->common.module;
struct gralloc_drm_bo_t *bo;
- bo = gralloc_drm_bo_validate(dmod->drm, handle);
+ bo = gralloc_drm_bo_from_handle(handle);
if (!bo)
return -EINVAL;
@@ -282,7 +263,7 @@ static int drm_mod_post_fb0(struct framebuffer_device_t *fb,
struct drm_module_t *dmod = (struct drm_module_t *) fb->common.module;
struct gralloc_drm_bo_t *bo;
- bo = gralloc_drm_bo_validate(dmod->drm, handle);
+ bo = gralloc_drm_bo_from_handle(handle);
if (!bo)
return -EINVAL;