Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 36a2ca7e authored by Krishna Srinivas's avatar Krishna Srinivas
Browse files

msm: mdss: update csc table on cdm block based on configuration



Update csc type table on cdm block based on configuration
from kernel client. Add proper validation checks in wfd
interface before updating the csc table to valid selection.

Change-Id: Id3a0f68c30919029df01e003a1bcb39ff894574c
Signed-off-by: default avatarDhaval Patel <pdhaval@codeaurora.org>
Signed-off-by: default avatarKrishna Srinivas <krisrini@codeaurora.org>
parent 62fc063d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -377,6 +377,7 @@ struct mdss_mdp_ctl {

	/* used for WFD */
	u32 dst_format;
	enum mdss_mdp_csc_type csc_type;
	struct mult_factor dst_comp_ratio;

	u32 clk_rate;
+4 −2
Original line number Diff line number Diff line
/* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -110,7 +110,9 @@ static int mdss_mdp_cdm_csc_setup(struct mdss_mdp_cdm *cdm,

	mdss_mdp_csc_setup(MDSS_MDP_BLOCK_CDM, cdm->num, data->csc_type);

	if (data->csc_type == MDSS_MDP_CSC_RGB2YUV_601L) {
	if ((data->csc_type == MDSS_MDP_CSC_RGB2YUV_601L) ||
		(data->csc_type == MDSS_MDP_CSC_RGB2YUV_601FR) ||
		(data->csc_type == MDSS_MDP_CSC_RGB2YUV_709L)) {
		op_mode |= BIT(2);  /* DST_DATA_FORMAT = YUV */
		op_mode &= ~BIT(1); /* SRC_DATA_FORMAT = RGB */
		op_mode |= BIT(0);  /* EN = 1 */
+1 −1
Original line number Diff line number Diff line
@@ -1709,7 +1709,7 @@ static int mdss_mdp_video_cdm_setup(struct mdss_mdp_cdm *cdm,
	}
	setup.out_format = pinfo->out_format;
	if (fmt->is_yuv)
		setup.csc_type = MDSS_MDP_CSC_RGB2YUV_601L;
		setup.csc_type = MDSS_MDP_CSC_RGB2YUV_601FR;
	else
		setup.csc_type = MDSS_MDP_CSC_RGB2RGB;

+3 −5
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ struct mdss_mdp_writeback_ctx {
	u16 width;
	u16 height;
	u16 frame_rate;
	enum mdss_mdp_csc_type csc_type;
	struct mdss_rect dst_rect;

	u32 dnsc_factor_w;
@@ -165,11 +166,6 @@ static int mdss_mdp_writeback_cdm_setup(struct mdss_mdp_writeback_ctx *ctx,
		return -EINVAL;
	}

	if (fmt->is_yuv)
		setup.csc_type = MDSS_MDP_CSC_RGB2YUV_601L;
	else
		setup.csc_type = MDSS_MDP_CSC_RGB2RGB;

	switch (fmt->chroma_sample) {
	case MDSS_MDP_CHROMA_RGB:
		setup.horz_downsampling_type = MDP_CDM_CDWN_DISABLE;
@@ -193,6 +189,7 @@ static int mdss_mdp_writeback_cdm_setup(struct mdss_mdp_writeback_ctx *ctx,
	setup.mdp_csc_bit_depth = MDP_CDM_CSC_8BIT;
	setup.output_width = ctx->width;
	setup.output_height = ctx->height;
	setup.csc_type = ctx->csc_type;
	return mdss_mdp_cdm_setup(cdm, &setup);
}

@@ -375,6 +372,7 @@ static int mdss_mdp_writeback_prepare_wfd(struct mdss_mdp_ctl *ctl, void *arg)
	ctx->width = ctl->width;
	ctx->height = ctl->height;
	ctx->frame_rate = ctl->frame_rate;
	ctx->csc_type = ctl->csc_type;
	ctx->dst_rect.x = 0;
	ctx->dst_rect.y = 0;
	ctx->dst_rect.w = ctx->width;
+21 −0
Original line number Diff line number Diff line
@@ -131,6 +131,7 @@ int mdss_mdp_wfd_setup(struct mdss_mdp_wfd *wfd,
	u32 wb_idx = layer->writeback_ndx;
	struct mdss_mdp_ctl *ctl = wfd->ctl;
	struct mdss_mdp_writeback *wb = NULL;
	struct mdss_mdp_format_params *fmt = NULL;
	int ret = 0;
	u32 width, height, max_mixer_width;

@@ -171,6 +172,26 @@ int mdss_mdp_wfd_setup(struct mdss_mdp_wfd *wfd,
	ctl->roi =  (struct mdss_rect) {0, 0, width, height};
	ctl->is_secure = (layer->flags & MDP_LAYER_SECURE_SESSION);

	fmt = mdss_mdp_get_format_params(layer->buffer.format);

	/* only 3 csc type supported */
	if (fmt->is_yuv) {
		switch (layer->color_space) {
		case MDP_CSC_ITU_R_601:
			ctl->csc_type = MDSS_MDP_CSC_RGB2YUV_601L;
			break;
		case MDP_CSC_ITU_R_709:
			ctl->csc_type = MDSS_MDP_CSC_RGB2YUV_709L;
			break;
		case MDP_CSC_ITU_R_601_FR:
		default:
			ctl->csc_type = MDSS_MDP_CSC_RGB2YUV_601FR;
			break;
		}
	} else {
		ctl->csc_type = MDSS_MDP_CSC_RGB2RGB;
	}

	if (ctl->mdata->wfd_mode == MDSS_MDP_WFD_INTERFACE) {
		ctl->mixer_left = mdss_mdp_mixer_alloc(ctl,
			MDSS_MDP_MIXER_TYPE_INTF, (width > max_mixer_width), 0);
Loading