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

Commit ea29a285 authored by Saurabh Shah's avatar Saurabh Shah
Browse files

msm: mdss: add support for rotator downscale



Add support for rotator downscale, available from 8994. This allows
source data to be downscaled via power of 2 steps, before being
written back to memory.

Change-Id: If42a5a8c9cb336abfc22dc9848c24ec0f54cd878
Signed-off-by: default avatarCasey Piper <cpiper@codeaurora.org>
Signed-off-by: default avatarSaurabh Shah <saurshah@codeaurora.org>
Signed-off-by: default avatarAdrian Salido-Moreno <adrianm@codeaurora.org>
parent 648cfa62
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -270,6 +270,8 @@ Optional properties:
			    access the memory.
- qcom,mdss-has-source-split: Boolean property to indicate if source split
			      feature is available or not.
- qcom,mdss-has-rotator-downscale: Boolean property to indicate if rotator
				   downscale feature is available or not.
- qcom,mdss-ad-off:		Array of offset addresses for the available
				Assertive Display (AD) blocks. These offsets
				are calculated from the register "mdp_phys"
@@ -524,6 +526,7 @@ Example:
		qcom,mdss-no-lut-read;
		qcom,mdss-no-hist-vote;
		qcom,mdss-traffic-shaper-enabled;
		qcom,mdss-has-rotator-downscale;

		qcom,mdss-has-dst-split;
		qcom,mdss-pipe-vig-xin-id = <0 4 8>;
+1 −0
Original line number Diff line number Diff line
@@ -241,6 +241,7 @@ struct mdss_data_type {
	int iommu_ref_cnt;
	u32 latency_buff_per;
	atomic_t active_intf_cnt;
	bool has_rot_dwnscale;

	u64 ab_rt[MDSS_MAX_HW_BLK];
	u64 ab_nrt[MDSS_MAX_HW_BLK];
+4 −1
Original line number Diff line number Diff line
@@ -1449,6 +1449,8 @@ static ssize_t mdss_mdp_show_capabilities(struct device *dev,
		SPRINT(" src_split");
	if (mdata->max_mixer_width)
		SPRINT(" max_mixer_width");
	if (mdata->has_rot_dwnscale)
		SPRINT(" rotator_downscale");
	SPRINT("\n");

	return cnt;
@@ -2728,7 +2730,8 @@ static int mdss_mdp_parse_dt_misc(struct platform_device *pdev)
	mdss_mdp_parse_vbif_qos(pdev);
	mdata->traffic_shaper_en = of_property_read_bool(pdev->dev.of_node,
		 "qcom,mdss-traffic-shaper-enabled");

	mdata->has_rot_dwnscale = of_property_read_bool(pdev->dev.of_node,
		"qcom,mdss-has-rotator-downscale");
	return 0;
}

+1 −0
Original line number Diff line number Diff line
@@ -397,6 +397,7 @@ enum mdss_mdp_writeback_index {
#define MDSS_MDP_REG_WB_DST_MATRIX_ROW3			0x03C
#define MDSS_MDP_REG_WB_DST_WRITE_CONFIG		0x048
#define MDSS_MDP_REG_WB_ROTATION_DNSCALER		0x050
#define MDSS_MDP_REG_WB_ROTATOR_PIPE_DOWNSCALER		0x054
#define MDSS_MDP_REG_WB_N16_INIT_PHASE_X_C03		0x060
#define MDSS_MDP_REG_WB_N16_INIT_PHASE_X_C12		0x064
#define MDSS_MDP_REG_WB_N16_INIT_PHASE_Y_C03		0x068
+17 −7
Original line number Diff line number Diff line
@@ -53,6 +53,9 @@ struct mdss_mdp_writeback_ctx {
	u16 height;
	struct mdss_rect dst_rect;

	u32 dnsc_factor_w;
	u32 dnsc_factor_h;

	u8 rot90;
	u32 bwc_mode;
	int initialized;
@@ -140,6 +143,7 @@ static int mdss_mdp_writeback_format_setup(struct mdss_mdp_writeback_ctx *ctx,
{
	struct mdss_mdp_format_params *fmt;
	u32 dst_format, pattern, ystride0, ystride1, outsize, chroma_samp;
	u32 dnsc_factor;
	u32 opmode = ctx->opmode;
	bool rotation = false;
	struct mdss_data_type *mdata;
@@ -227,6 +231,12 @@ static int mdss_mdp_writeback_format_setup(struct mdss_mdp_writeback_ctx *ctx,
		   (ctx->dst_planes.ystride[3] << 16);
	outsize = (ctx->dst_rect.h << 16) | ctx->dst_rect.w;

	if (ctx->type == MDSS_MDP_WRITEBACK_TYPE_ROTATOR &&
			mdata->has_rot_dwnscale) {
		dnsc_factor = (ctx->dnsc_factor_h) | (ctx->dnsc_factor_w << 16);
		mdp_wb_write(ctx, MDSS_MDP_REG_WB_ROTATOR_PIPE_DOWNSCALER,
								dnsc_factor);
	}
	mdp_wb_write(ctx, MDSS_MDP_REG_WB_ALPHA_X_VALUE, 0xFF);
	mdp_wb_write(ctx, MDSS_MDP_REG_WB_DST_FORMAT, dst_format);
	mdp_wb_write(ctx, MDSS_MDP_REG_WB_DST_OP_MODE, opmode);
@@ -306,12 +316,14 @@ static int mdss_mdp_writeback_prepare_rot(struct mdss_mdp_ctl *ctl, void *arg)
	ctx->bwc_mode = rot->bwc_mode;
	ctx->opmode |= ctx->bwc_mode;

	ctx->width = rot->dst.w;
	ctx->height = rot->dst.h;
	ctx->width = ctx->dst_rect.w = rot->dnsc_factor_w ?
		rot->dst.w / rot->dnsc_factor_w : rot->dst.w;
	ctx->height = ctx->dst_rect.h = rot->dnsc_factor_h ?
		rot->dst.h / rot->dnsc_factor_h : rot->dst.h;
	ctx->dst_rect.x = rot->dst.x;
	ctx->dst_rect.y = rot->dst.y;
	ctx->dst_rect.w = rot->src_rect.w;
	ctx->dst_rect.h = rot->src_rect.h;
	ctx->dnsc_factor_w = rot->dnsc_factor_w;
	ctx->dnsc_factor_h = rot->dnsc_factor_h;

	ctx->rot90 = !!(rot->flags & MDP_ROT_90);

@@ -327,10 +339,8 @@ static int mdss_mdp_writeback_prepare_rot(struct mdss_mdp_ctl *ctl, void *arg)
	else
		format = rot->format;

	if (ctx->rot90) {
	if (ctx->rot90)
		ctx->opmode |= BIT(5); /* ROT 90 */
		swap(ctx->dst_rect.w, ctx->dst_rect.h);
	}

	return mdss_mdp_writeback_format_setup(ctx, format);
}
Loading