From: Wangao Wang <wangao.wang@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>
Cc: quic_qiweil@quicinc.com,
Renjiang Han <renjiang.han@oss.qualcomm.com>,
Wangao Wang <wangao.wang@oss.qualcomm.com>,
linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org,
Neil Armstrong <neil.armstrong@linaro.org>
Subject: [PATCH v6 5/6] media: qcom: iris: Optimize iris_hfi_gen1_packet_session_set_property
Date: Wed, 01 Apr 2026 11:13:47 +0800 [thread overview]
Message-ID: <20260401-batch2_iris_encoder_enhancements-v6-5-7022af3401ff@oss.qualcomm.com> (raw)
In-Reply-To: <20260401-batch2_iris_encoder_enhancements-v6-0-7022af3401ff@oss.qualcomm.com>
Modify iris_hfi_gen1_packet_session_set_property to simplify size
calculations and remove redundant code patterns.
Previously, packet->shdr.hdr.size was incremented by sizeof(u32) in
every switch case, resulting in repetitive and less maintainable
logic.
Reviewed-by: Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-HDK
Signed-off-by: Wangao Wang <wangao.wang@oss.qualcomm.com>
---
.../platform/qcom/iris/iris_hfi_gen1_command.c | 50 +++++++++++-----------
1 file changed, 25 insertions(+), 25 deletions(-)
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 702ca1835b816088ffec1b3a5ce315cdccb4d7c0..74738b00c57138e4eadbbb62cf9dc9d8a815cf59 100644
--- a/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c
+++ b/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c
@@ -485,7 +485,7 @@ iris_hfi_gen1_packet_session_set_property(struct hfi_session_set_property_pkt *p
{
void *prop_data = &packet->data[1];
- packet->shdr.hdr.size = sizeof(*packet);
+ packet->shdr.hdr.size = sizeof(*packet) + sizeof(ptype);
packet->shdr.hdr.pkt_type = HFI_CMD_SESSION_SET_PROPERTY;
packet->shdr.session_id = inst->session_id;
packet->num_properties = 1;
@@ -498,14 +498,14 @@ iris_hfi_gen1_packet_session_set_property(struct hfi_session_set_property_pkt *p
fsize->buffer_type = in->buffer_type;
fsize->height = in->height;
fsize->width = in->width;
- packet->shdr.hdr.size += sizeof(u32) + sizeof(*fsize);
+ packet->shdr.hdr.size += sizeof(*fsize);
break;
}
case HFI_PROPERTY_CONFIG_VIDEOCORES_USAGE: {
struct hfi_videocores_usage_type *in = pdata, *cu = prop_data;
cu->video_core_enable_mask = in->video_core_enable_mask;
- packet->shdr.hdr.size += sizeof(u32) + sizeof(*cu);
+ packet->shdr.hdr.size += sizeof(*cu);
break;
}
case HFI_PROPERTY_PARAM_UNCOMPRESSED_FORMAT_SELECT: {
@@ -514,7 +514,7 @@ iris_hfi_gen1_packet_session_set_property(struct hfi_session_set_property_pkt *p
hfi->buffer_type = in->buffer_type;
hfi->format = in->format;
- packet->shdr.hdr.size += sizeof(u32) + sizeof(*hfi);
+ packet->shdr.hdr.size += sizeof(*hfi);
break;
}
case HFI_PROPERTY_PARAM_UNCOMPRESSED_PLANE_ACTUAL_CONSTRAINTS_INFO: {
@@ -533,7 +533,7 @@ iris_hfi_gen1_packet_session_set_property(struct hfi_session_set_property_pkt *p
info->plane_format[1].buffer_alignment = 256;
}
- packet->shdr.hdr.size += sizeof(u32) + sizeof(*info);
+ packet->shdr.hdr.size += sizeof(*info);
break;
}
case HFI_PROPERTY_PARAM_BUFFER_COUNT_ACTUAL: {
@@ -543,7 +543,7 @@ iris_hfi_gen1_packet_session_set_property(struct hfi_session_set_property_pkt *p
count->type = in->type;
count->count_actual = in->count_actual;
count->count_min_host = in->count_min_host;
- packet->shdr.hdr.size += sizeof(u32) + sizeof(*count);
+ packet->shdr.hdr.size += sizeof(*count);
break;
}
case HFI_PROPERTY_PARAM_VDEC_MULTI_STREAM: {
@@ -552,7 +552,7 @@ iris_hfi_gen1_packet_session_set_property(struct hfi_session_set_property_pkt *p
multi->buffer_type = in->buffer_type;
multi->enable = in->enable;
- packet->shdr.hdr.size += sizeof(u32) + sizeof(*multi);
+ packet->shdr.hdr.size += sizeof(*multi);
break;
}
case HFI_PROPERTY_PARAM_BUFFER_SIZE_ACTUAL: {
@@ -560,7 +560,7 @@ iris_hfi_gen1_packet_session_set_property(struct hfi_session_set_property_pkt *p
sz->size = in->size;
sz->type = in->type;
- packet->shdr.hdr.size += sizeof(u32) + sizeof(*sz);
+ packet->shdr.hdr.size += sizeof(*sz);
break;
}
case HFI_PROPERTY_PARAM_WORK_ROUTE: {
@@ -568,7 +568,7 @@ iris_hfi_gen1_packet_session_set_property(struct hfi_session_set_property_pkt *p
u32 *in = pdata;
wr->video_work_route = *in;
- packet->shdr.hdr.size += sizeof(u32) + sizeof(*wr);
+ packet->shdr.hdr.size += sizeof(*wr);
break;
}
case HFI_PROPERTY_PARAM_WORK_MODE: {
@@ -576,7 +576,7 @@ iris_hfi_gen1_packet_session_set_property(struct hfi_session_set_property_pkt *p
u32 *in = pdata;
wm->video_work_mode = *in;
- packet->shdr.hdr.size += sizeof(u32) + sizeof(*wm);
+ packet->shdr.hdr.size += sizeof(*wm);
break;
}
case HFI_PROPERTY_PARAM_PROFILE_LEVEL_CURRENT: {
@@ -592,7 +592,7 @@ iris_hfi_gen1_packet_session_set_property(struct hfi_session_set_property_pkt *p
/* Level not supported, falling back to 1 */
pl->level = 1;
- packet->shdr.hdr.size += sizeof(u32) + sizeof(*pl);
+ packet->shdr.hdr.size += sizeof(*pl);
break;
}
case HFI_PROPERTY_CONFIG_VENC_SYNC_FRAME_SEQUENCE_HEADER: {
@@ -600,7 +600,7 @@ iris_hfi_gen1_packet_session_set_property(struct hfi_session_set_property_pkt *p
u32 *in = pdata;
en->enable = *in;
- packet->shdr.hdr.size += sizeof(u32) + sizeof(*en);
+ packet->shdr.hdr.size += sizeof(*en);
break;
}
case HFI_PROPERTY_CONFIG_VENC_TARGET_BITRATE: {
@@ -608,7 +608,7 @@ iris_hfi_gen1_packet_session_set_property(struct hfi_session_set_property_pkt *p
brate->bitrate = in->bitrate;
brate->layer_id = in->layer_id;
- packet->shdr.hdr.size += sizeof(u32) + sizeof(*brate);
+ packet->shdr.hdr.size += sizeof(*brate);
break;
}
case HFI_PROPERTY_PARAM_VENC_RATE_CONTROL: {
@@ -627,7 +627,7 @@ iris_hfi_gen1_packet_session_set_property(struct hfi_session_set_property_pkt *p
}
packet->data[1] = *in;
- packet->shdr.hdr.size += sizeof(u32) * 2;
+ packet->shdr.hdr.size += sizeof(u32);
break;
}
case HFI_PROPERTY_PARAM_VENC_H264_ENTROPY_CONTROL: {
@@ -637,7 +637,7 @@ iris_hfi_gen1_packet_session_set_property(struct hfi_session_set_property_pkt *p
entropy->entropy_mode = *in;
if (entropy->entropy_mode == HFI_H264_ENTROPY_CABAC)
entropy->cabac_model = HFI_H264_CABAC_MODEL_0;
- packet->shdr.hdr.size += sizeof(u32) + sizeof(*entropy);
+ packet->shdr.hdr.size += sizeof(*entropy);
break;
}
case HFI_PROPERTY_PARAM_VENC_SESSION_QP_RANGE_V2: {
@@ -662,7 +662,7 @@ iris_hfi_gen1_packet_session_set_property(struct hfi_session_set_property_pkt *p
((max_qp & 0xFF) << 16);
range->min_qp.enable = 7;
range->max_qp.enable = 7;
- packet->shdr.hdr.size += sizeof(u32) + sizeof(*range);
+ packet->shdr.hdr.size += sizeof(*range);
break;
}
case HFI_PROPERTY_CONFIG_FRAME_RATE: {
@@ -671,7 +671,7 @@ iris_hfi_gen1_packet_session_set_property(struct hfi_session_set_property_pkt *p
frate->buffer_type = in->buffer_type;
frate->framerate = in->framerate;
- packet->shdr.hdr.size += sizeof(u32) + sizeof(*frate);
+ packet->shdr.hdr.size += sizeof(*frate);
break;
}
case HFI_PROPERTY_PARAM_UNCOMPRESSED_PLANE_ACTUAL_INFO: {
@@ -683,7 +683,7 @@ iris_hfi_gen1_packet_session_set_property(struct hfi_session_set_property_pkt *p
plane_actual_info->plane_format[0] = in->plane_format[0];
if (in->num_planes > 1)
plane_actual_info->plane_format[1] = in->plane_format[1];
- packet->shdr.hdr.size += sizeof(u32) + sizeof(*plane_actual_info);
+ packet->shdr.hdr.size += sizeof(*plane_actual_info);
break;
}
case HFI_PROPERTY_PARAM_VENC_INTRA_REFRESH: {
@@ -691,7 +691,7 @@ iris_hfi_gen1_packet_session_set_property(struct hfi_session_set_property_pkt *p
intra_refresh->mode = in->mode;
intra_refresh->mbs = in->mbs;
- packet->shdr.hdr.size += sizeof(u32) + sizeof(*intra_refresh);
+ packet->shdr.hdr.size += sizeof(*intra_refresh);
break;
}
case HFI_PROPERTY_PARAM_VENC_LTRMODE: {
@@ -700,7 +700,7 @@ iris_hfi_gen1_packet_session_set_property(struct hfi_session_set_property_pkt *p
ltr_mode->mode = in->mode;
ltr_mode->count = in->count;
ltr_mode->trust_mode = in->trust_mode;
- packet->shdr.hdr.size += sizeof(u32) + sizeof(*ltr_mode);
+ packet->shdr.hdr.size += sizeof(*ltr_mode);
break;
}
case HFI_PROPERTY_CONFIG_VENC_USELTRFRAME: {
@@ -709,14 +709,14 @@ iris_hfi_gen1_packet_session_set_property(struct hfi_session_set_property_pkt *p
ltr_use->frames = in->frames;
ltr_use->ref_ltr = in->ref_ltr;
ltr_use->use_constrnt = in->use_constrnt;
- packet->shdr.hdr.size += sizeof(u32) + sizeof(*ltr_use);
+ packet->shdr.hdr.size += sizeof(*ltr_use);
break;
}
case HFI_PROPERTY_CONFIG_VENC_MARKLTRFRAME: {
struct hfi_ltr_mark *in = pdata, *ltr_mark = prop_data;
ltr_mark->mark_frame = in->mark_frame;
- packet->shdr.hdr.size += sizeof(u32) + sizeof(*ltr_mark);
+ packet->shdr.hdr.size += sizeof(*ltr_mark);
break;
}
case HFI_PROPERTY_CONFIG_VENC_INTRA_PERIOD: {
@@ -724,21 +724,21 @@ iris_hfi_gen1_packet_session_set_property(struct hfi_session_set_property_pkt *p
intra_period->pframes = in->pframes;
intra_period->bframes = in->bframes;
- packet->shdr.hdr.size += sizeof(u32) + sizeof(*intra_period);
+ packet->shdr.hdr.size += sizeof(*intra_period);
break;
}
case HFI_PROPERTY_PARAM_VENC_HIER_P_MAX_NUM_ENH_LAYER: {
u32 *in = pdata;
packet->data[1] = *in;
- packet->shdr.hdr.size += sizeof(u32) + sizeof(u32);
+ packet->shdr.hdr.size += sizeof(u32);
break;
}
case HFI_PROPERTY_CONFIG_VENC_HIER_P_ENH_LAYER: {
u32 *in = pdata;
packet->data[1] = *in;
- packet->shdr.hdr.size += sizeof(u32) + sizeof(u32);
+ packet->shdr.hdr.size += sizeof(u32);
break;
}
default:
--
2.43.0
next prev parent reply other threads:[~2026-04-01 3:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-01 3:13 [PATCH v6 0/6] media: qcom: iris: encoder feature enhancements batch2 Wangao Wang
2026-04-01 3:13 ` [PATCH v6 1/6] media: qcom: iris: Add intra refresh support for gen1 encoder Wangao Wang
2026-04-01 3:13 ` [PATCH v6 2/6] media: qcom: iris: Add Long-Term Reference support for encoder Wangao Wang
2026-04-01 3:13 ` [PATCH v6 3/6] media: qcom: iris: Add B frames " Wangao Wang
2026-04-01 3:13 ` [PATCH v6 4/6] media: qcom: iris: Add hierarchical coding " Wangao Wang
2026-04-01 3:13 ` Wangao Wang [this message]
2026-04-01 3:13 ` [PATCH v6 6/6] media: qcom: iris: Simplify COMV size calculation Wangao Wang
2026-04-01 5:43 ` [PATCH v6 0/6] media: qcom: iris: encoder feature enhancements batch2 Wangao Wang
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=20260401-batch2_iris_encoder_enhancements-v6-5-7022af3401ff@oss.qualcomm.com \
--to=wangao.wang@oss.qualcomm.com \
--cc=abhinav.kumar@linux.dev \
--cc=bod@kernel.org \
--cc=dikshita.agarwal@oss.qualcomm.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=quic_qiweil@quicinc.com \
--cc=renjiang.han@oss.qualcomm.com \
--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