From 0451d8ea5b3d1556d4030f1a8ca5a812db6a0034 Mon Sep 17 00:00:00 2001 From: hmz007 Date: Wed, 14 May 2025 16:17:54 +0800 Subject: [PATCH] rockchip: drmhwc2: limit framebuffer for low-ram device Signed-off-by: hmz007 --- hardware/rockchip/hwcomposer/drmhwc2/drmhwctwo.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/hardware/rockchip/hwcomposer/drmhwc2/drmhwctwo.cpp b/hardware/rockchip/hwcomposer/drmhwc2/drmhwctwo.cpp index 04f85480f55..1b1dea4c8c7 100755 --- a/hardware/rockchip/hwcomposer/drmhwc2/drmhwctwo.cpp +++ b/hardware/rockchip/hwcomposer/drmhwc2/drmhwctwo.cpp @@ -1367,12 +1367,19 @@ HWC2::Error DrmHwcTwo::HwcDisplay::GetDisplayConfigs(uint32_t *num_configs, * RK3588/RK3576:Limit to 4096x2160 if large than 2160p * Other: Limit to 1920x1080 if large than 2160p */ - if(isRK3588(resource_manager_->getSocId()) || isRK3576(resource_manager_->getSocId())){ + bool low_ram_device = property_get_bool("ro.config.low_ram", false); + if (low_ram_device) { + if (ctx_.framebuffer_height >= 2160 && ctx_.framebuffer_width >= ctx_.framebuffer_height) { + HWC2_ALOGD_IF_DEBUG("Limit framebuffer for low-ram device"); + ctx_.framebuffer_width >>= 1; + ctx_.framebuffer_height >>= 1; + } + } else if (isRK3588(resource_manager_->getSocId()) || isRK3576(resource_manager_->getSocId())) { if (ctx_.framebuffer_height >= 2160 && ctx_.framebuffer_width >= ctx_.framebuffer_height) { ctx_.framebuffer_width = ctx_.framebuffer_width * (2160.0 / ctx_.framebuffer_height); ctx_.framebuffer_height = 2160; } - }else{ + } else { if (ctx_.framebuffer_height >= 2160 && ctx_.framebuffer_width >= ctx_.framebuffer_height) { ctx_.framebuffer_width = ctx_.framebuffer_width * (1080.0 / ctx_.framebuffer_height); ctx_.framebuffer_height = 1080;