summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2017-09-29 17:13:31 +1000
committerAlex Deucher <alexander.deucher@amd.com>2017-09-29 13:04:16 -0400
commitd8c893b44b2199f5935fe8667708253c38353782 (patch)
tree25712e4aecb086edebfdb5e3499e70a9fd835175 /drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h
parent2a206cc20a37b0a7a31179b32d1281ead9c56038 (diff)
downloadlinux-stable-d8c893b44b2199f5935fe8667708253c38353782.tar.gz
linux-stable-d8c893b44b2199f5935fe8667708253c38353782.tar.bz2
linux-stable-d8c893b44b2199f5935fe8667708253c38353782.zip
amdgpu/dc: inline dml_round_to_multiple
turns out to be a win to inline this. Signed-off-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Harry Wentland <harry.wentland@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.h19
1 files changed, 19 insertions, 0 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 1c6c631daad4..a91b4a6c6154 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
@@ -58,4 +58,23 @@ static inline double dml_log(double x, double base)
return (double) dcn_bw_log(x, base);
}
+static inline unsigned int dml_round_to_multiple(unsigned int num,
+ unsigned int multiple,
+ bool up)
+{
+ unsigned int remainder;
+
+ if (multiple == 0)
+ return num;
+
+ remainder = num % multiple;
+
+ if (remainder == 0)
+ return num;
+
+ if (up)
+ return (num + multiple - remainder);
+ else
+ return (num - remainder);
+}
#endif