drm/amd/display: Initialize num_pkrs on VANGOGH.
Subsystems (3)
PATCH 1/1 drm/amd/display: Initialize num_pkrs on VANGOGH.
As far a I can tell uses a variant of DCN3xx which uses num_pkrs.
If we do not initialize the variable we will set the register field to ilog2(0) = -1, though the mask will reduce that to 7. Pretty sure 7 is not the value we want here.
---
Found while rebasing my modifiers series. Not tested on HW.
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -1
@@ -4074,7 +4074,8 @@ fill_plane_buffer_attributes(struct amdgpu_device *adev,#ifdef CONFIG_DRM_AMD_DC_DCN3_0 if (adev->asic_type ==CHIP_SIENNA_CICHLID || adev->asic_type ==CHIP_NAVY_FLOUNDER || - adev->asic_type ==CHIP_DIMGREY_CAVEFISH ) + adev->asic_type ==CHIP_DIMGREY_CAVEFISH || + adev->asic_type ==CHIP_VANGOGH ) tiling_info->gfx9.num_pkrs = adev->gfx.config.gb_addr_config_fields.num_pkrs;#endif ret = fill_plane_dcc_attributes(adev, afb, format, rotation,
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
FYI, this fixes tiling on VanGogh.
Marek
Quoted 35 lines · Bas Nieuwenhuizen
As far a I can tell uses a variant of DCN3xx which uses
num_pkrs.If we do not initialize the variable we will set the register field to ilog2(0) = -1, though the mask will reduce that to 7. Pretty sure 7 is not the value we want here.
Signed-off-by Bas Nieuwenhuizen <[email protected]>---
Found while rebasing my modifiers series. Not tested on HW.
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2
-1@@ -4074,7 +4074,8 @@ fill_plane_buffer_attributes(struct amdgpu_device *adev,#ifdef CONFIG_DRM_AMD_DC_DCN3_0 if (adev->asic_type ==CHIP_SIENNA_CICHLID || adev->asic_type ==CHIP_NAVY_FLOUNDER || - adev->asic_type ==CHIP_DIMGREY_CAVEFISH ) + adev->asic_type ==CHIP_DIMGREY_CAVEFISH || + adev->asic_type ==CHIP_VANGOGH ) tiling_info->gfx9.num_pkrs = adev->gfx.config.gb_addr_config_fields.num_pkrs;#endif
ret = fill_plane_dcc_attributes(adev, afb, format,
rotation,
--
2.28.0
Quoted 5 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
Huang Rui
AppliedQuoted 19 lines · Marek Olšák
FYI, this fixes tiling on VanGogh.
Reviewed-by Marek Olšák <[email protected]>Marek
Quoted 10 lines · Bas Nieuwenhuizen
As far a I can tell uses a variant of DCN3xx which uses
num_pkrs.If we do not initialize the variable we will set the register field to ilog2(0) = -1, though the mask will reduce that to 7. Pretty sure 7 is not the value we want here.
Signed-off-by Bas Nieuwenhuizen <[email protected]>---
Found while rebasing my modifiers series. Not tested on HW.
Yes! Thank you so much, Bas!
I just verified the tiling issue got resovled with your patch! :-)
Applied.
Quoted 25 lines
Quoted 25 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2
-1@@ -4074,7 +4074,8 @@ fill_plane_buffer_attributes(struct amdgpu_device *adev,#ifdef CONFIG_DRM_AMD_DC_DCN3_0 if (adev->asic_type ==CHIP_SIENNA_CICHLID || adev->asic_type ==CHIP_NAVY_FLOUNDER || - adev->asic_type ==CHIP_DIMGREY_CAVEFISH ) + adev->asic_type ==CHIP_DIMGREY_CAVEFISH || + adev->asic_type ==CHIP_VANGOGH ) tiling_info->gfx9.num_pkrs = adev->gfx.config.gb_addr_config_fields.num_pkrs;#endif
ret = fill_plane_dcc_attributes(adev, afb, format,
rotation,
--
2.28.0
Quoted 10 lines
Quoted 5 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Cray.huang%40amd.com%7C9afdb4e0a2e949655c9b08d87552a1bf%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637388345070265382%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=SbojOTLaOXt85OSbYjyRPozLAsqBwXpvoYVBu7c0Ido%3D&reserved=0_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Cray.huang%40amd.com%7C9afdb4e0a2e949655c9b08d87552a1bf%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637388345070305360%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=uPui9S6bxwp%2B4J4uav4FekR1zOZ9VeHYcdrOSA9ZFKg%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Harry Wentland
maintainerPATCH 1/1 drm/amd/display: Interpret log_2(0) as 0
In reply to Bas NieuwenhuizenEven though log(0) is technically undefined our code assumes that log_2(0) is 0. This mirrors the current behavior of our log_2 implementation on non-Linux platforms.
---
What's num_pkrs value is upstream Mesa providing for CHIP_VANGOGH?
I saw that problem at bringup with an internal Mesa and had this fix for it.
Harry
drivers/gpu/drm/amd/display/dc/basics/conversion.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/basics/conversion.h +5 -1
@@ -40,7 +40,11 @@ void convert_float_matrix(static inline unsigned int log_2 (unsigned int num) { -return ilog2 (num); +/* +* Technically log(0) is undefined, but our code is structured +* in a way that assumes log(0) = 0 +*/ +return num ?ilog2 (num) : num; }#endif
Signature · 6 lines
2.28.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH] drm/amd/display: Interpret log_2(0) as 0
Quoted 9 lines · Harry Wentland
Even though log(0) is technically undefined our code assumes that
log_2(0)is 0. This mirrors the current behavior of ourlog_2implementation on non-Linux platforms.Signed-off-by Harry Wentland <[email protected]>---
What's
num_pkrsvalue is upstream Mesa providing forCHIP_VANGOGH?
So mesa isn't quite providing a num_pkrs value to the HW as the render HW doesn't require you to set one, it assumes something.
In practice mesa still uses num_pkrs, which is provided by a readback of the GB_ADDR_CFG(CONFIG?) register info provided by the kernel. This can be used for e.g. determining texture coordinates (like we do for the displayable DCC transform) but otherwise isn't really needed, since the tile size for texture allocation is not dependent on num_pkrs.
so outside of displayable DCC I think you'd be able to get far in mesa with a wrong num_pkrs.
Quoted 27 lines
I saw that problem at bringup with an internal Mesa and had this fix for it.
Harry
drivers/gpu/drm/amd/display/dc/basics/conversion.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/display/dc/basics/conversion.h +5
-2@@ -40,7 +40,11 @@ void convert_float_matrix(static inline unsigned int log_2 (unsigned int num) { -return ilog2 (num); +/* +* Technically log(0) is undefined, but our code is structured +* in a way that assumes log(0) = 0 +*/ +return num ?ilog2 (num) : num; }#endif --
Quoted 2 lines
2.28.0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH] drm/amd/display: Interpret log_2(0) as 0
num_pkrs is a hardware config parameter like the number of shader engines. It's constant for each chip.
Marek
Quoted 51 lines · Bas Nieuwenhuizen
Quoted 9 lines · Harry Wentland
Even though log(0) is technically undefined our code assumes that
log_2(0)is 0. This mirrors the current behavior of ourlog_2implementation on non-Linux platforms.Signed-off-by Harry Wentland <[email protected]>---
What's
num_pkrsvalue is upstream Mesa providing forCHIP_VANGOGH?So mesa isn't quite providing a
num_pkrsvalue to the HW as the render HW doesn't require you to set one, it assumes something.In practice mesa still uses
num_pkrs, which is provided by a readback of theGB_ADDR_CFG(CONFIG?)register info provided by the kernel. This can be used for e.g. determining texture coordinates (like we do for the displayable DCC transform) but otherwise isn't really needed, since the tile size for texture allocation is not dependent onnum_pkrs.so outside of displayable DCC I think you'd be able to get far in mesa with a wrong
num_pkrs.Review
Quoted 10 lines
I saw that problem at bringup with an internal Mesa and had this fix for it.
Harry
drivers/gpu/drm/amd/display/dc/basics/conversion.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/display/dc/basics/conversion.hQuoted 15 lines
index
ade785c4fdc7..da9883ec7b1c100644drivers/gpu/drm/amd/display/dc/basics/conversion.h +5
-1@@ -40,7 +40,11 @@ void convert_float_matrix(static inline unsigned int log_2 (unsigned int num) { -return ilog2 (num); +/* +* Technically log(0) is undefined, but our code is structured +* in a way that assumes log(0) = 0 +*/ +return num ?ilog2 (num) : num; }
Quoted 9 lines
Quoted 4 lines
drivers/gpu/drm/amd/display/dc/basics/conversion.h +0
-1#endif --2.28.0
_______________________________________________
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