[PATCH 2/2] media: rockchip: rkcif: Honour the requested bytesperline on MIPI
Faizel K B
faizel.kb at gmail.com
Wed Nov 11 22:20:27 PST 2026
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.
>> +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?
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 can only test the MIPI path, on RK3588 (Radxa ROCK 5B+). Could you
test the DVP part on PX30 or RK3568?
Regards,
Faizel
More information about the Linux-rockchip
mailing list