From fb438e9a0f5b49ccd1cef415561dcb4e83bed95a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=82=AC?= Date: Mon, 1 Sep 2025 08:48:48 +0000 Subject: [PATCH] =?UTF-8?q?updater=E7=95=8C=E9=9D=A2=E5=85=B3=E6=9C=BA?= =?UTF-8?q?=E6=88=96=E8=80=85=E9=87=8D=E5=90=AF=E6=97=B6=EF=BC=8C=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E4=BA=AE=E5=BA=A6=E4=B8=BA0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 黄悬 --- services/ui/driver/graphic_engine.cpp | 28 ++++++++++++++++++++------- services/ui/driver/graphic_engine.h | 3 +++ 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/services/ui/driver/graphic_engine.cpp b/services/ui/driver/graphic_engine.cpp index ba95193d..8dc6c86e 100644 --- a/services/ui/driver/graphic_engine.cpp +++ b/services/ui/driver/graphic_engine.cpp @@ -102,6 +102,11 @@ __attribute__((weak)) void InitFlushBatteryStatusExt(void) { } +__attribute__((weak)) void SetBrightness(int value) +{ + LOG(INFO) << "not pc, not set backlight"; +} + void GraphicEngine::FlushThreadLoop() const { while (!flushStop_) { @@ -110,18 +115,27 @@ void GraphicEngine::FlushThreadLoop() const Utils::UsSleep(sleepTime_); } // clear screen after stop - UiRotation::GetInstance().SetDegree(UI_ROTATION_DEGREE::UI_ROTATION_0); - uint8_t pixelBytes = OHOS::DrawUtils::GetByteSizeByColorMode(colorMode_); - uint32_t picSize = 0; - if (__builtin_mul_overflow(width_ * height_, pixelBytes, &picSize)) { - return; + LOG(INFO) << "disable clear stop stopClear_ = " << stopClear_; + if (stopClear_) { + UiRotation::GetInstance().SetDegree(UI_ROTATION_DEGREE::UI_ROTATION_0); + uint8_t pixelBytes = OHOS::DrawUtils::GetByteSizeByColorMode(colorMode_); + uint32_t picSize = 0; + if (__builtin_mul_overflow(width_ * height_, pixelBytes, &picSize)) { + return; + } + (void)memset_s(buffInfo_->virAddr, picSize, 0, picSize); + sfDev_->Flip(reinterpret_cast(buffInfo_->virAddr)); } - (void)memset_s(buffInfo_->virAddr, picSize, 0, picSize); - sfDev_->Flip(reinterpret_cast(buffInfo_->virAddr)); +} + +void GraphicEngine::DisableClearStop(void) +{ + stopClear_ = false; } void GraphicEngine::StopEngine(void) { + SetBrightness(0); flushStop_ = true; Utils::UsSleep(THREAD_USLEEP_TIME * 10); // 10: wait for stop 100ms } diff --git a/services/ui/driver/graphic_engine.h b/services/ui/driver/graphic_engine.h index c80dba19..a036388a 100644 --- a/services/ui/driver/graphic_engine.h +++ b/services/ui/driver/graphic_engine.h @@ -38,6 +38,7 @@ public: uint16_t GetScreenHeight() override; void StopEngine(void); void SetSleepTime(uint32_t sleepTime); + void DisableClearStop(void); void HandleScreenPowerDown(bool blank); private: void FlushThreadLoop() const; @@ -53,6 +54,7 @@ private: uint16_t width_ = 0; uint8_t colorMode_ = 0; bool flushStop_ = true; + bool stopClear_ = true; uint32_t sleepTime_ = THREAD_USLEEP_TIME; std::mutex mtx_ {}; }; @@ -64,6 +66,7 @@ extern "C" { #endif /* __cplusplus */ void InitFlushBatteryStatusExt(void); void PostInitSurfDev(std::unique_ptr &surfDev, GrSurface &surface); +void SetBrightness(int value); #ifdef __cplusplus #if __cplusplus } -- Gitee