mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Charvi Mehta <charvi.mehta@arm.com>
To: Nicolas Dufresne <nicolas@ndufresne.ca>,
	linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Vincenzo Frascino <vincenzo.frascino@arm.com>,
	Rathinavel Sankaralingam <rath.sankaralingam@arm.com>,
	Shobhit Pandey <shobhit.pandey@arm.com>
Subject: Re: [RFC PATCH 04/28] media: mali-vpu: initialize decoder format state
Date: Tue, 24 Nov 2026 14:56:46 +0000	[thread overview]
Message-ID: <b152209e-6117-4a24-aa2d-59be913850b5@arm.com> (raw)
In-Reply-To: <d1d53edeb358e1bdcd1c262e48074f7f1be276cf.camel@ndufresne.ca>


On 11/19/26 20:30, Nicolas Dufresne wrote:
>> +void mali_vpu_session_init_dec(struct mali_vpu_session *sess)
>> +{
>> +	const struct mali_vpu_format_caps *variant_fmts = &sess->vpu_dev->variant->fmt_caps;
>> +
>> +	sess->port_src.supported_fmts = variant_fmts->dec_src;
>> +	sess->port_dst.supported_fmts = variant_fmts->dec_dst;
> Why? the variant are constant, you can just read the information from the
> variant. Make a getter or point to it.
The format arrays are already static const and shared; only the list 
descriptor
(the pointer and count) is copied. However, you’re right that each port 
could
simply point to the const list in the variant, avoiding that copy too.
I’ll make that change.


> p.s. is that "port" like in OMX IL?
Here, “port” just groups the format and streaming state for a V4L2 OUTPUT
or CAPTURE queue.


>> +static int mali_vpu_set_port_fmt(struct mali_vpu_port *port,
>> +				 enum v4l2_buf_type type,
>> +				 u32 width, u32 height)
>> +{
>> +	struct v4l2_pix_format_mplane *pix_mp = &port->curr_fmt.fmt.pix_mp;
>> +	const struct mali_vpu_format_desc *fmt_default;
>> +	int ret;
>> +
>> +	if (!port->supported_fmts.fmts || !port->supported_fmts.num_fmts)
>> +		return -EINVAL;
>> +
>> +	fmt_default = &port->supported_fmts.fmts[0];
>> +
>> +	memset(&port->curr_fmt, 0, sizeof(port->curr_fmt));
>> +	port->curr_fmt.type = type;
>> +
>> +	if (fmt_default->flags & V4L2_FMT_FLAG_COMPRESSED) {
>> +		pix_mp->pixelformat = fmt_default->fourcc;
>> +		pix_mp->num_planes = 1;
>> +		pix_mp->width = width;
>> +		pix_mp->height = height;
>> +		pix_mp->plane_fmt[0].bytesperline = 0;
>> +
>> +		/*
>> +		 * Use one byte per pixel as the default compressed sizeimage,
>> +		 * with a minimum of one page, aligned to a page boundary.
>> +		 */
>> +		pix_mp->plane_fmt[0].sizeimage = PAGE_ALIGN(max_t(u32, PAGE_SIZE, width * height));
>> +	} else {
>> +		ret = v4l2_fill_pixfmt_mp(pix_mp, fmt_default->fourcc, width, height);
>> +		if (ret)
>> +			return ret;
> I might have to come back to this code once we have TRY/SET_FMT in place,
> meanwhile it seems more like a default setting helper then something that will
> be part of the ioctl interface.

Thanks, yes, this helper initializes the queue’s default format.
I’ll rename it to `mali_vpu_init_port_fmt()` to make that clear.
Patch 7 extracts the format-filling logic into `mali_vpu_fill_pixmp_fmt()`,
shared by initialization and TRY_FMT/S_FMT.


>>   struct mali_vpu_session {
>>   	struct mali_vpu_dev		*vpu_dev;
>>   	enum mali_vpu_session_role	role;
>> +	struct mali_vpu_port		port_src;
>> +	struct mali_vpu_port		port_dst;
> Ok, its time to comment, src_port and dst_port is a lot easier to read imho.
I’ve generally placed the direction last, as in dec_src/dec_dst and 
pixmp_src/pixmp_dst.
I’d prefer to retain port_src/port_dst to follow that pattern.


>> +	},
>> +	.frmsz_caps = {
>> +		.stepwise = {
>> +			.min_width = MALI_V76_MIN_FRAME_WIDTH,
>> +			.max_width = MALI_V76_MAX_FRAME_WIDTH,
>> +			.step_width = 2,
>> +			.min_height = MALI_V76_MIN_FRAME_HEIGHT,
>> +			.max_height = MALI_V76_MAX_FRAME_HEIGHT,
>> +			.step_height = 2,
>> +		},
> Are you sure this will be the same for all codecs and all formats?
These limits apply to H.264 and the three 8-bit YUV420 capture formats
currently exposed by the driver. The plan is to introduce separate ranges
when adding a codec or format that needs different limits.


>> +struct mali_vpu_format_caps {
>> +	const struct mali_vpu_format_list dec_src;
>> +	const struct mali_vpu_format_list dec_dst;
> Strange naming, perhaps src_formats/dst_formats?
Here, dec identifies the decoder role and src/dst the queue direction;
fmt_caps already provides the format context. I’d prefer to retain it.


Regards,
Charvi

  reply	other threads:[~2026-11-24 14:56 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 15:37 [RFC PATCH 00/28] media: add arm Mali-V76 video decoder driver Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 01/28] dt-bindings: media: add Arm Mali-V76 VPU Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 02/28] media: mali-vpu: add Mali VPU platform driver Charvi Mehta
2026-11-19 20:04   ` Nicolas Dufresne
2026-11-24  9:56     ` Charvi Mehta
2026-11-20 11:48   ` Uwe Kleine-König
2026-11-24 10:17     ` Charvi Mehta
2026-11-24 13:15       ` Uwe Kleine-König
2026-11-19 15:37 ` [RFC PATCH 03/28] media: mali-vpu: register V4L2 decoder device and add querycap ioctl Charvi Mehta
2026-11-19 20:10   ` Nicolas Dufresne
2026-11-24 10:29     ` Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 04/28] media: mali-vpu: initialize decoder format state Charvi Mehta
2026-11-19 20:30   ` Nicolas Dufresne
2026-11-24 14:56     ` Charvi Mehta [this message]
2026-11-19 15:37 ` [RFC PATCH 05/28] media: mali-vpu: add V4L2 mem2mem and VB2 queue support Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 06/28] media: mali-vpu: implement format query ioctls Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 07/28] media: mali-vpu: implement TRY_FMT and S_FMT ioctls Charvi Mehta
2026-11-19 20:44   ` Nicolas Dufresne
2026-11-23 17:26     ` Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 08/28] media: mali-vpu: register V76 decoder controls and introduce UAPI controls Charvi Mehta
2026-11-19 21:06   ` Nicolas Dufresne
2026-11-19 15:37 ` [RFC PATCH 09/28] media: mali-vpu: add MMU software page table manager Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 10/28] media: mali-vpu: add firmware cache infrastructure Charvi Mehta
2026-11-19 21:34   ` Nicolas Dufresne
2026-11-19 15:37 ` [RFC PATCH 11/28] media: mali-vpu: load firmware for decoder sessions Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 12/28] media: mali-vpu: prepare firmware address space Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 13/28] media: mali-vpu: add firmware message transport Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 14/28] media: mali-vpu: route decoder controls to firmware Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 15/28] media: mali-vpu: handle firmware RPC requests Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 16/28] media: mali-vpu: add LSID hardware support Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 17/28] media: mali-vpu: add single session scheduler Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 18/28] media: mali-vpu: handle firmware interrupts Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 19/28] media: mali-vpu: start decoder firmware through LSID scheduling Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 20/28] media: mali-vpu: implement vb2 buffer queue handling Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 21/28] media: mali-vpu: handle firmware buffer exchange Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 22/28] media: mali-vpu: handle fatal firmware error Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 23/28] media: mali-vpu: propagate buffer metadata Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 24/28] media: mali-vpu: add decoder EOS and DRC handling Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 25/28] media: mali-vpu: handle firmware buffer parameters Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 26/28] media: mali-vpu: handle firmware event responses Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 27/28] media: mali-vpu: add stateful decoder state machine Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 28/28] media: MAINTAINERS: add Arm Mali-V76 VPU driver Charvi Mehta
2026-11-19 19:44 ` [RFC PATCH 00/28] media: add arm Mali-V76 video decoder driver Nicolas Dufresne
2026-11-23 15:57   ` Charvi Mehta

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=b152209e-6117-4a24-aa2d-59be913850b5@arm.com \
    --to=charvi.mehta@arm.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=nicolas@ndufresne.ca \
    --cc=p.zabel@pengutronix.de \
    --cc=rath.sankaralingam@arm.com \
    --cc=robh@kernel.org \
    --cc=shobhit.pandey@arm.com \
    --cc=vincenzo.frascino@arm.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®