edce12ef10ebac0e1c3904450e51fa743fa575bc
[openwrt/staging/aparcar.git] /
1 From 8e15cefda972657178522ceb72c834ecd6ed9380 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.org>
3 Date: Thu, 21 Jun 2018 17:02:14 +0100
4 Subject: [PATCH 407/454] staging: bcm2835-camera: Set sequence number
5 correctly
6
7 Set the sequence number in vb2_v4l2_buffer mainly so the
8 latest v4l2-ctl reports the frame rate correctly.
9
10 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
11 ---
12 drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c | 4 ++++
13 drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.h | 2 ++
14 2 files changed, 6 insertions(+)
15
16 --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
17 +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
18 @@ -416,6 +416,7 @@ static void buffer_cb(struct vchiq_mmal_
19 }
20 }
21 dev->capture.last_timestamp = buf->vb.vb2_buf.timestamp;
22 + buf->vb.sequence = dev->capture.sequence++;
23
24 vb2_set_plane_payload(&buf->vb.vb2_buf, 0, length);
25 if (mmal_flags & MMAL_BUFFER_HEADER_FLAG_KEYFRAME)
26 @@ -544,6 +545,9 @@ static int start_streaming(struct vb2_qu
27 /* enable frame capture */
28 dev->capture.frame_count = 1;
29
30 + /* reset sequence number */
31 + dev->capture.sequence = 0;
32 +
33 /* if the preview is not already running, wait for a few frames for AGC
34 * to settle down.
35 */
36 --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.h
37 +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.h
38 @@ -96,6 +96,8 @@ struct bm2835_mmal_dev {
39 ktime_t kernel_start_ts;
40 /* Timestamp of last frame */
41 u64 last_timestamp;
42 + /* Sequence number of last buffer */
43 + u32 sequence;
44
45 struct vchiq_mmal_port *port; /* port being used for capture */
46 /* camera port being used for capture */