From b9851bd27af060d9215fd33e85156a66ffd53adf Mon Sep 17 00:00:00 2001 From: Ray Zhang Date: Fri, 13 Nov 2015 12:37:31 +0530 Subject: [PATCH] init: early_boot: Use virtual_size to set lcd_density Calculating density depending on FB resolution is more accurate than depending on platform or target ID, since in some cases there might be multiple panels supported on a single target or a single target can have multiple hwplatform variants Change-Id: Ibf238b269d3c64ffc06d798998dcd68343977003 --- rootdir/etc/init.qcom.early_boot.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/rootdir/etc/init.qcom.early_boot.sh b/rootdir/etc/init.qcom.early_boot.sh index ce2af5e4..bd94503f 100755 --- a/rootdir/etc/init.qcom.early_boot.sh +++ b/rootdir/etc/init.qcom.early_boot.sh @@ -45,6 +45,11 @@ else soc_hwver=`cat /sys/devices/system/soc/soc0/platform_version` 2> /dev/null fi +if [ -f /sys/class/graphics/fb0/virtual_size ]; then + res=`cat /sys/class/graphics/fb0/virtual_size` 2> /dev/null + fb_width=${res%,*} +fi + log -t BOOT -p i "MSM target '$1', SoC '$soc_hwplatform', HwID '$soc_hwid', SoC ver '$soc_hwver'" target=`getprop ro.board.platform` @@ -178,6 +183,20 @@ case "$target" in ;; esac ;; + *) + if [ -z $fb_width ]; then + setprop ro.sf.lcd_density 320 + else + if [ $fb_width -ge 1080 ]; then + setprop ro.sf.lcd_density 480 + elif [ $fb_width -ge 720 ]; then + setprop ro.sf.lcd_density 320 #for 720X1280 resolution + elif [ $fb_width -ge 480 ]; then + setprop ro.sf.lcd_density 240 #for 480X854 QRD resolution + else + setprop ro.sf.lcd_density 160 + fi + fi esac # Setup display nodes & permissions