artulab
projects
/
openbsd
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9b7d899
)
drm: Add fixed-point helper to get rounded integer values
author
jsg
<jsg@openbsd.org>
Thu, 20 Jul 2023 08:33:02 +0000
(08:33 +0000)
committer
jsg
<jsg@openbsd.org>
Thu, 20 Jul 2023 08:33:02 +0000
(08:33 +0000)
From Maira Canal
048b7168acf85cb856b0db1d0483584cfff3498f
in linux-6.1.y/6.1.39
8b25320887d7feac98875546ea0f521628b745bb
in mainline linux
sys/dev/pci/drm/include/drm/drm_fixed.h
patch
|
blob
|
history
diff --git
a/sys/dev/pci/drm/include/drm/drm_fixed.h
b/sys/dev/pci/drm/include/drm/drm_fixed.h
index
553210c
..
03cb890
100644
(file)
--- a/
sys/dev/pci/drm/include/drm/drm_fixed.h
+++ b/
sys/dev/pci/drm/include/drm/drm_fixed.h
@@
-70,6
+70,7
@@
static inline u32 dfixed_div(fixed20_12 A, fixed20_12 B)
}
#define DRM_FIXED_POINT 32
+#define DRM_FIXED_POINT_HALF 16
#define DRM_FIXED_ONE (1ULL << DRM_FIXED_POINT)
#define DRM_FIXED_DECIMAL_MASK (DRM_FIXED_ONE - 1)
#define DRM_FIXED_DIGITS_MASK (~DRM_FIXED_DECIMAL_MASK)
@@
-86,6
+87,11
@@
static inline int drm_fixp2int(s64 a)
return ((s64)a) >> DRM_FIXED_POINT;
}
+static inline int drm_fixp2int_round(s64 a)
+{
+ return drm_fixp2int(a + (1 << (DRM_FIXED_POINT_HALF - 1)));
+}
+
static inline int drm_fixp2int_ceil(s64 a)
{
if (a > 0)