drm/amdgpu: Do not change amdgpu framebuffer format during page flip
Subsystems (2)
PATCH 1/1 drm/amdgpu: Do not change amdgpu framebuffer format during page flip
[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.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +0 -2
@@ -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; } }
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 26 lines · Zhan Liu
[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 <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 -- 1 file changed, 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c static int convert_tiling_flags_to_modifier(struct amdgpu_framebuffer *afb) · line 835
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +0
-2@@ -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
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c static int convert_tiling_flags_to_modifier(struct amdgpu_framebuffer *afb) · line 836
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +0
-0} }
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 44 lines · Nicholas
Quoted 26 lines · Zhan Liu
[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 <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 -- 1 file changed, 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +0
-0drivers/gpu/drm/amd/amdgpu/amdgpu_display.c static int convert_tiling_flags_to_modifier(struct amdgpu_framebuffer *afb) · line 835
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +0
-2@@ -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.
Quoted 7 lines
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).
Quoted 13 lines
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 KazlauskasQuoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +0
-0} }
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
https://lists.freedesktop.org/archives/dri-devel/2021-January/292761.html
is my alternative patch.
Quoted 38 lines · Zhan Liu
[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 <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 -- 1 file changed, 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +0
-3@@ -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
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx