From: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
To: Vikash Garodia <vikash.garodia@oss.qualcomm.com>,
Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>,
Abhinav Kumar <abhinav.kumar@linux.dev>,
Bryan O'Donoghue <bod@kernel.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Hans Verkuil <hverkuil+cisco@kernel.org>
Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v2 08/13] media: iris: add VP8 decode support on Gen1 firmware
Date: Fri, 04 Dec 2026 20:24:49 +0200 [thread overview]
Message-ID: <20261204-iris-vp8-v2-8-462f9b48d246@oss.qualcomm.com> (raw)
In-Reply-To: <20261204-iris-vp8-v2-0-462f9b48d246@oss.qualcomm.com>
The Gen1 firmware supports decoding VP8, but the iris driver never
advertised or wired up the codec.
Add the VP8 HFI codec code, map V4L2_PIX_FMT_VP8 to it in the Gen1
session open path, and compute the VP8 internal buffer sizes (bin,
collocated motion vector, line and probability-table persist buffers,
which reuse the shared VPX helpers). Advertise the codec through the
Gen1 decode format list.
Register the VP8 profile menu control read-only and fill it in from the
profile the firmware reports with the sequence change.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/media/platform/qcom/iris/iris_ctrls.c | 7 +++
drivers/media/platform/qcom/iris/iris_hfi_gen1.c | 22 ++++++-
.../platform/qcom/iris/iris_hfi_gen1_command.c | 3 +
.../platform/qcom/iris/iris_hfi_gen1_defines.h | 6 ++
.../platform/qcom/iris/iris_hfi_gen1_response.c | 36 ++++++++++++
.../platform/qcom/iris/iris_platform_common.h | 1 +
drivers/media/platform/qcom/iris/iris_vpu_buffer.c | 67 ++++++++++++++++++++++
drivers/media/platform/qcom/iris/iris_vpu_buffer.h | 3 +
8 files changed, 143 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/qcom/iris/iris_ctrls.c b/drivers/media/platform/qcom/iris/iris_ctrls.c
index f1903e028ea8..dd1ecf1d90ca 100644
--- a/drivers/media/platform/qcom/iris/iris_ctrls.c
+++ b/drivers/media/platform/qcom/iris/iris_ctrls.c
@@ -29,6 +29,8 @@ static enum platform_inst_fw_cap_type iris_get_cap_id(u32 id)
return PROFILE_HEVC;
case V4L2_CID_MPEG_VIDEO_VP9_PROFILE:
return PROFILE_VP9;
+ case V4L2_CID_MPEG_VIDEO_VP8_PROFILE:
+ return PROFILE_VP8;
case V4L2_CID_MPEG_VIDEO_H264_LEVEL:
return LEVEL_H264;
case V4L2_CID_MPEG_VIDEO_HEVC_LEVEL:
@@ -180,6 +182,8 @@ static u32 iris_get_v4l2_id(enum platform_inst_fw_cap_type cap_id)
return V4L2_CID_MPEG_VIDEO_HEVC_PROFILE;
case PROFILE_VP9:
return V4L2_CID_MPEG_VIDEO_VP9_PROFILE;
+ case PROFILE_VP8:
+ return V4L2_CID_MPEG_VIDEO_VP8_PROFILE;
case LEVEL_H264:
return V4L2_CID_MPEG_VIDEO_H264_LEVEL;
case LEVEL_HEVC:
@@ -582,6 +586,9 @@ int iris_set_profile(struct iris_inst *inst, enum platform_inst_fw_cap_type cap_
if (inst->codec == V4L2_PIX_FMT_H264) {
hfi_id = inst->fw_caps[PROFILE_H264].hfi_id;
hfi_value = inst->fw_caps[PROFILE_H264].value;
+ } else if (inst->codec == V4L2_PIX_FMT_VP8) {
+ hfi_id = inst->fw_caps[PROFILE_VP8].hfi_id;
+ hfi_value = inst->fw_caps[PROFILE_VP8].value;
} else {
hfi_id = inst->fw_caps[PROFILE_HEVC].hfi_id;
hfi_value = inst->fw_caps[PROFILE_HEVC].value;
diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen1.c b/drivers/media/platform/qcom/iris/iris_hfi_gen1.c
index 4b38af68625e..178de720246b 100644
--- a/drivers/media/platform/qcom/iris/iris_hfi_gen1.c
+++ b/drivers/media/platform/qcom/iris/iris_hfi_gen1.c
@@ -30,6 +30,17 @@ static const struct platform_inst_fw_cap inst_fw_cap_sm8250_dec[] = {
.hfi_id = HFI_PROPERTY_PARAM_WORK_MODE,
.set = iris_set_stage,
},
+ {
+ .cap_id = PROFILE_VP8,
+ .min = V4L2_MPEG_VIDEO_VP8_PROFILE_0,
+ .max = V4L2_MPEG_VIDEO_VP8_PROFILE_3,
+ .step_or_mask = BIT(V4L2_MPEG_VIDEO_VP8_PROFILE_0) |
+ BIT(V4L2_MPEG_VIDEO_VP8_PROFILE_1) |
+ BIT(V4L2_MPEG_VIDEO_VP8_PROFILE_2) |
+ BIT(V4L2_MPEG_VIDEO_VP8_PROFILE_3),
+ .value = V4L2_MPEG_VIDEO_VP8_PROFILE_0,
+ .flags = CAP_FLAG_MENU | CAP_FLAG_READ_ONLY,
+ },
};
static const struct platform_inst_fw_cap inst_fw_cap_sm8250_enc[] = {
@@ -425,6 +436,13 @@ static const u32 iris_hfi_gen1_dec_fmts[] = {
V4L2_PIX_FMT_H264,
V4L2_PIX_FMT_HEVC,
V4L2_PIX_FMT_VP9,
+ V4L2_PIX_FMT_VP8,
+};
+
+static const u32 iris_hfi_gen1_ar50lt_dec_fmts[] = {
+ V4L2_PIX_FMT_H264,
+ V4L2_PIX_FMT_HEVC,
+ V4L2_PIX_FMT_VP9,
};
const struct iris_firmware_data iris_hfi_gen1_data = {
@@ -842,8 +860,8 @@ const struct iris_firmware_data iris_hfi_gen1_ar50lt_data = {
.inst_fw_caps_enc = inst_fw_cap_gen1_ar50lt_enc,
.inst_fw_caps_enc_size = ARRAY_SIZE(inst_fw_cap_gen1_ar50lt_enc),
- .dec_fmts = iris_hfi_gen1_dec_fmts,
- .dec_fmts_size = ARRAY_SIZE(iris_hfi_gen1_dec_fmts),
+ .dec_fmts = iris_hfi_gen1_ar50lt_dec_fmts,
+ .dec_fmts_size = ARRAY_SIZE(iris_hfi_gen1_ar50lt_dec_fmts),
.dec_input_config_params_default =
sm8250_vdec_input_config_param_default,
diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c b/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c
index ba0be31efa00..1f210a9a9a99 100644
--- a/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c
+++ b/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c
@@ -105,6 +105,9 @@ static int iris_hfi_gen1_session_open(struct iris_inst *inst)
case V4L2_PIX_FMT_HEVC:
codec = HFI_VIDEO_CODEC_HEVC;
break;
+ case V4L2_PIX_FMT_VP8:
+ codec = HFI_VIDEO_CODEC_VP8;
+ break;
case V4L2_PIX_FMT_VP9:
codec = HFI_VIDEO_CODEC_VP9;
break;
diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen1_defines.h b/drivers/media/platform/qcom/iris/iris_hfi_gen1_defines.h
index 699f22cc7255..07d128fe96ee 100644
--- a/drivers/media/platform/qcom/iris/iris_hfi_gen1_defines.h
+++ b/drivers/media/platform/qcom/iris/iris_hfi_gen1_defines.h
@@ -14,6 +14,7 @@
#define HFI_SESSION_TYPE_DEC 2
#define HFI_VIDEO_CODEC_H264 0x00000002
+#define HFI_VIDEO_CODEC_VP8 0x00001000
#define HFI_VIDEO_CODEC_HEVC 0x00002000
#define HFI_VIDEO_CODEC_VP9 0x00004000
@@ -61,6 +62,11 @@
#define HFI_HEVC_LEVEL_61 0x00000800
#define HFI_HEVC_LEVEL_62 0x00001000
+#define HFI_VPX_LEVEL_VERSION_0 0x00000001
+#define HFI_VPX_LEVEL_VERSION_1 0x00000002
+#define HFI_VPX_LEVEL_VERSION_2 0x00000004
+#define HFI_VPX_LEVEL_VERSION_3 0x00000008
+
#define HFI_ERR_NONE 0x0
#define HFI_CMD_SYS_INIT 0x10001
diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c b/drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c
index a1167ce524ff..88d625589eab 100644
--- a/drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c
+++ b/drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c
@@ -12,6 +12,41 @@
#include "iris_vdec.h"
#include "iris_vpu_buffer.h"
+static void iris_hfi_gen1_update_profile_level(struct iris_inst *inst,
+ u32 hfi_profile, u32 hfi_level)
+{
+ struct v4l2_ctrl *ctrl;
+ u32 profile_id = 0;
+ int profile = -1;
+
+ switch (inst->codec) {
+ case V4L2_PIX_FMT_VP8:
+ /* the firmware reports the VP8 version as the level */
+ profile_id = V4L2_CID_MPEG_VIDEO_VP8_PROFILE;
+ switch (hfi_level) {
+ case HFI_VPX_LEVEL_VERSION_0:
+ profile = V4L2_MPEG_VIDEO_VP8_PROFILE_0;
+ break;
+ case HFI_VPX_LEVEL_VERSION_1:
+ profile = V4L2_MPEG_VIDEO_VP8_PROFILE_1;
+ break;
+ case HFI_VPX_LEVEL_VERSION_2:
+ profile = V4L2_MPEG_VIDEO_VP8_PROFILE_2;
+ break;
+ case HFI_VPX_LEVEL_VERSION_3:
+ profile = V4L2_MPEG_VIDEO_VP8_PROFILE_3;
+ break;
+ }
+ break;
+ default:
+ return;
+ }
+
+ ctrl = v4l2_ctrl_find(&inst->ctrl_handler, profile_id);
+ if (ctrl && profile >= 0)
+ v4l2_ctrl_s_ctrl(ctrl, profile);
+}
+
static void iris_hfi_gen1_read_changed_params(struct iris_inst *inst,
struct hfi_msg_event_notify_pkt *pkt)
{
@@ -161,6 +196,7 @@ static void iris_hfi_gen1_read_changed_params(struct iris_inst *inst,
if (ctrl)
v4l2_ctrl_s_ctrl(ctrl, inst->buffers[BUF_OUTPUT].min_count);
+ iris_hfi_gen1_update_profile_level(inst, event.profile, event.level);
if (event.bit_depth || !event.pic_struct) {
dev_err(core->dev, "unsupported content, bit depth: %x, pic_struct = %x\n",
diff --git a/drivers/media/platform/qcom/iris/iris_platform_common.h b/drivers/media/platform/qcom/iris/iris_platform_common.h
index 47bca539d50d..13f94af2a9d9 100644
--- a/drivers/media/platform/qcom/iris/iris_platform_common.h
+++ b/drivers/media/platform/qcom/iris/iris_platform_common.h
@@ -131,6 +131,7 @@ enum platform_inst_fw_cap_type {
PROFILE_H264 = 1,
PROFILE_HEVC,
PROFILE_VP9,
+ PROFILE_VP8,
LEVEL_H264,
LEVEL_HEVC,
LEVEL_VP9,
diff --git a/drivers/media/platform/qcom/iris/iris_vpu_buffer.c b/drivers/media/platform/qcom/iris/iris_vpu_buffer.c
index a8170e5fa9e6..8d5692c82afb 100644
--- a/drivers/media/platform/qcom/iris/iris_vpu_buffer.c
+++ b/drivers/media/platform/qcom/iris/iris_vpu_buffer.c
@@ -293,6 +293,11 @@ static u32 hfi_buffer_persist_vp9d(void)
HDR10_HIST_EXTRADATA_SIZE;
}
+static u32 hfi_buffer_persist_vp8d(void)
+{
+ return ALIGN(VP8_NUM_PROBABILITY_TABLE_BUF * VP8_PROB_TABLE_SIZE, DMA_ALIGNMENT);
+}
+
static u32 hfi_buffer_persist_vp9d_ar50lt(void)
{
return ALIGN(VP9_NUM_PROBABILITY_TABLE_BUF * VP9_PROB_TABLE_SIZE, DMA_ALIGNMENT) +
@@ -715,6 +720,60 @@ u32 hfi_buffer_line_vp9d(u32 frame_width, u32 frame_height, u32 _yuv_bufcount_mi
return _lb_size + vpss_lb_size + 4096;
}
+static inline
+u32 size_vp8d_lb_fe_top_data(u32 frame_width, u32 frame_height)
+{
+ return (ALIGN(frame_width, 16) + 8) * 10 * 2;
+}
+
+static inline
+u32 size_vp8d_lb_pe_top_data(u32 frame_width, u32 frame_height)
+{
+ return (ALIGN(frame_width, 16) >> 4) * 64;
+}
+
+static inline
+u32 size_vp8d_lb_vsp_top(u32 frame_width, u32 frame_height)
+{
+ return ((ALIGN(frame_width, 16) >> 4) * 64 / 2) + 256;
+}
+
+static inline
+u32 hfi_iris_vp8d_lb_size(u32 frame_width, u32 frame_height, u32 num_vpp_pipes)
+{
+ return ALIGN(size_vpxd_lb_fe_left_ctrl(frame_width, frame_height), DMA_ALIGNMENT) *
+ num_vpp_pipes +
+ ALIGN(size_vpxd_lb_se_left_ctrl(frame_width, frame_height), DMA_ALIGNMENT) *
+ num_vpp_pipes +
+ ALIGN(size_vp8d_lb_vsp_top(frame_width, frame_height), DMA_ALIGNMENT) +
+ ALIGN(size_vpxd_lb_fe_top_ctrl(frame_width, frame_height), DMA_ALIGNMENT) +
+ 2 * ALIGN(size_vpxd_lb_recon_dma_metadata_wr(frame_width, frame_height),
+ DMA_ALIGNMENT) +
+ ALIGN(size_vpxd_lb_se_top_ctrl(frame_width, frame_height), DMA_ALIGNMENT) +
+ ALIGN(size_vp8d_lb_pe_top_data(frame_width, frame_height), DMA_ALIGNMENT) +
+ ALIGN(size_vp8d_lb_fe_top_data(frame_width, frame_height), DMA_ALIGNMENT);
+}
+
+static inline
+u32 hfi_buffer_line_vp8d(u32 frame_width, u32 frame_height, bool is_opb, u32 num_vpp_pipes)
+{
+ u32 vpss_lb_size = 0;
+ u32 _lb_size;
+
+ _lb_size = hfi_iris_vp8d_lb_size(frame_width, frame_height, num_vpp_pipes);
+
+ if (is_opb)
+ vpss_lb_size = size_vpss_lb(frame_width, frame_height);
+
+ return _lb_size + vpss_lb_size;
+}
+
+static inline
+u32 hfi_iris_vp8d_comv_size(u32 frame_width, u32 frame_height)
+{
+ return DIV_ROUND_UP(frame_width, 16) * DIV_ROUND_UP(frame_height, 16) * 8 * 2;
+}
+
static u32 hfi_buffer_line_h264d(u32 frame_width, u32 frame_height,
bool is_opb, u32 num_vpp_pipes)
{
@@ -943,6 +1002,8 @@ static u32 iris_vpu_dec_bin_size(struct iris_inst *inst)
return hfi_buffer_bin_h265d(width, height, num_vpp_pipes);
else if (inst->codec == V4L2_PIX_FMT_VP9)
return hfi_buffer_bin_vp9d(width, height, num_vpp_pipes);
+ else if (inst->codec == V4L2_PIX_FMT_VP8)
+ return hfi_buffer_bin_vp9d(width, height, num_vpp_pipes);
else if (inst->codec == V4L2_PIX_FMT_AV1)
return hfi_buffer_bin_av1d(width, height, num_vpp_pipes);
@@ -976,6 +1037,8 @@ static u32 iris_vpu_dec_comv_size(struct iris_inst *inst)
return hfi_buffer_comv_h264d(width, height, num_comv);
else if (inst->codec == V4L2_PIX_FMT_HEVC)
return hfi_buffer_comv_h265d(width, height, num_comv);
+ else if (inst->codec == V4L2_PIX_FMT_VP8)
+ return hfi_iris_vp8d_comv_size(width, height);
return 0;
}
@@ -1014,6 +1077,8 @@ static u32 iris_vpu_dec_persist_size(struct iris_inst *inst)
return hfi_buffer_persist_h265d(0);
else if (inst->codec == V4L2_PIX_FMT_VP9)
return hfi_buffer_persist_vp9d();
+ else if (inst->codec == V4L2_PIX_FMT_VP8)
+ return hfi_buffer_persist_vp8d();
else if (inst->codec == V4L2_PIX_FMT_AV1) {
caps = inst->core->iris_platform_data->inst_caps;
if (inst->fw_caps[DRAP].value)
@@ -1094,6 +1159,8 @@ static u32 iris_vpu_dec_line_size(struct iris_inst *inst)
else if (inst->codec == V4L2_PIX_FMT_VP9)
return hfi_buffer_line_vp9d(width, height, out_min_count, is_opb,
num_vpp_pipes);
+ else if (inst->codec == V4L2_PIX_FMT_VP8)
+ return hfi_buffer_line_vp8d(width, height, is_opb, num_vpp_pipes);
else if (inst->codec == V4L2_PIX_FMT_AV1)
return hfi_buffer_line_av1d(width, height, is_opb, num_vpp_pipes);
diff --git a/drivers/media/platform/qcom/iris/iris_vpu_buffer.h b/drivers/media/platform/qcom/iris/iris_vpu_buffer.h
index 2085e316a6bd..684b459c0cad 100644
--- a/drivers/media/platform/qcom/iris/iris_vpu_buffer.h
+++ b/drivers/media/platform/qcom/iris/iris_vpu_buffer.h
@@ -66,6 +66,9 @@ struct iris_inst;
#define MAX_SE_NBR_CTRL_LCU64_LINE_BUFFER_SIZE_AR50LT (32 / 8)
#define VP9_UDC_HEADER_BUF_SIZE (3 * 128)
+#define VP8_NUM_PROBABILITY_TABLE_BUF (5 + 1)
+#define VP8_PROB_TABLE_SIZE (3840)
+
#define SIZE_SEI_USERDATA 4096
#define SIZE_DOLBY_RPU_METADATA (41 * 1024)
#define H264_CABAC_HDR_RATIO_HD_TOT 1
--
2.47.3
next prev parent reply other threads:[~2026-12-04 18:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 18:24 [PATCH v2 00/13] media: iris: enable VP8, MPEG1/MPEG2 and interlaced MPEG2 support Dmitry Baryshkov
2026-12-04 18:24 ` [PATCH v2 01/13] media: iris: apply the capture buffer minimum in queue_setup Dmitry Baryshkov
2026-12-04 18:24 ` [PATCH v2 02/13] media: iris: translate Gen1 profile/level to HFI enumerants Dmitry Baryshkov
2026-12-04 18:24 ` [PATCH v2 03/13] media: iris: default the Gen1 encoder level to a usable value Dmitry Baryshkov
2026-12-04 18:24 ` [PATCH v2 04/13] media: iris: size QC08C buffers to fit field-coded pictures Dmitry Baryshkov
2026-12-04 18:24 ` [PATCH v2 05/13] media: iris: split Gen2 firmware data for vpu2-generation SoCs Dmitry Baryshkov
2026-12-04 18:24 ` [PATCH v2 06/13] media: iris: move the decode format list into the firmware data Dmitry Baryshkov
2026-12-04 18:24 ` [PATCH v2 07/13] media: iris: support read-only controls Dmitry Baryshkov
2026-12-04 18:24 ` Dmitry Baryshkov [this message]
2026-12-04 18:24 ` [PATCH v2 09/13] media: iris: add MPEG1 and MPEG2 decode support on Gen1 firmware Dmitry Baryshkov
2026-12-04 18:24 ` [PATCH v2 10/13] media: iris: support interlaced MPEG2 content Dmitry Baryshkov
2026-12-04 18:24 ` [PATCH v2 11/13] media: iris: move the encode format list into the firmware data Dmitry Baryshkov
2026-12-04 18:24 ` [PATCH v2 12/13] media: iris: accept gen1 encoder output at a non-zero offset Dmitry Baryshkov
2026-12-04 18:24 ` [PATCH v2 13/13] media: iris: add VP8 encode support on Gen1 firmware Dmitry Baryshkov
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=20261204-iris-vp8-v2-8-462f9b48d246@oss.qualcomm.com \
--to=dmitry.baryshkov@oss.qualcomm.com \
--cc=abhinav.kumar@linux.dev \
--cc=bod@kernel.org \
--cc=dikshita.agarwal@oss.qualcomm.com \
--cc=hverkuil+cisco@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=vikash.garodia@oss.qualcomm.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®