Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3402685pxv; Mon, 12 Jul 2021 16:53:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwNuIJE6Fk45QLmMosSe8/GRAbFWDb02As8aTnp1LL1j8X7VdgCXfKfKDhR6RClaypqh8DP X-Received: by 2002:aa7:df12:: with SMTP id c18mr1765563edy.62.1626133985234; Mon, 12 Jul 2021 16:53:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626133985; cv=none; d=google.com; s=arc-20160816; b=Tmlct6PXK1og7ttLTVkDOh3LjsvXimq2UlHSWO+sO2Bz4PBxEpYkGU0l5TXLO0CFWt zpXVE04Q0szjnFeIqho6nqOgApErn2acxSpy0sDxCjw0n/eGLVhRDFrUOBcZiEy7vyId 0YN+w7QG5iI/YpDg7+Y13gHTqpnx65unfWDs9gAbb8WpSjtfTBV+lWo4bT8ZloYOR+Bi 5bys2W6561WLeAyoezDliS0NrjwfAnEc0URHdMgv2N6M2f9xvmpCs4dMwWl3UNKRsQEg ThC+7FH31WgvieapP+YwhbRY+eXe8Wg3jLBsWYFsRfhwvZ4xnpDh2rL5O3TuPdV4FW7y YIoQ== 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=F+GpH1IZ3G5uTw/MvWK+cfS4v03HXoWiKQn6x8zSy0A=; b=cQiOGQa7Um47PNfIdKy03RnIIKHYHi5R9ZZsRuy4CgM3vRCHPgNc37pzA+lQjb3ajA iM20OEIIC9mAzRTCs5+avjuD4F+rlHOWYuMNs+PmpycdbCyR5aq4q0wQ98NH8xJKh28E 7IbCRdGjS4HE5oPr9BhKhYKfVzS88zHEDGyRF+fwWM/l/qeQFh2XirQIp5XpM0KjsJtv v75/tI1XvXH80sT1JPPNMF8Y9WKXFYsB32Ey/awbNd82ftwQkd8Ii5FHPnxz+sN8aBLa xk4Gn3u5K8C45VKjF//+o+rbQP0j7gTOzBKTGcYfCj9+BF8aw+FhGu1v22S1yHJloAxl ugCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Vr4uMzt2; 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 t10si16229287eju.92.2021.07.12.16.52.42; Mon, 12 Jul 2021 16:53:05 -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=Vr4uMzt2; 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 S233612AbhGLXxR (ORCPT + 99 others); Mon, 12 Jul 2021 19:53:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:38592 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233409AbhGLXxR (ORCPT ); Mon, 12 Jul 2021 19:53:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8F57D6115A; Mon, 12 Jul 2021 23:50:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1626133828; bh=Sus9FRs0hTcX2hu0wT0zxdo8Pi7+Qzp7q7LUn+28Des=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vr4uMzt2pgDl6+7owZ5QWsCH14MsV/t9yhkIx4uAgRpUjH9ypREeycwro6rEhoqkv A2Ci1FBx6tOWlrW9BkkyCa8tMM+/8KTeywUsyKf/SfbyqgJF9o7p7ANd4ly4jRCde/ BSBBW1m9PIgKSxXrjzOqdGGLbjzynT+6IecnvG4T/Rr+B9FPawhc3j0EdzWDrJX4Gi ei3m5zkFKb1sp1M+Zgo6OANMfJ8IRxi12Q6YsQyj5BlKi8bo8KczmRp2GX4tgVYrVN wN1oU0SIrddWCqHJET2+N3zhkYMJfCslcqk44rhuw3zpDjtfH3FojmWZujVBmfhzfq z3+VSED09nb+Q== 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 3/4] drm/mediatek: Detect CMDQ execution timeout Date: Tue, 13 Jul 2021 07:50:13 +0800 Message-Id: <20210712235014.42673-4-chunkuang.hu@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210712235014.42673-1-chunkuang.hu@kernel.org> References: <20210712235014.42673-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 db8621df7d85..5dd61eacce6c 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