summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Expósito <jose.exposito89@gmail.com>2022-06-20 18:06:38 +0200
committerJosé Expósito <jose.exposito89@gmail.com>2022-06-27 13:45:48 +0200
commit84509eede6203bc5ab43ce0361a6ae17e2a17152 (patch)
treeb335e53c145569d1268477f1f55039f19b00f9a0
parentdrm/ast: Enable primary plane with CRTC (diff)
downloadlinux-84509eede6203bc5ab43ce0361a6ae17e2a17152.tar.xz
linux-84509eede6203bc5ab43ce0361a6ae17e2a17152.zip
drm/rect: Add DRM_RECT_INIT() macro
Add a helper macro to initialize a rectangle from x, y, width and height information. Reviewed-by: Jani Nikula <jani.nikula@intel.com> Reviewed-by: David Gow <davidgow@google.com> Acked-by: Thomas Zimmermann <tzimmermann@suse.de> Signed-off-by: José Expósito <jose.exposito89@gmail.com> Link: https://patchwork.freedesktop.org/patch/msgid/20220620160640.3790-2-jose.exposito89@gmail.com
-rw-r--r--include/drm/drm_rect.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/drm/drm_rect.h b/include/drm/drm_rect.h
index 6f6e19bd4dac..e8d94fca2703 100644
--- a/include/drm/drm_rect.h
+++ b/include/drm/drm_rect.h
@@ -48,6 +48,22 @@ struct drm_rect {
};
/**
+ * DRM_RECT_INIT - initialize a rectangle from x/y/w/h
+ * @x: x coordinate
+ * @y: y coordinate
+ * @w: width
+ * @h: height
+ *
+ * RETURNS:
+ * A new rectangle of the specified size.
+ */
+#define DRM_RECT_INIT(x, y, w, h) ((struct drm_rect){ \
+ .x1 = (x), \
+ .y1 = (y), \
+ .x2 = (x) + (w), \
+ .y2 = (y) + (h) })
+
+/**
* DRM_RECT_FMT - printf string for &struct drm_rect
*/
#define DRM_RECT_FMT "%dx%d%+d%+d"