From: Charvi Mehta <charvi.mehta@arm.com>
To: linux-media@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Charvi Mehta <charvi.mehta@arm.com>,
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: [RFC PATCH 25/28] media: mali-vpu: handle firmware buffer parameters
Date: Thu, 19 Nov 2026 15:37:55 +0000 [thread overview]
Message-ID: <20261119153758.1426673-26-charvi.mehta@arm.com> (raw)
In-Reply-To: <20261119153758.1426673-1-charvi.mehta@arm.com>
From: Shobhit Pandey <shobhit.pandey@arm.com>
Add protocol definitions and parsing for firmware buffer-parameter
messages. Recognize colour-description and DPB-held-frame
notifications, log and ignore them when no session action is required.
Signed-off-by: Shobhit Pandey <shobhit.pandey@arm.com>
Signed-off-by: Charvi Mehta <charvi.mehta@arm.com>
---
.../platform/arm/mali-vpu/mali-vpu-firmware.c | 32 +++++++++++++++++++
.../platform/arm/mali-vpu/mali-vpu-firmware.h | 5 +++
.../arm/mali-vpu/mali-vpu-protocol-def-v3.h | 19 +++++++++++
.../platform/arm/mali-vpu/mali-vpu-session.c | 9 ++++++
4 files changed, 65 insertions(+)
diff --git a/drivers/media/platform/arm/mali-vpu/mali-vpu-firmware.c b/drivers/media/platform/arm/mali-vpu/mali-vpu-firmware.c
index 55bad502cae0b..34d57b288a682 100644
--- a/drivers/media/platform/arm/mali-vpu/mali-vpu-firmware.c
+++ b/drivers/media/platform/arm/mali-vpu/mali-vpu-firmware.c
@@ -8,6 +8,7 @@
#include <linux/err.h>
#include <linux/errno.h>
#include <linux/sizes.h>
+#include <linux/stddef.h>
#include <linux/string.h>
#include "mali-vpu-firmware.h"
@@ -950,6 +951,33 @@ mali_vpu_convert_buffer_bitstream(struct mali_vpu_fw *fw,
return 0;
}
+static int mali_vpu_convert_buffer_param(struct mali_vpu_fw_msg *msg,
+ struct mve_buffer_param *p,
+ size_t size)
+{
+ if (size < sizeof(p->type))
+ return -EPROTO;
+
+ switch (p->type) {
+ case MVE_BUFFER_PARAM_TYPE_COLOUR_DESCRIPTION:
+ /* The colour-description payload is currently ignored. */
+ msg->code = MALI_VPU_FW_CODE_COLOR_DESC;
+ break;
+ case MVE_BUFFER_PARAM_TYPE_DPB_HELD_FRAMES:
+ if (size < offsetofend(struct mve_buffer_param, data.arg))
+ return -EPROTO;
+
+ msg->code = MALI_VPU_FW_CODE_DPB_HELD_FRAMES;
+ msg->data.dpb_held_frames = p->data.arg;
+ break;
+ default:
+ msg->code = MALI_VPU_FW_CODE_UNKNOWN;
+ break;
+ }
+
+ return 1;
+}
+
static int mali_vpu_fw_get_buffer(struct mali_vpu_fw *fw,
struct mali_vpu_fw_proto_page *buf_host_page,
struct mali_vpu_fw_proto_page *buf_mve_page,
@@ -1007,6 +1035,7 @@ int mali_vpu_fw_parse_msg(struct mali_vpu_fw *fw, struct mali_vpu_fw_msg *msg)
struct mve_response_state_change state_change;
struct mve_response_frame_alloc_parameters alloc_params;
struct mve_response_sequence_parameters seq_params;
+ struct mve_buffer_param buffer_param;
struct mve_response_error error;
} fw_msg = {};
size_t size = sizeof(fw_msg);
@@ -1137,6 +1166,9 @@ int mali_vpu_fw_parse_msg(struct mali_vpu_fw *fw, struct mali_vpu_fw_msg *msg)
fw->pending_response_count--;
break;
+ case MVE_BUFFER_CODE_PARAM:
+ ret = mali_vpu_convert_buffer_param(msg, &fw_msg.buffer_param, size);
+ break;
case MVE_RESPONSE_CODE_ERROR: {
size_t message_offset = offsetof(struct mve_response_error, message);
size_t message_size;
diff --git a/drivers/media/platform/arm/mali-vpu/mali-vpu-firmware.h b/drivers/media/platform/arm/mali-vpu/mali-vpu-firmware.h
index ca90cc71ac64e..6c46f23ac8638 100644
--- a/drivers/media/platform/arm/mali-vpu/mali-vpu-firmware.h
+++ b/drivers/media/platform/arm/mali-vpu/mali-vpu-firmware.h
@@ -144,6 +144,8 @@ struct mali_vpu_fw_error {
* @MALI_VPU_FW_CODE_OUTPUT_FLUSH: Firmware successfully completed a CAPTURE queue flush.
* @MALI_VPU_FW_CODE_SEQUENCE_PARAMS: Firmware reported new sequence parameters.
* @MALI_VPU_FW_CODE_ALLOC_PARAM: Firmware reported new frame allocation parameters.
+ * @MALI_VPU_FW_CODE_COLOR_DESC: Firmware reported colour-description metadata.
+ * @MALI_VPU_FW_CODE_DPB_HELD_FRAMES: Firmware reported the number of frames held in the DPB.
* @MALI_VPU_FW_CODE_UNKNOWN: Unrecognized firmware message.
* @MALI_VPU_FW_CODE_MAX: Sentinel marking the end of the message-code enum.
*/
@@ -164,6 +166,8 @@ enum mali_vpu_fw_code {
MALI_VPU_FW_CODE_OUTPUT_FLUSH, /* Driver <- Firmware. */
MALI_VPU_FW_CODE_SEQUENCE_PARAMS, /* Driver <- Firmware. */
MALI_VPU_FW_CODE_ALLOC_PARAM, /* Driver <- Firmware. */
+ MALI_VPU_FW_CODE_COLOR_DESC, /* Driver <- Firmware. */
+ MALI_VPU_FW_CODE_DPB_HELD_FRAMES, /* Driver <- Firmware. */
MALI_VPU_FW_CODE_UNKNOWN, /* Driver <- Firmware. */
MALI_VPU_FW_CODE_MAX
};
@@ -182,6 +186,7 @@ struct mali_vpu_fw_msg {
struct mali_vpu_buffer *vpu_buf;
struct mali_vpu_fw_alloc_param alloc_params;
struct mali_vpu_fw_seq_param seq_params;
+ u32 dpb_held_frames;
} data;
};
diff --git a/drivers/media/platform/arm/mali-vpu/mali-vpu-protocol-def-v3.h b/drivers/media/platform/arm/mali-vpu/mali-vpu-protocol-def-v3.h
index cb4533a367957..76dc7bf076c8f 100644
--- a/drivers/media/platform/arm/mali-vpu/mali-vpu-protocol-def-v3.h
+++ b/drivers/media/platform/arm/mali-vpu/mali-vpu-protocol-def-v3.h
@@ -269,6 +269,8 @@ struct mve_msg_header {
#define MVE_BUFFER_CODE_FRAME (3001)
/* struct mve_buffer_bitstream */
#define MVE_BUFFER_CODE_BITSTREAM (3002)
+ /* struct mve_buffer_param */
+ #define MVE_BUFFER_CODE_PARAM (3003)
u16 size; /* size in bytes of trailing data, 0 if none */
};
@@ -601,4 +603,21 @@ struct mve_buffer_bitstream {
u32 reserved;
};
+/* Parameters that are sent in the same communication channels
+ * as the buffers. A parameter applies to all subsequent buffers.
+ * Some types are only valid for decode, and some only for encode.
+ */
+struct mve_buffer_param {
+ u32 type; /* Extra data: */
+ #define MVE_BUFFER_PARAM_TYPE_COLOUR_DESCRIPTION (15)
+ /* arg, number of output buffers that are complete and held by firmware in the
+ * DPB for reordering purposes. Valid after the next frame is output.
+ */
+ #define MVE_BUFFER_PARAM_TYPE_DPB_HELD_FRAMES (19)
+
+ union {
+ u32 arg;
+ } data;
+};
+
#endif /* __MALI_VPU_PROTOCOL_DEF_V3_H__ */
diff --git a/drivers/media/platform/arm/mali-vpu/mali-vpu-session.c b/drivers/media/platform/arm/mali-vpu/mali-vpu-session.c
index fcfad581223be..411421e175e71 100644
--- a/drivers/media/platform/arm/mali-vpu/mali-vpu-session.c
+++ b/drivers/media/platform/arm/mali-vpu/mali-vpu-session.c
@@ -559,6 +559,15 @@ static int mali_vpu_session_handle_fw_msg(struct mali_vpu_session *sess,
* state update is required.
*/
return 0;
+ case MALI_VPU_FW_CODE_COLOR_DESC:
+ /* Colour metadata is currently not consumed by the driver. */
+ return 0;
+ case MALI_VPU_FW_CODE_DPB_HELD_FRAMES:
+ /* DPB occupancy is informational. */
+ dev_dbg(sess->vpu_dev->dev,
+ "firmware holds %u frames in the DPB\n",
+ fw_msg->data.dpb_held_frames);
+ return 0;
case MALI_VPU_FW_CODE_OUTPUT_FLUSH:
dev_dbg(sess->vpu_dev->dev, "fw rsp: Dst queue flushed\n");
if (sess->role == MALI_VPU_DECODER && sess->drc_pending)
--
2.43.0
next prev parent reply other threads:[~2026-11-19 15:39 UTC|newest]
Thread overview: 29+ 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 15:37 ` [RFC PATCH 03/28] media: mali-vpu: register V4L2 decoder device and add querycap ioctl Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 04/28] media: mali-vpu: initialize decoder format state Charvi Mehta
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 15:37 ` [RFC PATCH 08/28] media: mali-vpu: register V76 decoder controls and introduce UAPI controls Charvi Mehta
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 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 ` Charvi Mehta [this message]
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
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=20261119153758.1426673-26-charvi.mehta@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=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®