From patchwork Fri Nov 1 13:10:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 3124761 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 520AEBEEB2 for ; Fri, 1 Nov 2013 13:09:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 34BEF20481 for ; Fri, 1 Nov 2013 13:09:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 468D62012F for ; Fri, 1 Nov 2013 13:09:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753115Ab3KANJV (ORCPT ); Fri, 1 Nov 2013 09:09:21 -0400 Received: from mga11.intel.com ([192.55.52.93]:27884 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751683Ab3KANJU (ORCPT ); Fri, 1 Nov 2013 09:09:20 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 01 Nov 2013 06:09:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.93,617,1378882800"; d="scan'208";a="426469527" Received: from paasikivi.fi.intel.com ([10.237.72.42]) by fmsmga002.fm.intel.com with ESMTP; 01 Nov 2013 06:09:18 -0700 Received: from nauris.fi.intel.com (nauris.localdomain [192.168.240.2]) by paasikivi.fi.intel.com (Postfix) with ESMTP id D52EB200BB; Fri, 1 Nov 2013 15:09:17 +0200 (EET) Received: by nauris.fi.intel.com (Postfix, from userid 1000) id EE27E201F5; Fri, 1 Nov 2013 15:10:43 +0200 (EET) From: Sakari Ailus To: linux-media@vger.kernel.org Cc: vinod.govindapillai@intel.com Subject: [PATCH 1/1] v4l: Add frame end event Date: Fri, 1 Nov 2013 15:10:43 +0200 Message-Id: <1383311443-7863-1-git-send-email-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 1.8.3.2 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add an event to signal frame end. This is not necessarily the same timestamp as the video buffer done timestamp, and can be also subscribed by other processes than the one controlling streaming and buffer (de)queueing. Also make all event type constants appear as constants in documentation and move frame sync event struct documentation after all control event documentation. Signed-off-by: Sakari Ailus --- Hi folks, As we have a frame sync event that's being used to tell about the frame start, I thought of having a frame end event as well. This isn't exactly the same as a buffer ready event which could take place already earlier for instance if cropping is being done. I propose to use the id field for the purpose (V4L2_EVENT_FRAME_SYNC_START / V4L2_EVENT_FRAME_SYNC_END). The frame start event will retain its old id zero. Originally I think we thought of using the id field for the line, but now I think it's worth adding a distinct event for that purpose: line based events are typically triggered from other sources than line based events. Frame sync, in my opinion, matches better with frame start and frame end than to anything related to lines. So should line based events be supported, they should have their own event type and use the id field as the line number. Kind regards, Sakari Documentation/DocBook/media/v4l/vidioc-dqevent.xml | 58 +++++++++++++++------- .../DocBook/media/v4l/vidioc-subscribe-event.xml | 11 +++- include/uapi/linux/videodev2.h | 3 ++ 3 files changed, 51 insertions(+), 21 deletions(-) diff --git a/Documentation/DocBook/media/v4l/vidioc-dqevent.xml b/Documentation/DocBook/media/v4l/vidioc-dqevent.xml index 89891ad..e258c6e 100644 --- a/Documentation/DocBook/media/v4l/vidioc-dqevent.xml +++ b/Documentation/DocBook/media/v4l/vidioc-dqevent.xml @@ -76,21 +76,22 @@ &v4l2-event-vsync; vsync - Event data for event V4L2_EVENT_VSYNC. + Event data for event V4L2_EVENT_VSYNC. &v4l2-event-ctrl; ctrl - Event data for event V4L2_EVENT_CTRL. + Event data for event V4L2_EVENT_CTRL. &v4l2-event-frame-sync; frame_sync - Event data for event V4L2_EVENT_FRAME_SYNC. + Event data for event V4L2_EVENT_FRAME_SYNC + . @@ -226,22 +227,6 @@ - - struct <structname>v4l2_event_frame_sync</structname> - - &cs-str; - - - __u32 - frame_sequence - - The sequence number of the frame being received. - - - - -
- Changes @@ -270,6 +255,41 @@
+ + + struct <structname>v4l2_event_frame_sync</structname> + + &cs-str; + + + __u32 + frame_sequence + + The sequence number of the frame being received. + + + + +
+ + + Frame sync event IDs + + &cs-def; + + + V4L2_EVENT_FRAME_SYNC_START + 0x0000 + Frame sync event delivered at frame start. + + + V4L2_EVENT_FRAME_SYNC_END + 0x0001 + Frame sync event delivered at frame end. + + + +
&return-value; diff --git a/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml b/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml index 5c70b61..aaa6fe1 100644 --- a/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml +++ b/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml @@ -143,15 +143,22 @@ 4 Triggered immediately when the reception of a - frame has begun. This event has a + frame has begun or ended. This event has a &v4l2-event-frame-sync; associated with it. 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 frame_sequence field in &v4l2-event-frame-sync; will not be incremented. This - causes two consecutive frame sequence numbers to have n times + causes two consecutive frame sync events to have n times frame interval in between them. + + The id field must be set to + either V4L2_EVENT_FRAME_SYNC_START or + V4L2_EVENT_FRAME_SYNC_END which signify + the start of frame and end of frame, respectively. See + for more + information.
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 437f1b0..133957a 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -1760,6 +1760,9 @@ struct v4l2_event_ctrl { __s32 default_value; }; +#define V4L2_EVENT_FRAME_SYNC_START 0 +#define V4L2_EVENT_FRAME_SYNC_END 1 + struct v4l2_event_frame_sync { __u32 frame_sequence; };