From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/3] drm/i915: Handle YUV subpixel support better
Date: Fri, 22 Mar 2019 16:08:33 +0200 [thread overview]
Message-ID: <20190322140833.GW3888@intel.com> (raw)
In-Reply-To: <20190322135954.20434-1-maarten.lankhorst@linux.intel.com>
On Fri, Mar 22, 2019 at 02:59:52PM +0100, Maarten Lankhorst wrote:
> Y41x formats is a 4:4:4 format, so it can be addressed with pixel level accuracy.
> Meanwhile it seems that while rotating YUYV 4:2:2 formats need a multiple of 2
> for width and height, otherwise corruption occurs.
>
> For YUV 4:2:2, the spec says that w/h should always be even, but we get
> away with odd height while unrotated. When rotating it seems corruption
> occurs with an odd x/y, and w/h should always be even.
> Just to be completely paranoid, reject odd x/y w/h when rotating 90/270.
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
> drivers/gpu/drm/i915/intel_sprite.c | 29 +++++++++++++++++++----------
> 1 file changed, 19 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> index 3f2055f70d05..aca987356194 100644
> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> @@ -269,7 +269,8 @@ int intel_plane_check_src_coordinates(struct intel_plane_state *plane_state)
> {
> const struct drm_framebuffer *fb = plane_state->base.fb;
> struct drm_rect *src = &plane_state->base.src;
> - u32 src_x, src_y, src_w, src_h;
> + u32 src_x, src_y, src_w, src_h, hsub, vsub;
> + bool rotated = drm_rotation_90_or_270(plane_state->base.rotation);
>
> /*
> * Hardware doesn't handle subpixel coordinates.
> @@ -287,18 +288,26 @@ int intel_plane_check_src_coordinates(struct intel_plane_state *plane_state)
> src->y1 = src_y << 16;
> src->y2 = (src_y + src_h) << 16;
>
> - if (fb->format->is_yuv &&
> - (src_x & 1 || src_w & 1)) {
> - DRM_DEBUG_KMS("src x/w (%u, %u) must be a multiple of 2 for YUV planes\n",
> - src_x, src_w);
> + if (!fb->format->is_yuv)
> + return 0;
> +
> + /* YUV specific checks */
> + if (!rotated) {
> + hsub = fb->format->hsub;
> + vsub = fb->format->vsub;
> + } else {
This could maybe use a comment of some sort. But can't think of one
right now so meh.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> + hsub = vsub = max(fb->format->hsub, fb->format->vsub);
> + }
> +
> + if (src_x % hsub || src_w % hsub) {
> + DRM_DEBUG_KMS("src x/w (%u, %u) must be a multiple of %u for %sYUV planes\n",
> + src_x, src_w, hsub, rotated ? "rotated " : "");
> return -EINVAL;
> }
>
> - if (fb->format->is_yuv &&
> - fb->format->num_planes > 1 &&
> - (src_y & 1 || src_h & 1)) {
> - DRM_DEBUG_KMS("src y/h (%u, %u) must be a multiple of 2 for planar YUV planes\n",
> - src_y, src_h);
> + if (src_y % vsub || src_h % vsub) {
> + DRM_DEBUG_KMS("src y/h (%u, %u) must be a multiple of %u for %sYUV planes\n",
> + src_y, src_h, vsub, rotated ? "rotated " : "");
> return -EINVAL;
> }
>
> --
> 2.20.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2019-03-22 14:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-22 13:59 [PATCH 1/3] drm/i915: Handle YUV subpixel support better Maarten Lankhorst
2019-03-22 13:59 ` [PATCH 2/3] drm/i915: Reject Yf tiling for HDR formats, v2 Maarten Lankhorst
2019-03-22 14:06 ` Ville Syrjälä
2019-03-22 13:59 ` [PATCH 3/3] drm/i915: Reject rotation for some hdr formats Maarten Lankhorst
2019-03-22 14:06 ` Ville Syrjälä
2019-03-27 16:54 ` Maarten Lankhorst
2019-03-22 14:08 ` Ville Syrjälä [this message]
2019-03-22 15:14 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/3] drm/i915: Handle YUV subpixel support better Patchwork
2019-03-22 15:15 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-03-22 15:34 ` ✓ Fi.CI.BAT: success " Patchwork
2019-03-23 15:10 ` ✓ Fi.CI.IGT: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190322140833.GW3888@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=maarten.lankhorst@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox