summaryrefslogtreecommitdiff
path: root/include/drm
diff options
context:
space:
mode:
authorRob Clark <robdclark@gmail.com>2016-11-05 11:08:08 -0400
committerSean Paul <seanpaul@chromium.org>2016-11-08 16:38:03 -0500
commit1638d30c1584ff8097776d691f5fa5aafa7aeb8c (patch)
treec5a339c20e97b2ce284e7a335845f609125133a1 /include/drm
parentd8187177b0b195368699ba12b5fa8cd5fdc39b79 (diff)
drm: add helpers to go from plane state to drm_rect
Signed-off-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Sean Paul <seanpaul@chromium.org> [seanpaul resolved conflict in drm_plane.h] Signed-off-by: Sean Paul <seanpaul@chromium.org>
Diffstat (limited to 'include/drm')
-rw-r--r--include/drm/drm_plane.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
index 29a175754aee..a421cb553620 100644
--- a/include/drm/drm_plane.h
+++ b/include/drm/drm_plane.h
@@ -118,6 +118,30 @@ struct drm_plane_state {
struct drm_atomic_state *state;
};
+static inline struct drm_rect
+drm_plane_state_src(const struct drm_plane_state *state)
+{
+ struct drm_rect src = {
+ .x1 = state->src_x,
+ .y1 = state->src_y,
+ .x2 = state->src_x + state->src_w,
+ .y2 = state->src_y + state->src_h,
+ };
+ return src;
+}
+
+static inline struct drm_rect
+drm_plane_state_dest(const struct drm_plane_state *state)
+{
+ struct drm_rect dest = {
+ .x1 = state->crtc_x,
+ .y1 = state->crtc_y,
+ .x2 = state->crtc_x + state->crtc_w,
+ .y2 = state->crtc_y + state->crtc_h,
+ };
+ return dest;
+}
+
/**
* struct drm_plane_funcs - driver plane control functions
*/