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 9C40D3FA5EF for ; Tue, 31 Mar 2026 14:59:52 +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=1774969194; cv=none; b=dKoLJlyX+w9pQIX6m3r0NVpBgGN+ViPoAv7WxWUoeZgnGpnmxTqhONKA54j2M9JivfSzveNoveIl8KDjvU+BrN9Nif1TU93OF0YMUGkD/VhyKEf/Zwl8NCRHeAW1DZmJ8lJTRp9h4XUXg2fhNkgu/g6MAarutYhyW7+DB/MJ+xA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774969194; c=relaxed/simple; bh=QiRxrqei+K6PaiikKThBiLEJm1XZe0nj7yVJVMtDQDw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=JhTBV6PBajY65MVO4jPoHW38jT55rs05c3+EkhiM6vtyz5k4di+F13UNRxcSoZPVwBTznKB9lLKdI2LAvxyt1UAa16t0/qAkv0BchKoBbWI4XncV9n/MUgQhGMphA8FER4a2Txz+dEcmZxFr4HpPhdeIax6oiNKvYrlpycfpwAU= 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=HZ8FILzD; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=KTfXhVua; 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="HZ8FILzD"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="KTfXhVua" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62VDBLd92465798 for ; Tue, 31 Mar 2026 14:59:51 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= VYap/Rv76WurwaOPbgF1n3XsyyM1ysQ/R5Pd/s9WDMc=; b=HZ8FILzDjzCkuwB6 JAsA472f66du0rj7tVRsSezzIuRtaofPg65vUdRhykUpJX7P3oVkBHfVzlfbxY+9 Cn0SyRnh/JFhckfk0XBxWQflLTqRrZfNHizkvKEi2eR7ti7hYLpXTr1vDvqQLuAt XLQ7JrZwp6xm8rI9eZvk1LlGiYa6KiGBpe9q7HUB2bPdX7e0Vg7stcZ4plTIMbA0 yeNeHaiNhejmF5oKpJueeQ2mSU0db2Wh/oB4mUuP//bJSGdnCqeKBOEp9WbPzLoR bAyr5+BHX4iSCh0hl65pL7Ncy8ZKv7ZOPv3qyXhcIDcwMWyQp4bG35ZVtduax+UE lmiQFQ== Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4d89ut9yhw-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 31 Mar 2026 14:59:51 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-2b0bf2b3879so189788975ad.1 for ; Tue, 31 Mar 2026 07:59:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1774969190; x=1775573990; 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=VYap/Rv76WurwaOPbgF1n3XsyyM1ysQ/R5Pd/s9WDMc=; b=KTfXhVua2nDCjYVt74sj8DzPB8K3Sc00wOkMFLl1DBq2ya4UNEm/joZ2ijNFIinog3 u8+N/97rFsMYtz/Y4VUV6BZ2aLvdP9tBWcBfQEyrBlsb/O6h1mMUC5qnVO12hJGrzMJB +IPbmS1VUAMa8EK8T58/2uqLts2EoUIjuSkK/KGEVLoc+lAQJkIANeNtrPi64Ud8bMpw lse1c93hk0u3GCQiU0xNPfl2a8M5QJyHaWAvWnjH0GyT1wvQpbSVmpbMYUcF43zhYXL3 dz/yBIBqvkZ8ihL4TRSOOHkuz4tAEDv7pyIDmxZ7r06tDg5eNlYXydHgBYNfBdGi+uns u+5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774969190; x=1775573990; 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=VYap/Rv76WurwaOPbgF1n3XsyyM1ysQ/R5Pd/s9WDMc=; b=O+XW/Gdknt2EqxGcY4tCEEEws3McMGmEpE80+bZUiXHjZr2WeMe2LVdWzndABCMyFK 4obWAKFwibHz8iJ7nS/RTurQGvSTOWzzUUemcjMNALWtjn/MhDdh7vkaG6b8+TULn24+ yMDM9bHvR7MdbSb1SZQEZVZLd9YPCTwrHJ0O5gY/pTCpn3CEoLOzrAdf+QplA/CA9SBZ 2DVhlRg2s7/i9L3iofUXy+JWiO/BL3+kkMlrcLH7B0vL1vxUsNqP5p4G4RNd74VdptJq ZBQNdVK3fQ6+YualjbReBgLEqiSFR6fjv3aUd3dy9kGVGUKgCmk7xYk0ZFxLVtIQFhMn N/Mg== X-Forwarded-Encrypted: i=1; AJvYcCXw+A5TF/Fq9MU0OyQ+kiqaWFKGG+ByJdVVSrEFa846vRe2VR2Za+t6eHcA2XIe8uwugx5AVEi6cpA4pic=@vger.kernel.org X-Gm-Message-State: AOJu0YzXNFHezA0dgcV9JGMJkmSL5tLjGbvyH5B+ZFUIKSCsLh7fR1LZ wvTrGkIlr+Pi+IEBd58MBb17X+FixFjt0PjxdZua2a1tWULIOX9PhtLe+N+PtVUXXwqzdxhqIEH k+PNdTQwftFRwzoncS/63VIGsXki9As/z1VZ6GSo981iv/beoDa10oItfOtnFa07bckHPEAILsl I= X-Gm-Gg: ATEYQzy2aIXU27Wtb6ANcDP1CNnEcKu64FMrYmmq/mKSuM9e6ILoRdPd4hWolP4RAHd aRiuTpXkJwJ/XeBwZW+ILPR93q4nN3eTkzNBK6NokmAGVtedh7pNIgdHB/pHbqScxeqexXn6eMo z3U5hnnNhnPDlkhsP2RFrJ3HOUmBVNSnlJmjw/2psxTFH9186meSzCmJE9oCWi16rNf7iqjHHaW /ISswZsZnYvb5lOD0/IR7wyoRpXXZ7ZLm0hEoY16vRMCykldpRiGH7sj6wT4/DvOrH2qK5z7hzC DsaF5AnI0Kimsd+qpoOATKQEDyneC6KC8YRAPh0Sj51mEvHu4lO14t9Bpvo2xNcvQOSTt8yBuUH k8aNNp7wKe/1imCGjAkwoU4a+Btxh2SHqSwUdF38QkH24k/OTmOE= X-Received: by 2002:a17:903:290:b0:2b2:51ed:4522 with SMTP id d9443c01a7336-2b251ed580emr95262815ad.47.1774969190461; Tue, 31 Mar 2026 07:59:50 -0700 (PDT) X-Received: by 2002:a17:903:290:b0:2b2:51ed:4522 with SMTP id d9443c01a7336-2b251ed580emr95262455ad.47.1774969189919; Tue, 31 Mar 2026 07:59:49 -0700 (PDT) Received: from [192.168.0.5] ([49.205.255.13]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b2427b3bfdsm147188725ad.75.2026.03.31.07.59.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 31 Mar 2026 07:59:49 -0700 (PDT) Message-ID: Date: Tue, 31 Mar 2026 20:29:43 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH v4] media: iris: add FPS calculation and VPP FW overhead in frequency formula To: Bryan O'Donoghue , Vikash Garodia , Dikshita Agarwal , Abhinav Kumar , 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-v4-1-13728c0065ff@oss.qualcomm.com> <09993b18-157a-48b9-afdc-150697b660f3@kernel.org> Content-Language: en-US From: Vishnu Reddy In-Reply-To: <09993b18-157a-48b9-afdc-150697b660f3@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Proofpoint-ORIG-GUID: C7k7kKDozV3cbqvuK2_MYWkagKokk5F4 X-Authority-Analysis: v=2.4 cv=C5LkCAP+ c=1 sm=1 tr=0 ts=69cbe167 cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=oBuh6LqfVrjb6oiH9OVomg==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=StC7ZdNPSmHupGmBuFAA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=1OuFwYUASf3TG4hYMiVC:22 X-Proofpoint-GUID: C7k7kKDozV3cbqvuK2_MYWkagKokk5F4 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzMxMDE0NSBTYWx0ZWRfXwsv1obzz0Wf/ LNvXnGYOwWnH/R0MTkbyIRS6aPNA07hWcnHCZedOjnGgpUKfBjECfzWSolV9SM5a3h47zeygAcl imiQY5lYrJy3rbr0UU5+FDmtEhQiuGNtVJEP4zOCZ7muhkvI+0v4xyxvH8f2A+Cw1CHqSCVrnXc v/+goFfdwiDuGRlb10d+yGP35U6bK54dUpnCW76jrdUGbdtFL29ddehlQZ05kjDo/UETixTgwU6 Ntfesy1QYDXbwT+UnS7sf23wRsxCb7rCLj3JWN8MXDQ3sYlZgq6IV6Kr3nwlUBx9Xtx7rFMQeYD EW8KHBJeYoyVjeqBQTL0evoGmOPMCDJMaHUgeT3B2l2bhrZvvGdrj6XozqfaI+3y5CnyhKR82z+ z3QgIaNvj09qI58zocnfWvpCZ+RGTdYfRZZcIBFCRDfiQY35VEjIIzl7wSBqyIaNHYZditfCN0h oCmdBz0GcXD3uG6RG1A== 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-31_03,2026-03-31_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 clxscore=1015 malwarescore=0 bulkscore=0 suspectscore=0 lowpriorityscore=0 adultscore=0 phishscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603310145 On 3/31/2026 7:45 PM, Bryan O'Donoghue wrote: > On 25/03/2026 16:35, 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 v4: >> - Renamed the variable names (Vikash Garodia) >> - Updated the fps calculation logic (Vikash Garodia) >> - Link to v3: >> https://lore.kernel.org/r/20260325-update_fps_calculation-v3-1-b2ec654f7e4d@oss.qualcomm.com >> >> Changes in v3: >> - Updated the frame_count condition check (Vikash Garodia) >> - 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 (Konrad Dybcio) >> - 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       | 20 >> ++++++++++++++++++++ >>   drivers/media/platform/qcom/iris/iris_vpu_common.c |  6 +++++- >>   3 files changed, 27 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..a47cd949645f 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_ns; >> +    u32                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..7fb45df37db6 100644 >> --- a/drivers/media/platform/qcom/iris/iris_vdec.c >> +++ b/drivers/media/platform/qcom/iris/iris_vdec.c >> @@ -54,6 +54,7 @@ int iris_vdec_inst_init(struct iris_inst *inst) >>       f->fmt.pix_mp.quantization = V4L2_QUANTIZATION_DEFAULT; >>       inst->buffers[BUF_OUTPUT].min_count = iris_vpu_buf_count(inst, >> BUF_OUTPUT); >>       inst->buffers[BUF_OUTPUT].size = >> f->fmt.pix_mp.plane_fmt[0].sizeimage; >> +    inst->frame_rate = MAXIMUM_FPS; >> >>       memcpy(&inst->fw_caps[0], &core->inst_fw_caps_dec[0], >>              INST_FW_CAP_MAX * sizeof(struct platform_inst_fw_cap)); >> @@ -369,6 +370,8 @@ int iris_vdec_streamon_input(struct iris_inst *inst) >>       if (ret) >>           return ret; >> >> +    inst->frame_counter = 0; >> + >>       return iris_process_streamon_input(inst); >>   } >> >> @@ -411,6 +414,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_ns, delta_ns; >>       struct vb2_queue *q; >>       int ret; >> >> @@ -427,6 +431,22 @@ int iris_vdec_qbuf(struct iris_inst *inst, >> struct vb2_v4l2_buffer *vbuf) >>           return 0; >>       } >> >> +    if (buf->type == BUF_INPUT) { >> +        cur_buf_ns = ktime_get_ns(); >> + >> +        if (!inst->frame_counter) >> +            inst->last_buf_ns = cur_buf_ns; >> + >> +        inst->frame_counter++; >> +        delta_ns = cur_buf_ns - inst->last_buf_ns; >> + >> +        if (delta_ns >= NSEC_PER_SEC) { >> +            inst->frame_rate = clamp_t(u32, inst->frame_counter, >> DEFAULT_FPS, >> +                           MAXIMUM_FPS); >> +            inst->frame_counter = 0; >> +        } >> +    } >> + >>       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, >> -- >> Vishnu Reddy >> >> > > Please fix your doxygen. > > [[ATTACHMENT|junit/test-kernel-doc.log.txt]] > 4 warnings as errors > Warning: drivers/media/platform/qcom/iris/iris_instance.h:124 struct > member 'last_buf_ns' not described in 'iris_inst' > Warning: drivers/media/platform/qcom/iris/iris_instance.h:124 struct > member 'frame_counter' not described in 'iris_inst' > Warning: drivers/media/platform/qcom/iris/iris_instance.h:124 struct > member 'last_buf_ns' not described in 'iris_inst' > Warning: drivers/media/platform/qcom/iris/iris_instance.h:124 struct > member 'frame_counter' not described in 'iris_inst' > > > System Err: > > [[ATTACHMENT|junit/test-kernel-doc.err.txt]] > Warning: drivers/media/platform/qcom/iris/iris_instance.h:124 struct > member 'last_buf_ns' not described in 'iris_inst' > Warning: drivers/media/platform/qcom/iris/iris_instance.h:124 struct > member 'frame_counter' not described in 'iris_inst' > Warning: drivers/media/platform/qcom/iris/iris_instance.h:124 struct > member 'last_buf_ns' not described in 'iris_inst' > Warning: drivers/media/platform/qcom/iris/iris_instance.h:124 struct > member 'frame_counter' not described in 'iris_inst' > Ack Vishnu Reddy. > --- > bod