[media] solo6x10: just pass frame motion flag from hardware, drop additional handling...
authorAndrey Utkin <andrey.utkin@corp.bluecherry.net>
Wed, 5 Nov 2014 20:11:14 +0000 (17:11 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 23 Dec 2014 12:27:12 +0000 (10:27 -0200)
Dropping code (introduced in 316d9e84a72069e04e483de0d5934c1d75f6a44c)
which intends to make raising of motion events more "smooth"(?).

It made motion event never appear in my installation.
That code is complicated, so I couldn't figure out quickly how to fix
it, so dropping it seems better to me.

Another justification is that anyway application would implement
"motion signal stabilization" if required, it is not necessarily kernel
driver's job.

Signed-off-by: Andrey Utkin <andrey.utkin@corp.bluecherry.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c
drivers/media/pci/solo6x10/solo6x10.h

index 6e933d383fa2b7d4066611072093b1ab01365928..1c9688f58c5c585291a0e59e0ba21d6b23c2102b 100644 (file)
@@ -239,8 +239,6 @@ static int solo_enc_on(struct solo_enc_dev *solo_enc)
        if (solo_enc->bw_weight > solo_dev->enc_bw_remain)
                return -EBUSY;
        solo_enc->sequence = 0;
-       solo_enc->motion_last_state = false;
-       solo_enc->frames_since_last_motion = 0;
        solo_dev->enc_bw_remain -= solo_enc->bw_weight;
 
        if (solo_enc->type == SOLO_ENC_TYPE_EXT)
@@ -529,36 +527,12 @@ static int solo_enc_fillbuf(struct solo_enc_dev *solo_enc,
        }
 
        if (!ret) {
-               bool send_event = false;
-
                vb->v4l2_buf.sequence = solo_enc->sequence++;
                vb->v4l2_buf.timestamp.tv_sec = vop_sec(vh);
                vb->v4l2_buf.timestamp.tv_usec = vop_usec(vh);
 
                /* Check for motion flags */
-               if (solo_is_motion_on(solo_enc)) {
-                       /* It takes a few frames for the hardware to detect
-                        * motion. Once it does it clears the motion detection
-                        * register and it takes again a few frames before
-                        * motion is seen. This means in practice that when the
-                        * motion field is 1, it will go back to 0 for the next
-                        * frame. This leads to motion detection event being
-                        * sent all the time, which is not what we want.
-                        * Instead wait a few frames before deciding that the
-                        * motion has halted. After some experimentation it
-                        * turns out that waiting for 5 frames works well.
-                        */
-                       if (enc_buf->motion == 0 &&
-                           solo_enc->motion_last_state &&
-                           solo_enc->frames_since_last_motion++ > 5)
-                               send_event = true;
-                       else if (enc_buf->motion) {
-                               solo_enc->frames_since_last_motion = 0;
-                               send_event = !solo_enc->motion_last_state;
-                       }
-               }
-
-               if (send_event) {
+               if (solo_is_motion_on(solo_enc) && enc_buf->motion) {
                        struct v4l2_event ev = {
                                .type = V4L2_EVENT_MOTION_DET,
                                .u.motion_det = {
@@ -568,8 +542,6 @@ static int solo_enc_fillbuf(struct solo_enc_dev *solo_enc,
                                },
                        };
 
-                       solo_enc->motion_last_state = enc_buf->motion;
-                       solo_enc->frames_since_last_motion = 0;
                        v4l2_event_queue(solo_enc->vfd, &ev);
                }
        }
index bd8edfa319b80e5b878dc2c2611075b858b0da28..6c9bc707773f3be13c05ef41d8ca5d2e2610b934 100644 (file)
@@ -159,8 +159,6 @@ struct solo_enc_dev {
        u16                     motion_thresh;
        bool                    motion_global;
        bool                    motion_enabled;
-       bool                    motion_last_state;
-       u8                      frames_since_last_motion;
        u16                     width;
        u16                     height;