From patchwork Mon Aug 29 17:55:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Jarzmik X-Patchwork-Id: 9304243 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 731286086B for ; Mon, 29 Aug 2016 17:57:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 691CA287BE for ; Mon, 29 Aug 2016 17:57:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5DEFE288FF; Mon, 29 Aug 2016 17:57:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C582288E3 for ; Mon, 29 Aug 2016 17:57:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756092AbcH2R5D (ORCPT ); Mon, 29 Aug 2016 13:57:03 -0400 Received: from smtp07.smtpout.orange.fr ([80.12.242.129]:59128 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755385AbcH2R4M (ORCPT ); Mon, 29 Aug 2016 13:56:12 -0400 Received: from belgarion.home ([90.38.47.83]) by mwinf5d30 with ME id d5w31t00o1nh6NJ035wAhk; Mon, 29 Aug 2016 19:56:10 +0200 X-ME-Helo: belgarion.home X-ME-Date: Mon, 29 Aug 2016 19:56:10 +0200 X-ME-IP: 90.38.47.83 From: Robert Jarzmik To: Mauro Carvalho Chehab , Guennadi Liakhovetski , Jiri Kosina , Hans Verkuil Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Robert Jarzmik Subject: [PATCH v5 08/13] media: platform: pxa_camera: add buffer sequencing Date: Mon, 29 Aug 2016 19:55:53 +0200 Message-Id: <1472493358-24618-9-git-send-email-robert.jarzmik@free.fr> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1472493358-24618-1-git-send-email-robert.jarzmik@free.fr> References: <1472493358-24618-1-git-send-email-robert.jarzmik@free.fr> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add sequence numbers to completed buffers. Signed-off-by: Robert Jarzmik --- Since v3: reset buffer sequence number in start_streaming() --- drivers/media/platform/soc_camera/pxa_camera.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/media/platform/soc_camera/pxa_camera.c b/drivers/media/platform/soc_camera/pxa_camera.c index 45583a40a4bd..9b294a14fa2e 100644 --- a/drivers/media/platform/soc_camera/pxa_camera.c +++ b/drivers/media/platform/soc_camera/pxa_camera.c @@ -223,6 +223,7 @@ struct pxa_camera_dev { struct list_head capture; spinlock_t lock; + unsigned int buf_sequence; struct pxa_buffer *active; struct tasklet_struct task_eof; @@ -423,10 +424,13 @@ static void pxa_camera_wakeup(struct pxa_camera_dev *pcdev, struct pxa_buffer *buf) { struct vb2_buffer *vb = &buf->vbuf.vb2_buf; + struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); /* _init is used to debug races, see comment in pxa_camera_reqbufs() */ list_del_init(&buf->queue); vb->timestamp = ktime_get_ns(); + vbuf->sequence = pcdev->buf_sequence++; + vbuf->field = V4L2_FIELD_NONE; vb2_buffer_done(vb, VB2_BUF_STATE_DONE); dev_dbg(pcdev_to_dev(pcdev), "%s dequeud buffer (buf=0x%p)\n", __func__, buf); @@ -1022,6 +1026,7 @@ static int pxac_vb2_start_streaming(struct vb2_queue *vq, unsigned int count) dev_dbg(pcdev_to_dev(pcdev), "%s(count=%d) active=%p\n", __func__, count, pcdev->active); + pcdev->buf_sequence = 0; if (!pcdev->active) pxa_camera_start_capture(pcdev);