From: Mauro Rossi Date: Sat, 18 Apr 2020 08:20:32 +0000 (+0200) Subject: gralloc0_register_buffer: initialize gralloc0 when needed X-Git-Url: http://git.osdn.net/view?p=android-x86%2Fexternal-minigbm.git;a=commitdiff_plain;h=916c3345d793c07aee9433b9948ef6777b8e41ef;hp=5e46fdd08b7527ef805d81dbc19da5a1c6e256bd gralloc0_register_buffer: initialize gralloc0 when needed 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. --- diff --git a/cros_gralloc/gralloc0/gralloc0.cc b/cros_gralloc/gralloc0/gralloc0.cc index f71b934..f32b99d 100644 --- a/cros_gralloc/gralloc0/gralloc0.cc +++ b/cros_gralloc/gralloc0/gralloc0.cc @@ -283,7 +283,7 @@ static int gralloc0_register_buffer(struct gralloc_module_t const *module, buffe auto mod = const_cast(const_module); if (!mod->initialized) - if (gralloc0_init(mod, false)) + if (gralloc0_init(mod, true)) return -ENODEV; int ret = mod->driver->retain(handle);