All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Longerbeam <slongerbeam@gmail.com>
To: "Philipp Zabel" <p.zabel@pengutronix.de>,
	"Krzysztof Hałasa" <khalasa@piap.pl>
Cc: Javier Martinez Canillas <javierm@redhat.com>,
	linux-media@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCH] gpu: ipu-v3: Allow negative offsets for interlaced scanning
Date: Wed, 20 Jun 2018 21:30:01 -0700	[thread overview]
Message-ID: <26996359-69a2-9465-e7ab-4807de27b8bb@gmail.com> (raw)
In-Reply-To: <1529484851.4008.1.camel@pengutronix.de>



On 06/20/2018 01:54 AM, Philipp Zabel wrote:
> Hi Steve,
>
> On Tue, 2018-06-19 at 18:30 -0700, Steve Longerbeam wrote:
>> I've found some time to diagnose the behavior of interweave with B/T line
>> swapping (to support interlaced-bt) with planar formats.
>>
>> There are a couple problems (one known and one unknown):
>>
>> 1. This requires 32 pixel alignment to meet the IDMAC 8-byte alignment
>>       of the planar U/V buffer offsets, and 32 pixel alignment precludes
>>       capturing raw NTSC/PAL at 720 pixel line stride.
> What needs to be aligned to multiples of 32 pixels?
>
> I thought 8 pixel width alignment should be good enough for NV12/NV16,
> for which luma and chroma strides are equal to the width in pixels, and
> 16 pixel alignment for YUV420/YVU420/YUV422P, where chroma stride is
> half the width in pixels.

I see where the problem is now. I was basing my mistaken 32 pixel
alignment from a read of the U_OFFSET/V_OFFSET macros in
ipu-cpmem.c:

u_offset = pix->width * pix->height + pix->width * y / 4 + x / 2

But you can probably see the bug now. This does not produce
a correct offset for odd values of y. It should read:

u_offset = pix->width * pix->height + pix->width * (y / 2) / 2 + x / 2

With that fix, interweave line swap with planar 4:2:0 is working now.
That includes YUV420, YVU420, and NV12.

NV16 is also working after programming SLUV with double
the chroma line stride.

>> 2. Even with 32 pixel aligned frames, for example by using the prpenc scaler
>>       to generate 704 pixel strides from 720, the colors are still wrong when
>>       capturing interlaced-bt.
> As a side note, we can't properly scale seq-tb/bt direct input from the
> CSI vertically with the IC, as the bottom line of the first field will
> be blended with the top line of the second field...
>
>>   I thought for sure this must be because we
>> also
>>       need to double the SLUV line strides in addition to doubling SLY
>> line stride.
>>       But I tried this and the results are that it works only for YUV
>> 4:2:2. For 4:2:0
>>       it causes system hard lockups. (Aside note: interweave without line
>> swap
>>       apparently has never worked for 4:2:2, even when doubling SLUV, so it's
>>       quite bizarre to me why 4:2:2 interweave _with_ line swap _does_ work
>>       after doubling SLUV).
> When you say 4:2:2 you only mean YUV422P, not NV16 or YUYV/UYVY ?

Correct, I meant planar YUV422P.


>
>> For these reasons I think we should disallow interlaced-bt with planar
>> formats.
> Does that include NV12/NV16? Capturing to NV12 could be desirable if at
> all possible, because the result can be encoded by the CODA. The other
> formats are bandwidth inefficient anyway.

Never mind, I found the bug described above in the U_OFFSET/V_OFFSET
macros.

In summary, at this point all planar formats are working with interlaced
bt and tb, except for YUV422P.

Steve

      reply	other threads:[~2018-06-21  4:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-01 13:13 [PATCH] gpu: ipu-v3: Allow negative offsets for interlaced scanning Philipp Zabel
2018-06-11  0:08 ` Steve Longerbeam
2018-06-11  9:19   ` Philipp Zabel
2018-06-11 21:06     ` Steve Longerbeam
2018-06-12 16:43       ` Philipp Zabel
2018-06-12 17:27       ` Javier Martinez Canillas
2018-06-12 17:31         ` Steve Longerbeam
2018-06-14  9:39           ` Krzysztof Hałasa
2018-06-14 16:26             ` Steve Longerbeam
2018-06-15  8:33               ` Krzysztof Hałasa
2018-06-20  1:30                 ` Steve Longerbeam
2018-06-20  8:54                   ` Philipp Zabel
2018-06-21  4:30                     ` Steve Longerbeam [this message]

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=26996359-69a2-9465-e7ab-4807de27b8bb@gmail.com \
    --to=slongerbeam@gmail.com \
    --cc=javierm@redhat.com \
    --cc=kernel@pengutronix.de \
    --cc=khalasa@piap.pl \
    --cc=linux-media@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    /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.