All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: Do not change amdgpu framebuffer format during page flip
@ 2020-12-22  3:18 Zhan Liu
  2020-12-22 20:55   ` Kazlauskas, Nicholas
  2021-01-02 14:03 ` Bas Nieuwenhuizen
  0 siblings, 2 replies; 6+ messages in thread
From: Zhan Liu @ 2020-12-22  3:18 UTC (permalink / raw)
  To: amd-gfx, zhan.liu, Nikola.Cornij, Stylon.Wang, Chao-kai.Wang

[Why]
Driver cannot change amdgpu framebuffer (afb) format while doing
page flip. Force system doing so will cause ioctl error, and result in
breaking several functionalities including FreeSync.

If afb format is forced to change during page flip, following message
will appear in dmesg.log:

"[drm:drm_mode_page_flip_ioctl [drm]]
Page flip is not allowed to change frame buffer format."

[How]
Do not change afb format while doing page flip. It is okay to check
whether afb format is valid here, however, forcing afb format change
shouldn't happen here.

Signed-off-by: Zhan Liu <zhan.liu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index a638709e9c92..0efebd592b65 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -831,8 +831,6 @@ static int convert_tiling_flags_to_modifier(struct amdgpu_framebuffer *afb)
 								modifier);
 			if (!format_info)
 				return -EINVAL;
-
-			afb->base.format = format_info;
 		}
 	}
 
-- 
2.25.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/amdgpu: Do not change amdgpu framebuffer format during page flip
  2020-12-22  3:18 [PATCH] drm/amdgpu: Do not change amdgpu framebuffer format during page flip Zhan Liu
@ 2020-12-22 20:55   ` Kazlauskas, Nicholas
  2021-01-02 14:03 ` Bas Nieuwenhuizen
  1 sibling, 0 replies; 6+ messages in thread
From: Kazlauskas, Nicholas @ 2020-12-22 20:55 UTC (permalink / raw)
  To: Zhan Liu, amd-gfx, Nikola.Cornij, Stylon.Wang, Chao-kai.Wang,
	Bas Nieuwenhuizen, Maling list - DRI developers

On 2020-12-21 10:18 p.m., Zhan Liu wrote:
> [Why]
> Driver cannot change amdgpu framebuffer (afb) format while doing
> page flip. Force system doing so will cause ioctl error, and result in
> breaking several functionalities including FreeSync.
> 
> If afb format is forced to change during page flip, following message
> will appear in dmesg.log:
> 
> "[drm:drm_mode_page_flip_ioctl [drm]]
> Page flip is not allowed to change frame buffer format."
> 
> [How]
> Do not change afb format while doing page flip. It is okay to check
> whether afb format is valid here, however, forcing afb format change
> shouldn't happen here.
> 
> Signed-off-by: Zhan Liu <zhan.liu@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> index a638709e9c92..0efebd592b65 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> @@ -831,8 +831,6 @@ static int convert_tiling_flags_to_modifier(struct amdgpu_framebuffer *afb)
>   								modifier);
>   			if (!format_info)
>   				return -EINVAL;
> -
> -			afb->base.format = format_info;

Adding Bas for comment since he added the modifiers conversion, but I'll 
leave my own thoughts below.

This patch is a NAK from me - the framebuffer is still expected to be in 
a specific format/tiling configuration and ignoring the incoming format 
doesn't resolve the problem.

The problem is that the legacy page IOCTL has this check in the first 
place expecting that no driver is capable of performing this action.

This is not the case for amdgpu (be it DC enabled or not), so I think 
it's best to have a driver cap here or some new driver hook to validate 
that the flip is valid.

This is legacy code, and in the shared path, so I don't know how others 
in the list feel about modifying this but I think we do expect that 
legacy userspace can do this from the X side of things.

I recall seeing this happen going from DCC disabled to non DCC enabled 
buffers and some of this functionality being behind a version check in 
xf86-video-amdgpu.

Regards,
Nicholas Kazlauskas

