From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 89CD439185A for ; Wed, 25 Mar 2026 07:53:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774425204; cv=none; b=CoGC62EAX1tAYKQmSNtJxpf5ED9N9ehtAevJDj/mjE6RmiUpZcgSFTyqd2IlB0Ps7H/Vgf2R9EYHLPWRUNWEz1GQRyoUUo1/wOVXz9CMuQCmQM5krkpSfi8+x7JQ1QzjD/QGa5rrZbx9QhK36wziJb75Z6FCfDJrnQcBEyTCRmI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774425204; c=relaxed/simple; bh=VXkJN4Kl+ZASyeCC/VdbGUtIGaTdV9woIEAznZCxA64=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=MDh8nyV8T94HBl/o+e+bGEjGROKoVsMoOBJSmFxfPHKMbx3pZr+9xh7UFCFifxvg9A/hyDwaWHpyIVANCM0/7KP0psrh6CEMCRVKQWndlIdvzlAkAGsxzJmzKTSSU0ccHYk9c2/bHQzDkUGy0B6B0gwLG5fOjkSTayVWVhnwB2o= 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=ocIvucwT; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=hYJqwdBW; arc=none smtp.client-ip=205.220.180.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="ocIvucwT"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="hYJqwdBW" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62P3o1u11208507 for ; Wed, 25 Mar 2026 07:53:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= DySCntb1zXYgrtxOMXpVWEI01R8xxlo7pSRoUDAwyFw=; b=ocIvucwTxpdsQmPK eruF0N7ZtHsEuBs1RHNS+e/ckAp6Sd8fVmYEdYg6Fe8ZSYcMNgimdylqCd7UcuG7 4ocfMVfOUmt4egh34JUwc6p6wR2xbMOMO4zT1JoZ7RpA9rbAXzcL35aNoGIjrf1Y U1fQiz5lf5GzqF7OAg959YiLz9kIOJ5TV8tFIr/+HVDSlILcq7sbmcvX0WtKlNdx qJl01izb75z8ZORmVMLyqKIOz38WR7BixuV+Fx7ytUrVVJhho92bqV5/WliH1a1s tAdXHQsxgxrTrWsOiaTuEVCZNW9hsY0YiSBTD39U3G0yLjMZkERAGLP99APyY1Zd 4ZnpLg== Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4d48598rb4-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 25 Mar 2026 07:53:17 +0000 (GMT) Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-2b07bd30b5eso9933815ad.1 for ; Wed, 25 Mar 2026 00:53:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1774425196; x=1775029996; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=DySCntb1zXYgrtxOMXpVWEI01R8xxlo7pSRoUDAwyFw=; b=hYJqwdBWqpa1yrUEQYW52KB2Ajcdm0ImJ4Be8BHeu3Zuoie8hKJN94ldxdCZkMcD/x H3d+v61SYk5L8E76UFUE6KmoOPput1BKoGBcW+dgVy3bekSyp9TzIEbktH+WZ6H/XCf4 /SQQUZNcui29zIXnlRjgcMt9ETzIrTITmNMaCZi6eACPOAiYPau6M/RP+xgFjKfK3jnI HWxZZY3rQsV7gcIlX+TD2qxmMMHE5ZJb+6RGg3nHJ31mbIaAZqqDIS6Hk7DXzcx/hm+C 38565JwZsnkvTfuCI/e+yti2VXUzFWpLion1ji0guc1SzYpSsCrYXyWGbAqdnbqg/Ar5 XOnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774425196; x=1775029996; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=DySCntb1zXYgrtxOMXpVWEI01R8xxlo7pSRoUDAwyFw=; b=MpVRZKJVFMlCvzapRXDbRkwDuo3ks54VJ2wr+vOditvoPI7DA+cz7m/X0T/i3MxAUG lyIEQvylUvnI+SELHeO0LmVIgDK5MLmTDNA+xexcZR15D2ZzNAT28iSYt3HK46PYlqc3 2EEKOTQQnzbFqdXAXT4tC+OOVBbbgfBLMhVqR3k3u1Q5CQ66GHEAadqtnTMq4c/4/BUA tA2p/GEBuVNzjQjBDNQr61+Bm/gAB/H86H3ZkaqsVK4kSk/kMVYg1gZVV716VFBtZA6+ pcivaK5WnWcj6Z5wxmrf4kwGDgpmJYeW2eV54YcZrmqlzOEgopziwYz7EGmpfIcbzi9K ZIXQ== X-Forwarded-Encrypted: i=1; AJvYcCV/scdm7h9dQwXGOohyyx0jQo1uQzFIShGTEd18EGxorO+j7I4/KTZM5Bmqtxr3/XKVvvwnmduLdldXiIw=@vger.kernel.org X-Gm-Message-State: AOJu0YwF0E58/xe9WDfDEQ7c6runx4L4TqFRL7MS+wy+8P5/SJN+we+Q YZ1lgn5UwhNvS1doeeLBaShOYra6VsxaHmTiMhgzWlqDfddCma/rit0YeBDDryGGvcB1GUkt5Zt 7k4JpB+HD4bx8T9gA3wwTCByFqoyvM5tFDthkX+Z5yo141oAL8aVz9du7ZpAQ8+pPSTY= X-Gm-Gg: ATEYQzwjdaHfPo7xZvlONbPOvrWyLJp7jxmb1VQyoBjPliwVBbMVyQ0WZ0Lxuq7bcGA pQSZu+td/MOn8NDCVCixs9/ZlWBQarayr8rruAhCOErf8NyIW51mHI08LjK2LvfQeV0lRSOcOZT NxfnWzKmCwJbfZmwxdyVT8yRAJIOg8PVgmaDdSGqttTh6SMp2fz4YGtkmKnB56+h71ZLq/PXHC0 wPn1OreMffg8wuDqXTn1gKzKea6SjH3KWAOsYu6kx6Sm4Qc+OpQIFpU4uDDgXH8/r5BCNlepsyK ALSAKFkPlr+iMcjcCVRXPOcZSp9VlMAR5Z3sIkTLOUh7aET0j1vLdPRPlQsDecSutgEMOe9f0HC 6C5JN1DRXQGsXMS6EFNdAIInmbIj1ib4YHuIGCphk3oKsYBUGWTCWlw== X-Received: by 2002:a17:902:e80a:b0:2b0:b7c6:4ae7 with SMTP id d9443c01a7336-2b0b7c64d78mr3400205ad.1.1774425196056; Wed, 25 Mar 2026 00:53:16 -0700 (PDT) X-Received: by 2002:a17:902:e80a:b0:2b0:b7c6:4ae7 with SMTP id d9443c01a7336-2b0b7c64d78mr3399995ad.1.1774425195495; Wed, 25 Mar 2026 00:53:15 -0700 (PDT) Received: from [10.204.101.77] ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b08368ea1bsm210836495ad.68.2026.03.25.00.53.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 25 Mar 2026 00:53:15 -0700 (PDT) Message-ID: <4a81a54d-2dc5-476c-82ed-9481aee8515b@oss.qualcomm.com> Date: Wed, 25 Mar 2026 13:23:11 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3] media: iris: add FPS calculation and VPP FW overhead in frequency formula To: Vishnu Reddy , 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 References: <20260325-update_fps_calculation-v3-1-b2ec654f7e4d@oss.qualcomm.com> Content-Language: en-US From: Vikash Garodia In-Reply-To: <20260325-update_fps_calculation-v3-1-b2ec654f7e4d@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzI1MDA1NCBTYWx0ZWRfXy9ZaLcKe9wo8 8YT5nPxgasRnl6EeNOMT4Kfk6BNGZ2Vu3KYxiGqFmpOj4NGMg2e4NH1b/VEdH+tejqLDi3GvQWb JlUXIZC5ahNGo8G6u/ORPzROMnsrwXlawtt3oaXoz+IVK7Wr9Qd6aSoqW5ZSjzsraSpZHNYy6qo AxCqlxxtFAp12mk/ResT3MTVADhlt363HEjhgxdR6iLUfGvE+bBCfLYe6WHTPQYjd5+XTkxTddJ qRpxwRh8evrHBUpvnvGY1MmcTgvwvQ8ZT1U47XFCYaTjLjZgx/RWLyM2TsLNO6/fE2VXiJIt/uR wchoEQ8o1tqdPu05mGh5CZWqCINA9iZZXCTPrgCLN3BkGUZf9I53wO3fup0/g84V1myR2PYiHLg iMgEgZCO2gz97dg2FAfut39gWVL5oODkcWr/TLW5E5XSvRDfDOK1ulh6pjD942Ex6ptgwUWylYK 2/qwJZ8RRMezLXkL+gg== X-Authority-Analysis: v=2.4 cv=VODQXtPX c=1 sm=1 tr=0 ts=69c3946d cx=c_pps a=IZJwPbhc+fLeJZngyXXI0A==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_glEPmIy2e8OvE2BGh3C:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=zq2kz8iOUWQeT6CNkjIA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=uG9DUKGECoFWVXl0Dc02:22 X-Proofpoint-GUID: X32fkxKSokgi_qYiY78PkkVziCVE73Ke X-Proofpoint-ORIG-GUID: X32fkxKSokgi_qYiY78PkkVziCVE73Ke 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-25_02,2026-03-24_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 lowpriorityscore=0 malwarescore=0 phishscore=0 priorityscore=1501 spamscore=0 impostorscore=0 clxscore=1015 adultscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603250054 On 3/25/2026 9:58 AM, Vishnu Reddy wrote: > The driver was using a fixed default FPS value when calculating the VPU > frequency. This caused wrong frequency requests for high‑frame‑rate > 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 v3: > - Updated the frame_count condition check > - Link to v2: https://lore.kernel.org/r/20260305-update_fps_calculation-v2-1-e3b5cccb1246@oss.qualcomm.com > > 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/media/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; s/last_buf_recv_time_ns/last_buf_ns > + u32 frame_count; s/frame_count/frame_counter > u32 frame_rate; > u32 operating_rate; > u32 hfi_rc_type; > diff --git a/drivers/media/platform/qcom/iris/iris_vdec.c b/drivers/media/platform/qcom/iris/iris_vdec.c > index 719217399a30..6d982802e5d4 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; > > + inst->frame_count = 0; > + > return iris_process_streamon_input(inst); > } > > @@ -411,6 +413,7 @@ int iris_vdec_qbuf(struct iris_inst *inst, struct vb2_v4l2_buffer *vbuf) > { > struct iris_buffer *buf = to_iris_buffer(vbuf); > struct vb2_buffer *vb2 = &vbuf->vb2_buf; > + u64 cur_buf_recv_time_ns, time_delta_ns; > struct vb2_queue *q; > int ret; > > @@ -427,6 +430,24 @@ int iris_vdec_qbuf(struct iris_inst *inst, struct vb2_v4l2_buffer *vbuf) > return 0; > } > > + if (buf->type == BUF_INPUT) { > + cur_buf_recv_time_ns = ktime_get_ns(); s/cur_buf_recv_time_ns/cur_buf_ns > + > + if (!inst->frame_count) { > + inst->last_buf_recv_time_ns = cur_buf_recv_time_ns; > + inst->frame_rate = MAXIMUM_FPS; move this to default initialization > + } > + time_delta_ns = cur_buf_recv_time_ns - inst->last_buf_recv_time_ns; > + > + if (time_delta_ns >= NSEC_PER_SEC) { > + inst->frame_rate = clamp_t(u32, inst->frame_count, DEFAULT_FPS, > + MAXIMUM_FPS); > + inst->last_buf_recv_time_ns = cur_buf_recv_time_ns; drop this > + inst->frame_count = 0; > + } > + inst->frame_count++; move this above IF block, so that the reset of inst->last_buf_recv_time_ns can be handled in first IF block > + } > + > iris_scale_power(inst); > > return iris_queue_buffer(inst, buf); > diff --git a/drivers/media/platform/qcom/iris/iris_vpu_common.c b/drivers/media/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_inst *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 = DEFAULT_FPS; > + u32 fps = inst->frame_rate; > > width = max(inp_f->fmt.pix_mp.width, inst->crop.width); > height = max(inp_f->fmt.pix_mp.height, inst->crop.height); > @@ -435,6 +435,10 @@ u64 iris_vpu3x_vpu4x_calculate_frequency(struct iris_inst *inst, size_t data_siz > if (inst->fw_caps[PIPE].value > 1) > vpp_cycles += div_u64(vpp_cycles * 59, 1000); > > + /* 1.05 is VPP FW overhead */ > + if (inst->fw_caps[STAGE].value == STAGE_2) > + vpp_cycles += mult_frac(vpp_cycles, 5, 100); > + > vsp_cycles = fps * data_size * 8; > vsp_cycles = div_u64(vsp_cycles, 2); > /* VSP FW overhead 1.05 */ > > --- > base-commit: f505e978d1a0442adbbde48aed38c084ddea6d6e > change-id: 20260304-update_fps_calculation-98ee7f7507b1 > > Best regards,