7bffc3cd6503d02cf61b8508a5c4f4379dc850c0
[openwrt/staging/yousong.git] /
1 From ba37d62e7bbdf42c2fa9ac3655354992da199a4b 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 252/806] 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 @@ -409,6 +409,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 @@ -537,6 +538,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 @@ -93,6 +93,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 */