summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h
diff options
context:
space:
mode:
authorAric Cyr <aric.cyr@amd.com>2022-08-20 17:20:30 -0400
committerAlex Deucher <alexander.deucher@amd.com>2022-09-13 14:32:59 -0400
commit17529ea2acfa3e2118f5a9ee911e0daf2d88c13f (patch)
treeba1f26a49c8bea8ecb0db07a6e0d4246d567b8ac /drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h
parent6da15a236c8c80d9f87e4c5216e00ad8f1cace2d (diff)
downloadlinux-stable-17529ea2acfa3e2118f5a9ee911e0daf2d88c13f.tar.gz
linux-stable-17529ea2acfa3e2118f5a9ee911e0daf2d88c13f.tar.bz2
linux-stable-17529ea2acfa3e2118f5a9ee911e0daf2d88c13f.zip
drm/amd/display: Optimizations for DML math
[why] Conditionals in the DML basic math functions significantly impact mode enumeration. [how] Remove conditionals for floor/ceil operations which are used frequently in DML and add an assertion for invalid callers using zero granuality. Fix existing callers that rely on 0 granularity. Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Reviewed-by: Nevenko Stupar <Nevenko.Stupar@amd.com> Acked-by: Pavle Kotarac <Pavle.Kotarac@amd.com> Signed-off-by: Aric Cyr <aric.cyr@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h')
-rw-r--r--drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h9
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h b/drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h
index 479d7d83220c..072bd0539605 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h
+++ b/drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h
@@ -76,14 +76,9 @@ static inline double dml_floor(double a, double granularity)
static inline double dml_round(double a)
{
- double round_pt = 0.5;
- double ceil = dml_ceil(a, 1);
- double floor = dml_floor(a, 1);
+ const double round_pt = 0.5;
- if (a - floor >= round_pt)
- return ceil;
- else
- return floor;
+ return dml_floor(a + round_pt, 1);
}
/* float