drm/amd/display: Add FPU wrappers to dcn21_validate_bandwidth()
Subsystems (3)
PATCH 1/1 drm/amd/display: Add FPU wrappers to dcn21_validate_bandwidth()
dcn21_validate_bandwidth() calls functions that use floating point math. On my machine this sometimes results in simd exceptions when there are other FPU users such as KVM virtual machines running. The screen freezes completely in this case.
Wrapping the function with DC_FP_START()/DC_FP_END() seems to solve the problem. This mirrors the approach used for dcn20_validate_bandwidth.
Tested on a AMD Ryzen 7 PRO 4750U (Renoir).
--- .../drm/amd/display/dc/dcn20/dcn20_resource.c | 2 +- .../drm/amd/display/dc/dcn21/dcn21_resource.c | 20 +++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +1 -1
@@ -3245,7 +3245,7 @@ static noinline bool dcn20_validate_bandwidth_fp(struct dc *dc,bool dcn20_validate_bandwidth (struct dc *dc,struct dc_state *context,bool fast_validate) { -bool voltage_supported = false; +bool voltage_supported;DC_FP_START (); voltage_supported =dcn20_validate_bandwidth_fp (dc, context, fast_validate);DC_FP_END ();
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c +18 -2
@@ -1329,8 +1329,8 @@ static bool dcn21_fast_validate_bw(return out; } -bool dcn21_validate_bandwidth (struct dc *dc,struct dc_state *context, -bool fast_validate) +static noinline bool dcn21_validate_bandwidth_fp(struct dc *dc, +struct dc_state *context,bool fast_validate) {bool out = false;
@@ -1383,6 +1383,22 @@ bool dcn21_validate_bandwidth(struct dc *dc, struct dc_state *context,return out; } + +/* +* Some of the functions further below use the FPU, so we need to wrap this +* with DC_FP_START()/DC_FP_END(). Use the same approach as for +* dcn20_validate_bandwidth in dcn20_resource.c. +*/ +bool dcn21_validate_bandwidth (struct dc *dc,struct dc_state *context, +bool fast_validate) +{ +bool voltage_supported; +DC_FP_START (); + voltage_supported =dcn21_validate_bandwidth_fp (dc, context, fast_validate); +DC_FP_END (); +return voltage_supported; +} +static void dcn21_destroy_resource_pool (struct resource_pool **pool) {struct dcn21_resource_pool *dcn21_pool =TO_DCN21_RES_POOL (*pool);
Signature · 6 lines
2.30.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
AppliedQuoted 6 lines · Jan Kokemüller
dcn21_validate_bandwidth()calls functions that use floating point math. On my machine this sometimes results in simd exceptions when there are other FPU users such as KVM virtual machines running. The screen freezes completely in this case.
Quoted 7 lines
Wrapping the function with DC_FP_START()/DC_FP_END() seems to solve the problem. This mirrors the approach used for
dcn20_validate_bandwidth.Tested on a AMD Ryzen 7 PRO 4750U (Renoir).
Applied. Thanks!
Alex
Quoted 59 lines
--- .../drm/amd/display/dc/dcn20/dcn20_resource.c | 2 +- .../drm/amd/display/dc/dcn21/dcn21_resource.c | 20 +++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +1
-1@@ -3245,7 +3245,7 @@ static noinline bool dcn20_validate_bandwidth_fp(struct dc *dc,bool dcn20_validate_bandwidth (struct dc *dc,struct dc_state *context,bool fast_validate) { -bool voltage_supported = false; +bool voltage_supported;DC_FP_START (); voltage_supported =dcn20_validate_bandwidth_fp (dc, context, fast_validate);DC_FP_END ();drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c +18
-3@@ -1329,8 +1329,8 @@ static bool dcn21_fast_validate_bw(return out; } -bool dcn21_validate_bandwidth (struct dc *dc,struct dc_state *context, -bool fast_validate) +static noinline bool dcn21_validate_bandwidth_fp(struct dc *dc, +struct dc_state *context,bool fast_validate) {bool out = false;@@ -1383,6 +1383,22 @@ bool dcn21_validate_bandwidth(struct dc *dc, struct dc_state *context,return out; } + +/* +* Some of the functions further below use the FPU, so we need to wrap this +* with DC_FP_START()/DC_FP_END(). Use the same approach as for +* dcn20_validate_bandwidth in dcn20_resource.c. +*/ +bool dcn21_validate_bandwidth (struct dc *dc,struct dc_state *context, +bool fast_validate) +{ +bool voltage_supported; +DC_FP_START (); + voltage_supported =dcn21_validate_bandwidth_fp (dc, context, fast_validate); +DC_FP_END (); +return voltage_supported; +} +static void dcn21_destroy_resource_pool (struct resource_pool **pool) {struct dcn21_resource_pool *dcn21_pool =TO_DCN21_RES_POOL (*pool); --2.30.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