* [PATCH v2 0/2] Frame synchronisation events and support for them in the OMAP 3 ISP driver
@ 2011-08-02 10:40 Sakari Ailus
2011-08-02 10:40 ` [PATCH v2 1/2] v4l: events: Define V4L2_EVENT_FRAME_SYNC Sakari Ailus
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Sakari Ailus @ 2011-08-02 10:40 UTC (permalink / raw)
To: linux-media@vger.kernel.org
Cc: Hans Verkuil, Sylwester Nawrocki, Laurent Pinchart
Hi all,
This is the second version of the frame synchronisation patchset which
contains fixes based on the comments from Laurent. The patches are on
top of this tree which contains acked patches:
http://linuxtv.org/git/sailus/media_tree.git media-for-3.1-misc-1
Shortlog is available here:
<URL:http://git.linuxtv.org/sailus/media_tree.git/shortlog/refs/heads/media-for-3.1-misc-1>
Changes since the first one:
- Fixed the description of the second patch.
- Clarified the documentation.
- v4l2_event_frame_sync.buffer_sequence renamed to frame_sequence
Changes to the RFC:
- Renamed V4L2_EVENT_FRAME_START to V4L2_EVENT_FRAME_SYNC.
- Removed extra reference to V4L2_EVENT_FRAME_START in documentation; it
is mentioned in the same page struct v4l2_event_frame_sync is related to it.
- The OMAP 3 ISP driver check that the id field is zero in anticipation
of such events.
--
Sakari Ailus
sakari.ailus@iki.fi
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 1/2] v4l: events: Define V4L2_EVENT_FRAME_SYNC
2011-08-02 10:40 [PATCH v2 0/2] Frame synchronisation events and support for them in the OMAP 3 ISP driver Sakari Ailus
@ 2011-08-02 10:40 ` Sakari Ailus
2011-08-02 10:40 ` [PATCH v2 2/2] omap3isp: ccdc: Make frame start event generic Sakari Ailus
2011-08-02 13:44 ` [PATCH v2 0/2] Frame synchronisation events and support for them in the OMAP 3 ISP driver Laurent Pinchart
2 siblings, 0 replies; 4+ messages in thread
From: Sakari Ailus @ 2011-08-02 10:40 UTC (permalink / raw)
To: linux-media; +Cc: laurent.pinchart, hans.verkuil, snjw23
Define a frame sync event to tell user space when the reception of a frame
starts.
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
---
Documentation/DocBook/media/v4l/vidioc-dqevent.xml | 22 ++++++++++++++++++++
.../DocBook/media/v4l/vidioc-subscribe-event.xml | 16 ++++++++++++++
include/linux/videodev2.h | 12 ++++++++--
3 files changed, 47 insertions(+), 3 deletions(-)
diff --git a/Documentation/DocBook/media/v4l/vidioc-dqevent.xml b/Documentation/DocBook/media/v4l/vidioc-dqevent.xml
index 5200b68..e8714aa 100644
--- a/Documentation/DocBook/media/v4l/vidioc-dqevent.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-dqevent.xml
@@ -88,6 +88,12 @@
</row>
<row>
<entry></entry>
+ <entry>&v4l2-event-frame-sync;</entry>
+ <entry><structfield>frame</structfield></entry>
+ <entry>Event data for event V4L2_EVENT_FRAME_SYNC.</entry>
+ </row>
+ <row>
+ <entry></entry>
<entry>__u8</entry>
<entry><structfield>data</structfield>[64]</entry>
<entry>Event data. Defined by the event type. The union
@@ -220,6 +226,22 @@
</tgroup>
</table>
+ <table frame="none" pgwide="1" id="v4l2-event-frame-sync">
+ <title>struct <structname>v4l2_event_frame_sync</structname></title>
+ <tgroup cols="3">
+ &cs-str;
+ <tbody valign="top">
+ <row>
+ <entry>__u32</entry>
+ <entry><structfield>frame_sequence</structfield></entry>
+ <entry>
+ The sequence number of the frame being received.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
<table pgwide="1" frame="none" id="changes-flags">
<title>Changes</title>
<tgroup cols="3">
diff --git a/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml b/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml
index 275be96..5c70b61 100644
--- a/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml
@@ -139,6 +139,22 @@
</entry>
</row>
<row>
+ <entry><constant>V4L2_EVENT_FRAME_SYNC</constant></entry>
+ <entry>4</entry>
+ <entry>
+ <para>Triggered immediately when the reception of a
+ frame has begun. This event has a
+ &v4l2-event-frame-sync; associated with it.</para>
+
+ <para>If the hardware needs to be stopped in the case of a
+ buffer underrun it might not be able to generate this event.
+ In such cases the <structfield>frame_sequence</structfield>
+ field in &v4l2-event-frame-sync; will not be incremented. This
+ causes two consecutive frame sequence numbers to have n times
+ frame interval in between them.</para>
+ </entry>
+ </row>
+ <row>
<entry><constant>V4L2_EVENT_PRIVATE_START</constant></entry>
<entry>0x08000000</entry>
<entry>Base event number for driver-private events.</entry>
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index fca24cc..a5359c6 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -2006,6 +2006,7 @@ struct v4l2_streamparm {
#define V4L2_EVENT_VSYNC 1
#define V4L2_EVENT_EOS 2
#define V4L2_EVENT_CTRL 3
+#define V4L2_EVENT_FRAME_SYNC 4
#define V4L2_EVENT_PRIVATE_START 0x08000000
/* Payload for V4L2_EVENT_VSYNC */
@@ -2032,12 +2033,17 @@ struct v4l2_event_ctrl {
__s32 default_value;
};
+struct v4l2_event_frame_sync {
+ __u32 frame_sequence;
+};
+
struct v4l2_event {
__u32 type;
union {
- struct v4l2_event_vsync vsync;
- struct v4l2_event_ctrl ctrl;
- __u8 data[64];
+ struct v4l2_event_vsync vsync;
+ struct v4l2_event_ctrl ctrl;
+ struct v4l2_event_frame_sync frame_sync;
+ __u8 data[64];
} u;
__u32 pending;
__u32 sequence;
--
1.7.2.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 2/2] omap3isp: ccdc: Make frame start event generic
2011-08-02 10:40 [PATCH v2 0/2] Frame synchronisation events and support for them in the OMAP 3 ISP driver Sakari Ailus
2011-08-02 10:40 ` [PATCH v2 1/2] v4l: events: Define V4L2_EVENT_FRAME_SYNC Sakari Ailus
@ 2011-08-02 10:40 ` Sakari Ailus
2011-08-02 13:44 ` [PATCH v2 0/2] Frame synchronisation events and support for them in the OMAP 3 ISP driver Laurent Pinchart
2 siblings, 0 replies; 4+ messages in thread
From: Sakari Ailus @ 2011-08-02 10:40 UTC (permalink / raw)
To: linux-media; +Cc: laurent.pinchart, hans.verkuil, snjw23
The ccdc block in the omap3isp produces frame start events. These events
were previously specific to the omap3isp. Make them generic.
Also add sequence number to the frame. This is stored to the id field.
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
---
Documentation/video4linux/omap3isp.txt | 9 +++++----
drivers/media/video/omap3isp/ispccdc.c | 11 +++++++++--
include/linux/omap3isp.h | 2 --
3 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/Documentation/video4linux/omap3isp.txt b/Documentation/video4linux/omap3isp.txt
index 69be2c7..5dd1439 100644
--- a/Documentation/video4linux/omap3isp.txt
+++ b/Documentation/video4linux/omap3isp.txt
@@ -70,10 +70,11 @@ Events
The OMAP 3 ISP driver does support the V4L2 event interface on CCDC and
statistics (AEWB, AF and histogram) subdevs.
-The CCDC subdev produces V4L2_EVENT_OMAP3ISP_HS_VS type event on HS_VS
-interrupt which is used to signal frame start. The event is triggered exactly
-when the reception of the first line of the frame starts in the CCDC module.
-The event can be subscribed on the CCDC subdev.
+The CCDC subdev produces V4L2_EVENT_FRAME_SYNC type event on HS_VS
+interrupt which is used to signal frame start. Earlier version of this
+driver used V4L2_EVENT_OMAP3ISP_HS_VS for this purpose. The event is
+triggered exactly when the reception of the first line of the frame starts
+in the CCDC module. The event can be subscribed on the CCDC subdev.
(When using parallel interface one must pay account to correct configuration
of the VS signal polarity. This is automatically correct when using the serial
diff --git a/drivers/media/video/omap3isp/ispccdc.c b/drivers/media/video/omap3isp/ispccdc.c
index 6766247..110d4ab 100644
--- a/drivers/media/video/omap3isp/ispccdc.c
+++ b/drivers/media/video/omap3isp/ispccdc.c
@@ -1402,11 +1402,14 @@ static int __ccdc_handle_stopping(struct isp_ccdc_device *ccdc, u32 event)
static void ccdc_hs_vs_isr(struct isp_ccdc_device *ccdc)
{
+ struct isp_pipeline *pipe =
+ to_isp_pipeline(&ccdc->video_out.video.entity);
struct video_device *vdev = &ccdc->subdev.devnode;
struct v4l2_event event;
memset(&event, 0, sizeof(event));
- event.type = V4L2_EVENT_OMAP3ISP_HS_VS;
+ event.type = V4L2_EVENT_FRAME_SYNC;
+ event.u.frame_sync.frame_sequence = atomic_read(&pipe->frame_number);
v4l2_event_queue(vdev, &event);
}
@@ -1688,7 +1691,11 @@ static long ccdc_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
static int ccdc_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
struct v4l2_event_subscription *sub)
{
- if (sub->type != V4L2_EVENT_OMAP3ISP_HS_VS)
+ if (sub->type != V4L2_EVENT_FRAME_SYNC)
+ return -EINVAL;
+
+ /* line number is zero at frame start */
+ if (sub->id != 0)
return -EINVAL;
return v4l2_event_subscribe(fh, sub, OMAP3ISP_CCDC_NEVENTS);
diff --git a/include/linux/omap3isp.h b/include/linux/omap3isp.h
index b6111f8..c73a34c 100644
--- a/include/linux/omap3isp.h
+++ b/include/linux/omap3isp.h
@@ -62,14 +62,12 @@
* V4L2_EVENT_OMAP3ISP_AEWB: AEWB statistics data ready
* V4L2_EVENT_OMAP3ISP_AF: AF statistics data ready
* V4L2_EVENT_OMAP3ISP_HIST: Histogram statistics data ready
- * V4L2_EVENT_OMAP3ISP_HS_VS: Horizontal/vertical synchronization detected
*/
#define V4L2_EVENT_OMAP3ISP_CLASS (V4L2_EVENT_PRIVATE_START | 0x100)
#define V4L2_EVENT_OMAP3ISP_AEWB (V4L2_EVENT_OMAP3ISP_CLASS | 0x1)
#define V4L2_EVENT_OMAP3ISP_AF (V4L2_EVENT_OMAP3ISP_CLASS | 0x2)
#define V4L2_EVENT_OMAP3ISP_HIST (V4L2_EVENT_OMAP3ISP_CLASS | 0x3)
-#define V4L2_EVENT_OMAP3ISP_HS_VS (V4L2_EVENT_OMAP3ISP_CLASS | 0x4)
struct omap3isp_stat_event_status {
__u32 frame_number;
--
1.7.2.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 0/2] Frame synchronisation events and support for them in the OMAP 3 ISP driver
2011-08-02 10:40 [PATCH v2 0/2] Frame synchronisation events and support for them in the OMAP 3 ISP driver Sakari Ailus
2011-08-02 10:40 ` [PATCH v2 1/2] v4l: events: Define V4L2_EVENT_FRAME_SYNC Sakari Ailus
2011-08-02 10:40 ` [PATCH v2 2/2] omap3isp: ccdc: Make frame start event generic Sakari Ailus
@ 2011-08-02 13:44 ` Laurent Pinchart
2 siblings, 0 replies; 4+ messages in thread
From: Laurent Pinchart @ 2011-08-02 13:44 UTC (permalink / raw)
To: Sakari Ailus
Cc: linux-media@vger.kernel.org, Hans Verkuil, Sylwester Nawrocki
On Tuesday 02 August 2011 12:40:21 Sakari Ailus wrote:
> Hi all,
>
> This is the second version of the frame synchronisation patchset which
> contains fixes based on the comments from Laurent. The patches are on
> top of this tree which contains acked patches:
>
> http://linuxtv.org/git/sailus/media_tree.git media-for-3.1-misc-1
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Shortlog is available here:
>
> <URL:http://git.linuxtv.org/sailus/media_tree.git/shortlog/refs/heads/media
> -for-3.1-misc-1>
>
> Changes since the first one:
>
> - Fixed the description of the second patch.
> - Clarified the documentation.
> - v4l2_event_frame_sync.buffer_sequence renamed to frame_sequence
>
> Changes to the RFC:
>
> - Renamed V4L2_EVENT_FRAME_START to V4L2_EVENT_FRAME_SYNC.
> - Removed extra reference to V4L2_EVENT_FRAME_START in documentation; it
> is mentioned in the same page struct v4l2_event_frame_sync is related to
> it.
> - The OMAP 3 ISP driver check that the id field is zero in anticipation of
> such events.
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-08-02 13:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-02 10:40 [PATCH v2 0/2] Frame synchronisation events and support for them in the OMAP 3 ISP driver Sakari Ailus
2011-08-02 10:40 ` [PATCH v2 1/2] v4l: events: Define V4L2_EVENT_FRAME_SYNC Sakari Ailus
2011-08-02 10:40 ` [PATCH v2 2/2] omap3isp: ccdc: Make frame start event generic Sakari Ailus
2011-08-02 13:44 ` [PATCH v2 0/2] Frame synchronisation events and support for them in the OMAP 3 ISP driver Laurent Pinchart
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox