<div dir="ltr"><div>On Thu, Jan 7, 2021 at 6:21 PM Liu, Zhan <<a href="mailto:Zhan.Liu@amd.com">Zhan.Liu@amd.com</a>> wrote:<br>><br>> [AMD Official Use Only - Internal Distribution Only]<br>><br>> > -----Original Message-----<br>> > From: Liu, Zhan<br>> > Sent: 2021/January/06, Wednesday 10:04 AM<br>> > To: Bas Nieuwenhuizen <<a href="mailto:bas@basnieuwenhuizen.nl">bas@basnieuwenhuizen.nl</a>>; Mario Kleiner<br>> > <<a href="mailto:mario.kleiner.de@gmail.com">mario.kleiner.de@gmail.com</a>><br>> > Cc: dri-devel <<a href="mailto:dri-devel@lists.freedesktop.org">dri-devel@lists.freedesktop.org</a>>; amd-gfx list <amd-<br>> > <a href="mailto:gfx@lists.freedesktop.org">gfx@lists.freedesktop.org</a>>; Deucher, Alexander<br>> > <<a href="mailto:Alexander.Deucher@amd.com">Alexander.Deucher@amd.com</a>>; Daniel Vetter <<a href="mailto:daniel.vetter@ffwll.ch">daniel.vetter@ffwll.ch</a>>;<br>> > Kazlauskas, Nicholas <<a href="mailto:Nicholas.Kazlauskas@amd.com">Nicholas.Kazlauskas@amd.com</a>>; Ville Syrjälä<br>> > <<a href="mailto:ville.syrjala@linux.intel.com">ville.syrjala@linux.intel.com</a>><br>> > Subject: RE: [PATCH] drm: Check actual format for legacy pageflip.<br>> ><br>> ><br>> > > -----Original Message-----<br>> > > From: Liu, Zhan <<a href="mailto:Zhan.Liu@amd.com">Zhan.Liu@amd.com</a>><br>> > > Sent: 2021/January/04, Monday 3:46 PM<br>> > > To: Bas Nieuwenhuizen <<a href="mailto:bas@basnieuwenhuizen.nl">bas@basnieuwenhuizen.nl</a>>; Mario Kleiner<br>> > > <<a href="mailto:mario.kleiner.de@gmail.com">mario.kleiner.de@gmail.com</a>><br>> > > Cc: dri-devel <<a href="mailto:dri-devel@lists.freedesktop.org">dri-devel@lists.freedesktop.org</a>>; amd-gfx list <amd-<br>> > > <a href="mailto:gfx@lists.freedesktop.org">gfx@lists.freedesktop.org</a>>; Deucher, Alexander<br>> > > <<a href="mailto:Alexander.Deucher@amd.com">Alexander.Deucher@amd.com</a>>; Daniel Vetter <<a href="mailto:daniel.vetter@ffwll.ch">daniel.vetter@ffwll.ch</a>>;<br>> > > Kazlauskas, Nicholas <<a href="mailto:Nicholas.Kazlauskas@amd.com">Nicholas.Kazlauskas@amd.com</a>>; Ville Syrjälä<br>> > > <<a href="mailto:ville.syrjala@linux.intel.com">ville.syrjala@linux.intel.com</a>><br>> > > Subject: Re: [PATCH] drm: Check actual format for legacy pageflip.<br>> > ><br>> > ><br>> > ><br>> > > + Ville<br>> > ><br>> > > On Sat, Jan 2, 2021 at 4:31 PM Mario Kleiner<br>> > > <<a href="mailto:mario.kleiner.de@gmail.com">mario.kleiner.de@gmail.com</a>><br>> > > wrote:<br>> > > ><br>> > > > On Sat, Jan 2, 2021 at 3:02 PM Bas Nieuwenhuizen<br>> > > > <<a href="mailto:bas@basnieuwenhuizen.nl">bas@basnieuwenhuizen.nl</a>> wrote:<br>> > > > ><br>> > > > > With modifiers one can actually have different format_info structs<br>> > > > > for the same format, which now matters for AMDGPU since we convert<br>> > > > > implicit modifiers to explicit modifiers with multiple planes.<br>> > > > ><br>> > > > > I checked other drivers and it doesn't look like they end up<br>> > > > > triggering this case so I think this is safe to relax.<br>> > > > ><br>> > > > > Signed-off-by: Bas Nieuwenhuizen <<a href="mailto:bas@basnieuwenhuizen.nl">bas@basnieuwenhuizen.nl</a>><br>> > > > > Fixes: 816853f9dc40 ("drm/amd/display: Set new format info for<br>> > > > >converted metadata.")<br>> > > > > ---<br>> > > > >  drivers/gpu/drm/drm_plane.c | 2 +-<br>> > > > >  1 file changed, 1 insertion(+), 1 deletion(-)<br>> > > > ><br>> > > > > diff --git a/drivers/gpu/drm/drm_plane.c<br>> > > > > b/drivers/gpu/drm/drm_plane.c index e6231947f987..f5085990cfac<br>> > > > > 100644<br>> > > > > --- a/drivers/gpu/drm/drm_plane.c<br>> > > > > +++ b/drivers/gpu/drm/drm_plane.c<br>> > > > > @@ -1163,7 +1163,7 @@ int drm_mode_page_flip_ioctl(struct<br>> > > drm_device<br>> > > > >*dev,<br>> > > > >         if (ret)<br>> > > > >                 goto out;<br>> > > > ><br>> > > > > -       if (old_fb->format != fb->format) {<br>> > > > > +       if (old_fb->format->format != fb->format->format) {<br>> > > ><br>> > ><br>> > > I agree with this patch, though considering the original way was made<br>> > > by Ville, I will wait for Ville's input first. Adding my "Acked-by" here.<br>> > ><br>> > > This patch is:<br>> > > Acked-by: Zhan Liu <<a href="mailto:zhan.liu@amd.com">zhan.liu@amd.com</a>><br>><br>> Since there is no objection from the community on this patch over the past few days, and this patch totally makes sense to me, this patch is:<br>><br>> Reviewed-by: Zhan Liu <<a href="mailto:zhan.liu@amd.com">zhan.liu@amd.com</a>><br>><br><br>Well, there is my alternative one-line patch, which is equally simple and solves the problem in a similar way that doesn't undo Ville's stricter checks, but it doesn't seem to get any attention:<br><div><br></div><div><a href="https://lists.freedesktop.org/archives/dri-devel/2021-January/292763.html">https://lists.freedesktop.org/archives/dri-devel/2021-January/292763.html</a><br></div><div><br></div><div>Mine keeps the check as strict as before for non-atomic drivers, but removes the check for atomic drivers, given the assumption that they should be able to do without it.</div><div><br></div>In the end both patches solve the problem in the short term, also satisfying my (users) needs, and the future is unknown. But it would be nice to get an opinion from an atomic expert which one is the more future proof / elegant / final solution to stick to in the face of potential future atomic kms drivers<br><br>With that said, i will add to Bas patch a<br><br>Reported-by: Mario Kleiner <<a href="mailto:mario.kleiner.de@gmail.com">mario.kleiner.de@gmail.com</a>><br>Acked-by: Mario Kleiner <<a href="mailto:mario.kleiner.de@gmail.com">mario.kleiner.de@gmail.com</a>><br><br></div><div>thanks,</div><div>-mario<br></div><div><br>> ><br>> > Ping...<br>> ><br>> > ><br>> > > > This was btw. the original way before Ville made it more strict<br>> > > > about<br>> > > > 4 years ago, to catch issues related to tiling, and more complex<br>> > > > layouts, like the dcc tiling/retiling introduced by your modifier<br>> > > > patches. That's why I hope my alternative patch is a good solution<br>> > > > for atomic drivers while keeping the strictness for potential legacy<br>> > > > drivers.<br>> > > ><br>> > > > -mario<br>> > > ><br>> > > > >                 DRM_DEBUG_KMS("Page flip is not allowed to change<br>> > > > >frame buffer format.\n");<br>> > > > >                 ret = -EINVAL;<br>> > > > >                 goto out;<br>> > > > > --<br>> > > > > 2.29.2<br>> > > > ></div></div>