drm_hwcomposer: Don't use Mapper@4 metadata API for legacy getters
As it turned out Mapper@4 metadata API calls are slow.
Allow using legacy getters again.
Closes: https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer/-/issues/56
Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
diff --git a/bufferinfo/BufferInfoGetter.cpp b/bufferinfo/BufferInfoGetter.cpp
index 7f7f8ae..c284365 100644
--- a/bufferinfo/BufferInfoGetter.cpp
+++ b/bufferinfo/BufferInfoGetter.cpp
@@ -32,17 +32,17 @@
BufferInfoGetter *BufferInfoGetter::GetInstance() {
static std::unique_ptr<BufferInfoGetter> inst;
- if (inst == nullptr) {
-#if PLATFORM_SDK_VERSION >= 30
+ if (!inst) {
+#if PLATFORM_SDK_VERSION >= 30 && defined(USE_IMAPPER4_METADATA_API)
inst.reset(BufferInfoMapperMetadata::CreateInstance());
- if (inst == nullptr) {
+ if (!inst) {
ALOGW(
"Generic buffer getter is not available. Falling back to legacy...");
-#endif
- inst = LegacyBufferInfoGetter::CreateInstance();
-#if PLATFORM_SDK_VERSION >= 30
}
#endif
+ if (!inst) {
+ inst = LegacyBufferInfoGetter::CreateInstance();
+ }
}
return inst.get();