From: "Jason-JH Lin (林睿祥)" <Jason-JH.Lin@mediatek.com>
To: "amergnat@baylibre.com" <amergnat@baylibre.com>,
"chunkuang.hu@kernel.org" <chunkuang.hu@kernel.org>,
"angelogioacchino.delregno@collabora.com"
<angelogioacchino.delregno@collabora.com>,
"eugen.hristev@collabora.com" <eugen.hristev@collabora.com>
Cc: "linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
"Singo Chang (張興國)" <Singo.Chang@mediatek.com>,
"Johnson Wang (王聖鑫)" <Johnson.Wang@mediatek.com>,
"Jason-ch Chen (陳建豪)" <Jason-ch.Chen@mediatek.com>,
"Shawn Sung (宋孝謙)" <Shawn.Sung@mediatek.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Nancy Lin (林欣螢)" <Nancy.Lin@mediatek.com>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
Project_Global_Chrome_Upstream_Group
<Project_Global_Chrome_Upstream_Group@mediatek.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH RESEND v4 2/2] drm/mediatek: Fix iommu fault during crtc enabling
Date: Tue, 8 Aug 2023 15:04:11 +0000 [thread overview]
Message-ID: <a006a3d7d886e2aa34bfdd29cff0a4262d971440.camel@mediatek.com> (raw)
In-Reply-To: <02dc52cd-db64-af1c-0f07-5ef76b954c75@collabora.com>
Hi Eugen,
Thanks for the reviews.
On Tue, 2023-08-08 at 14:55 +0300, Eugen Hristev wrote:
> Hi Jason,
>
> On 8/7/23 04:51, Jason-JH.Lin wrote:
> > The plane_state of drm_atomic_state is not sync to the
> > mtk_plane_state
> > stored in mtk_crtc during crtc enabling.
> >
> > So we need to update the mtk_plane_state stored in mtk_crtc by the
> > drm_atomic_state carried from mtk_drm_crtc_atomic_enable().
> >
> > While updating mtk_plane_state, OVL layer should be disabled when
> > the fb
> > in plane_state of drm_atomic_state is NULL.
> >
> > Fixes: 119f5173628a ("drm/mediatek: Add DRM Driver for Mediatek SoC
> > MT8173.")
> > Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
> > ---
> > Change in RESEND v4:
> > Remove redundant plane_state assigning.
> > ---
> > drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 14 ++++++++++----
> > drivers/gpu/drm/mediatek/mtk_drm_plane.c | 11 ++++++++---
> > drivers/gpu/drm/mediatek/mtk_drm_plane.h | 2 ++
> > 3 files changed, 20 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> > b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> > index d40142842f85..7db4d6551da7 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> > @@ -328,7 +328,7 @@ static void ddp_cmdq_cb(struct mbox_client *cl,
> > void *mssg)
> > }
> > #endif
> >
> > -static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc *mtk_crtc)
> > +static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc *mtk_crtc,
> > struct drm_atomic_state *state)
> > {
> > struct drm_crtc *crtc = &mtk_crtc->base;
> > struct drm_connector *connector;
> > @@ -405,11 +405,17 @@ static int mtk_crtc_ddp_hw_init(struct
> > mtk_drm_crtc *mtk_crtc)
> > /* Initially configure all planes */
> > for (i = 0; i < mtk_crtc->layer_nr; i++) {
> > struct drm_plane *plane = &mtk_crtc->planes[i];
> > - struct mtk_plane_state *plane_state;
> > + struct drm_plane_state *new_state;
> > + struct mtk_plane_state *plane_state =
> > to_mtk_plane_state(plane->state);
> > struct mtk_ddp_comp *comp;
> > unsigned int local_layer;
> >
> > - plane_state = to_mtk_plane_state(plane->state);
>
> any reason why you moved the initialization of plane_state at the
> declaration phase ?
>
I just like to assign it at the declaration phase.
But it's not related to this fix patch, so I'll move it back.
Thanks.
> > + /* sync the new plane state from drm_atomic_state */
> > + if (state->planes[i].ptr) {
> > + new_state =
> > drm_atomic_get_new_plane_state(state, state->planes[i].ptr);
>
> Can drm_atomic_get_new_plane_state fail ? and new_state becomes null
> ?
drm_atomic_get_new_plane_state() won't fail and new_state won't be
NULL.
But if state->planes[i].ptr is NULL, it'll crash in drm_plane_index()
inside drm_atomic_get_new_plane_state().
>
> I see mtk_plane_update_new_state assumes new_state being a correct
> state/pointer.
The usage is the same as mtk_plane_atomic_update().
Regards,
Jason-JH.Lin
>
> Regards,
>
prev parent reply other threads:[~2023-08-08 16:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230807015110.30579-1-jason-jh.lin@mediatek.com>
[not found] ` <20230807015110.30579-3-jason-jh.lin@mediatek.com>
2023-08-07 8:59 ` CK Hu (胡俊光)
2023-08-08 8:54 ` Jason-JH Lin (林睿祥)
2023-08-07 9:45 ` Alexandre Mergnat
2023-08-08 8:38 ` Jason-JH Lin (林睿祥)
2023-08-08 11:55 ` Eugen Hristev
2023-08-08 15:04 ` Jason-JH Lin (林睿祥) [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a006a3d7d886e2aa34bfdd29cff0a4262d971440.camel@mediatek.com \
--to=jason-jh.lin@mediatek.com \
--cc=Jason-ch.Chen@mediatek.com \
--cc=Johnson.Wang@mediatek.com \
--cc=Nancy.Lin@mediatek.com \
--cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
--cc=Shawn.Sung@mediatek.com \
--cc=Singo.Chang@mediatek.com \
--cc=amergnat@baylibre.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=chunkuang.hu@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=eugen.hristev@collabora.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®