From nobody Mon Apr 13 21:02:31 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 486643947BF for ; Wed, 4 Mar 2026 09:20:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772616024; cv=none; b=UlESev0ECMC69ezWBZo2yZMzsraq5AQapDZqPYu1p0SUnV67/jn1iBNrWZdzStMLwHvfd4XRyThZnBJiCcfPmG8XmpqV7M0AQxq6etPTX1cgNlQIT2oEVvyB5GcP7/WiDruPaGFdOuVEZS1xF1izGKq67a1KiCh/Z0gHDZ4zYqk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772616024; c=relaxed/simple; bh=8ABxF8KGWyosxpUtDGwgLl2L+AgpEgGxwR2CtQsrr9o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=LbZ0lum5xZ3hJiylxTkmPVsYRHPV3wCAmg2lQg6GVK49B/cd6sVVpP1VMD5cVNUS2kU2LJWpszHHO55b3yTavx8zGb9K7c+UCNI1lfaZTV+3qbcTHZ3YpnBJ63V2GH4dOrUYAan3SBaeKkmDp2dswK3KnBDoBQ/lNJ0XtdcuuiQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=EJLxzpsA; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=SUkFCX09; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="EJLxzpsA"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="SUkFCX09" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6245SfDX1072656 for ; Wed, 4 Mar 2026 09:20:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=qcppdkim1; bh=/M3P51h1a1yRann62VX77s 1NXUJKicz1Y0SDE55UB5Q=; b=EJLxzpsA+/w8ts3WmSF2pXGIAkzsMUVwccnPC5 vL5OfHiBJwnaNzkMYbmd/XBCBUmf2whww83iUz58PXpGerDqSw8JMEyeRJUsIOkD l6irhr/vzlJkiho2l2zENMLtbuwhCwu3H6E3iq1TnlLKSDrZN+W/JCO6ychubRrD P023RPMZb/4liBIDfMc2Q/ifg9VjI1atgS/EmGLdo6JPW1LYt0ATop6ktug3WEK6 R2cPpkM6e2F3wkFPIXBNZy2RU4XmiXnxyPu6GS4R5kDhchTBKozSd8PCPksz5g9c COTyJkjKscs6vfIpp6e/c39JX0FeGMW1UfoIXaMJ/vWYOJ5w== Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cpcxfh2j9-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 04 Mar 2026 09:20:20 +0000 (GMT) Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-35678f99c6eso4302075a91.1 for ; Wed, 04 Mar 2026 01:20:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1772616019; x=1773220819; darn=vger.kernel.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=/M3P51h1a1yRann62VX77s1NXUJKicz1Y0SDE55UB5Q=; b=SUkFCX09ZUDfYxLa7dDtBgreTlEM5HQJoFRyYH1MY3CxiMbU5P4cJTaNy0oTuTNi8k c+XBN0YY2nA0czoRlKRCFIVFcGZSb0rbKs5ko8wvqy1HwS2eLsYrogJDIl9blRk8eZat dkAvOEGuRF7I2CeKdrRvlQu2a7pnIxF1FrVkTOofB0yHD9Sq+lGLq4eaOMwnmwtbVEUT ar6TicknmJzKD8gdQnk/Rz8v02743heOhnmnXGn1bjuBW09dPVQu9BuBvjAOmeb4IyUv 5IX8/S92RB9ldPS5bf8xp9cKKFEnFqZ+r5tuq7+TwuqaQKg19j/BAaDRpBOTdeyAjyle uujA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772616019; x=1773220819; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=/M3P51h1a1yRann62VX77s1NXUJKicz1Y0SDE55UB5Q=; b=RXoPdX0UI16XegaUbTLjEZSj9G7b7uIpsTVlTIHK31Hwseqcw1CwGhK1PMpMEmQwcM dRCrSgqZx8t1L3fGEPr5TusDr5XDfEd+v2FlgeHRseo3+AxoUXZ64zWC02CyL2FdRmmz J0Lu1ygNNHs3rk74Eie4hk4gZQYfDE2OPSQx6wOZfM5oXYvCMElXtwHbTIcA1L99Df8I GrqSYVWKlgMlz7BxDsUGVAEJU1XRvFNX67IdqkDIyQJeF+pbmBWaozr3MWKEu3V7u/d4 yJT+Cv+lmnHMwvD2AX1GooX2NMFG4ZT32X1MCAwBfSiOz2v07qOItmgB3OyYE51hgDgb DXRw== X-Forwarded-Encrypted: i=1; AJvYcCVtty49xRZfJnxS5XrMbCmB7FfAFR1GC0fYMxP2U8jIQtowrGGPDIVRMXeSoEX6wyPNuhGYDfe1TfuNDOU=@vger.kernel.org X-Gm-Message-State: AOJu0Yw0jR7NjXoSar+r5n9UAAWAYvuWMapf3Z4wu9vronPUx1Nj4r7f C4qq46CnMGRdtJt5hpx/PHG9SNesUGTWv24oZSKsiSvp7gPhMk0YJ9LiWRYwV/SEGbthtcoUMOP LItsLO+OnLlWbZNaliGP6WgQhHwNCW/g0ePf2IBROsAQdvMaqZr1dzEOdKmUlhuiE7qv5NpYlQN E= X-Gm-Gg: ATEYQzyJIalhDDYr52BM7M3zDCrIP7RNrC08x7vL+8p0ASL9QiOdbsumJJmVTmkpbx7 eqxUdTU5PGbsqg71nt/lYyvVieqKmKnLqSnwIvC9VG001tjcvgJ9UAPavZHo49ibZAkF8PpBZ5k qwJNlU0TMVqThLvzR1Ohj9fLMPy6YViCQPX5A+nFJ6AU1mp+0XwBcFMl/sugyeuWAhecUPJ+FTk mbVmMdrOTFj3vnbv0gtAggclRM3qurGqEsLJkXq19f/iOnP4gIdMAtATYOYRySkhx/caJoVHVn1 Q/zwtFAweXxsu9Y0ih/AgTFluUrqLaTHagBfFa4qD0iSnD2P2jjK2PFOPxEQOjY5Lhfjvb6cP1R pb/NMmskmb+HkxOt0Jel8OOfoEAM8dFTKwxQ1KoM6+TYh0EsdBM4/OKQ= X-Received: by 2002:a17:90b:2ccf:b0:354:bd08:4802 with SMTP id 98e67ed59e1d1-359a6a7c458mr1241511a91.35.1772616019480; Wed, 04 Mar 2026 01:20:19 -0800 (PST) X-Received: by 2002:a17:90b:2ccf:b0:354:bd08:4802 with SMTP id 98e67ed59e1d1-359a6a7c458mr1241499a91.35.1772616018970; Wed, 04 Mar 2026 01:20:18 -0800 (PST) Received: from hu-bvisredd-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2ae4651e409sm123643265ad.44.2026.03.04.01.20.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Mar 2026 01:20:18 -0800 (PST) From: Vishnu Reddy Date: Wed, 04 Mar 2026 14:48:54 +0530 Subject: [PATCH] media: iris: add FPS calculation and VPP FW overhead in frequency formula Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260304-update_fps_calculation-v1-1-4eeac373a504@oss.qualcomm.com> X-B4-Tracking: v=1; b=H4sIAP34p2kC/yWMWwqDMBAAryL73UDUaGKvUkTW7KYN+GoSS0G8e 0P9nIGZAyIHzxHuxQGBPz76dclQ3gqwL1yeLDxlhkpWraylEvtGmHhwWxwsTnafMOVEdIZZO91 IPZaQ4y2w89//+NFfHPi953+6JIwYWdh1nn26F66RDXfaUIlSqQppHImVQabaWGkUEWNLLUN/n j+xY9wLtAAAAA== X-Change-ID: 20260304-update_fps_calculation-98ee7f7507b1 To: Vikash Garodia , Dikshita Agarwal , Abhinav Kumar , Bryan O'Donoghue , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Vishnu Reddy X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1772616015; l=4136; i=busanna.reddy@oss.qualcomm.com; s=20260216; h=from:subject:message-id; bh=8ABxF8KGWyosxpUtDGwgLl2L+AgpEgGxwR2CtQsrr9o=; b=3pv5kCDvQZyFvKiptpI/HpmnbMCL4Q6+sQGcxCof/YQtHdtCPqLdNTyWjgagdYeb6a/jIMEy8 R90QfE/2394DNFLI/ehIOldVdh484LgMkHmSsUxm3yVhou6zdvO5OGl X-Developer-Key: i=busanna.reddy@oss.qualcomm.com; a=ed25519; pk=9vmy9HahBKVAa+GBFj1yHVbz0ey/ucIs1hrlfx+qtok= X-Proofpoint-ORIG-GUID: 9Qw_q60xei6AOcPsM4s1SJ0IztWVEPI- X-Authority-Analysis: v=2.4 cv=R4gO2NRX c=1 sm=1 tr=0 ts=69a7f954 cx=c_pps a=UNFcQwm+pnOIJct1K4W+Mw==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=EUspDBNiAAAA:8 a=aZFUA4iBNJJznah6NdIA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=uKXjsCUrEbL0IQVhDsJ9:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA0MDA3MCBTYWx0ZWRfX502Mbs4bZfHz YSXgR3Fpr2xsA8CJtluKD63Tn/j2Zre78ZkMlMY6llPopkleXoYa+2Y5qOYuvpYimadY5zLntiE 8/PydRs9aQ3TobIbAngywkzte/Mtxx/kP25f+JxlsgvCiSPhrRL1GE8o5oHyhbbtOWGubTHBHBk SAWFDMUfSQ22vyDhPrCA26oZ3PleFBNNR0//0611rYNF+4WnF8J3PouxHi+LnA4VBOZ1qKUgj04 dshga5Gksg2bD3qeETjjMN0a8J+WOsymNc2wnQlMfX/yRXfkDdXrw8f9BPyn3YJrGlqyX8LQYYT nspHYG9v7828zAMlBmTxDDBmSpxPGIHNgiWfyXo0ExMIPjoQWJWEBN/aOq2firs7KaDwt+fDLqn gmdvgGTa/lkSJAFXUCFnLOKy5JkJQ82YxbD1ffF3a2ziwx1IBji5wCNJWNayIPH6bmUGydiPU1J Bi6Ml8qV3nijFGeSKZg== X-Proofpoint-GUID: 9Qw_q60xei6AOcPsM4s1SJ0IztWVEPI- X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-04_04,2026-03-03_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 priorityscore=1501 clxscore=1015 phishscore=0 bulkscore=0 lowpriorityscore=0 impostorscore=0 spamscore=0 suspectscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603040070 The driver was using a fixed default FPS value when calculating the VPU frequency. This caused wrong frequency requests for high=E2=80=91frame=E2= =80=91rate streams, for example 4K at 240 FPS. Because of this, the hardware was running at a lower frequency than needed. Add the FPS measurement based on the decoder input buffer arrival rate. The measured FPS is stored per instance and used in frequency calculation instead of the fixed default FPS. The value is clamped so that it does not exceed platform limits. Add a VPP firmware overhead when running in STAGE_2. Signed-off-by: Vishnu Reddy --- drivers/media/platform/qcom/iris/iris_instance.h | 2 ++ drivers/media/platform/qcom/iris/iris_vdec.c | 21 ++++++++++++++++++= +++ drivers/media/platform/qcom/iris/iris_vpu_common.c | 6 +++++- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/iris/iris_instance.h b/drivers/med= ia/platform/qcom/iris/iris_instance.h index 16965150f427..180cba36a7f2 100644 --- a/drivers/media/platform/qcom/iris/iris_instance.h +++ b/drivers/media/platform/qcom/iris/iris_instance.h @@ -109,6 +109,8 @@ struct iris_inst { u32 metadata_idx; u32 codec; bool last_buffer_dequeued; + u64 last_buf_recv_time_ns; + u32 frame_count; u32 frame_rate; u32 operating_rate; u32 hfi_rc_type; diff --git a/drivers/media/platform/qcom/iris/iris_vdec.c b/drivers/media/p= latform/qcom/iris/iris_vdec.c index 719217399a30..88820060e22a 100644 --- a/drivers/media/platform/qcom/iris/iris_vdec.c +++ b/drivers/media/platform/qcom/iris/iris_vdec.c @@ -369,6 +369,8 @@ int iris_vdec_streamon_input(struct iris_inst *inst) if (ret) return ret; =20 + inst->frame_count =3D 0; + return iris_process_streamon_input(inst); } =20 @@ -411,6 +413,7 @@ int iris_vdec_qbuf(struct iris_inst *inst, struct vb2_v= 4l2_buffer *vbuf) { struct iris_buffer *buf =3D to_iris_buffer(vbuf); struct vb2_buffer *vb2 =3D &vbuf->vb2_buf; + u64 cur_buf_recv_time_ns, time_delta_ns; struct vb2_queue *q; int ret; =20 @@ -427,6 +430,24 @@ int iris_vdec_qbuf(struct iris_inst *inst, struct vb2_= v4l2_buffer *vbuf) return 0; } =20 + if (buf->type =3D=3D BUF_INPUT) { + cur_buf_recv_time_ns =3D ktime_get_ns(); + + if (inst->frame_count =3D=3D 0) { + inst->last_buf_recv_time_ns =3D cur_buf_recv_time_ns; + inst->frame_rate =3D MAXIMUM_FPS; + } + time_delta_ns =3D cur_buf_recv_time_ns - inst->last_buf_recv_time_ns; + + if (time_delta_ns >=3D NSEC_PER_SEC) { + inst->frame_rate =3D clamp_t(u32, inst->frame_count, DEFAULT_FPS, + MAXIMUM_FPS); + inst->last_buf_recv_time_ns =3D cur_buf_recv_time_ns; + inst->frame_count =3D 0; + } + inst->frame_count++; + } + iris_scale_power(inst); =20 return iris_queue_buffer(inst, buf); diff --git a/drivers/media/platform/qcom/iris/iris_vpu_common.c b/drivers/m= edia/platform/qcom/iris/iris_vpu_common.c index 548e5f1727fd..3ccc8feff678 100644 --- a/drivers/media/platform/qcom/iris/iris_vpu_common.c +++ b/drivers/media/platform/qcom/iris/iris_vpu_common.c @@ -416,7 +416,7 @@ u64 iris_vpu3x_vpu4x_calculate_frequency(struct iris_in= st *inst, size_t data_siz u32 height, width, mbs_per_second, mbpf; u64 fw_cycles, fw_vpp_cycles; u64 vsp_cycles, vpp_cycles; - u32 fps =3D DEFAULT_FPS; + u32 fps =3D inst->frame_rate; =20 width =3D max(inp_f->fmt.pix_mp.width, inst->crop.width); height =3D max(inp_f->fmt.pix_mp.height, inst->crop.height); @@ -435,6 +435,10 @@ u64 iris_vpu3x_vpu4x_calculate_frequency(struct iris_i= nst *inst, size_t data_siz if (inst->fw_caps[PIPE].value > 1) vpp_cycles +=3D div_u64(vpp_cycles * 59, 1000); =20 + /* 1.050 is VPP FW overhead */ + if (inst->fw_caps[STAGE].value =3D=3D STAGE_2) + vpp_cycles +=3D div_u64(vpp_cycles * 50, 1000); + vsp_cycles =3D fps * data_size * 8; vsp_cycles =3D div_u64(vsp_cycles, 2); /* VSP FW overhead 1.05 */ --- base-commit: f505e978d1a0442adbbde48aed38c084ddea6d6e change-id: 20260304-update_fps_calculation-98ee7f7507b1 Best regards, --=20 Vishnu Reddy