>   		}
>   	}
>   
> 

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/amdgpu: Do not change amdgpu framebuffer format during page flip
@ 2020-12-22 20:55   ` Kazlauskas, Nicholas
  0 siblings, 0 replies; 6+ messages in thread
From: Kazlauskas, Nicholas @ 2020-12-22 20:55 UTC (permalink / raw)
  To: Zhan Liu, amd-gfx, Nikola.Cornij, Stylon.Wang, Chao-kai.Wang,
	Bas Nieuwenhuizen, Maling list - DRI developers

On 2020-12-21 10:18 p.m., Zhan Liu wrote:
> [Why]
> Driver cannot change amdgpu framebuffer (afb) format while doing
> page flip. Force system doing so will cause ioctl error, and result in
> breaking several functionalities including FreeSync.
> 
> If afb format is forced to change during page flip, following message
> will appear in dmesg.log:
> 
> "[drm:drm_mode_page_flip_ioctl [drm]]
> Page flip is not allowed to change frame buffer format."
> 
> [How]
> Do not change afb format while doing page flip. It is okay to check
> whether afb format is valid here, however, forcing afb format change
> shouldn't happen here.
> 
> Signed-off-by: Zhan Liu <zhan.liu@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> index a638709e9c92..0efebd592b65 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> @@ -831,8 +831,6 @@ static int convert_tiling_flags_to_modifier(struct amdgpu_framebuffer *afb)
>   								modifier);
>   			if (!format_info)
>   				return -EINVAL;
> -
> -			afb->base.format = format_info;

Adding Bas for comment since he added the modifiers conversion, but I'll 
leave my own thoughts below.

This patch is a NAK from me - the framebuffer is still expected to be in 
a specific format/tiling configuration and ignoring the incoming format 
doesn't resolve the problem.

The problem is that the legacy page IOCTL has this check in the first 
place expecting that no driver is capable of performing this action.

This is not the case for amdgpu (be it DC enabled or not), so I think 
it's best to have a driver cap here or some new driver hook to validate 
that the flip is valid.

This is legacy code, and in the shared path, so I don't know how others 
in the list feel about modifying this but I think we do expect that 
legacy userspace can do this from the X side of things.

I recall seeing this happen going from DCC disabled to non DCC enabled 
buffers and some of this functionality being behind a version check in 
xf86-video-amdgpu.

Regards,
Nicholas Kazlauskas

>   		}
>   	}
>   
> 

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/amdgpu: Do not change amdgpu framebuffer format during page flip
  2020-12-22 20:55   ` Kazlauskas, Nicholas
@ 2020-12-23  0:37     ` Bas Nieuwenhuizen
  -1 siblings, 0 replies; 6+ messages in thread
From: Bas Nieuwenhuizen @ 2020-12-23  0:37 UTC (permalink / raw)
  To: Kazlauskas, Nicholas
  Cc: Stylon.Wang, Zhan Liu, Chao-kai.Wang,
	Maling list - DRI developers, Nikola.Cornij,
	amd-gfx mailing list

On Tue, Dec 22, 2020 at 9:55 PM Kazlauskas, Nicholas
<nicholas.kazlauskas@amd.com> wrote:
>
> On 2020-12-21 10:18 p.m., Zhan Liu wrote:
> > [Why]
> > Driver cannot change amdgpu framebuffer (afb) format while doing
> > page flip. Force system doing so will cause ioctl error, and result in
> > breaking several functionalities including FreeSync.
> >
> > If afb format is forced to change during page flip, following message
> > will appear in dmesg.log:
> >
> > "[drm:drm_mode_page_flip_ioctl [drm]]
> > Page flip is not allowed to change frame buffer format."
> >
> > [How]
> > Do not change afb format while doing page flip. It is okay to check
> > whether afb format is valid here, however, forcing afb format change
> > shouldn't happen here.
> >
> > Signed-off-by: Zhan Liu <zhan.liu@amd.com>
> > ---
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 --
> >   1 file changed, 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> > index a638709e9c92..0efebd592b65 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> > @@ -831,8 +831,6 @@ static int convert_tiling_flags_to_modifier(struct amdgpu_framebuffer *afb)
> >                                                               modifier);
> >                       if (!format_info)
> >                               return -EINVAL;
> > -
> > -                     afb->base.format = format_info;
>
> Adding Bas for comment since he added the modifiers conversion, but I'll
> leave my own thoughts below.
>
> This patch is a NAK from me - the framebuffer is still expected to be in
> a specific format/tiling configuration and ignoring the incoming format
> doesn't resolve the problem.
>
> The problem is that the legacy page IOCTL has this check in the first
> place expecting that no driver is capable of performing this action.
>
> This is not the case for amdgpu (be it DC enabled or not), so I think
> it's best to have a driver cap here or some new driver hook to validate
> that the flip is valid.
>
> This is legacy code, and in the shared path, so I don't know how others
> in the list feel about modifying this but I think we do expect that
> legacy userspace can do this from the X side of things.

I think the "new" thing is that we can have different format_info
structs for the same drm fourcc (as we need a different number of
planes depending on modifier). It would probably make sense to relax
this check to check the actual drm fourcc (i.e. fb->format->format)
instead of the format_info pointer. This case would likely only be hit
in the AMDGPU driver anyway (with intel being the other possibility).


>
> I recall seeing this happen going from DCC disabled to non DCC enabled
> buffers and some of this functionality being behind a version check in
> xf86-video-amdgpu.
>
> Regards,
> Nicholas Kazlauskas
>
> >               }
> >       }
> >
> >
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/amdgpu: Do not change amdgpu framebuffer format during page flip
@ 2020-12-23  0:37     ` Bas Nieuwenhuizen
  0 siblings, 0 replies; 6+ messages in thread
From: Bas Nieuwenhuizen @ 2020-12-23  0:37 UTC (permalink / raw)
  To: Kazlauskas, Nicholas
  Cc: Stylon.Wang, Zhan Liu, Chao-kai.Wang,
	Maling list - DRI developers, Nikola.Cornij,
	amd-gfx mailing list

