OSDN Git Service

make sure the driver is initialized before registering
authorChia-I Wu <olvaffe@gmail.com>
Sat, 30 Jul 2011 07:31:24 +0000 (16:31 +0900)
committerChia-I Wu <olvaffe@gmail.com>
Sat, 30 Jul 2011 07:37:56 +0000 (16:37 +0900)
gralloc.c

index e134e81..0cf63e5 100644 (file)
--- a/gralloc.c
+++ b/gralloc.c
@@ -115,6 +115,11 @@ static int drm_mod_register_buffer(const gralloc_module_t *mod,
                buffer_handle_t handle)
 {
        struct drm_module_t *dmod = (struct drm_module_t *) mod;
+       int err;
+
+       err = drm_init(dmod, 0);
+       if (err)
+               return err;
 
        return (gralloc_drm_bo_register(dmod->drm, handle, 1)) ? 0 : -EINVAL;
 }
@@ -124,6 +129,11 @@ static int drm_mod_unregister_buffer(const gralloc_module_t *mod,
 {
        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)