diff options
| author | Philipp Zabel <p.zabel@pengutronix.de> | 2016-10-18 06:30:36 -0400 |
|---|---|---|
| committer | Philipp Zabel <p.zabel@pengutronix.de> | 2016-10-20 08:39:38 -0400 |
| commit | 5fb57ab328aaf313c5ad9c4c48900f632e7c6f1c (patch) | |
| tree | c4982baf5a9e8660ba78eaa8e84ecd2d5568f9d7 /drivers/gpu/drm/imx | |
| parent | e73aca5184ad9fc948ba22b4d35dce11db35bb25 (diff) | |
drm/imx: ipuv3-plane: make sure x/y offsets are even in case of chroma subsampling
Odd x/y offsets are not allowed for horizontally/vertically chroma
subsampled planar YUV formats.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Liu Ying <gnuiyl@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/imx')
| -rw-r--r-- | drivers/gpu/drm/imx/ipuv3-plane.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c index 5c342997863e..e1ad844abafb 100644 --- a/drivers/gpu/drm/imx/ipuv3-plane.c +++ b/drivers/gpu/drm/imx/ipuv3-plane.c | |||
| @@ -259,6 +259,7 @@ static int ipu_plane_atomic_check(struct drm_plane *plane, | |||
| 259 | struct drm_framebuffer *fb = state->fb; | 259 | struct drm_framebuffer *fb = state->fb; |
| 260 | struct drm_framebuffer *old_fb = old_state->fb; | 260 | struct drm_framebuffer *old_fb = old_state->fb; |
| 261 | unsigned long eba, ubo, vbo, old_ubo, old_vbo; | 261 | unsigned long eba, ubo, vbo, old_ubo, old_vbo; |
| 262 | int hsub, vsub; | ||
| 262 | 263 | ||
| 263 | /* Ok to disable */ | 264 | /* Ok to disable */ |
| 264 | if (!fb) | 265 | if (!fb) |
| @@ -372,6 +373,16 @@ static int ipu_plane_atomic_check(struct drm_plane *plane, | |||
| 372 | 373 | ||
| 373 | if (old_fb && old_fb->pitches[1] != fb->pitches[1]) | 374 | if (old_fb && old_fb->pitches[1] != fb->pitches[1]) |
| 374 | crtc_state->mode_changed = true; | 375 | crtc_state->mode_changed = true; |
| 376 | |||
| 377 | /* | ||
| 378 | * The x/y offsets must be even in case of horizontal/vertical | ||
| 379 | * chroma subsampling. | ||
| 380 | */ | ||
| 381 | hsub = drm_format_horz_chroma_subsampling(fb->pixel_format); | ||
| 382 | vsub = drm_format_vert_chroma_subsampling(fb->pixel_format); | ||
| 383 | if (((state->src_x >> 16) & (hsub - 1)) || | ||
| 384 | ((state->src_y >> 16) & (vsub - 1))) | ||
| 385 | return -EINVAL; | ||
| 375 | } | 386 | } |
| 376 | 387 | ||
| 377 | return 0; | 388 | return 0; |
