Re: [PATCH v4 09/14] media: qcom: camss: Tell userspace we're using start-of-frame timestamps

From: Gjorgji Rosikopulos (Consultant)

Date: Fri Dec 04 2026 - 03:54:17 EST


Hi Loic,

On 12/3/2026 6:53 PM, Loic Poulain wrote:
> On the SoCs whose CSID can track the start of frame, the buffer
> timestamp is taken when the reception of the frame begins, not once it
> has been written out to memory. Show this to userspace with the
> V4L2_BUF_FLAG_TSTAMP_SRC_SOE buffer flag, the closest the API has to
> offer, it is defined as the start of the exposure, which on a rolling
> shutter sensor precedes the start of the readout by the exposure time
> of the first row.
>
> Signed-off-by: Loic Poulain <loic.poulain@xxxxxxxxxxxxxxxx>
> ---
> drivers/media/platform/qcom/camss/camss-video.c | 2 ++
> drivers/media/platform/qcom/camss/camss.c | 6 ++++++
> drivers/media/platform/qcom/camss/camss.h | 1 +
> 3 files changed, 9 insertions(+)
>
> diff --git a/drivers/media/platform/qcom/camss/camss-video.c b/drivers/media/platform/qcom/camss/camss-video.c
> index 5de6ff5ecc76a2863e536fca1c40ae6b2de6dc0c..4ce87527b9b984068f5c9a9cc3bbdca645cff1d3 100644
> --- a/drivers/media/platform/qcom/camss/camss-video.c
> +++ b/drivers/media/platform/qcom/camss/camss-video.c
> @@ -698,6 +698,8 @@ int msm_video_register(struct camss_video *video, struct v4l2_device *v4l2_dev,
> q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
> q->io_modes = VB2_DMABUF | VB2_MMAP | VB2_READ;
> q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
> + if (camss_has_frame_sync(video->camss))
> + q->timestamp_flags |= V4L2_BUF_FLAG_TSTAMP_SRC_SOE;
> q->buf_struct_size = sizeof(struct camss_buffer);
> q->dev = video->camss->dev;
> q->lock = &video->q_lock;
> diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
> index 26e3f2aa3ef2485e0486eaa89f93b804926b6e32..e60aa29051e71cd70bd3564a01655251ba2f37e6 100644
> --- a/drivers/media/platform/qcom/camss/camss.c
> +++ b/drivers/media/platform/qcom/camss/camss.c
> @@ -4839,6 +4839,12 @@ int camss_get_pixel_clock(struct media_entity *entity, u64 *pixel_clock)
> return 0;
> }
>
> +bool camss_has_frame_sync(struct camss *camss)
> +{
> + /* All the CSIDs of a given SoC have the same capability */
> + return camss->res->csid_res[0].csid.frame_sync_en;
> +}

Maybe shall be moved to global resources. But that was not introduced in this series.
So maybe some cleanup latter.

> +
> int camss_pm_domain_on(struct camss *camss, int id)
> {
> int ret = 0;
> diff --git a/drivers/media/platform/qcom/camss/camss.h b/drivers/media/platform/qcom/camss/camss.h
> index 8154fab54f99b12456cb377dc4ddfcadfcf8278e..da1095c436323639bc0fda5ebac8026a09565108 100644
> --- a/drivers/media/platform/qcom/camss/camss.h
> +++ b/drivers/media/platform/qcom/camss/camss.h
> @@ -177,6 +177,7 @@ struct media_pad *camss_find_sensor_pad(struct media_entity *entity);
> s64 camss_get_link_freq(struct media_entity *entity, unsigned int bpp,
> unsigned int lanes);
> int camss_get_pixel_clock(struct media_entity *entity, u64 *pixel_clock);
> +bool camss_has_frame_sync(struct camss *camss);
> int camss_pm_domain_on(struct camss *camss, int id);
> void camss_pm_domain_off(struct camss *camss, int id);
> int camss_vfe_get(struct camss *camss, int id);

Looks good to me.

Reviewed-by: Gjorgji Rosikopulos <gjorgji.rosikopulos@xxxxxxxxxxxxxxxx>

>