summaryrefslogtreecommitdiff
path: root/sdm/libs/hwc2/hwc_buffer_allocator.cpp
diff options
context:
space:
mode:
authorNaseer Ahmed <naseer@codeaurora.org>2018-03-07 16:00:05 -0500
committerNaseer Ahmed <naseer@codeaurora.org>2018-03-21 10:15:31 -0400
commit5503d8d355689892bbbf77e88b753cb4386a43d9 (patch)
treeecd647b7d052f0158d3366fe3f8bf856447ac940 /sdm/libs/hwc2/hwc_buffer_allocator.cpp
parent036d57dfbc5ca749e65ce2ac09981bb5cc07a0b0 (diff)
display: hwc_buffer_allocator fixes
Fixes an issue where the HWC init randomly blocks on the allocator init by doing a lazy initialization of the allocator object. The allocator may not have fully initialized at HWC init. Also, increases the allocator connection threadpool to 4. Change-Id: I38454ee25aaf2a211125e55297300eac754fb5cf CRs-Fixed: 2201202
Diffstat (limited to 'sdm/libs/hwc2/hwc_buffer_allocator.cpp')
-rw-r--r--sdm/libs/hwc2/hwc_buffer_allocator.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/sdm/libs/hwc2/hwc_buffer_allocator.cpp b/sdm/libs/hwc2/hwc_buffer_allocator.cpp
index 42105018..0ebd9a4a 100644
--- a/sdm/libs/hwc2/hwc_buffer_allocator.cpp
+++ b/sdm/libs/hwc2/hwc_buffer_allocator.cpp
@@ -47,7 +47,12 @@ using android::hardware::hidl_vec;
namespace sdm {
-DisplayError HWCBufferAllocator::Init() {
+DisplayError HWCBufferAllocator::GetGrallocInstance() {
+ // Lazy initialization of gralloc HALs
+ if (mapper_ != nullptr || allocator_ != nullptr) {
+ return kErrorNone;
+ }
+
allocator_ = IAllocator::getService();
mapper_ = IMapper::getService();
@@ -58,11 +63,11 @@ DisplayError HWCBufferAllocator::Init() {
return kErrorNone;
}
-DisplayError HWCBufferAllocator::Deinit() {
- return kErrorNone;
-}
-
DisplayError HWCBufferAllocator::AllocateBuffer(BufferInfo *buffer_info) {
+ auto err = GetGrallocInstance();
+ if (err != kErrorNone) {
+ return err;
+ }
const BufferConfig &buffer_config = buffer_info->buffer_config;
AllocatedBufferInfo *alloc_buffer_info = &buffer_info->alloc_buffer_info;
int format;