On Tue, Dec 22, 2020 at 9:55 PM Kazlauskas, Nicholas
<nicholas.kazlauskas@amd.com> wrote:
>
> On 2020-12-21 10:18 p.m., Zhan Liu wrote:
> > [Why]
> > Driver cannot change amdgpu framebuffer (afb) format while doing
> > page flip. Force system doing so will cause ioctl error, and result in
> > breaking several functionalities including FreeSync.
> >
> > If afb format is forced to change during page flip, following message
> > will appear in dmesg.log:
> >
> > "[drm:drm_mode_page_flip_ioctl [drm]]
> > Page flip is not allowed to change frame buffer format."
> >
> > [How]
> > Do not change afb format while doing page flip. It is okay to check
> > whether afb format is valid here, however, forcing afb format change
> > shouldn't happen here.
> >
> > Signed-off-by: Zhan Liu <zhan.liu@amd.com>
> > ---
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 --
> >   1 file changed, 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> > index a638709e9c92..0efebd592b65 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> > @@ -831,8 +831,6 @@ static int convert_tiling_flags_to_modifier(struct amdgpu_framebuffer *afb)
> >                                                               modifier);
> >                       if (!format_info)
> >                               return -EINVAL;
> > -
> > -                     afb->base.format = format_info;
>
> Adding Bas for comment since he added the modifiers conversion, but I'll
> leave my own thoughts below.
>
> This patch is a NAK from me - the framebuffer is still expected to be in
> a specific format/tiling configuration and ignoring the incoming format
> doesn't resolve the problem.
>
> The problem is that the legacy page IOCTL has this check in the first
> place expecting that no driver is capable of performing this action.
>
> This is not the case for amdgpu (be it DC enabled or not), so I think
> it's best to have a driver cap here or some new driver hook to validate
> that the flip is valid.
>
> This is legacy code, and in the shared path, so I don't know how others
> in the list feel about modifying this but I think we do expect that
> legacy userspace can do this from the X side of things.

I think the "new" thing is that we can have different format_info
structs for the same drm fourcc (as we need a different number of
planes depending on modifier). It would probably make sense to relax
this check to check the actual drm fourcc (i.e. fb->format->format)
instead of the format_info pointer. This case would likely only be hit
in the AMDGPU driver anyway (with intel being the other possibility).


>
> I recall seeing this happen going from DCC disabled to non DCC enabled
> buffers and some of this functionality being behind a version check in
> xf86-video-amdgpu.
>
> Regards,
> Nicholas Kazlauskas
>
> >               }
> >       }
> >
> >
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/amdgpu: Do not change amdgpu framebuffer format during page flip
  2020-12-22  3:18 [PATCH] drm/amdgpu: Do not change amdgpu framebuffer format during page flip Zhan Liu
  2020-12-22 20:55   ` Kazlauskas, Nicholas
@ 2021-01-02 14:03 ` Bas Nieuwenhuizen
  1 sibling, 0 replies; 6+ messages in thread
From: Bas Nieuwenhuizen @ 2021-01-02 14:03 UTC (permalink / raw)
  To: Zhan Liu; +Cc: Stylon.Wang, Chao-kai.Wang, amd-gfx mailing list, Nikola.Cornij

https://lists.freedesktop.org/archives/dri-devel/2021-January/292761.html
is my alternative patch.

On Tue, Dec 22, 2020 at 4:18 AM Zhan Liu <zhan.liu@amd.com> wrote:
>
> [Why]
> Driver cannot change amdgpu framebuffer (afb) format while doing
> page flip. Force system doing so will cause ioctl error, and result in
> breaking several functionalities including FreeSync.
>
> If afb format is forced to change during page flip, following message
> will appear in dmesg.log:
>
> "[drm:drm_mode_page_flip_ioctl [drm]]
> Page flip is not allowed to change frame buffer format."
>
> [How]
> Do not change afb format while doing page flip. It is okay to check
> whether afb format is valid here, however, forcing afb format change
> shouldn't happen here.
>
> Signed-off-by: Zhan Liu <zhan.liu@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> index a638709e9c92..0efebd592b65 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> @@ -831,8 +831,6 @@ static int convert_tiling_flags_to_modifier(struct amdgpu_framebuffer *afb)
>                                                                 modifier);
>                         if (!format_info)
>                                 return -EINVAL;
> -
> -                       afb->base.format = format_info;
>                 }
>         }
>
> --
> 2.25.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-01-02 14:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-22  3:18 [PATCH] drm/amdgpu: Do not change amdgpu framebuffer format during page flip Zhan Liu
2020-12-22 20:55 ` Kazlauskas, Nicholas
2020-12-22 20:55   ` Kazlauskas, Nicholas
2020-12-23  0:37   ` Bas Nieuwenhuizen
2020-12-23  0:37     ` Bas Nieuwenhuizen
2021-01-02 14:03 ` Bas Nieuwenhuizen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.