Devicetree
 help / color / mirror / Atom feed
* Re: [PATCH v6 1/6] docs: uapi: media: Clarify HEVC slice_param bit_size, data_byte_offset
       [not found] ` <20260304-media-rpi-hevc-dec-v6-1-93868ae6dff8@raspberrypi.com>
@ 2026-04-28 20:07   ` Nicolas Dufresne
  0 siblings, 0 replies; 3+ messages in thread
From: Nicolas Dufresne @ 2026-04-28 20:07 UTC (permalink / raw)
  To: Dave Stevenson, Sakari Ailus, Laurent Pinchart,
	Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Florian Fainelli,
	Broadcom internal kernel review list, John Cox, Dom Cobley,
	review list, Ezequiel Garcia
  Cc: John Cox, Stefan Wahren, linux-media, linux-kernel, devicetree,
	linux-rpi-kernel, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 1744 bytes --]

Le mercredi 04 mars 2026 à 14:05 +0000, Dave Stevenson a écrit :
> From: John Cox <john.cox@raspberrypi.com>
> 
> Clarify exactly what bit_size and data_byte_offset mean when there are
> multiple slices in the bitstream data.
> 
> Signed-off-by: John Cox <john.cox@raspberrypi.com>
> Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>

Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>

> ---
>  Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst
> index 3b1e05c6eb13..a54e8ea29440 100644
> --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst
> +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst
> @@ -2399,10 +2399,12 @@ This structure contains all loop filter related parameters. See sections
>  
>      * - __u32
>        - ``bit_size``
> -      - Size (in bits) of the current slice data.
> +      - Size in bits of the slice_segment_data for the current slice including
> +        any emulation prevention bytes.
>      * - __u32
>        - ``data_byte_offset``
> -      - Offset (in byte) to the video data in the current slice data.
> +      - Offset in bytes from the start of the current v4l2_buffer to the start
> +        of the slice_segment_data for the current slice.
>      * - __u32
>        - ``num_entry_point_offsets``
>        - Specifies the number of entry point offset syntax elements in the slice header.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v6 2/6] docs: uapi: media: Document Raspberry Pi NV12 column format
       [not found] ` <20260304-media-rpi-hevc-dec-v6-2-93868ae6dff8@raspberrypi.com>
@ 2026-04-28 20:09   ` Nicolas Dufresne
  0 siblings, 0 replies; 3+ messages in thread
From: Nicolas Dufresne @ 2026-04-28 20:09 UTC (permalink / raw)
  To: Dave Stevenson, Sakari Ailus, Laurent Pinchart,
	Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Florian Fainelli,
	Broadcom internal kernel review list, John Cox, Dom Cobley,
	review list, Ezequiel Garcia
  Cc: John Cox, Stefan Wahren, linux-media, linux-kernel, devicetree,
	linux-rpi-kernel, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 3010 bytes --]

Le mercredi 04 mars 2026 à 14:05 +0000, Dave Stevenson a écrit :
> The Raspberry Pi HEVC decoder uses a tiled format based on
> columns for 8 and 10 bit YUV images, so document them as
> NV12MT_COL128 and NV12MT_10_COL128.
> 
> Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>

Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>

