[PATCH 1/5] drm: Add drm_fixed_16_16 helper
Alyssa Rosenzweig
alyssa at rosenzweig.io
Wed Sep 1 17:54:27 UTC 2021
This constructs a fixed 16.16 rational, useful to specify the minimum
and maximum scaling in drm_atomic_helper_check_plane_state. It is
open-coded as a macro in multiple drivers, so let's share the helper.
Signed-off-by: Alyssa Rosenzweig <alyssa at rosenzweig.io>
---
include/drm/drm_fixed.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/drm/drm_fixed.h b/include/drm/drm_fixed.h
index 553210c02ee0..df1f369b4918 100644
--- a/include/drm/drm_fixed.h
+++ b/include/drm/drm_fixed.h
@@ -208,4 +208,9 @@ static inline s64 drm_fixp_exp(s64 x)
return sum;
}
+static inline int drm_fixed_16_16(s32 mult, s32 div)
+{
+ return (mult << 16) / div;
+}
+
#endif
--
2.30.2
More information about the dri-devel
mailing list