diff options
author | Yiwei Zhang <zzyiwei@chromium.org> | 2021-07-01 20:43:04 +0000 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-07-02 18:26:18 +0000 |
commit | 61f9752a1cdd833c4254cdae69846cda1e172794 (patch) | |
tree | d45d6b5b0e4aab7b7cff30e2640b939b6d97c41d /cros_gralloc/gralloc4/CrosGralloc4Mapper.h | |
parent | bb9d4af4529b3019d830b8ef7e39479436b642af (diff) | |
download | minigbm-61f9752a1cdd833c4254cdae69846cda1e172794.tar.gz |
minigbm: refactor cros_gralloc_driver to be a singleton
Only a single cros_gralloc_driver instance is allowed to exist in a
process. However, currently when Gralloc3.0 or Gralloc4.0 is used, it's
possible for 2 independent driver instances to be created. This change
refactors cros_gralloc_driver to be a singleton and ensures the driver
initialization only happens once per process.
BUG=b:191895066
TEST=No regression of gralloc0 in ARCVM
Change-Id: I3cb8b7c3d13717cfe531b557b9d69b72efdbf3da
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3002266
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Jason Macnak <natsu@google.com>
Tested-by: John Stultz <john.stultz@linaro.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Jason Macnak <natsu@google.com>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
Diffstat (limited to 'cros_gralloc/gralloc4/CrosGralloc4Mapper.h')
-rw-r--r-- | cros_gralloc/gralloc4/CrosGralloc4Mapper.h | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/cros_gralloc/gralloc4/CrosGralloc4Mapper.h b/cros_gralloc/gralloc4/CrosGralloc4Mapper.h index 3c159a2..0641b29 100644 --- a/cros_gralloc/gralloc4/CrosGralloc4Mapper.h +++ b/cros_gralloc/gralloc4/CrosGralloc4Mapper.h @@ -11,8 +11,7 @@ class CrosGralloc4Mapper : public android::hardware::graphics::mapper::V4_0::IMapper { public: - CrosGralloc4Mapper(); - ~CrosGralloc4Mapper(); + CrosGralloc4Mapper() = default; android::hardware::Return<void> createDescriptor(const BufferDescriptorInfo& description, createDescriptor_cb hidlCb) override; @@ -75,7 +74,7 @@ class CrosGralloc4Mapper : public android::hardware::graphics::mapper::V4_0::IMa int getResolvedDrmFormat(android::hardware::graphics::common::V1_2::PixelFormat pixelFormat, uint64_t bufferUsage, uint32_t* outDrmFormat); - cros_gralloc_driver* mDriver = nullptr; + cros_gralloc_driver* mDriver = cros_gralloc_driver::get_instance(); }; extern "C" android::hardware::graphics::mapper::V4_0::IMapper* HIDL_FETCH_IMapper(const char* name); |