Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion drivers/media/platform/raspberrypi/pisp_be/pisp_be.c
Original file line number Diff line number Diff line change
Expand Up @@ -1103,8 +1103,9 @@ static void pispbe_set_plane_params(struct v4l2_format *f,
*/
const unsigned int align =
p->bytesperline ? fmt->min_align : fmt->opt_align;
unsigned int pixel_grouping = fmt->pixel_grouping ?: 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this type of statement be accepted upstream? It does the right thing with gcc, but is not standard C syntax.

Copy link
Contributor

@naushir naushir Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although there seems to be tons of this type of usage in other kernel source files.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Must be getting rusty - never seen that syntax before, had to look it up!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically it is not C code. It's a gcc extension (that clang also supports).
But the kernel allows many gcc extensions and this idiom is commonly used.


bpl = (f->fmt.pix_mp.width * fmt->bit_depth) >> 3;
bpl = ((f->fmt.pix_mp.width / pixel_grouping) * fmt->bit_depth) >> 3;
bpl = ALIGN(max(p->bytesperline, bpl), align);

plane_size = bpl * f->fmt.pix_mp.height *
Expand Down
13 changes: 13 additions & 0 deletions drivers/media/platform/raspberrypi/pisp_be/pisp_be_formats.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ struct pisp_be_format {
unsigned int opt_align;
unsigned int min_align;
unsigned int bit_depth;
unsigned int pixel_grouping;
/* 0P3 factor for plane sizing */
unsigned int plane_factor[PISPBE_MAX_PLANES];
unsigned int num_planes;
Expand Down Expand Up @@ -240,6 +241,18 @@ static const struct pisp_be_format supported_formats[] = {
.colorspace_mask = V4L2_COLORSPACE_MASK_ALL_SRGB,
.colorspace_default = V4L2_COLORSPACE_SMPTE170M,
},
{
.fourcc = V4L2_PIX_FMT_NV12MT_10_COL128,
.opt_align = 128,
.min_align = 128,
/* 3 pixels packed into 32bits */
.bit_depth = 32,
.pixel_grouping = 3,
.plane_factor = { P3(1), P3(0.5) },
.num_planes = 2,
.colorspace_mask = V4L2_COLORSPACE_MASK_ALL_SRGB,
.colorspace_default = V4L2_COLORSPACE_SMPTE170M,
},
/* RGB formats */
{
.fourcc = V4L2_PIX_FMT_RGB24,
Expand Down