> ---
>  .../userspace-api/media/v4l/pixfmt-yuv-planar.rst  | 46 ++++++++++++++++++++++
>  1 file changed, 46 insertions(+)
> 
> diff --git a/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst b/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst
> index 0631919bd667..1aa4182b8adc 100644
> --- a/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst
> +++ b/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst
> @@ -957,6 +957,52 @@ Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian ord
>        - Cr\ :sub:`11`
>  
>  
> +.. _V4L2-PIX-FMT-NV12MT-COL128:
> +.. _V4L2-PIX-FMT-NV12MT-10-COL128:
> +
> +NV12MT_COL128 and NV12MT_10_COL128
> +----------------------------------
> +
> +``V4L2_PIX_FMT_NV12MT_COL128`` is a tiled version of
> +``V4L2_PIX_FMT_NV12M`` where the two planes are split into 128 byte wide columns
> +of Y or interleaved CbCr. The height is always aligned to a multiple of 8 lines.
> +
> +V4L2_PIX_FMT_NV12MT_10_COL128 expands that as a 10 bit format where 3 10 bit
> +values are packed into a 32bit word. A 128 byte wide column therefore holds 96
> +samples (either Y or interleaved CrCb). That effectively makes it 6 values in a
> +64 bit word for the CbCr plane, as the values always go in pairs.
> +
> +Bit-packed representation.
> +
> +.. tabularcolumns:: |p{1.2cm}||p{1.2cm}||p{1.2cm}||p{1.2cm}|p{3.2cm}|p{3.2cm}|
> +
> +.. flat-table::
> +    :header-rows:  0
> +    :stub-columns: 0
> +    :widths: 8 8 8 8
> +
> +    * - Y'\ :sub:`00[7:0]`
> +      - Y'\ :sub:`01[5:0] (bits 7--2)` Y'\ :sub:`00[9:8]`\ (bits 1--0)
> +      - Y'\ :sub:`02[3:0] (bits 7--4)` Y'\ :sub:`01[9:6]`\ (bits 3--0)
> +      - unused (bits 7--6)` Y'\ :sub:`02[9:4]`\ (bits 5--0)
> +
> +.. tabularcolumns:: |p{1.2cm}||p{1.2cm}||p{1.2cm}||p{1.2cm}|p{3.2cm}|p{3.2cm}|
> +
> +.. flat-table::
> +    :header-rows:  0
> +    :stub-columns: 0
> +    :widths: 12 12 12 12 12 12 12 12
> +
> +    * - Cb\ :sub:`00[7:0]`
> +      - Cr\ :sub:`00[5:0]`\ (bits 7--2) Cb\ :sub:`00[9:8]`\ (bits 1--0)
> +      - Cb\ :sub:`01[3:0]`\ (bits 7--4) Cr\ :sub:`00[9:6]`\ (bits 3--0)
> +      - unused (bits 7--6) Cb\ :sub:`02[9:4]`\ (bits 5--0)
> +      - Cr\ :sub:`01[7:0]`
> +      - Cb\ :sub:`02[5:0]`\ (bits 7--2) Cr\ :sub:`01[9:8]`\ (bits 1--0)
> +      - Cr\ :sub:`02[3:0]`\ (bits 7--4) Cb\ :sub:`02[9:6]`\ (bits 3--0)
> +      - unused (bits 7--6) Cr\ :sub:`02[9:4]`\ (bits 5--0)
> +
> +
>  Fully Planar YUV Formats
>  ========================
>  

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v6 3/6] media: ioctl: Add pixel formats NV12MT_COL128 and NV12MT_10_COL128
       [not found] ` <20260304-media-rpi-hevc-dec-v6-3-93868ae6dff8@raspberrypi.com>
