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

Commit b7b83c81 authored by Ujwal Patel's avatar Ujwal Patel
Browse files

msm: mdss: Enable fixed MMBs support for RGB pipes



RGB pipes in some of the chip-sets are statically tied to dedicated
Memory Macro Blocks (MMBs) out of common shared memory pool. These MMBs
cannot be used by other pipes. Enable support for this fixed MMBs by
parsing indexes from device tree and reserving fixed MMBs first before
general pool is used.

Change-Id: Ic4bc7fa790f430a2853719fec7fd849149bc6976
Signed-off-by: default avatarUjwal Patel <ujwalp@codeaurora.org>
parent 80ef8f9b
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -143,6 +143,11 @@ Optional properties:
- qcom,mdss-highest-bank-bit: Property to indicate tile format as opposed to usual
				linear format. The value tells the GPU highest memory
				 bank bit used.
- qcom,mdss-pipe-rgb-fixed-mmb: Array of indexes describing fixed Memory Macro
				Blocks (MMBs) for rgb pipes. First value denotes
				total numbers of MMBs per pipe while values, if
				any, following first one denotes indexes of MMBs
				to that RGB pipe.

Optional subnodes:
Child nodes representing the frame buffer virtual devices.
@@ -190,6 +195,10 @@ Example:
		qcom,mdss-pipe-vig-fetch-id = <1 4 7>;
		qcom,mdss-pipe-rgb-fetch-id = <16 17 18>;
		qcom,mdss-pipe-dma-fetch-id = <10 13>;
		qcom,mdss-pipe-rgb-fixed-mmb =	<2 0 1>,
						<2 2 3>,
						<2 4 5>,
						<2 6 7>;
		qcom,mdss-smp-data = <22 4096>;
		qcom,mdss-rot-block-size = <64>;
		qcom,mdss-smp-mb-per-pipe = <2>;
+5 −0
Original line number Diff line number Diff line
@@ -28,6 +28,8 @@
#define MDSS_REG_WRITE(addr, val) writel_relaxed(val, mdss_res->mdp_base + addr)
#define MDSS_REG_READ(addr) readl_relaxed(mdss_res->mdp_base + addr)

#define MAX_DRV_SUP_MMB_BLKS	44

enum mdss_mdp_clk_type {
	MDSS_CLK_AHB,
	MDSS_CLK_AXI,
@@ -112,6 +114,9 @@ struct mdss_data_type {
	u32 nvig_pipes;
	u32 nrgb_pipes;
	u32 ndma_pipes;

	DECLARE_BITMAP(mmb_alloc_map, MAX_DRV_SUP_MMB_BLKS);

	struct mdss_mdp_mixer *mixer_intf;
	struct mdss_mdp_mixer *mixer_wb;
	u32 nmixers_intf;
+45 −2
Original line number Diff line number Diff line
@@ -1870,7 +1870,8 @@ static int mdss_mdp_parse_dt_smp(struct platform_device *pdev)
	struct mdss_data_type *mdata = platform_get_drvdata(pdev);
	u32 num;
	u32 data[2];
	int rc;
	int rc, len;
	const u32 *arr;

	num = mdss_mdp_parse_dt_prop_len(pdev, "qcom,mdss-smp-data");

@@ -1892,7 +1893,49 @@ static int mdss_mdp_parse_dt_smp(struct platform_device *pdev)
		"qcom,mdss-smp-mb-per-pipe", data);
	mdata->smp_mb_per_pipe = (!rc ? data[0] : 0);

	return 0;
	rc = 0;
	arr = of_get_property(pdev->dev.of_node,
		"qcom,mdss-pipe-rgb-fixed-mmb", &len);
	if (arr) {
		int i, j, k;
		u32 cnt, mmb;

		len /= sizeof(u32);
		for (i = 0, k = 0; i < len; k++) {
			struct mdss_mdp_pipe *pipe = NULL;

			if (k >= mdata->nrgb_pipes) {
				pr_err("invalid fixed mmbs for rgb pipes\n");
				return -EINVAL;
			}

			pipe = &mdata->rgb_pipes[k];

			cnt = be32_to_cpu(arr[i++]);
			if (cnt == 0)
				continue;

			for (j = 0; j < cnt; j++) {
				mmb = be32_to_cpu(arr[i++]);
				if (mmb > mdata->smp_mb_cnt) {
					pr_err("overflow mmb%d: rgb%d: max%d\n",
						mmb, k, mdata->smp_mb_cnt);
					return -EINVAL;
				}
				/* rgb pipes fetches only single plane */
				set_bit(mmb, pipe->smp_map[0].fixed);
			}
			if (bitmap_intersects(pipe->smp_map[0].fixed,
				mdata->mmb_alloc_map, mdata->smp_mb_cnt)) {
				pr_err("overlapping fixed mmb map\n");
				return -EINVAL;
			}
			bitmap_or(mdata->mmb_alloc_map, pipe->smp_map[0].fixed,
				mdata->mmb_alloc_map, mdata->smp_mb_cnt);
		}
	}

	return rc;
}

static int mdss_mdp_parse_dt_misc(struct platform_device *pdev)
+3 −2
Original line number Diff line number Diff line
@@ -316,8 +316,9 @@ struct mdss_pipe_pp_res {
};

struct mdss_mdp_pipe_smp_map {
	DECLARE_BITMAP(reserved, MDSS_MDP_SMP_MMB_BLOCKS);
	DECLARE_BITMAP(allocated, MDSS_MDP_SMP_MMB_BLOCKS);
	DECLARE_BITMAP(reserved, MAX_DRV_SUP_MMB_BLKS);
	DECLARE_BITMAP(allocated, MAX_DRV_SUP_MMB_BLKS);
	DECLARE_BITMAP(fixed, MAX_DRV_SUP_MMB_BLKS);
};

struct mdss_mdp_pipe {
+0 −2
Original line number Diff line number Diff line
@@ -500,8 +500,6 @@ enum mdss_mdp_pingpong_index {
#define MDSS_MDP_REG_SMP_ALLOC_W0			0x00180
#define MDSS_MDP_REG_SMP_ALLOC_R0			0x00230

#define MDSS_MDP_SMP_MMB_BLOCKS			44

#define MDSS_MDP_LP_MISR_SEL			0x450
#define MDSS_MDP_LP_MISR_CTRL_MDP		0x454
#define MDSS_MDP_LP_MISR_CTRL_HDMI		0x458
Loading