diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-07-21 20:17:56 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-07-21 20:17:56 +0000 |
commit | 5f79f4c6266c54fefc46c7cdbd09e72a6c106b44 (patch) | |
tree | 72f3586b297ad5781b6f9ae5f68fc53bc5ccd4df | |
parent | 344ddef8c1ef23e8b44b1c771a370e2c28eda9ab (diff) | |
parent | 08d1cd4be4a0519e3708502e4bb1e197485a1b16 (diff) | |
download | goldfish-opengl-android13-mainline-go-scheduling-release.tar.gz |
Snap for 8857176 from 08d1cd4be4a0519e3708502e4bb1e197485a1b16 to mainline-go-scheduling-releaseaml_go_sch_330911000android13-mainline-go-scheduling-release
Change-Id: I9b6f7c744804c1928dfcd12d748f239e74a6ad7d
-rw-r--r-- | system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.cpp | 40 | ||||
-rw-r--r-- | system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.h | 1 | ||||
-rw-r--r-- | system/hwc2/HostComposer.cpp | 2 | ||||
-rw-r--r-- | system/hwc3/HostFrameComposer.cpp | 2 |
4 files changed, 42 insertions, 3 deletions
diff --git a/system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.cpp b/system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.cpp index 90b56532..963558ee 100644 --- a/system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.cpp +++ b/system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.cpp @@ -42,6 +42,8 @@ #include "C2GoldfishAvcDec.h" +#include <mutex> + #define DEBUG 0 #if DEBUG #define DDD(...) ALOGD(__VA_ARGS__) @@ -64,6 +66,35 @@ constexpr uint32_t kDefaultOutputDelay = 8; So total maximum output delay is 34 */ constexpr uint32_t kMaxOutputDelay = 34; constexpr uint32_t kMinInputBytes = 4; + +static std::mutex s_decoder_count_mutex; +static int s_decoder_count = 0; + +int allocateDecoderId() { + DDD("calling %s", __func__); + std::lock_guard<std::mutex> lock(s_decoder_count_mutex); + if (s_decoder_count >= 32 || s_decoder_count < 0) { + ALOGE("calling %s failed", __func__); + return -1; + } + ++ s_decoder_count; + DDD("calling %s success total decoder %d", __func__, s_decoder_count); + return s_decoder_count;; +} + +bool deAllocateDecoderId() { + DDD("calling %s", __func__); + std::lock_guard<std::mutex> lock(s_decoder_count_mutex); + if (s_decoder_count < 1) { + ALOGE("calling %s failed ", __func__); + return false; + } + -- s_decoder_count; + DDD("calling %s success total decoder %d", __func__, s_decoder_count); + return true; +} + + } // namespace class C2GoldfishAvcDec::IntfImpl : public SimpleInterface<void>::BaseParams { @@ -393,6 +424,9 @@ C2GoldfishAvcDec::C2GoldfishAvcDec(const char *name, c2_node_id_t id, C2GoldfishAvcDec::~C2GoldfishAvcDec() { onRelease(); } c2_status_t C2GoldfishAvcDec::onInit() { + ALOGD("calling onInit"); + mId = allocateDecoderId(); + if (mId <= 0) return C2_NO_MEMORY; status_t err = initDecoder(); return err == OK ? C2_OK : C2_CORRUPTED; } @@ -407,6 +441,11 @@ c2_status_t C2GoldfishAvcDec::onStop() { void C2GoldfishAvcDec::onReset() { (void)onStop(); } void C2GoldfishAvcDec::onRelease() { + DDD("calling onRelease"); + if (mId > 0) { + deAllocateDecoderId(); + mId = -1; + } deleteContext(); if (mOutBlock) { mOutBlock.reset(); @@ -476,7 +515,6 @@ status_t C2GoldfishAvcDec::setParams(size_t stride) { } status_t C2GoldfishAvcDec::initDecoder() { - // if (OK != createDecoder()) return UNKNOWN_ERROR; mStride = ALIGN2(mWidth); mSignalledError = false; resetPlugin(); diff --git a/system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.h b/system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.h index afa27f56..5b5e760a 100644 --- a/system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.h +++ b/system/codecs/c2/decoders/avcdec/C2GoldfishAvcDec.h @@ -155,6 +155,7 @@ class C2GoldfishAvcDec : public SimpleC2Component { std::unique_ptr<GoldfishH264Helper> mH264Helper; + int mId = -1; C2_DO_NOT_COPY(C2GoldfishAvcDec); }; diff --git a/system/hwc2/HostComposer.cpp b/system/hwc2/HostComposer.cpp index 5bf324e0..472e7829 100644 --- a/system/hwc2/HostComposer.cpp +++ b/system/hwc2/HostComposer.cpp @@ -570,7 +570,7 @@ std::tuple<HWC2::Error, base::unique_fd> HostComposer::presentDisplay( display->clearReleaseFencesAndIdsLocked(); if (numLayer == 0) { - ALOGW( + ALOGV( "%s display has no layers to compose, flushing client target buffer.", __FUNCTION__); diff --git a/system/hwc3/HostFrameComposer.cpp b/system/hwc3/HostFrameComposer.cpp index 7b090c2d..f976e053 100644 --- a/system/hwc3/HostFrameComposer.cpp +++ b/system/hwc3/HostFrameComposer.cpp @@ -578,7 +578,7 @@ HWC3::Error HostFrameComposer::presentDisplay( displayId, static_cast<int>(layers.size())); if (numLayer == 0) { - ALOGW( + ALOGV( "%s display has no layers to compose, flushing client target buffer.", __FUNCTION__); |