diff options
-rw-r--r-- | hwc3/ComposerClient.cpp | 11 | ||||
-rw-r--r-- | hwc3/ComposerClient.h | 3 | ||||
-rw-r--r-- | hwc3/impl/HalImpl.cpp | 6 | ||||
-rw-r--r-- | hwc3/impl/HalImpl.h | 2 | ||||
-rw-r--r-- | hwc3/include/IComposerHal.h | 3 | ||||
-rw-r--r-- | libhwc2.1/libdevice/ExynosDisplay.cpp | 2 | ||||
-rw-r--r-- | libhwc2.1/libdevice/ExynosLayer.cpp | 10 | ||||
-rw-r--r-- | libhwc2.1/libdevice/ExynosLayer.h | 2 | ||||
-rw-r--r-- | libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.cpp | 4 | ||||
-rw-r--r-- | libhwc2.1/libresource/ExynosMPP.h | 4 | ||||
-rw-r--r-- | libhwjpeg/libhwjpeg-exynos.cpp | 12 |
11 files changed, 47 insertions, 12 deletions
diff --git a/hwc3/ComposerClient.cpp b/hwc3/ComposerClient.cpp index 80231ef..ff65c04 100644 --- a/hwc3/ComposerClient.cpp +++ b/hwc3/ComposerClient.cpp @@ -432,6 +432,17 @@ ndk::ScopedAStatus ComposerClient::setIdleTimerEnabled(int64_t display, int32_t return TO_BINDER_STATUS(err); } +ndk::ScopedAStatus ComposerClient::setRefreshRateChangedCallbackDebugEnabled(int64_t /* display */, + bool /* enabled */) { + // TODO(b/267825022) Add implementation for the HAL and pass appropriate binder status + return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); +} + +void ComposerClient::HalEventCallback::onRefreshRateChangedDebug( + const RefreshRateChangedDebugData&) { + // TODO(b/267825022) Add implementation for the HAL +} + void ComposerClient::HalEventCallback::onHotplug(int64_t display, bool connected) { DEBUG_DISPLAY_FUNC(display); if (connected) { diff --git a/hwc3/ComposerClient.h b/hwc3/ComposerClient.h index 89763f8..f8bfa4c 100644 --- a/hwc3/ComposerClient.h +++ b/hwc3/ComposerClient.h @@ -49,6 +49,7 @@ public: const VsyncPeriodChangeTimeline& timeline) override; void onVsyncIdle(int64_t display) override; void onSeamlessPossible(int64_t display) override; + void onRefreshRateChangedDebug(const RefreshRateChangedDebugData& data) override; private: void cleanDisplayResources(int64_t display); @@ -130,6 +131,8 @@ public: const ndk::ScopedFileDescriptor& releaseFence) override; ndk::ScopedAStatus setVsyncEnabled(int64_t display, bool enabled) override; ndk::ScopedAStatus setIdleTimerEnabled(int64_t display, int32_t timeout) override; + ndk::ScopedAStatus setRefreshRateChangedCallbackDebugEnabled(int64_t /* display */, + bool /* enabled */) override; protected: ::ndk::SpAIBinder createBinder() override; diff --git a/hwc3/impl/HalImpl.cpp b/hwc3/impl/HalImpl.cpp index acae3d2..92e120a 100644 --- a/hwc3/impl/HalImpl.cpp +++ b/hwc3/impl/HalImpl.cpp @@ -1064,4 +1064,10 @@ int32_t HalImpl::getDisplayMultiThreadedPresentSupport(const int64_t& display, b return halDisplay->getDisplayMultiThreadedPresentSupport(outSupport); } +int32_t HalImpl::setRefreshRateChangedCallbackDebugEnabled(int64_t /* display*/, + bool /* enabled */) { + // TODO(b/267825022) Add implementation for the HAL + return EX_UNSUPPORTED_OPERATION; +} + } // namespace aidl::android::hardware::graphics::composer3::impl diff --git a/hwc3/impl/HalImpl.h b/hwc3/impl/HalImpl.h index dce48c0..372e190 100644 --- a/hwc3/impl/HalImpl.h +++ b/hwc3/impl/HalImpl.h @@ -158,6 +158,8 @@ class HalImpl : public IComposerHal { const std::optional<ClockMonotonicTimestamp> expectedPresentTime) override; EventCallback* getEventCallback() { return mEventCallback; } + int32_t setRefreshRateChangedCallbackDebugEnabled(int64_t /* display */, + bool /* enabled */) override; private: void initCaps(); diff --git a/hwc3/include/IComposerHal.h b/hwc3/include/IComposerHal.h index fc6484d..898f254 100644 --- a/hwc3/include/IComposerHal.h +++ b/hwc3/include/IComposerHal.h @@ -70,6 +70,7 @@ #include <aidl/android/hardware/graphics/composer3/PresentFence.h> #include <aidl/android/hardware/graphics/composer3/PresentOrValidate.h> #include <aidl/android/hardware/graphics/composer3/ReadbackBufferAttributes.h> +#include <aidl/android/hardware/graphics/composer3/RefreshRateChangedDebugData.h> #include <aidl/android/hardware/graphics/composer3/ReleaseFences.h> #include <aidl/android/hardware/graphics/composer3/RenderIntent.h> #include <aidl/android/hardware/graphics/composer3/VirtualDisplay.h> @@ -105,6 +106,7 @@ class IComposerHal { const VsyncPeriodChangeTimeline& timeline) = 0; virtual void onVsyncIdle(int64_t display) = 0; virtual void onSeamlessPossible(int64_t display) = 0; + virtual void onRefreshRateChangedDebug(const RefreshRateChangedDebugData& data) = 0; }; virtual void registerEventCallback(EventCallback* callback) = 0; virtual void unregisterEventCallback() = 0; @@ -227,6 +229,7 @@ class IComposerHal { virtual int32_t setLayerBlockingRegion( int64_t display, int64_t layer, const std::vector<std::optional<common::Rect>>& blockingRegion) = 0; + virtual int32_t setRefreshRateChangedCallbackDebugEnabled(int64_t display, bool enabled) = 0; }; } // namespace aidl::android::hardware::graphics::composer3::detail diff --git a/libhwc2.1/libdevice/ExynosDisplay.cpp b/libhwc2.1/libdevice/ExynosDisplay.cpp index 1c001a7..b38f2b5 100644 --- a/libhwc2.1/libdevice/ExynosDisplay.cpp +++ b/libhwc2.1/libdevice/ExynosDisplay.cpp @@ -374,7 +374,6 @@ void ExynosDisplay::PowerHalHintWorker::forceUpdateHints(void) { int32_t ExynosDisplay::PowerHalHintWorker::sendActualWorkDuration() { Lock(); if (mPowerHintSession == nullptr) { - ALOGW("Cannot send actual work duration, power hint session not running"); Unlock(); return -EINVAL; } @@ -413,7 +412,6 @@ int32_t ExynosDisplay::PowerHalHintWorker::updateTargetWorkDuration() { } if (mPowerHintSession == nullptr) { - ALOGW("Cannot send target work duration, power hint session not running"); return -EINVAL; } diff --git a/libhwc2.1/libdevice/ExynosLayer.cpp b/libhwc2.1/libdevice/ExynosLayer.cpp index f21e318..6645ea2 100644 --- a/libhwc2.1/libdevice/ExynosLayer.cpp +++ b/libhwc2.1/libdevice/ExynosLayer.cpp @@ -962,14 +962,16 @@ int32_t ExynosLayer::resetAssignedResource() return ret; } -bool ExynosLayer::checkDownscaleCap(uint32_t bts_refresh_rate) -{ +bool ExynosLayer::checkBtsCap(const uint32_t bts_refresh_rate) { if (mOtfMPP == nullptr) return true; exynos_image src_img; - exynos_image dst_img; - setSrcExynosImage(&src_img); + if (mOtfMPP->checkSpecificRestriction(bts_refresh_rate, src_img)) { + return false; + } + + exynos_image dst_img; setDstExynosImage(&dst_img); const bool isPerpendicular = !!(src_img.transform & HAL_TRANSFORM_ROT_90); diff --git a/libhwc2.1/libdevice/ExynosLayer.h b/libhwc2.1/libdevice/ExynosLayer.h index 8168d16..c180fb3 100644 --- a/libhwc2.1/libdevice/ExynosLayer.h +++ b/libhwc2.1/libdevice/ExynosLayer.h @@ -462,7 +462,7 @@ class ExynosLayer : public ExynosMPPSource { int32_t setSrcExynosImage(exynos_image *src_img); int32_t setDstExynosImage(exynos_image *dst_img); int32_t resetAssignedResource(); - bool checkDownscaleCap(uint32_t btsRefreshRate); + bool checkBtsCap(const uint32_t btsRefreshRate); void setSrcAcquireFence(); diff --git a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.cpp b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.cpp index 489e8cc..fb4cdb2 100644 --- a/libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.cpp +++ b/libhwc2.1/libmaindisplay/ExynosPrimaryDisplay.cpp @@ -840,7 +840,7 @@ void ExynosPrimaryDisplay::handleDisplayIdleEnter(const uint32_t idleTeRefreshRa bool needed = false; for (size_t i = 0; i < mLayers.size(); i++) { if (mLayers[i]->mOtfMPP && mLayers[i]->mM2mMPP == nullptr && - !mLayers[i]->checkDownscaleCap(idleTeRefreshRate)) { + !mLayers[i]->checkBtsCap(idleTeRefreshRate)) { needed = true; break; } @@ -988,7 +988,7 @@ void ExynosPrimaryDisplay::checkBtsReassignResource(const uint32_t vsyncPeriod, if (vsyncPeriod < btsVsyncPeriod) { for (size_t i = 0; i < mLayers.size(); i++) { if (mLayers[i]->mOtfMPP && mLayers[i]->mM2mMPP == nullptr && - !mLayers[i]->checkDownscaleCap(refreshRate)) { + !mLayers[i]->checkBtsCap(refreshRate)) { mLayers[i]->setGeometryChanged(GEOMETRY_DEVICE_CONFIG_CHANGED); break; } diff --git a/libhwc2.1/libresource/ExynosMPP.h b/libhwc2.1/libresource/ExynosMPP.h index b01e5f6..4393301 100644 --- a/libhwc2.1/libresource/ExynosMPP.h +++ b/libhwc2.1/libresource/ExynosMPP.h @@ -604,6 +604,10 @@ public: bool isSupportedDRM(struct exynos_image &src); virtual bool isSupportedHStrideCrop(struct exynos_image &src); bool checkDownscaleCap(const float resolution, const float displayRatio_V) const; + virtual bool checkSpecificRestriction(const uint32_t __unused refreshRate, + const struct exynos_image __unused &src) { + return false; + } virtual uint32_t getDownscaleRestriction(const struct exynos_image &src, const struct exynos_image &dst) const; virtual uint32_t getMaxDownscale(const ExynosDisplay &display, const struct exynos_image &src, diff --git a/libhwjpeg/libhwjpeg-exynos.cpp b/libhwjpeg/libhwjpeg-exynos.cpp index 1bfa55a..9af30d3 100644 --- a/libhwjpeg/libhwjpeg-exynos.cpp +++ b/libhwjpeg/libhwjpeg-exynos.cpp @@ -117,6 +117,7 @@ bool CJpegStreamParser::Parse(unsigned char *streambase, size_t length) } unsigned char marker = *addr++; + filelen -= 2; if ((marker != 0xC4) && ((marker & 0xF0) == 0xC0)) { // SOFn if (marker != 0xC0) { @@ -124,7 +125,7 @@ bool CJpegStreamParser::Parse(unsigned char *streambase, size_t length) return false; } - if (filelen < GetLength(addr)) { + if (filelen < 2 || filelen < GetLength(addr)) { ALOGE("Too small SOF0 segment"); return false; } @@ -143,17 +144,22 @@ bool CJpegStreamParser::Parse(unsigned char *streambase, size_t length) return false; } - if (filelen < GetLength(addr)) { + if (filelen < 2 || filelen < GetLength(addr)) { ALOGE("Corrupted JPEG stream"); return false; } } - if (GetLength(addr) == 0) { + if (filelen < 2 || GetLength(addr) == 0) { ALOGE("Invalid length 0 is read at offset %lu", GetOffset(addr)); return false; } + if (filelen < GetLength(addr)) { + ALOGE("Corrupted JPEG Stream"); + return false; + } + filelen -= GetLength(addr); addr += GetLength(addr); } |