From nobody Thu Apr 9 21:57:23 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 42AB839B4BF for ; Thu, 5 Mar 2026 13:30:29 +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=1772717430; cv=none; b=pQ1Oc2PjLdUi9OeSNRHb8uFpLnnvZGK/9EqbXvhrKtW3UCqEWhHeFH+VC0bY4DZ7cbv/cdFahr4XA7ipG1TVPfZ3EcdSq7u0gWq3rg3o/hbmAZCa9ZMQOrtt8jUDf5N2wtly9eNJpK9h3okdKT70QkhNXxQpW8Vlxt3e22pWVow= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772717430; c=relaxed/simple; bh=zVbqjpkjW7FulZscz7dxSatBpi7dmc9OK/lBG9AXHuo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=NLP2t2xXHFYvR/rgdFdEzk6xeYFS/fJvBjemIEA99hzzu1XYrbZswZHQV1bUwZmy/acMm93Sdj8jTdpfaGso/ivO5kYfbVqrqIXxXF0R0WRFK0OX/CNHNjYq5oZOV90N3YK+B9M5bxxmnTaT4EQ+l34pTasZ9iJ7Fd5r4dQ0vXY= 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=EJl/ALOh; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=enJDJWG0; 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="EJl/ALOh"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="enJDJWG0" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 625AFjvV936026 for ; Thu, 5 Mar 2026 13:30:28 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=sQ3LaKCpwhAN8tXXKc4fac w4IUD4LrbVBtbodb8lwk0=; b=EJl/ALOhsNlzhv4IesKhUimpwPFwbZ8u7v38Vu zrOFLTTuBods+7qLWlRRk2FMHrTn5PMNSLhTe0JH+8C53pAijc5Ugc4KMOKXloOh bX1CwwNgBogI4GvNCb9DapKKjKYmuBKjKGg1uju8cakb1q02sAIGd4CJJmBxp0Cy wOmlbS7deytXMTAS2s197GUd5GPTimYiLG+jEkND2YLAlVCN5a7/7o6STeryoOFH /ehpM4SzkTPV9ZNpGIZrXyC0zFUSGpfe6VxFQ5Sa8ZNjvhfagM8Y6Y9/ciILHGth aMa686chs0q23+1Jg1kC2ZQucWVpNc8lcg/bKBYPXEGhhT6w== Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cq04u26vs-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 05 Mar 2026 13:30:28 +0000 (GMT) Received: by mail-pg1-f198.google.com with SMTP id 41be03b00d2f7-c738662b963so896231a12.0 for ; Thu, 05 Mar 2026 05:30:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1772717428; x=1773322228; 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=sQ3LaKCpwhAN8tXXKc4facw4IUD4LrbVBtbodb8lwk0=; b=enJDJWG04IpGJXFhetk/mzp6gNj7H3t2LApIw5f2OQc9JXs9xVvcR3F5xOXPuNJx7G UQ31NXrUIl8gAFrbIBfwaoCS7vCk+8bjnWh/yKpCkzTzpUCOCLshXSWhJ+J9NnhYI7Lf ZvRAuzjNkUk4CAqSGI4UP3ldykP8ntcd5tHX68R+a06NqK+/EHAbR7wtZ4shaaMMr1iU dGaYsvkYmGoRBuKMGLl/+8wWfC/b2rWs8+94JX9+oYW3/WR/nnk1ZOySolq3OWeBU9oX hMpVFpZnkMdzKHphKxV2mhXGMTDRGw2D+7/Za0BSSnwCJlFctkkV9gx4KRYMKQLH1BGc YsmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772717428; x=1773322228; 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=sQ3LaKCpwhAN8tXXKc4facw4IUD4LrbVBtbodb8lwk0=; b=xGTUqaU0KQRp0pU4WQZ7twD2KBgS5JQsTXNGHAPvTy/2Z9VIAUfr6VFX78VtM628YW qSOdxvVKh7wtBqMaPa8WOKVGlSKTxeT0R21fKDa0mIcFZV8DNuHmRuBZizJt7S7+HcFV fP3F+Ouz4ZeYFcjE9z/pLsZjjDp7my9xsbpRFADCKFPgQ+41vM8anh4Gs88PRXIqHORr laN64zQ1CMspzng3zHtaGu7xssITYP3BTp3iR0QgDZVGbpO+QqROS+AvrgLtDGMbZ99H CEzXYxlLYYBK8uOOb6bsOgFFWi8tMsnMW+z7MVOLE0gLUE6j4IyR11cCpaEtcWwR6iZa pOtw== X-Forwarded-Encrypted: i=1; AJvYcCXADzf4seDMqEQw4kch4x2uqbYJKd+/VQEJSbl/FwdIT1m3mBfKZoY3sAqs2shw93ftmdlRDwv2+vzUL/M=@vger.kernel.org X-Gm-Message-State: AOJu0Yw6R4EZEdwzuGZbnipusVREY3ebaLjvG1HrY00X4ekOoM0lpy3O NP1yhAWnB+63Qqk8SZ4rLw8GGsAVh6e6p1zgwym+ugUSfn96BJXC3ufdmzRVFZqdMpGSl7TTNNM LO2MHtw8BU5ZE920g/vwZVmtqeHs5CW6j2ZcaLYrWVtL/Hy03xgvHQlwZ2wzwHmJ8HvhGW6FXhA Y= X-Gm-Gg: ATEYQzxwQPRc2xhWSgNL/7Zn/LTx3tRGi0ASEVTQ6lkBfilaTDKipZu11X9v/CsBhCj d+rL8+8f6o3T1tgxQdQbB1edPGHGxu8j1QJQssrHttpbu44QpS0TLc8M0iJAIdh6ZotmqlXk3KW 7nn/hLq7ddINMBwS5deymSslSLEc87r6YsCDz2Ec61O41hdbZlONKurvX904+j7eZWYfIcepsxC eg62+XdCYhM9NEVJ8drv90ln72nSeM2Qfct06cDon+apbtVHA6U6l80TTSx00/8eyTkMuJpYjvD O0fa0rPcfwAEcdJR1Y2UdzGww+B44fOMc7HJlYqGYoi7CKtTse86GL7YGqUke4TRUMXnRisFIwU owX1lduppfA9atiNhPPzUvSUsEggEJaRChr1jyRWd/1iRQNdygONdVCg= X-Received: by 2002:a05:6a21:3b93:b0:38d:f745:4d63 with SMTP id adf61e73a8af0-3982e29a1eemr5506467637.63.1772717427422; Thu, 05 Mar 2026 05:30:27 -0800 (PST) X-Received: by 2002:a05:6a21:3b93:b0:38d:f745:4d63 with SMTP id adf61e73a8af0-3982e29a1eemr5506404637.63.1772717426373; Thu, 05 Mar 2026 05:30:26 -0800 (PST) Received: from hu-bvisredd-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c7389126194sm2913390a12.24.2026.03.05.05.30.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2026 05:30:25 -0800 (PST) From: Vishnu Reddy Date: Thu, 05 Mar 2026 19:00:14 +0530 Subject: [PATCH v2] 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: <20260305-update_fps_calculation-v2-1-e3b5cccb1246@oss.qualcomm.com> X-B4-Tracking: v=1; b=H4sIAGWFqWkC/4WOQQ6CMBBFr0JmbU0LhVZX3sMYM3QGbaKAbSEaw 92teAA3k7zJ/y//DZGD5wj74g2BZx/90GcoNwW4K/YXFp4yQynLRlZSi2kkTHzuxnh2eHPTDVO uiJ1lNp2ppWkV5PIYuPPPVXw8/TjwY8r+9HtCi5GFG+53n/ZFV8uad8aSQql1idS2xNoiU2Wdt JqIsaGG4eu6+piG8Fo3z2qV/Zs3K6GEZkZXmQprqQ9DjNvHlCN5wTYfOC3L8gE7FPHQDwEAAA= = 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=1772717423; l=4298; i=busanna.reddy@oss.qualcomm.com; s=20260216; h=from:subject:message-id; bh=zVbqjpkjW7FulZscz7dxSatBpi7dmc9OK/lBG9AXHuo=; b=j3HRaeDwFhB7TbnpIKvzvGvAu5g9kcitqICfzOIuEc0943SbnSquNyGA2NnF/ZVNlX0vgMNIG 3DAEmgICDSnDvowKoJEZolSOzDKKUV2mfvvYuad4priuIFuYwuWDEar X-Developer-Key: i=busanna.reddy@oss.qualcomm.com; a=ed25519; pk=9vmy9HahBKVAa+GBFj1yHVbz0ey/ucIs1hrlfx+qtok= X-Proofpoint-GUID: MSTKrdPFPxbWu8fqG-cbzLfw_W8QByvP X-Authority-Analysis: v=2.4 cv=eqTSD4pX c=1 sm=1 tr=0 ts=69a98574 cx=c_pps a=Qgeoaf8Lrialg5Z894R3/Q==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=aZFUA4iBNJJznah6NdIA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=x9snwWr2DeNwDh03kgHS:22 X-Proofpoint-ORIG-GUID: MSTKrdPFPxbWu8fqG-cbzLfw_W8QByvP X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA1MDEwNyBTYWx0ZWRfXzWzwEG7iUVvK 9pv3yUdDvlKFueYD55A07gMaNlF20ZoCobam6U1FrmzAFtk4+DVpx5MN02ilrzBC4qmtSVWAy1M //yv8Yp/iZDI5nlgtxgG1DiMFu9vJrI+SXmJnzZvM3fiPh1XLt7KxAM9GUXC1VBF8bWRdfhLnsr HcdEX1vfRIqO4FkEoufGaDNi93aqj06ZTPMAVa3Ev1XN5HiJytGHtEcnvaFZPYJkmlnqKjGCTaF qR7YUQ+undAj0xSJa0VuzLVB+1mlaWtWSYV0yKI7n6lTeVRHjFR6+92bCIlAW6GDEopa0Cg0dvz CTJTKe74xQyxqy+7unGufb+eSXRPPUykBcc/cmyU7tKLGBRJoUaleHhExrhMAAQG9BzVDp7Gm4a 3w4aGgMicb7GG9r/fL529BJmQQL+iUi8zSpxAjofQWpIumwYlK5IlJMRwdn4Dr4z+CQJfGSor90 1Pw3cTMlJaH5Vpjh+gA== 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-05_04,2026-03-04_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 bulkscore=0 clxscore=1015 priorityscore=1501 malwarescore=0 lowpriorityscore=0 spamscore=0 impostorscore=0 adultscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603050107 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 --- Changes in v2: - Replaced div_u64 with mult_frac - Link to v1: https://lore.kernel.org/r/20260304-update_fps_calculation-v1-= 1-4eeac373a504@oss.qualcomm.com --- 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..d621ccffa868 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.05 is VPP FW overhead */ + if (inst->fw_caps[STAGE].value =3D=3D STAGE_2) + vpp_cycles +=3D mult_frac(vpp_cycles, 5, 100); + 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