Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp1996221pxy; Mon, 2 Aug 2021 16:17:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2DprpcWfL0I6YXtDPeLo5dqwpdk2CEdfNeKrx8sVMCb6Qh5MH9CyGX8TiYg5We5J5kRu/ X-Received: by 2002:a05:6602:5de:: with SMTP id w30mr1284701iox.199.1627946258957; Mon, 02 Aug 2021 16:17:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627946258; cv=none; d=google.com; s=arc-20160816; b=a98Uqd01gNovzxsImja/81XeoAxFYimVSTaQ7Imc+pChQJUj8x7blH6QYH3IBgOG8+ nvd29RiJ+lqEvTU6xv4ZkQ88ulrM4pQ8jeR+Pe4FsZMfeD8vsRMPAjG0JhMsjocYt1a2 OtS5A1rKBbDhS+3u8o4J3snQhnSUBCQ7p/VlwZz4Q+f+FuVo8Bhcs9X8Kqk7E/XkfWi5 Vyv5fq6sEYXD+CgwI16YPe7l9pEvT2pjlTuTAfgW7s3UBqhVRKaFahjZ8EflLCZUCYtR 7TOnw6sd4qZyJvfw/cEsk2HwLhhspuG2wOr4xYTxsW/SNjQ5CBq1n/s4dA1c+D0dZubr Qlag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=1/TxMMMGrnenjuVNVbPEKWWaMVt5cP0Hw9sWuUf9rHI=; b=K5/5vB8RWjCHNp0oc1Vji2ryPXjYU1F1EU0+3j972U4LTWZGqyE8pEpLznQWqQmni/ /tkG0rgTKl6TPSIY23IRZ/OeIEwXcJrYnFY0hXoqY3QX+44c8fW36KXUdxr2yAj5RGXc Y2okHorAQrGqcCryzQ+T+k1mYO27K3riOpAy/2+F2pRsqHkFQrf+r1JgyoZRR+edCYBf 0QYyNf+SX0FFlh9bSLnEALdvLEbdRRqp1PMvvHYsP4BmM+uHPWNipFuPj5mAk2vCnV+u +Y5QlC+DkxAF27bxliFbKkNFQob4vJ4zIWlZp4sW5Oqa3C7LfQOS1skhhSSSXVblRgW6 p7OQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JL0zMLYd; 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 m12si14261454ilq.105.2021.08.02.16.17.27; Mon, 02 Aug 2021 16:17:38 -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=JL0zMLYd; 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 S232289AbhHBXQq (ORCPT + 99 others); Mon, 2 Aug 2021 19:16:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:59712 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232192AbhHBXQp (ORCPT ); Mon, 2 Aug 2021 19:16:45 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B321560EC0; Mon, 2 Aug 2021 23:16:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627946195; bh=0CE6qR/gop+OdKgxD/k5bSNptqvMl6JQUMWiGm6+tfw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=JL0zMLYdH8Ohwr0tKC+IKekf9Qbx/szIeRH9N8fqiDCVhLUwEpH0OaP2BmrUBBOMe J3d2gpr0JPj+pzFs3AWElm9jmuiqcZnxjHChKTXJAQWwlWelFoGHHNcIj/UBCcLnlB h+/MMl4u+SZq16NuI3C67q2HZweSwyOitqWIgJD4HZT4Pqc+pJPJqABOSeKxHrUCDM UlgJqUlXToOjoMEgH6wjA7bNQI2Kc+VnewJDgfZWG6m3nFPYTIICwkoTRuYHNTfKLJ UtRDwZ81YzKbbrKn4oTHVbrTX8+pRytq8MdWuHIh/97vwkaZJ75slHtGja2GXC0iCN pDLNuM01n7y5A== Received: by mail-ed1-f51.google.com with SMTP id n2so26623713eda.10; Mon, 02 Aug 2021 16:16:35 -0700 (PDT) X-Gm-Message-State: AOAM53019CpA/WjU0yg72JJeKz+ZX1dD7yRS7r8t1NtU+9vjLYt08Trz i8GDcZP7e3vzPu4s3VKHbX5Tx32MRyzFNmwUKg== X-Received: by 2002:aa7:c6d3:: with SMTP id b19mr21633222eds.303.1627946194379; Mon, 02 Aug 2021 16:16:34 -0700 (PDT) MIME-Version: 1.0 References: <1627888227-5757-1-git-send-email-yongqiang.niu@mediatek.com> <1627888227-5757-2-git-send-email-yongqiang.niu@mediatek.com> In-Reply-To: <1627888227-5757-2-git-send-email-yongqiang.niu@mediatek.com> From: Chun-Kuang Hu Date: Tue, 3 Aug 2021 07:16:23 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3] drm/mediatek: clear pending flag when cmdq packet is done. To: Yongqiang Niu Cc: Chun-Kuang Hu , Rob Herring , Matthias Brugger , Philipp Zabel , David Airlie , Daniel Vetter , Jassi Brar , Fabien Parent , Dennis YC Hsieh , DTML , Linux ARM , "moderated list:ARM/Mediatek SoC support" , linux-kernel , DRI Development , Project_Global_Chrome_Upstream_Group@mediatek.com, Hsin-Yi Wang Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Yongqiang: Yongqiang Niu =E6=96=BC 2021=E5=B9=B48=E6=9C= =882=E6=97=A5 =E9=80=B1=E4=B8=80 =E4=B8=8B=E5=8D=883:11=E5=AF=AB=E9=81=93= =EF=BC=9A > > 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/me= diatek/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 =3D container_of(cl, struct mtk_drm= _crtc, cmdq_cl); > struct cmdq_cb_data *data =3D mssg; > + struct mtk_crtc_state *state; > + unsigned int i; > + > + state =3D to_mtk_crtc_state(mtk_crtc->base.state); > + > + if (state->pending_config) { No matter pending_config is true or not, it would be false after this. So we could simply drop this checking. > + state->pending_config =3D false; > + } > + > + if (mtk_crtc->pending_planes) { > + for (i =3D 0; i < mtk_crtc->layer_nr; i++) { > + struct drm_plane *plane =3D &mtk_crtc->planes[i]; > + struct mtk_plane_state *plane_state; > + > + plane_state =3D to_mtk_plane_state(plane->state); > + > + if (plane_state->pending.config) Ditto. > + plane_state->pending.config =3D false; > + } > + mtk_crtc->pending_planes =3D false; > + } > + > + if (mtk_crtc->pending_async_planes) { > + for (i =3D 0; i < mtk_crtc->layer_nr; i++) { > + struct drm_plane *plane =3D &mtk_crtc->planes[i]; > + struct mtk_plane_state *plane_state; > + > + plane_state =3D to_mtk_plane_state(plane->state); > + > + if (plane_state->pending.async_config) Ditto. Regards, Chun-Kuang. > + plane_state->pending.async_config =3D fal= se; > + } > + mtk_crtc->pending_async_planes =3D false; > + } > > mtk_crtc->cmdq_vblank_cnt =3D 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 =3D false; > + if (!cmdq_handle) > + state->pending_config =3D false; > } > > if (mtk_crtc->pending_planes) { > @@ -443,9 +478,12 @@ static void mtk_crtc_ddp_config(struct drm_crtc *crt= c, > mtk_ddp_comp_layer_config(comp, local_lay= er, > plane_state, > cmdq_handle); > - plane_state->pending.config =3D false; > + if (!cmdq_handle) > + plane_state->pending.config =3D false; > } > - mtk_crtc->pending_planes =3D false; > + > + if (!cmdq_handle) > + mtk_crtc->pending_planes =3D false; > } > > if (mtk_crtc->pending_async_planes) { > @@ -465,9 +503,12 @@ static void mtk_crtc_ddp_config(struct drm_crtc *crt= c, > mtk_ddp_comp_layer_config(comp, local_lay= er, > plane_state, > cmdq_handle); > - plane_state->pending.async_config =3D false; > + if (!cmdq_handle) > + plane_state->pending.async_config =3D fal= se; > } > - mtk_crtc->pending_async_planes =3D false; > + > + if (!cmdq_handle) > + mtk_crtc->pending_async_planes =3D false; > } > } > > -- > 1.8.1.1.dirty >