Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp2241527pxt; Sun, 8 Aug 2021 16:51:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEwMuhHke2bFv5NyB2DFLuiKQP6vUDiVoOtwBk4Q/G7l2qX1zkBr3aaZegsoiO02Pr8eZz X-Received: by 2002:a05:6638:3474:: with SMTP id q52mr19768395jav.101.1628466663197; Sun, 08 Aug 2021 16:51:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628466663; cv=none; d=google.com; s=arc-20160816; b=atcUBl77rdY3uc6RrenBoci50lE9HmGlffkCJCTT0vDqDrFf1cyq8HWg/Oa+SMknWm CSXyab/FsOrSeFgA03kVaDeOcKU04YlFxqwrRlHASmScP9owKDXT751Q+unpvj9yChCt myutKeCdj93vtbpAkUW96a3VEb+OO4n7D/uOrPMnCMcURV6VRNtM9i0QgnHvZYkzxujg xzxZB8CALK9pOCVvC38i4p0/ol030prITm8O1LClcCtb7QM4nwyb8bgBdIz7R+oc707/ /6gGTZR08HhaRlCuIRG4Us7X3rWtSHC2eex/h895UC4XUhx7oaAYb58ilYF5R8r9TOil kC+Q== 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=0WBKyM1UDjPJyb3YEWrqhxK0LfldVvrl+kHltU//6tU=; b=YymPem2zAk5bcMH4bpld87j85SoEVYy4D65W2y3VdJqez3/a9J8bQrGp7v7epLPd4Y PtJYaQzVARkFznH2Onw90AePl4f1aKNFpZw3TZuh74aqQI27SzrjeGSiPfMyL0U7N+b8 8m3dG2u7+JSV33Z+VzrRwjVA/62R6Y6bjl06ndP23SGQORT3i8s0I2Uur+ylkrTanMZv NVoE4O3sO+pMbde2cnlT+/1CFVKXIHeKR1Efn4+PQdyixrS5aki75jHhN5oxhy+LDbkH UY/UyouqtMMn0bKEfuVPlIrD/RFXVFGZ1t8H3aGRAbKsQuzMizbXTwCj8pjh12ZneZX/ vjGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X8zWZ1dC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a1si16456333iow.19.2021.08.08.16.50.52; Sun, 08 Aug 2021 16:51:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X8zWZ1dC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232142AbhHHXsP (ORCPT + 99 others); Sun, 8 Aug 2021 19:48:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:38206 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232002AbhHHXsN (ORCPT ); Sun, 8 Aug 2021 19:48:13 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B964F60F0F; Sun, 8 Aug 2021 23:47:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628466474; bh=ikmC57xWW8Emw+SnefdLIObzwt1WuO4pE6M/lSUjq+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X8zWZ1dC1hha+Zj1l23AtXXF1rkOrr6nAX8Rlz7MptZLwHjeVjS8d+iZtgp11zq/W TPFPFxgVMEdeRGV/v/dQFNHj7o1w8o+a/LKPEXRC8oZAmAHdQig+cEaryIMROFi2mj S7JDm0V45U27LHNlH5cYMgLvK8O/ai/oc3j+uo18HQU+Do4tk2qLbq5wNpUypfqWO0 6oEs7wBN7YDO/OaD3hnkTmsoDvFRazTbX8m5JUXCKFYHBNldF0f+MOdM/WeSOD77r7 NUyUIj3/33m9FuuB9CggVIhB4qZu2cHv9TaJh9kMTzHNw66q2aCmAXPCYGZPzjwDyZ vLlQvsQGxeSKw== From: Chun-Kuang Hu To: Philipp Zabel , David Airlie , Daniel Vetter Cc: Yongqiang Niu , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, Chun-Kuang Hu Subject: [PATCH v2 3/4] drm/mediatek: Detect CMDQ execution timeout Date: Mon, 9 Aug 2021 07:47:32 +0800 Message-Id: <20210808234733.14782-4-chunkuang.hu@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210808234733.14782-1-chunkuang.hu@kernel.org> References: <20210808234733.14782-1-chunkuang.hu@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org CMDQ is used to update display register in vblank period, so it should be execute in next vblank. If it fail to execute in next 2 vblank, tiemout happen. Signed-off-by: Chun-Kuang Hu --- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c index da92a3fedd0a..ad4c1a3a9294 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c @@ -55,6 +55,7 @@ struct mtk_drm_crtc { struct mbox_client cmdq_cl; struct mbox_chan *cmdq_chan; u32 cmdq_event; + u32 cmdq_vblank_cnt; #endif struct device *mmsys_dev; @@ -269,6 +270,7 @@ static void ddp_cmdq_cb(struct mbox_client *cl, void *mssg) struct mtk_drm_crtc *mtk_crtc = container_of(cl, struct mtk_drm_crtc, cmdq_cl); struct cmdq_cb_data *data = mssg; + mtk_crtc->cmdq_vblank_cnt = 0; mtk_drm_cmdq_pkt_destroy(mtk_crtc->cmdq_chan, data->pkt); } #endif @@ -524,6 +526,11 @@ static void mtk_drm_crtc_update_config(struct mtk_drm_crtc *mtk_crtc, cmdq_handle->pa_base, cmdq_handle->cmd_buf_size, DMA_TO_DEVICE); + /* + * CMDQ command should execute in next vblank, + * If it fail to execute in next 2 vblank, timeout happen. + */ + mtk_crtc->cmdq_vblank_cnt = 2; mbox_send_message(mtk_crtc->cmdq_chan, cmdq_handle); mbox_client_txdone(mtk_crtc->cmdq_chan, 0); } @@ -540,11 +547,14 @@ static void mtk_crtc_ddp_irq(void *data) #if IS_REACHABLE(CONFIG_MTK_CMDQ) if (!priv->data->shadow_register && !mtk_crtc->cmdq_chan) + mtk_crtc_ddp_config(crtc, NULL); + else if (mtk_crtc->cmdq_vblank_cnt > 0 && --mtk_crtc->cmdq_vblank_cnt == 0) + DRM_ERROR("mtk_crtc %d CMDQ execute command timeout!\n", + drm_crtc_index(&mtk_crtc->base)); #else if (!priv->data->shadow_register) -#endif mtk_crtc_ddp_config(crtc, NULL); - +#endif mtk_drm_finish_page_flip(mtk_crtc); } -- 2.25.1