sm7250-common: Enable color mode & set display calibration on color mode settings

* sRGB on Natural and Boosted
   Unmanaged on Saturated
   P3 on Automatic

 * Set color mode to Natural by default

 * Adjust display composition color spaces

Change-Id: If73eafa82395e80acf84445fcab2f1ce25a33e23
Signed-off-by: aswin7469 <aswinas@pixysos.com>
This commit is contained in:
Jake Weinstein
2021-07-10 14:52:09 +08:00
committed by KakatkarAkshay
parent 830a408488
commit 84e9206b3a
6 changed files with 62 additions and 6 deletions

View File

@@ -310,12 +310,37 @@
<item>0:2:15</item> <!-- ID0:Fingerprint:Strong -->
</string-array>
<!-- Indicate available ColorDisplayManager.COLOR_MODE_xxx. -->
<!-- List supported color modes. -->
<integer-array name="config_availableColorModes">
<item>0</item>
<item>256</item>
<item>257</item>
<item>258</item>
<item>259</item>
<item>0</item> <!-- COLOR_MODE_NATURAL -->
<item>1</item> <!-- COLOR_MODE_BOOSTED -->
<item>2</item> <!-- COLOR_MODE_SATURATED -->
<item>3</item> <!-- COLOR_MODE_AUTOMATIC -->
</integer-array>
<!-- The following two arrays specify which color space to use for display composition when a
certain color mode is active.
Composition color spaces are defined in android.view.Display.COLOR_MODE_xxx, and color
modes are defined in ColorDisplayManager.COLOR_MODE_xxx and
ColorDisplayManager.VENDOR_COLOR_MODE_xxx.
The color space COLOR_MODE_DEFAULT (0) lets the system select the most appropriate
composition color space for currently displayed content. Other values (e.g.,
COLOR_MODE_SRGB) override system selection; these other color spaces must be supported by
the device for for display composition.
If a color mode does not have a corresponding color space specified in this array, the
currently set composition color space will not be modified.-->
<integer-array name="config_displayCompositionColorModes">
<item>0</item> <!-- COLOR_MODE_NATURAL -->
<item>1</item> <!-- COLOR_MODE_BOOSTED -->
<item>2</item> <!-- COLOR_MODE_SATURATED -->
<item>3</item> <!-- COLOR_MODE_AUTOMATIC -->
</integer-array>
<integer-array name="config_displayCompositionColorSpaces">
<item>0</item> <!-- COLOR_MODE_DEFAULT -->
<item>0</item> <!-- COLOR_MODE_DEFAULT -->
<item>0</item> <!-- COLOR_MODE_DEFAULT -->
<item>9</item> <!-- COLOR_MODE_DISPLAY_P3 -->
</integer-array>
</resources>

View File

@@ -120,6 +120,14 @@ LOCAL_SRC_FILES := etc/init.oem.rc
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/init/hw
include $(BUILD_PREBUILT)
include $(CLEAR_VARS)
LOCAL_MODULE := init.color.rc
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := ETC
LOCAL_SRC_FILES := etc/init.color.rc
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/init/hw
include $(BUILD_PREBUILT)
include $(CLEAR_VARS)
LOCAL_MODULE := init.qcom.factory.rc
LOCAL_MODULE_TAGS := optional

18
rootdir/etc/init.color.rc Normal file
View File

@@ -0,0 +1,18 @@
on boot
chown system system /sys/class/drm/card0-DSI-1/native_display_p3_mode
chown system system /sys/class/drm/card0-DSI-1/native_display_srgb_color_mode
# Set sRGB calibration on Natural and Boosted Mode.
on property:persist.sys.sf.native_mode=0
write /sys/class/drm/card0-DSI-1/native_display_p3_mode 0
write /sys/class/drm/card0-DSI-1/native_display_srgb_color_mode 1
# Set unmanaged calibration on Saturated Mode.
on property:persist.sys.sf.native_mode=1
write /sys/class/drm/card0-DSI-1/native_display_srgb_color_mode 0
write /sys/class/drm/card0-DSI-1/native_display_p3_mode 0
# Set P3 calibration on Adaptive/Automatic Mode.
on property:persist.sys.sf.native_mode=2
write /sys/class/drm/card0-DSI-1/native_display_srgb_color_mode 0
write /sys/class/drm/card0-DSI-1/native_display_p3_mode 1

View File

@@ -22,3 +22,4 @@ type sysfs_tpd, fs_type, sysfs_type;
type sysfs_tri_state_key, sysfs_type, fs_type;
type sysfs_vl53l1, fs_type, sysfs_type;
type vendor_sysfs_video_call_on, fs_type, sysfs_type;
type sysfs_color, fs_type, sysfs_type;

View File

@@ -17,6 +17,8 @@ genfscon sysfs /devices/platform/soc/ae00000.qcom,mdss_mdp/drm/card0/card0-DSI-1
genfscon sysfs /devices/platform/soc/ae00000.qcom,mdss_mdp/drm/card0/card0-DSI-1/hbm u:object_r:sysfs_livedisplay_tuneable:s0
genfscon sysfs /devices/platform/soc/ae00000.qcom,mdss_mdp/drm/card0/card0-DSI-1/notify_dim u:object_r:sysfs_fod:s0
genfscon sysfs /devices/platform/soc/ae00000.qcom,mdss_mdp/drm/card0/card0-DSI-1/notify_fppress u:object_r:sysfs_fod:s0
genfscon sysfs /devices/platform/soc/ae00000.qcom,mdss_mdp/drm/card0/card0-DSI-1/native_display_p3_mode u:object_r:sysfs_color:s0
genfscon sysfs /devices/platform/soc/ae00000.qcom,mdss_mdp/drm/card0/card0-DSI-1/native_display_srgb_color_mode u:object_r:sysfs_color:s0
genfscon sysfs /devices/platform/soc/soc:tri_state_key/hall_data_calib u:object_r:sysfs_tri_state_key:s0
genfscon sysfs /module/memplus_core/parameters u:object_r:sysfs_memplus:s0
genfscon sysfs /module/qpnp_smb5/parameters/call_on u:object_r:sysfs_dash_charger:s0

View File

@@ -12,6 +12,8 @@ binder_call(hal_display_default, vendor_hal_display_color)
allow hal_display_default vendor_hal_display_postproc_hwservice:hwservice_manager find;
allow hal_display_default sysfs_color:file rw_file_perms;
allow hal_display_default sysfs:file rw_file_perms;
allow hal_display_default sysfs_fod:file rw_file_perms;