aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_plane_helper.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/drm_plane_helper.c')
-rw-r--r--drivers/gpu/drm/drm_plane_helper.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
index fc51306fe365..16c4a7bd7465 100644
--- a/drivers/gpu/drm/drm_plane_helper.c
+++ b/drivers/gpu/drm/drm_plane_helper.c
@@ -115,6 +115,7 @@ static int get_connectors_for_crtc(struct drm_crtc *crtc,
115 * @src: source coordinates in 16.16 fixed point 115 * @src: source coordinates in 16.16 fixed point
116 * @dest: integer destination coordinates 116 * @dest: integer destination coordinates
117 * @clip: integer clipping coordinates 117 * @clip: integer clipping coordinates
118 * @rotation: plane rotation
118 * @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point 119 * @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point
119 * @max_scale: maximum @src:@dest scaling factor in 16.16 fixed point 120 * @max_scale: maximum @src:@dest scaling factor in 16.16 fixed point
120 * @can_position: is it legal to position the plane such that it 121 * @can_position: is it legal to position the plane such that it
@@ -134,16 +135,17 @@ static int get_connectors_for_crtc(struct drm_crtc *crtc,
134 * Zero if update appears valid, error code on failure 135 * Zero if update appears valid, error code on failure
135 */ 136 */
136int drm_plane_helper_check_update(struct drm_plane *plane, 137int drm_plane_helper_check_update(struct drm_plane *plane,
137 struct drm_crtc *crtc, 138 struct drm_crtc *crtc,
138 struct drm_framebuffer *fb, 139 struct drm_framebuffer *fb,
139 struct drm_rect *src, 140 struct drm_rect *src,
140 struct drm_rect *dest, 141 struct drm_rect *dest,
141 const struct drm_rect *clip, 142 const struct drm_rect *clip,
142 int min_scale, 143 unsigned int rotation,
143 int max_scale, 144 int min_scale,
144 bool can_position, 145 int max_scale,
145 bool can_update_disabled, 146 bool can_position,
146 bool *visible) 147 bool can_update_disabled,
148 bool *visible)
147{ 149{
148 int hscale, vscale; 150 int hscale, vscale;
149 151
@@ -163,6 +165,8 @@ int drm_plane_helper_check_update(struct drm_plane *plane,
163 return -EINVAL; 165 return -EINVAL;
164 } 166 }
165 167
168 drm_rect_rotate(src, fb->width << 16, fb->height << 16, rotation);
169
166 /* Check scaling */ 170 /* Check scaling */
167 hscale = drm_rect_calc_hscale(src, dest, min_scale, max_scale); 171 hscale = drm_rect_calc_hscale(src, dest, min_scale, max_scale);
168 vscale = drm_rect_calc_vscale(src, dest, min_scale, max_scale); 172 vscale = drm_rect_calc_vscale(src, dest, min_scale, max_scale);
@@ -174,6 +178,9 @@ int drm_plane_helper_check_update(struct drm_plane *plane,
174 } 178 }
175 179
176 *visible = drm_rect_clip_scaled(src, dest, clip, hscale, vscale); 180 *visible = drm_rect_clip_scaled(src, dest, clip, hscale, vscale);
181
182 drm_rect_rotate_inv(src, fb->width << 16, fb->height << 16, rotation);
183
177 if (!*visible) 184 if (!*visible)
178 /* 185 /*
179 * Plane isn't visible; some drivers can handle this 186 * Plane isn't visible; some drivers can handle this
@@ -267,6 +274,7 @@ int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,
267 274
268 ret = drm_plane_helper_check_update(plane, crtc, fb, 275 ret = drm_plane_helper_check_update(plane, crtc, fb,
269 &src, &dest, &clip, 276 &src, &dest, &clip,
277 BIT(DRM_ROTATE_0),
270 DRM_PLANE_HELPER_NO_SCALING, 278 DRM_PLANE_HELPER_NO_SCALING,
271 DRM_PLANE_HELPER_NO_SCALING, 279 DRM_PLANE_HELPER_NO_SCALING,
272 false, false, &visible); 280 false, false, &visible);