OSDN Git Service

gralloc0_register_buffer: initialize gralloc0 when needed
authorMauro Rossi <issor.oruam@gmail.com>
Sat, 18 Apr 2020 08:20:32 +0000 (10:20 +0200)
committerMauro Rossi <issor.oruam@gmail.com>
Tue, 29 Dec 2020 12:54:30 +0000 (13:54 +0100)
Based on Michael Goffioul "Always initialize gralloc0 module"
considerign that !mod->initialized defines the condition when it's needed.

Original commit message:
Both mapper and allocator HIDL adapter uses the same gralloc module, but
the mapper HILD does not fully initialize the module, leaving the
allocator HIDL in limbo if the mapper HIDL is called first.

Fixes SystemUI crash on startup.

cros_gralloc/gralloc0/gralloc0.cc

index f71b934..f32b99d 100644 (file)
@@ -283,7 +283,7 @@ static int gralloc0_register_buffer(struct gralloc_module_t const *module, buffe
        auto mod = const_cast<struct gralloc0_module *>(const_module);
 
        if (!mod->initialized)
        auto mod = const_cast<struct gralloc0_module *>(const_module);
 
        if (!mod->initialized)
-               if (gralloc0_init(mod, false))
+               if (gralloc0_init(mod, true))
                        return -ENODEV;
 
        int ret = mod->driver->retain(handle);
                        return -ENODEV;
 
        int ret = mod->driver->retain(handle);