if (!h || !l_w) {
dev_err(dev, "%s: input width(%d) or height(%d) is invalid\n", __func__, l_w, h); return;
}
if (priv->fifo_en) {
mtk_merge_fifo_setting(priv, cmdq_pkt);
mode = CFG_10_10_2PI_2PO_BUF_MODE;
}
if (r_w)
mode = CFG_11_10_1PI_2PO_MERGE;
mtk_ddp_write(cmdq_pkt, h << 16 | l_w, &priv->cmdq_reg, priv->regs,
DISP_REG_MERGE_CFG_0);
mtk_ddp_write(cmdq_pkt, h << 16 | r_w, &priv->cmdq_reg, priv->regs,
DISP_REG_MERGE_CFG_1);
mtk_ddp_write(cmdq_pkt, h << 16 | (l_w + r_w), &priv->cmdq_reg, priv->regs,
DISP_REG_MERGE_CFG_4); /* * DISP_REG_MERGE_CFG_24 is merge SRAM0 w/h * DISP_REG_MERGE_CFG_25 is merge SRAM1 w/h. * If r_w > 0, the merge is in merge mode (input0 and input1 merge together), * the input0 goes to SRAM0, and input1 goes to SRAM1. * If r_w = 0, the merge is in buffer mode, the input goes through SRAM0 and * then to SRAM1. Both SRAM0 and SRAM1 are set to the same size.
*/
mtk_ddp_write(cmdq_pkt, h << 16 | l_w, &priv->cmdq_reg, priv->regs,
DISP_REG_MERGE_CFG_24); if (r_w)
mtk_ddp_write(cmdq_pkt, h << 16 | r_w, &priv->cmdq_reg, priv->regs,
DISP_REG_MERGE_CFG_25); else
mtk_ddp_write(cmdq_pkt, h << 16 | l_w, &priv->cmdq_reg, priv->regs,
DISP_REG_MERGE_CFG_25);
/* * DISP_REG_MERGE_CFG_26 and DISP_REG_MERGE_CFG_27 is only used in LR merge. * Only take effect when the merge is setting to merge mode.
*/
mtk_ddp_write(cmdq_pkt, h << 16 | l_w, &priv->cmdq_reg, priv->regs,
DISP_REG_MERGE_CFG_26);
mtk_ddp_write(cmdq_pkt, h << 16 | r_w, &priv->cmdq_reg, priv->regs,
DISP_REG_MERGE_CFG_27);
/* * Measure the bandwidth requirement of hardware prefetch (per frame) * * let N = prefetch buffer size in lines * (ex. N=3, then prefetch buffer size = 3 lines) * * prefetch size = htotal * N (pixels) * time per line = 1 / fps / vtotal (seconds) * duration = vbp * time per line * = vbp / fps / vtotal * * data rate = prefetch size / duration * = htotal * N / (vbp / fps / vtotal) * = htotal * vtotal * fps * N / vbp * = clk * N / vbp (pixels per second) * * Say 4K60 (CEA-861) is the maximum mode supported by the SoC * data rate = 594000K * N / 72 = 8250 (standard) * (remove K * N due to the same unit) * * For 2560x1440@144 (clk=583600K, vbp=17): * data rate = 583600 / 17 ~= 34329 > 8250 (NG) * * For 2560x1440@120 (clk=497760K, vbp=77): * data rate = 497760 / 77 ~= 6464 < 8250 (OK) * * A non-standard 4K60 timing (clk=521280K, vbp=54) * data rate = 521280 / 54 ~= 9653 > 8250 (NG) * * Bandwidth requirement of hardware prefetch increases significantly * when the VBP decreases (more than 4x in this example). * * The proposed formula is only one way to estimate whether our SoC * supports the mode setting. The basic idea behind it is just to check * if the data rate requirement is too high (directly proportional to * pixel clock, inversely proportional to vbp). Please adjust the * function if it doesn't fit your situation in the future.
*/
rate = mode->clock / (mode->vtotal - mode->vsync_end);
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM;
priv->regs = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(priv->regs)) return dev_err_probe(dev, PTR_ERR(priv->regs), "failed to ioremap merge\n");
priv->clk = devm_clk_get(dev, NULL); if (IS_ERR(priv->clk)) return dev_err_probe(dev, PTR_ERR(priv->clk), "failed to get merge clk\n");
priv->async_clk = devm_clk_get_optional(dev, "merge_async"); if (IS_ERR(priv->async_clk)) return dev_err_probe(dev, PTR_ERR(priv->async_clk), "failed to get merge async clock\n");
if (priv->async_clk) {
priv->reset_ctl = devm_reset_control_get_optional_exclusive(dev, NULL); if (IS_ERR(priv->reset_ctl)) return PTR_ERR(priv->reset_ctl);
}
#if IS_REACHABLE(CONFIG_MTK_CMDQ)
ret = cmdq_dev_get_client_reg(dev, &priv->cmdq_reg, 0); if (ret)
dev_dbg(dev, "get mediatek,gce-client-reg fail!\n"); #endif
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.