Bootstrap

DRM驱动代码分析:色彩管理

高通PQ有哪些子模块?

/**
 * DSPP sub-blocks
 * @SDE_DSPP_IGC             DSPP Inverse gamma correction block
 * @SDE_DSPP_PCC             Panel color correction block
 * @SDE_DSPP_GC              Gamma correction block
 * @SDE_DSPP_HSIC            Global HSIC block
 * @SDE_DSPP_MEMCOLOR        Memory Color block
 * @SDE_DSPP_SIXZONE         Six zone block
 * @SDE_DSPP_GAMUT           Gamut block
 * @SDE_DSPP_DITHER          Dither block
 * @SDE_DSPP_HIST            Histogram block
 * @SDE_DSPP_VLUT            PA VLUT block
 * @SDE_DSPP_AD              AD block
 * @SDE_DSPP_LTM             LTM block
 * @SDE_DSPP_SPR             SPR block
 * @SDE_DSPP_DEMURA          Demura block
 * @SDE_DSPP_RC              RC block
 * @SDE_DSPP_SB              SB LUT DMA
 * @SDE_DSPP_MAX             maximum value
 */

Inverse gamma correction:反向gamma校正

HSIC: 色相(Hue)、饱和度(Saturation)、亮度(Intensity)、对比度(Contrast)

Memory Color:记忆色。(人们记忆中的颜色,可能存在某种程度上的偏好强化)

Six zone:Sixzone HSV。和HSV有什么区别?

Gamut:3d gamut

Dither:抖动,有1个4x4的矩阵

Histogram:直方图

PA VLUT:

AD:
TFT显示屏功耗控制方向——AD显示
AD显示是方案硬件平台(高通,MTK,展锐等)支持一种显示增强型技术。
实现原理:
1)根据环境光感度实时调整单像素的亮度。
2)模拟人视觉系统做单像素调节,修正对比度。
3)依据光线传感器ALS上报LUX值来确定AD调节强度和LCD亮度。
4)与CABC可并用。
来源:LCD这样设计可以多用半天

LTM:local tone mapping

SPR:

Demura:

RC:圆角

SB LUT:

配置gamma表

vendor\qcom\opensource\display-drivers\msm\sde\sde_color_processing.c
static void _dspp_gc_install_property(struct drm_crtc *crtc)
snprintf(feature_name, ARRAY_SIZE(feature_name), "%s%d", "SDE_DSPP_GC_V", version);
_sde_cp_crtc_install_blob_property(crtc, feature_name, SDE_CP_CRTC_DSPP_GC, sizeof(struct drm_msm_pgc_lut));
struct drm_msm_pgc_lut {
   
	__u64 flags;
	__u32 c0[PGC_TBL_LEN];
	__u32 c1[PGC_TBL_LEN];
	__u32 c2[PGC_TBL_LEN];
};

定义了一个SDE_CP_CRTC_DSPP_GC property,用来传递gamma lut。

vendor\qcom\opensource\display-drivers\msm\msm_atomic.c
static void complete_commit(struct msm_commit *c)
drm_atomic_helper_commit_planes(dev, state, DRM_PLANE_COMMIT_ACTIVE_ONLY);
drivers\gpu\drm\drm_atomic_helper.c
void drm_atomic_helper_commit_planes(struct drm_device *dev, struct drm_atomic_state *old_state, uint32_t flags)
const struct drm_crtc_helper_funcs *funcs;
funcs = crtc->helper_private;
funcs->atomic_begin(crtc, old_state);
vendor\qcom\opensource\display-drivers\msm\sde\sde_crtc.c
static void sde_crtc_atomic_begin(struct drm_crtc *crtc,	struct drm_crtc_state *old_state)
if (sde_kms_is_cp_operation_allowed(sde_kms))
		sde_cp_crtc_apply_properties(crtc);
vendor\qcom\opensource\display-drivers\msm\sde\sde_color_processing.c
void sde_cp_crtc_apply_properties(struct drm_crtc *crtc)
list_for_each_entry_safe(prop_node, n, &sde_crtc->cp_dirty_list, cp_dirty_list) {
   
_sde_cp_crtc_commit_feature(prop_node, sde_crtc);
}
vendor\qcom\opensource\display-drivers\msm\sde\sde_color_processing.c
static void _sde_cp_crtc_commit_feature(struct sde_cp_node *prop_node, struct sde_crtc *sde_crtc)
memset(&hw_cfg, 0, sizeof(hw_cfg));
_sde_cp_get_cached_payload(prop_node, &hw_cfg, &feature_enabled);----------------------1
feature_wrapper commit_feature = set_crtc_feature_wrappers[prop_node->feature];
ret = commit_feature(hw_dspp, &hw_cfg, sde_crtc);

将blob->data赋给hw_cfg->payload。

feature_wrapper set_crtc_feature_wrappers[SDE_CP_CRTC_MAX_FEATURES];
#define setup_set_crtc_feature_wrappers(wrappers) \
do {
      \
	memset(wrappers, 0, sizeof(wrappers)); \
	wrappers[SDE_CP_CRTC_DSPP_VLUT] = _set_dspp_vlut_feature; \
	wrappers[SDE_CP_CRTC_DSPP_PCC] = _set_dspp_pcc_feature; \
	wrappers[SDE_CP_CRTC_DSPP_IGC] = _set_dspp_igc_feature; \
	wrappers
;