From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=205.220.180.131 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796139590; b=kSFM7dVQr3juRLgHH+AcatUQ2M6mu4cLJNczvOzvjLQFHfxWkBuIWfKPCDiaN2jKtmmj 0mS4CBdnqHyXyBEl8stXDbm7VRYtz9xxT9OGm45/zndlIqE5wyWaOAmdZePWF/9IklpRr UyRJMsp+QRZRQ2Y4bDRStcUZADfZkxGMKDQYr00McKEqpXwlg/dkt6R4LnzUrId4BpybC zMUEkp3kNcJcQpKQbMAsOy6A/gi8ZB8Mty0ycBQAnFOwhDTQ6JFHH/XHGlg9kifSGhQFX jooAqAozEyerOw0zNtnkGPWkJdTiG79jpPF79Mo0gv/BP765hYrqW6hbt5JzbIVzR/g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796139590; h=DMARC-Filter:Received:DKIM-Signature:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:X-Received:Received:Message-ID: Date:MIME-Version:User-Agent:Subject:To:Cc:References: Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding:X-Proofpoint-Spam-Details-Enc: X-Authority-Analysis:X-Proofpoint-Spam-Info:X-Proofpoint-GUID: X-Proofpoint-ORIG-GUID:X-Proofpoint-Virus-Version: X-Proofpoint-Spam-Details; bh=r7Rufwe9p9G/vERMIcEAUl8MIGUBFVl7ZbVDIr9yoxc=; b=UGm5C3Ek2Et8mSfUhn2m4S/2ic2QZ8SG9/LN7yHNf+E1qAdxrVHnkqZ3ELxMJHTbNhpL kRxIr17IaJyXxafIIXh8crGhI3JzdstB3NlfFBp+8hCwhQC5ZxJJGDK4KvEabAXrEIvUc KtHq3jhYY6w0llA0EViWqCT4DHdDA+ZnYGJ07BKUal31CsolgyBOqOy9vcTkQ4HaXove4 jroFESw8AXwqkhMX3lxFgXxaroA8wy9ix1b30uTTDVt0MJpm8h2VAvCmKV0XFOlnLp91K EgWEuua9aQx1PYAtLxVB//l3+NUgDz1+xh/HcSswIX5v+NX5cdamlGmyyCeuu5Zcz3g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=BDZlxs7T; dkim=pass header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=UpGo1OKe; arc=none smtp.remote-ip=205.220.180.131 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 32925606A31A for ; Tue, 1 Dec 2026 15:39:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 32925606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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.a=rsa-sha256 header.s=qcppdkim1 header.b=BDZlxs7T; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=UpGo1OKe Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B1F7WsB2102161 for ; Tue, 1 Dec 2026 15:39:49 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= r7Rufwe9p9G/vERMIcEAUl8MIGUBFVl7ZbVDIr9yoxc=; b=BDZlxs7TsPvsN0g4 pmSdQsnGkeAO37gU3C3mNBXzSEMxf84jWRc191x04j+qmcspA1BBmaP2Ysh/JYVk y4SHPSZNwigIU5PrM/4xcBSYx7uvhGkO64xIMFvOfGO9feqQRZbfz+BQap+qUhYb O+2avVGaFaZ3AUuYRezXKr0EfPe1jRzjdEOFEs6l8eg3YIxlPrNaEFkTsOPYDe20 A5R+EJxJMdQU/mW4sqRg4WGD3XKauT2yblR7X36POvUPtGuPoU8hVZxk75ASneP7 0lam7wDecIXrBnIFgyUGyCrGI+zMaa3NbAPGM3GHVb9v6ib4Fdl8/0AJdR7orRNP 4VlgsA== Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j9qn4tjwc-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 01 Dec 2026 15:39:49 +0000 (GMT) Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-93909014c85so363167085a.0 for ; Tue, 01 Dec 2026 07:39:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1796139588; x=1796744388; darn=vger.kernel.org; h=content-transfer-encoding:content-type: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 :content-type; bh=r7Rufwe9p9G/vERMIcEAUl8MIGUBFVl7ZbVDIr9yoxc=; b=UpGo1OKep4Q4UYvz4DUOlJLoT29zAQj6CxbBCMz5zqtgTJpSjhq/+qNiWuwv/mD+Ig tqouPWF4iHMIMN14GkRtsjgeAFK4U9t4ldZGaPYRN1z9gx+8YgTL9bc2ltMgUSJKJB2+ +Gv7Y37ouVcRvcyYQTIgPhm1c2I8MoOB6z2WgG1CVgnkS/iEjx9AphGofoOVmH1VL1A/ lfoMMFd08rtleWCLMMMVoByiR1QMoohwQxe3zWJq+h5JdEokX5VXMOwV1l9sQqAkuZC8 gua9H1z94qrZGu8blq8DAh7eevtCBzlO2W4Tt0nD6hQdPaz7kuAPu4NIVlLZK+wEiswQ /32Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796139588; x=1796744388; h=content-transfer-encoding:content-type: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:content-type; bh=r7Rufwe9p9G/vERMIcEAUl8MIGUBFVl7ZbVDIr9yoxc=; b=zjWeJp6yqa+++YAuPjx/b5yrrfbMzMnivG9xd2qsOWbA3I4E90iaeojt1zi9pPUpzx mFiWJ/7C2LpaIDnhiEQ0oQB+/cU5Flly2S2K69A9oYnlv1mVZwGALxhsm7RYZV6kSpzy Oqk60PtIsNA2KAvUWWAORTFMYUPRsPakXQA0mW5QwhVFhCUn184u2EM7Tpu7tiTIIayq 1/j1YKyb9oz7R+0tDgHqCXNm19OlsJCeo8iiiNwQhryBZtydGWQwzpuFiCQNHcGdlfkB 9lFV7eIaCfy71YU8cjQeD2vibSS1YE0FtEuslvuCtl9zrGAZbs6KAAzkbF4+pMOvjzcQ KYEA== X-Forwarded-Encrypted: i=1; AL+hErG+RKXn+RmTDS5eAi90jcxz9XDdyM1d1EUIYdmYS+7pX7hD8iCkQ9KHyjYXwOanXhkf1pxzPkhoJ8YJ7aE=@vger.kernel.org X-Gm-Message-State: APuU4Z8bHJXA4Xl/C5izKOaVQcbGwJutsS1cVfaS08gxXVoOKalaID4G yzn86xymGMm/CjCcRzYmcY/MhpkBCwZVoeb5i2lK69SKffibTeBPr4c297CC6jg0G8B2wsbR71g QbRO2uyKnp4B/Ql391Zb5DluVC70Y8QVR3ZRpemv6ARWjTyq3ruYs4nynupszfkAFwIw= X-Gm-Gg: AZFdTZdSFVQXqttVZHtPme+kyRoo/aqs7P9VH2T0bR9+zLmDRIxjlM4jHWDFVbS7+FA uWgq4ZN3eRr1mbSFJ+HYh3Ov9aLyv2LVVtm04GOVJFu+z+chAkDvgZo5Doku/xjJdfQiwrk8FLf 9nvM53dVxbomnFdD6WxF/Io0rfy4jYrfEuUZD+m4TKWDVs6vZnpk7XsEu/u/l5eEncFj8wPECvP 1uvk/GmgIHZlqqYVsyPaneoeGT++AoA9mNB1arOYfvtJqSg3fUwlZQyHSw+EeSjWG6bLppRlzeW zBl7gtV3c1f0qYwKzCyM6lT4HO/bmYHitYgDB+X0H4MA3z9QFJZlCjmeDrjfKnk85qCpQIECPFg 95lH/NQT8cGlCT3yHuJAt7jkl4BnXAr3Q7N1JWd3rJ4eg+40cYjL3VlucCx/i/orHAmYbNhp/Nz T68Od8VFAxwV5n X-Received: by 2002:a05:620a:f04:b0:949:3ba5:15d1 with SMTP id af79cd13be357-949ba8239b2mr6819973885a.4.1796139588354; Tue, 01 Dec 2026 07:39:48 -0800 (PST) X-Received: by 2002:a05:620a:f04:b0:949:3ba5:15d1 with SMTP id af79cd13be357-949ba8239b2mr6819965885a.4.1796139587687; Tue, 01 Dec 2026 07:39:47 -0800 (PST) Received: from [192.168.25.64] ([94.155.124.210]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4b1ed8b6a05sm46608816f8f.43.2026.12.01.07.39.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Dec 2026 07:39:46 -0800 (PST) Message-ID: <804c1f0b-35cd-4a82-b67c-8c6397db8ab8@oss.qualcomm.com> Date: Tue, 1 Dec 2026 17:39:45 +0200 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 7/8] media: qcom: camss: Timestamp buffers at start of frame To: Loic Poulain Cc: Mauro Carvalho Chehab , Bryan O'Donoghue , Vladimir Zapolskiy , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org References: <20261127-camss-hw-ts-v3-0-e4b6ad98ce9c@oss.qualcomm.com> <20261127-camss-hw-ts-v3-7-e4b6ad98ce9c@oss.qualcomm.com> Content-Language: en-US From: "Gjorgji Rosikopulos (Consultant)" In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAxMDA2MiBTYWx0ZWRfXzY7k+msIRQWh AOZRRVBLry2QicQFYNt5tTmPHk61pdPj8mzY1LQiaVAGBd2EhlcnwaLZ33rRCD4Kf+X/1z8Ayqf 2JrWxfjRTH2C6zmjRw+tgG/c5RZisfzwQ04wkyMEf5NLAosRqyh73NTSA0+AVPYzvfhMHWFUO5i 5+y2blb3bxwf9xYEK3t/4C5EmElR4HVp+0h2So20QhoZ+PGxamTbwtgoMpfzU8u/12zEeWHwl/J M/j5Ya+gCe9/O7WfbrAkM7KrnDdL+l3Wka7HtB8ZtTrFAwOErn+IAkXgyAwcbGmY0yYLa9w5qid TYh3E3EMCepV2PwCn33mQqGhF/OBwdWogNA/o6OPIWEaOg1yeN5T+0+eOy3C0ebRKCPmHBgRt+D qFkqlmYOoBOcMc0spINJRukA+zVGuFzePjTeHwLF2T8gtuXgjsreYCDgB0po7OKBkbVrK23FcGZ IFrGJt6fDwKcsnwpFAg== X-Authority-Analysis: v=2.4 cv=JoBkP84C c=1 sm=1 tr=0 ts=6b0eea45 cx=c_pps a=qKBjSQ1v91RyAK45QCPf5w==:117 a=eGCDHFSXubCXFTSSGhjuOA==:17 a=IkcTkHD0fZMA:10 a=pUM-KoujPXoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8 a=FWftoctxMarcwIXdQpcA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=NFOGd7dJGGMPyQGDc5-O:22 X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAxMDA2MiBTYWx0ZWRfX3v8/3/VPzWqD cy/55gRnzgMwNkELljLinNf3VwyrnkaS+xaLu5VZWm99kM0lVaMrp2ew17A48gjlGAJSm0+SJg/ clP4gEQ1kI8hFKn+bhF3NmpBboejPHc= X-Proofpoint-GUID: DlWohZK_ztZEP48MkdlENIeO0gyj-0mu X-Proofpoint-ORIG-GUID: DlWohZK_ztZEP48MkdlENIeO0gyj-0mu X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-12-01_03,2026-12-01_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 clxscore=1015 phishscore=0 suspectscore=0 spamscore=0 bulkscore=0 malwarescore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612010062 Hi Loic, On 12/1/2026 4:41 PM, Loic Poulain wrote: > On Tue, Dec 1, 2026 at 12:53 PM Gjorgji Rosikopulos (Consultant) > wrote: >> >> Hi Loic, >> >> On 11/27/2026 6:11 PM, Loic Poulain wrote: >>> Buffers are stamped from the write master done interrupt, once the frame >>> has been written out to memory, while V4L2 defines vb2_buf.timestamp as >>> the time the first data byte was captured. Use the SOF time the CSID >>> already computes instead, handed to the VFE the same way as the SOF >>> sequence number. Hardware without SOF tracking keeps using the buf done >>> time. >>> >>> Signed-off-by: Loic Poulain >>> --- >>> drivers/media/platform/qcom/camss/camss-vfe-17x.c | 7 +++++-- >>> drivers/media/platform/qcom/camss/camss-vfe.c | 8 ++++++-- >>> drivers/media/platform/qcom/camss/camss-vfe.h | 1 + >>> 3 files changed, 12 insertions(+), 4 deletions(-) >>> >>> diff --git a/drivers/media/platform/qcom/camss/camss-vfe-17x.c b/drivers/media/platform/qcom/camss/camss-vfe-17x.c >>> index 4972d3ab65078387735ef2e853bf1c9c3d82baee..6b8df1f6e2a731ccd0e739edaa82221c18203f74 100644 >>> --- a/drivers/media/platform/qcom/camss/camss-vfe-17x.c >>> +++ b/drivers/media/platform/qcom/camss/camss-vfe-17x.c >>> @@ -472,7 +472,6 @@ static void vfe_isr_wm_done(struct vfe_device *vfe, u8 wm) >>> struct vfe_output *output; >>> unsigned long flags; >>> u32 index; >>> - u64 ts = ktime_get_ns(); >>> >>> spin_lock_irqsave(&vfe->output_lock, flags); >>> >>> @@ -490,7 +489,11 @@ static void vfe_isr_wm_done(struct vfe_device *vfe, u8 wm) >>> goto out_unlock; >>> } >>> >>> - ready_buf->vb.vb2_buf.timestamp = ts; >>> + if (line->sof_ts) >>> + ready_buf->vb.vb2_buf.timestamp = atomic64_read(line->sof_ts); >>> + else >>> + ready_buf->vb.vb2_buf.timestamp = ktime_get_ns(); >> >> I am not sure that this correct thing to do. WM done can be received >> after the next SOF in pixel path. I think that i have commented this for the sof_seq as well. >> The proper way is during SOF or RUP or EPOC to check what is the current active >> buffer (which is filled) and fill the sequence and timestamp there. > > Probably yes, The assumption here is that, under normal operation, > WM_DONE is received before the next SOF, so the SOF timestamp stored > by CSID still corresponds to the frame being completed. If that > assumption does not hold, then we likely have a more fundamental > scheduling or throughput issue. I am afraid it is not scheduling or throughput issue, it depends on vertical blanking of the sensor and output size of the IFE (IFE has some delay because of the line-buffers). So there is no guarantee that you will receive them always in same order. > > That said, I agree that explicitly associating the timestamp with the > active buffer would be more robust and would avoid relying on this > timing assumption. > > Now, the question is to find a reliable way to identify the currently > active/filling buffer from these events (SOF). > > For example in the sequence you describe we have: > SOF0 SOF1 WM_DONE SOF2 WM_DONE SOF3... > > When processing SOF1, which buffer should be associated with that > timestamp? Is SOF1 received because frame/buffer 0 was dropped, or > because it already corresponds to buffer 1? > > We would need a reliable way to determine which future WM_DONE event > should be associated with a given SOF event before we can safely move > the timestamping logic there. Otherwise, we may simply be moving the > same ambiguity from WM_DONE to SOF. In the ife implementation posted we have used the: bus_wr_addr_status_0 which contains the last consumed address and can be read after buf_done. bus_wr_addr_status_3 which contains the Current buffer address which is filled. With those two you can make association of the buffer filled during the events. Even further you can monitor what is the hw fifo position in respect to the sw queue and keep them in sync if some big delay happens during the irq handling. ~Gjorgji > > Regards, > Loic > > >> >> ~Gjorgji >> >> >>> + >>> if (line->sof_seq) >>> ready_buf->vb.sequence = atomic_read(line->sof_seq); >>> else >>> diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c >>> index f9bd2367671f6e50c6948a6405f78b8c2b03e5f7..ab4edb14ed7486724f12fbd024e0600d70f8355d 100644 >>> --- a/drivers/media/platform/qcom/camss/camss-vfe.c >>> +++ b/drivers/media/platform/qcom/camss/camss-vfe.c >>> @@ -456,7 +456,6 @@ void vfe_buf_done(struct vfe_device *vfe, int wm) >>> struct vfe_output *output; >>> unsigned long flags; >>> u32 index; >>> - u64 ts = ktime_get_ns(); >>> >>> spin_lock_irqsave(&vfe->output_lock, flags); >>> >>> @@ -474,7 +473,11 @@ void vfe_buf_done(struct vfe_device *vfe, int wm) >>> goto out_unlock; >>> } >>> >>> - ready_buf->vb.vb2_buf.timestamp = ts; >>> + if (line->sof_ts) >>> + ready_buf->vb.vb2_buf.timestamp = atomic64_read(line->sof_ts); >>> + else >>> + ready_buf->vb.vb2_buf.timestamp = ktime_get_ns(); >>> + >>> if (line->sof_seq) >>> ready_buf->vb.sequence = atomic_read(line->sof_seq); >>> else >>> @@ -532,6 +535,7 @@ int vfe_enable_output_v2(struct vfe_line *line) >>> >>> csid_pad = media_pad_remote_pad_first(&line->pads[MSM_VFE_PAD_SINK]); >>> line->sof_seq = csid_get_sof_seq(csid_pad); >>> + line->sof_ts = csid_get_sof_ts(csid_pad); >>> >>> spin_lock_irqsave(&vfe->output_lock, flags); >>> >>> diff --git a/drivers/media/platform/qcom/camss/camss-vfe.h b/drivers/media/platform/qcom/camss/camss-vfe.h >>> index c37526caf9a6fc052c3f4ab4215e635167f6da95..8eda4592257169d04027a9a3c45233ac937eecae 100644 >>> --- a/drivers/media/platform/qcom/camss/camss-vfe.h >>> +++ b/drivers/media/platform/qcom/camss/camss-vfe.h >>> @@ -95,6 +95,7 @@ struct vfe_line { >>> const struct camss_format_info *formats; >>> unsigned int nformats; >>> atomic_t *sof_seq; >>> + atomic64_t *sof_ts; >>> }; >>> >>> struct vfe_device; >>> >>