summaryrefslogtreecommitdiff
path: root/include/drm/drm_rect.h
diff options
context:
space:
mode:
authorJosé Roberto de Souza <jose.souza@intel.com>2021-01-04 23:56:51 +0300
committerJosé Roberto de Souza <jose.souza@intel.com>2021-01-05 16:32:52 +0300
commit7d8ac172d7f1098acc58023819117f7c26d4b604 (patch)
tree9e7b90e76032c81879236b8a8adae0f188733129 /include/drm/drm_rect.h
parentb3304591f14b437b6bccd8dbff06006c11837031 (diff)
downloadlinux-7d8ac172d7f1098acc58023819117f7c26d4b604.tar.xz
drm: Add function to convert rect in 16.16 fixed format to regular format
Much more clear to read one function call than four lines doing this conversion. v7: - function renamed - calculating width and height before truncate - inlined v10: - renamed parameters from source and destination to src and dst to match sister functions Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: dri-devel@lists.freedesktop.org Cc: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com> Reviewed-by: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com> Signed-off-by: José Roberto de Souza <jose.souza@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20210104205654.238928-1-jose.souza@intel.com
Diffstat (limited to 'include/drm/drm_rect.h')
-rw-r--r--include/drm/drm_rect.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/drm/drm_rect.h b/include/drm/drm_rect.h
index e7f4d24cdd00..39f2deee709c 100644
--- a/include/drm/drm_rect.h
+++ b/include/drm/drm_rect.h
@@ -206,6 +206,19 @@ static inline bool drm_rect_equals(const struct drm_rect *r1,
r1->y1 == r2->y1 && r1->y2 == r2->y2;
}
+/**
+ * drm_rect_fp_to_int - Convert a rect in 16.16 fixed point form to int form.
+ * @dst: rect to be stored the converted value
+ * @src: rect in 16.16 fixed point form
+ */
+static inline void drm_rect_fp_to_int(struct drm_rect *dst,
+ const struct drm_rect *src)
+{
+ drm_rect_init(dst, src->x1 >> 16, src->y1 >> 16,
+ drm_rect_width(src) >> 16,
+ drm_rect_height(src) >> 16);
+}
+
bool drm_rect_intersect(struct drm_rect *r, const struct drm_rect *clip);
bool drm_rect_clip_scaled(struct drm_rect *src, struct drm_rect *dst,
const struct drm_rect *clip);