Skip to content

Commit

Permalink
drm/imx: ipuv3-plane: make sure x/y offsets are even in case of chrom…
Browse files Browse the repository at this point in the history
…a 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>
  • Loading branch information
Philipp Zabel committed Oct 20, 2016
1 parent e73aca5 commit 5fb57ab
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions drivers/gpu/drm/imx/ipuv3-plane.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ static int ipu_plane_atomic_check(struct drm_plane *plane,
struct drm_framebuffer *fb = state->fb;
struct drm_framebuffer *old_fb = old_state->fb;
unsigned long eba, ubo, vbo, old_ubo, old_vbo;
int hsub, vsub;

/* Ok to disable */
if (!fb)
Expand Down Expand Up @@ -372,6 +373,16 @@ static int ipu_plane_atomic_check(struct drm_plane *plane,

if (old_fb && old_fb->pitches[1] != fb->pitches[1])
crtc_state->mode_changed = true;

/*
* The x/y offsets must be even in case of horizontal/vertical
* chroma subsampling.
*/
hsub = drm_format_horz_chroma_subsampling(fb->pixel_format);
vsub = drm_format_vert_chroma_subsampling(fb->pixel_format);
if (((state->src_x >> 16) & (hsub - 1)) ||
((state->src_y >> 16) & (vsub - 1)))
return -EINVAL;
}

return 0;
Expand Down

0 comments on commit 5fb57ab

Please sign in to comment.