@ 2026-04-28 20:14   ` Nicolas Dufresne
  0 siblings, 0 replies; 3+ messages in thread
From: Nicolas Dufresne @ 2026-04-28 20:14 UTC (permalink / raw)
  To: Dave Stevenson, Sakari Ailus, Laurent Pinchart,
	Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Florian Fainelli,
	Broadcom internal kernel review list, John Cox, Dom Cobley,
	review list, Ezequiel Garcia
  Cc: John Cox, Stefan Wahren, linux-media, linux-kernel, devicetree,
	linux-rpi-kernel, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 4259 bytes --]

Le mercredi 04 mars 2026 à 14:05 +0000, Dave Stevenson a écrit :
> Add V4L2_PIXFMT_NV12MT_COL128 and V4L2_PIXFMT_NV12MT_10_COL128
> to describe the Raspberry Pi HEVC decoder NV12 multiplanar formats.
> 
> NV12MT_COL128 has been added to v4l2_format_info.
> NV12MT_10_COL128 has not as the block width is not a power of 2,
> but the framework uses ALIGN with the value.

The performance of that code is not critical, any reason you can't just port
everything to round up to the next multiple of ? (to be done in its own patch).

Nicolas

p.s. we should really add a ktest for that table ...

> 
> Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
> ---
>  drivers/media/v4l2-core/v4l2-common.c | 2 ++
>  drivers/media/v4l2-core/v4l2-ioctl.c  | 2 ++
>  include/uapi/linux/videodev2.h        | 4 ++++
>  3 files changed, 8 insertions(+)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c
> index 554c591e1113..20a7066df570 100644
> --- a/drivers/media/v4l2-core/v4l2-common.c
> +++ b/drivers/media/v4l2-core/v4l2-common.c
> @@ -311,6 +311,8 @@ const struct v4l2_format_info *v4l2_format_info(u32 format)
>  		{ .format = V4L2_PIX_FMT_NV15_4L4, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 5, 10, 0, 0 }, .bpp_div = { 4, 4, 1, 1 }, .hdiv = 2, .vdiv = 2,
>  		  .block_w = { 4, 2, 0, 0 }, .block_h = { 1, 1, 0, 0 }},
>  		{ .format = V4L2_PIX_FMT_P010_4L4, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 2, 4, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 2, .vdiv = 2 },
> +		{ .format = V4L2_PIX_FMT_NV12MT_COL128, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 2, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 2, .vdiv = 2 },
> +		/* V4L2_PIX_FMT_NV12MT_10_COL128 can not be described within the current constraints of v4l2_format_info as 96 pixels is not a power of 2 */
>  
>  		/* YUV planar formats, non contiguous variant */
>  		{ .format = V4L2_PIX_FMT_YUV420M, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 3, .comp_planes = 3, .bpp = { 1, 1, 1, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 2, .vdiv = 2 },
> diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
> index 37d33d4a363d..2fe8f591cdb3 100644
> --- a/drivers/media/v4l2-core/v4l2-ioctl.c
> +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
> @@ -1379,7 +1379,9 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
>  	case V4L2_PIX_FMT_NV16M:	descr = "Y/UV 4:2:2 (N-C)"; break;
>  	case V4L2_PIX_FMT_NV61M:	descr = "Y/VU 4:2:2 (N-C)"; break;
>  	case V4L2_PIX_FMT_NV12MT:	descr = "Y/UV 4:2:0 (64x32 MB, N-C)"; break;
> +	case V4L2_PIX_FMT_NV12MT_COL128: descr = "Y/CbCr 4:2:0 (128b cols)"; break;
>  	case V4L2_PIX_FMT_NV12MT_16X16:	descr = "Y/UV 4:2:0 (16x16 MB, N-C)"; break;
> +	case V4L2_PIX_FMT_NV12MT_10_COL128: descr = "10-bit Y/CbCr 4:2:0 (128b cols)"; break;
>  	case V4L2_PIX_FMT_P012M:	descr = "12-bit Y/UV 4:2:0 (N-C)"; break;
>  	case V4L2_PIX_FMT_YUV420M:	descr = "Planar YUV 4:2:0 (N-C)"; break;
>  	case V4L2_PIX_FMT_YVU420M:	descr = "Planar YVU 4:2:0 (N-C)"; break;
> diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
> index eda4492e40dc..e466c816ff2f 100644
> --- a/include/uapi/linux/videodev2.h
> +++ b/include/uapi/linux/videodev2.h
> @@ -697,6 +697,10 @@ struct v4l2_pix_format {
>  #define V4L2_PIX_FMT_NV12MT_16X16 v4l2_fourcc('V', 'M', '1', '2') /* 12  Y/CbCr 4:2:0 16x16 tiles */
>  #define V4L2_PIX_FMT_NV12M_8L128      v4l2_fourcc('N', 'A', '1', '2') /* Y/CbCr 4:2:0 8x128 tiles */
>  #define V4L2_PIX_FMT_NV12M_10BE_8L128 v4l2_fourcc_be('N', 'T', '1', '2') /* Y/CbCr 4:2:0 10-bit 8x128 tiles */
> +#define V4L2_PIX_FMT_NV12MT_COL128 v4l2_fourcc('N', 'c', '1', '2') /* 12  Y/CbCr 4:2:0 128 pixel wide column */
> +#define V4L2_PIX_FMT_NV12MT_10_COL128 v4l2_fourcc('N', 'c', '3', '0')
> +			/* Y/CbCr 4:2:0 10bpc, 3x10 packed as 4 bytes in a 128 bytes / 96 pixel wide column */
> +
>  
>  /* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */
>  #define V4L2_PIX_FMT_SBGGR8  v4l2_fourcc('B', 'A', '8', '1') /*  8  BGBG.. GRGR.. */

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-04-28 20:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20260304-media-rpi-hevc-dec-v6-0-93868ae6dff8@raspberrypi.com>
     [not found] ` <20260304-media-rpi-hevc-dec-v6-1-93868ae6dff8@raspberrypi.com>
2026-04-28 20:07   ` [PATCH v6 1/6] docs: uapi: media: Clarify HEVC slice_param bit_size, data_byte_offset Nicolas Dufresne
     [not found] ` <20260304-media-rpi-hevc-dec-v6-2-93868ae6dff8@raspberrypi.com>
2026-04-28 20:09   ` [PATCH v6 2/6] docs: uapi: media: Document Raspberry Pi NV12 column format Nicolas Dufresne
     [not found] ` <20260304-media-rpi-hevc-dec-v6-3-93868ae6dff8@raspberrypi.com>
2026-04-28 20:14   ` [PATCH v6 3/6] media: ioctl: Add pixel formats NV12MT_COL128 and NV12MT_10_COL128 Nicolas Dufresne

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox