mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mehdi Djait <mehdi.djait@linux.intel.com>
To: Michael Riesch <michael.riesch@collabora.com>
Cc: Faizel K B <faizel.kb@gmail.com>,
	 Mauro Carvalho Chehab <mchehab@kernel.org>,
	Heiko Stuebner <heiko@sntech.de>,
	linux-media@vger.kernel.org,  linux-rockchip@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	 linux-kernel@vger.kernel.org,
	libcamera-devel@lists.libcamera.org,
	 Robert Mader <robert.mader@collabora.com>
Subject: Re: [PATCH 2/2] media: rockchip: rkcif: Honour the requested bytesperline on MIPI
Date: Mon, 16 Nov 2026 14:13:11 +0100	[thread overview]
Message-ID: <avsA41bM33cwYfW9@mdjait-mobl> (raw)
In-Reply-To: <8c3805ca-0be7-4634-8904-30a9c36d8962@collabora.com>

Hello,

On Mon, Nov 16, 2026 at 12:51:45PM +0100, Michael Riesch wrote:
> Hi Faizel,
> 
> On 11/12/26 07:20, Faizel K B wrote:
> > Hi Michael,
> > 
> > On Wed, Nov 11, 2026 at 10:46:43AM +0100, Michael Riesch wrote:
> >>
> >> Come to think of it, TRM p. 2111 says for e.g. VICAP_MIPI0_VLW_ID0:
> >> "Virtual line width of even frame for ID0 path(must be aligned to double
> >> word)." which I would interpret as "it must be a multiple of four
> >> bytes". What do you think?
> >>
> > 
> > The VICAP register summary defines it.TRM part 1 (V1.0, page 2081)
> > "DW - Double WORD (64 bits) access". So 8 bytes.
> 
> Ack.
> 
> >>> +static void rkcif_stream_set_bytesperline(struct
> >>> v4l2_pix_format_mplane *pix,
> >>> +                      u32 req_bpl)
> >>> +{
> >>> +    u32 min_bpl = ALIGN(pix->plane_fmt[0].bytesperline, 8);
> >>
> >> Please add support for the bytesperline field in all the plane_fmt
> >> entries here...
> >>
> >>>      width = clamp_t(u32, pix->width, CIF_MIN_WIDTH, CIF_MAX_WIDTH);
> >>> +    req_bpl = pix->plane_fmt[0].bytesperline;
> >>
> >> ... and here.
> >>
> >>>      ret = v4l2_fill_pixfmt_mp(pix, fmt->fourcc, width, height);
> >>>      if (ret)
> >>>          return ret;
> >>>
> >>> +    if (stream->interface->type == RKCIF_IF_MIPI)
> >>> +        rkcif_stream_set_bytesperline(pix, req_bpl);
> >>
> >> Why is this restricted to the MIPI interfaces?
> >>
> > 
> > The MIPI formats all have a single plane, and the MIPI path already
> > programs the line width from bytesperline. The DVP path uses the width,
> > and I can't test it. But I agree it should not depend on the interface.
> > 
> > For v2 I would:
> > 
> > - take the requested bytesperline of all planes into account, and use
> >   the largest for all planes, as the DVP has one line width register
> >   for Y and UV
> > - compute the sizeimage of each plane from it
> > - limit it to the line width field (20 bits MIPI, 15 bits DVP)
> > - program RKCIF_DVP_VIR_LINE_WIDTH from bytesperline, with the current
> >   value as the minimum
> > 
> > Does that sound ok?
> 
> That does sound reasonable, yes.
> 
> > A question on the DVP: the PX30 TRM (Part 2, 5.3) says raw data is
> > stored as 16 bits per pixel, even from an 8-bit source. This matches
> > the width * 2 in the driver. But for V4L2_PIX_FMT_S*8 (e.g.
> > V4L2_PIX_FMT_SRGGB8) bytesperline is the width, so the buffer is half
> > the size the hardware writes. Am I missing something?
> 
> I don't have any PX30 board, and actually it is the first time I hear
> about that. Maybe Mehdi can chime in?

Unfortunately I also don't have hw with DVP and the one time I did look
online, it is really not that easy to find.

The PX30 board I used to delevop the rkcif is a custom hw that I don't
have access to anymore.

--
Kind Regards
Mehdi Djait

      reply	other threads:[~2026-11-16 13:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05 23:23 [PATCH 0/2] media: rockchip: rkcif: ENUM_FMT and bytesperline fixes Faizel K B
2026-11-05 23:23 ` [PATCH 1/2] media: rockchip: rkcif: Filter enumerated formats by media bus code Faizel K B
2026-11-09 12:27   ` Mehdi Djait
2026-11-09 19:54     ` Faizel K B
2026-11-11  9:55       ` Michael Riesch
2026-11-05 23:23 ` [PATCH 2/2] media: rockchip: rkcif: Honour the requested bytesperline on MIPI Faizel K B
2026-11-11  9:46   ` Michael Riesch
2026-11-12  6:20     ` Faizel K B
2026-11-16 11:51       ` Michael Riesch
2026-11-16 13:13         ` Mehdi Djait [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=avsA41bM33cwYfW9@mdjait-mobl \
    --to=mehdi.djait@linux.intel.com \
    --cc=faizel.kb@gmail.com \
    --cc=heiko@sntech.de \
    --cc=libcamera-devel@lists.libcamera.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mchehab@kernel.org \
    --cc=michael.riesch@collabora.com \
    --cc=robert.mader@collabora.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

all inboxes | Powered by JetHome®