All of lore.kernel.org
 help / color / mirror / Atom feed
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] drm/i915: Handle YUV subpixel support better
Date: Tue, 19 Mar 2019 13:15:55 +0200	[thread overview]
Message-ID: <20190319111555.GW3888@intel.com> (raw)
In-Reply-To: <b075e920-6712-f55f-31e2-9133639b8e26@linux.intel.com>

On Tue, Mar 19, 2019 at 08:28:58AM +0100, Maarten Lankhorst wrote:
> Op 18-03-2019 om 19:15 schreef Ville Syrjälä:
> > On Mon, Mar 18, 2019 at 04:13:57PM +0100, Maarten Lankhorst wrote:
> >> Op 18-03-2019 om 15:18 schreef Ville Syrjälä:
> >>> On Mon, Mar 18, 2019 at 03:07:18PM +0100, Maarten Lankhorst wrote:
> >>>> 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 268fb34ff0e2..862fc172042f 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 {
> >>>> +		hsub = vsub = max(fb->format->hsub, fb->format->vsub);
> >>> Why this? From the looks of things there should be no need to deal with
> >>> rotation in this function at all.
> >> I wrote a dumb test that fails if I rotate YUYV.
> >>
> >> https://patchwork.freedesktop.org/patch/286170/
> >>
> >> Corrupted image:
> >>
> >> (kms_yuv:1155) igt_kms-DEBUG: display: A.0: plane_set_rotation(90°)
> >> (kms_yuv:1155) igt_kms-DEBUG: display: A.0: src_set_position(18,33)
> >> (kms_yuv:1155) igt_kms-DEBUG: display: A.0: src_set_size(44x65)
> >> (kms_yuv:1155) igt_kms-DEBUG: display: A.0: plane_set_position(64,64)
> >> (kms_yuv:1155) igt_kms-DEBUG: display: A.0: plane_set_size (256x256)
> >>
> >> I had a 80x128 fb, only showing the center part which should be white, with a black border around it to cause CRC errors if we mess up clipping.
> >>
> >> The scaling works fine, but the clipping does not in this case. I am getting a corrupted plane on screen which is mostly white, but with black dots in each tile.
> >>
> >> Scaling just magnifies this corruption. :)
> > Hmm. I just poked my KBL a bit and it is also showing curious
> > behaviour. Even with 90/270 rotation it is in fact the TILEOFF
> > X coordinate that needs to be even (actually the hw just appears
> > to ignore the lsb). I can make the Y coordinate odd, and the image
> > still looks correct to my eyes. So feels like someone forgot to
> > to remove a (x&~1) from the hw when they added the 90/270 rotation,
> > and yet they went to the trouble of making odd Y coordinates work
> > correctly. Quite stange.
> >
> > Width/height being odd seems to handled just fine by the hw.
> >
> Hmm does that mean we should keep the original checks in place while checking format->h/vsub, and on top reject the unrotated Y coordinate being a multiple of hsub when rotating?

Not quite sure. Based on what I see we could actually just swap the
coordinates (or do the check after the coordinates are already rotated)
and it should still work. But I didn't check if that would still work
when the scaler is involved.

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-03-19 11:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-18 14:07 [PATCH] drm/i915: Handle YUV subpixel support better Maarten Lankhorst
2019-03-18 14:18 ` Ville Syrjälä
2019-03-18 15:13   ` Maarten Lankhorst
2019-03-18 18:15     ` Ville Syrjälä
2019-03-19  7:28       ` Maarten Lankhorst
2019-03-19 11:15         ` Ville Syrjälä [this message]
2019-03-19 12:45           ` Ville Syrjälä
2019-03-18 17:38 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2019-03-18 17:39 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-03-18 17:58 ` ✓ Fi.CI.BAT: success " Patchwork
2019-03-19  1:44 ` ✗ Fi.CI.IGT: failure " 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=20190319111555.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.