Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp1404542pxy; Mon, 2 Aug 2021 00:12:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGYPnHaBvZ72TeRhRoTb70/88ZBRNQrpjkvwFNF69sUYPM2Jw7h0uyjWbe7ryRSolwVL5q X-Received: by 2002:a5e:d918:: with SMTP id n24mr3836922iop.173.1627888331306; Mon, 02 Aug 2021 00:12:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627888331; cv=none; d=google.com; s=arc-20160816; b=fzlbt1ELDVYG0W7dj0Xi2F5jvxWWrchBBc9MGAkF2Toj8BM1p2zmq2zOlUiASlBS+s TAXJJgRpyRlYGlKty3iShLdHIPee/1gg53NFnzGaXSWkCDeteYlEZsccsDuYkXLQHGur CZdROwmWuza1p7FdT+vwfzBOfvF/t+JD9bnbe7qUVRR+lvyFcQUS+oiHZ0KFTYSpX6xv 35c/aJB8HcPc7oWJSxVCbg88XkXbm4vIkzBIifycRGEhWLpBjdgxxYQsnp410TiCpTFa 1hQfXxSVI3/84pgbDydvayfnCvPuNIzKr/2kPqLrWggmKyMkwJHAttsjEJH11eYWtnMF ymQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=6oZkq+8xox2da81fw9OqSXr+l4mTkzaazaFmfC3ku4A=; b=WkmOFgwTonXJCLEIIXRZILTS3ZwFFgjDC9QYJJYybh0Tg1TNXKIhFd0Dem0PbZlHTk ei5l1Po3EL2v86Chsbesvm7BJtgRMm6b7lx/eNt7nFg5jSjIkbxDfzeIdfrglLtebmSO ctH08NUivU6eDg+JzK/ZhuWyKmsPPObZ1L88DJ0/0FSjQLBDoDFDei63W24tfX3qAdTj VX28jeL4EDW29iOavAJcXbUQoCycKMc/cHYzCECN+MDPwrnxfPOFy50oSgNPII5e0C/6 hbAr5k1VCP161ajgdCVSo9hwjYrGaCsINJjM6US3nHKdKKnmYfDHEoHS0SrZA5clR9yv 6MbA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x17si12499028jat.44.2021.08.02.00.11.59; Mon, 02 Aug 2021 00:12:11 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232482AbhHBHLO (ORCPT + 99 others); Mon, 2 Aug 2021 03:11:14 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:33774 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S232435AbhHBHLO (ORCPT ); Mon, 2 Aug 2021 03:11:14 -0400 X-UUID: 4ed62d7496ad4498a3fc50f1c7c9213a-20210802 X-UUID: 4ed62d7496ad4498a3fc50f1c7c9213a-20210802 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1913833571; Mon, 02 Aug 2021 15:11:02 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs02n2.mediatek.inc (172.21.101.101) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 2 Aug 2021 15:11:00 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 2 Aug 2021 15:10:59 +0800 From: Yongqiang Niu To: Chun-Kuang Hu CC: Rob Herring , Matthias Brugger , Philipp Zabel , David Airlie , Daniel Vetter , Jassi Brar , Yongqiang Niu , Fabien Parent , Dennis YC Hsieh , , , , , , , Hsin-Yi Wang Subject: [PATCH v3] drm/mediatek: clear pending flag when cmdq packet is done. Date: Mon, 2 Aug 2021 15:10:27 +0800 Message-ID: <1627888227-5757-2-git-send-email-yongqiang.niu@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1627888227-5757-1-git-send-email-yongqiang.niu@mediatek.com> References: <1627888227-5757-1-git-send-email-yongqiang.niu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In cmdq mode, packet may be flushed before it is executed, so the pending flag should be cleared after cmdq packet is done. Signed-off-by: Yongqiang Niu --- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 51 +++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c index 4c25e33..2a2d43e 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c @@ -267,6 +267,40 @@ 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; + struct mtk_crtc_state *state; + unsigned int i; + + state = to_mtk_crtc_state(mtk_crtc->base.state); + + if (state->pending_config) { + state->pending_config = false; + } + + if (mtk_crtc->pending_planes) { + for (i = 0; i < mtk_crtc->layer_nr; i++) { + struct drm_plane *plane = &mtk_crtc->planes[i]; + struct mtk_plane_state *plane_state; + + plane_state = to_mtk_plane_state(plane->state); + + if (plane_state->pending.config) + plane_state->pending.config = false; + } + mtk_crtc->pending_planes = false; + } + + if (mtk_crtc->pending_async_planes) { + for (i = 0; i < mtk_crtc->layer_nr; i++) { + struct drm_plane *plane = &mtk_crtc->planes[i]; + struct mtk_plane_state *plane_state; + + plane_state = to_mtk_plane_state(plane->state); + + if (plane_state->pending.async_config) + plane_state->pending.async_config = false; + } + mtk_crtc->pending_async_planes = false; + } mtk_crtc->cmdq_vblank_cnt = 0; mtk_drm_cmdq_pkt_destroy(mtk_crtc->cmdq_chan, data->pkt); @@ -423,7 +457,8 @@ static void mtk_crtc_ddp_config(struct drm_crtc *crtc, state->pending_vrefresh, 0, cmdq_handle); - state->pending_config = false; + if (!cmdq_handle) + state->pending_config = false; } if (mtk_crtc->pending_planes) { @@ -443,9 +478,12 @@ static void mtk_crtc_ddp_config(struct drm_crtc *crtc, mtk_ddp_comp_layer_config(comp, local_layer, plane_state, cmdq_handle); - plane_state->pending.config = false; + if (!cmdq_handle) + plane_state->pending.config = false; } - mtk_crtc->pending_planes = false; + + if (!cmdq_handle) + mtk_crtc->pending_planes = false; } if (mtk_crtc->pending_async_planes) { @@ -465,9 +503,12 @@ static void mtk_crtc_ddp_config(struct drm_crtc *crtc, mtk_ddp_comp_layer_config(comp, local_layer, plane_state, cmdq_handle); - plane_state->pending.async_config = false; + if (!cmdq_handle) + plane_state->pending.async_config = false; } - mtk_crtc->pending_async_planes = false; + + if (!cmdq_handle) + mtk_crtc->pending_async_planes = false; } } -- 1.8.1.1.dirty