Hi Tomi, On Fri, Apr 22, 2022 at 09:41:51AM +0300, Tomi Valkeinen wrote: > On 22/04/2022 02:52, Laurent Pinchart wrote: > > On Thu, Apr 21, 2022 at 05:34:47PM +0300, Tomi Valkeinen wrote: > >> The userspace needs a way to match received metadata buffers to pixel > >> data buffers. The obvious way to do this is to use the CSI-2 frame > >> number, as both the metadata and the pixel data have the same frame > >> number as they come from the same frame. > >> > >> However, we don't have means to convey the frame number to userspace. We > >> do have the 'sequence' field, which with a few tricks can be used for > >> this purpose. > >> > >> To achieve this, track the frame number for each virtual channel and > >> increase the sequence for each virtual channel by frame-number - > >> previous-frame-number, also taking into account the eventual wrap of the > >> CSI-2 frame number. > >> > >> This way we get a monotonically increasing sequence number which is > >> common to all streams using the same virtual channel. > > > > I'd agree in principle, if it wasn't for the fact that sensors are not > > required to produce a frame number :-S > > In that case the CAL hardware will increment the register every frame. > From CAL doc: > > Frame number. > Matches the frame number sent by the camera when the > camera transmits it. > Otherwise, incremented by one on every FS short packet > for this context. Is that only when the FS packet contains a frame number equal to 0 ? How about the extreme case where the frame number counts up to 2 and resets to 1, effectively toggling between 1 and 2 ? Does your patch support this correctly ? > Reset when the context is enabled. > > I'll add a note about that to the desc. -- Regards, Laurent Pinchart