Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp3912534rdb; Mon, 11 Dec 2023 03:59:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IE69ahDKhSkz8uyshiSXAh8fLx4KH+lL8ZLjC+wd/c6INl9swtn6cOIB/rG9+15vHzb1Jem X-Received: by 2002:a05:6e02:18c6:b0:35d:5995:1d64 with SMTP id s6-20020a056e0218c600b0035d59951d64mr8159017ilu.41.1702295996736; Mon, 11 Dec 2023 03:59:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702295996; cv=none; d=google.com; s=arc-20160816; b=TZHQjYJo10MVQYYYx7mxkKvdNy6Z1gFxG7NmKIfneJIptpXTDQW9yTaL6aOvSfe1T+ et1+aAciyoopHCJrMiyOHvzABtNPjwL6zVW9XNMiY4LJcBK2ENnsHLcnnBWTesQjLrEx Zu8cJ3L1hOfnN3f0aM+sQE9uP0KbpWbT9tMOMqQDbn/ggRYTdaruXUzYXxG1m5JMGAUn yKFJbsYpF/+7i6S0WSo3R5TagfKlGSA1TW1MIc7lZ/JG6DVCJSbgdOpxqdH4cX7XCI6E lvqqgII0c8H5MhLP3vUo5abdad5vySQrg19uwexpK2rUiUQhYQyppsGQD1W4XPeljfU7 NTEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VvpYTW40NZ46U/uC3kxp5psTC7U46RpXFvNEExH8M2A=; fh=UxFpKtBK5VEiehKMA7YEJ/g9njmupgYZNYvE1WeoN9M=; b=YIQ28lzouyaTAXgyMpQSeU6dTQQne4EHNHRFrvd9RaJeA2sl4jrz/iVGgLq+0eNdSi OkYNWfW+KLuEEJy5HYs2LFzIHYsJHBfN8q62oWclvz9agkkS0wJOFW7T2Y4coIJzUBpA gf91pSIbKVM1kDYKG8XsQP25gQKt7aCJxJzzd+DOtHbsQVqcB64/C+tqvo8Ak1343f2G tLtmMxNDAJsqmMZyrMo4tJExqvzIDqt3Sy36DF2JjHHa4VC7UCJdUNNOJ7x4Wz9fK3hJ lv5IF4tPHWUJpQDjEux8CEumX7wPTAxkN9ldeELFWnIz4bEhKsYCj8Gs+MGllQO1YQ/1 VyAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=ST917H6s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id 19-20020a631253000000b005859c81f1f0si5861268pgs.137.2023.12.11.03.59.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 03:59:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=ST917H6s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 718B580A733E; Mon, 11 Dec 2023 03:59:54 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234861AbjLKL7g (ORCPT + 99 others); Mon, 11 Dec 2023 06:59:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234510AbjLKL7T (ORCPT ); Mon, 11 Dec 2023 06:59:19 -0500 Received: from m12.mail.163.com (m12.mail.163.com [220.181.12.198]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 92238CD; Mon, 11 Dec 2023 03:59:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=VvpYT W40NZ46U/uC3kxp5psTC7U46RpXFvNEExH8M2A=; b=ST917H6sunqf2y6NnCz6K XvAbAMXofT9a6GGmmtjaYxodl+EqyBmUfhErUFpzdkfo23HYE9334Rhm0t3TWuXP OyXRd7d9cPrWh9mHI8+zMsDmR36GoCzHSMPo9QNO6nHNLd5L/B6/WvoT1tM3q7vS I96Anf5QvBSHsvH+JhJfhQ= Received: from ProDesk.. (unknown [58.22.7.114]) by zwqz-smtp-mta-g5-1 (Coremail) with SMTP id _____wDnj5FY+XZlTHfzCQ--.17744S2; Mon, 11 Dec 2023 19:58:19 +0800 (CST) From: Andy Yan To: heiko@sntech.de Cc: hjc@rock-chips.com, dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, krzysztof.kozlowski+dt@linaro.org, robh+dt@kernel.org, devicetree@vger.kernel.org, sebastian.reichel@collabora.com, kever.yang@rock-chips.com, chris.obbard@collabora.com, Andy Yan Subject: [PATCH v5 07/16] drm/rockchip: vop2: set bg dly and prescan dly at vop2_post_config Date: Mon, 11 Dec 2023 19:58:15 +0800 Message-Id: <20231211115815.1785131-1-andyshrk@163.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231211115547.1784587-1-andyshrk@163.com> References: <20231211115547.1784587-1-andyshrk@163.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: _____wDnj5FY+XZlTHfzCQ--.17744S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxZw4kZw1UJrWUtF15Ww1Utrb_yoW5Xr4rp3 4fGry3CrWUJF4qvw1kZa4DZr4fKws7tr47JFW7Jas2yF90qr9xZwn8urn8GrWqqFy7AFy2 9rWvgrWYgF1akr7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jTApnUUUUU= X-Originating-IP: [58.22.7.114] X-CM-SenderInfo: 5dqg52xkunqiywtou0bp/1tbiqB5DXmVOA44ldgAAse X-Spam-Status: No, score=0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_SORBS_WEB, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 11 Dec 2023 03:59:54 -0800 (PST) From: Andy Yan We need to setup background delay cycle and prescan delay cycle when a mode is enable to avoid trigger POST_BUF_EMPTY irq on rk3588. Note: RK356x has no such requirement. Signed-off-by: Andy Yan --- (no changes since v1) drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 26 ++++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c index 40b5c5ca4864..d52395b6aff7 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c @@ -1460,8 +1460,18 @@ static void vop2_post_config(struct drm_crtc *crtc) u32 top_margin = 100, bottom_margin = 100; u16 hsize = hdisplay * (left_margin + right_margin) / 200; u16 vsize = vdisplay * (top_margin + bottom_margin) / 200; + u16 hsync_len = mode->crtc_hsync_end - mode->crtc_hsync_start; u16 hact_end, vact_end; u32 val; + u32 bg_dly; + u32 pre_scan_dly; + + bg_dly = vp->data->pre_scan_max_dly[3]; + vop2_writel(vp->vop2, RK3568_VP_BG_MIX_CTRL(vp->id), + FIELD_PREP(RK3568_VP_BG_MIX_CTRL__BG_DLY, bg_dly)); + + pre_scan_dly = ((bg_dly + (hdisplay >> 1) - 1) << 16) | hsync_len; + vop2_vp_write(vp, RK3568_VP_PRE_SCAN_HTIMING, pre_scan_dly); vsize = rounddown(vsize, 2); hsize = rounddown(hsize, 2); @@ -1956,11 +1966,6 @@ static void vop2_setup_layer_mixer(struct vop2_video_port *vp) u32 layer_sel = 0; u32 port_sel; unsigned int nlayer, ofs; - struct drm_display_mode *adjusted_mode; - u16 hsync_len; - u16 hdisplay; - u32 bg_dly; - u32 pre_scan_dly; u32 ovl_ctrl; int i; struct vop2_video_port *vp0 = &vop2->vps[0]; @@ -1968,17 +1973,6 @@ static void vop2_setup_layer_mixer(struct vop2_video_port *vp) struct vop2_video_port *vp2 = &vop2->vps[2]; struct rockchip_crtc_state *vcstate = to_rockchip_crtc_state(vp->crtc.state); - adjusted_mode = &vp->crtc.state->adjusted_mode; - hsync_len = adjusted_mode->crtc_hsync_end - adjusted_mode->crtc_hsync_start; - hdisplay = adjusted_mode->crtc_hdisplay; - - bg_dly = vp->data->pre_scan_max_dly[3]; - vop2_writel(vop2, RK3568_VP_BG_MIX_CTRL(vp->id), - FIELD_PREP(RK3568_VP_BG_MIX_CTRL__BG_DLY, bg_dly)); - - pre_scan_dly = ((bg_dly + (hdisplay >> 1) - 1) << 16) | hsync_len; - vop2_vp_write(vp, RK3568_VP_PRE_SCAN_HTIMING, pre_scan_dly); - ovl_ctrl = vop2_readl(vop2, RK3568_OVL_CTRL); ovl_ctrl |= RK3568_OVL_CTRL__LAYERSEL_REGDONE_IMD; if (vcstate->yuv_overlay) -- 2.34.1