From patchwork Thu Sep 13 19:53:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 1454061 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 4FA6DDF24C for ; Thu, 13 Sep 2012 19:52:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756091Ab2IMTw4 (ORCPT ); Thu, 13 Sep 2012 15:52:56 -0400 Received: from perceval.ideasonboard.com ([95.142.166.194]:34356 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755508Ab2IMTwz (ORCPT ); Thu, 13 Sep 2012 15:52:55 -0400 Received: from avalon.ideasonboard.com (unknown [91.178.185.169]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8D0B57ACE; Thu, 13 Sep 2012 21:52:53 +0200 (CEST) From: Laurent Pinchart To: linux-media@vger.kernel.org Cc: Antoine Reversat , sakari.ailus@iki.fi Subject: [PATCH] omap3isp: Use monotonic timestamps for statistics buffers Date: Thu, 13 Sep 2012 21:53:23 +0200 Message-Id: <1347566003-14500-1-git-send-email-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 1.7.8.6 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org V4L2 buffers use the monotonic clock, while statistics buffers use wall time. This makes it difficult to correlate video frames and statistics. Switch statistics buffers to the monotonic clock to fix this. Reported-by: Antoine Reversat Signed-off-by: Laurent Pinchart --- drivers/media/platform/omap3isp/ispstat.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/drivers/media/platform/omap3isp/ispstat.c b/drivers/media/platform/omap3isp/ispstat.c index b8640be..52263cc 100644 --- a/drivers/media/platform/omap3isp/ispstat.c +++ b/drivers/media/platform/omap3isp/ispstat.c @@ -253,10 +253,14 @@ isp_stat_buf_find_oldest_or_empty(struct ispstat *stat) static int isp_stat_buf_queue(struct ispstat *stat) { + struct timespec ts; + if (!stat->active_buf) return STAT_NO_BUF; - do_gettimeofday(&stat->active_buf->ts); + ktime_get_ts(&ts); + stat->active_buf->ts.tv_sec = ts.tv_sec; + stat->active_buf->ts.tv_usec = ts.tv_nsec / NSEC_PER_USEC; stat->active_buf->buf_size = stat->buf_size; if (isp_stat_buf_check_magic(stat, stat->active_buf)) {