Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6215894imu; Sun, 2 Dec 2018 12:45:09 -0800 (PST) X-Google-Smtp-Source: AFSGD/UklK79B4Kupcczb3pD8seOg1+LOaf9XWnOcQjfcdR5yGCI2TiEZX/SDBWBDjZbBif/dE9B X-Received: by 2002:a63:9a09:: with SMTP id o9mr10770870pge.94.1543783509004; Sun, 02 Dec 2018 12:45:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543783508; cv=none; d=google.com; s=arc-20160816; b=kRi79Y2POhBYFLA6CCYhdRhZDV6n6ydfYrzRt1aweoCGJq+d3EUZGsRBfur7s/l5FX /b9TXkIkpRMp1m/KlVSlMD8japKjSr+iywsKgyEzclsyfD0+51Hamb+vTBo4uJTVuPa7 WlyKYvpeCyVbrKLE8gdyWOGnLUE4fxmWAHeiB4Q23/yQZjGPyKdZrwd/NHNhZcGAYUGe d0SVqQs2l504FSUdj23VksRVS6X6pHHp8VrMRGT5cA0uM/JzRZ+QkuOYpnSASwb9vUo/ j1c2OBcIGIHZDlTFYwVqcOLgOEG8AdoE1cZWZg3kNKgq42M3qqCDlsSbaQKfcNnLSi5B aPTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=UBCjz3/bTZN3xwkD9xF12upGO3yCqSrBbulx5aakBH0=; b=ou44cK74MH06BrAY5IFceOQFkgjmGnaMEs6oV2Qt07ECMvqTpgHJUXi2WzVi3GIWON Ehv5AqLaHusmwQPrypYspMd+noTzFQVstvrxlLmFhEuTZbGwUNEnYCNONPTmJEviHwUf oigPqFG0CtQVSbHmvJle4wL6rDqOJMz0fhofuSmsDt/LcqgLFtUTrR8nCX523pI35Cbz Ac331QHMK/SPg08qM0Aumnz+wusCNlC488Hv17o2P/pHsbwJjTBo8fN89GX9c4wF3Iya EWs7n0m82CtBDL4flZxvoG2GaNQXCbAvNh+ClxRaioe52ZK/emLtYBenwze/glJZTdHY iGIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z14si9660097pga.349.2018.12.02.12.44.50; Sun, 02 Dec 2018 12:45:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725786AbeLBUoO (ORCPT + 99 others); Sun, 2 Dec 2018 15:44:14 -0500 Received: from mail-qt1-f196.google.com ([209.85.160.196]:41303 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725730AbeLBUoO (ORCPT ); Sun, 2 Dec 2018 15:44:14 -0500 Received: by mail-qt1-f196.google.com with SMTP id d18so11590394qto.8; Sun, 02 Dec 2018 12:44:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=UBCjz3/bTZN3xwkD9xF12upGO3yCqSrBbulx5aakBH0=; b=o1Aty3Q7FIpC/x44fE8F6rjJ0ZfXi/UHaB3llwRkze9HqVRkpXmWuBzfWFeOraHgJx WJq11ghiSpwtDvq7qoIqdmAz/CQ/XYcuJDHjcFWXIJJGcAGlAFIedZq54bIEhelS7XHP 9cTAdcMVTL6LW9QTzDK1baZ87VLL935I2QTSYVJi1KiX9UgGan3QFcg0R4JH/wwl+xha eVP7kHHaUUuNexPvNGLwUDpoNIO92BOAqMsgnzFEeKoIzvaroSdDetmmGlPVHmh55U1b E+4uNkEBftMtKLGI3bYj9udBJ8sgPtfzYb80cDhEAOK5CSCULHhbBtqa2NB4S6+7Xgg+ Uz4A== X-Gm-Message-State: AA+aEWbhjMWMLSjuXcqt4Jm7pMTpjenOx7UzhClz3pqbsQdEo0x5Cv0i EVyhiBq1Bmh0y6pD+bGiHUHW3xywWbXh9uNBz4w= X-Received: by 2002:ac8:1d12:: with SMTP id d18mr12870920qtl.343.1543783450915; Sun, 02 Dec 2018 12:44:10 -0800 (PST) MIME-Version: 1.0 References: <20181202134538.GA18886@gfm-note> In-Reply-To: <20181202134538.GA18886@gfm-note> From: Arnd Bergmann Date: Sun, 2 Dec 2018 21:43:53 +0100 Message-ID: Subject: Re: [PATCH v4] media: vivid: Improve timestamping To: gfmandaji@gmail.com Cc: Hans Verkuil , Mauro Carvalho Chehab , Linux Media Mailing List , Linux Kernel Mailing List , lkcamp@lists.libreplanetbr.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Dec 2, 2018 at 2:47 PM Gabriel Francisco Mandaji wrote: > @@ -667,10 +653,28 @@ static void vivid_overlay(struct vivid_dev *dev, struct vivid_buffer *buf) > } > } > > +static void vivid_cap_update_frame_period(struct vivid_dev *dev) > +{ > + u64 f_period; > + > + f_period = (u64)dev->timeperframe_vid_cap.numerator * 1000000000; > + do_div(f_period, dev->timeperframe_vid_cap.denominator); > + if (dev->field_cap == V4L2_FIELD_ALTERNATE) > + do_div(f_period, 2); > + /* > + * If "End of Frame", then offset the exposure time by 0.9 > + * of the frame period. > + */ > + dev->cap_frame_eof_offset = f_period * 9; > + do_div(dev->cap_frame_eof_offset, 10); > + dev->cap_frame_period = f_period; > +} Doing two or three do_div() operations is going to make this rather expensive on 32-bit architectures, and it looks like this happens for each frame? Since each one is a multiplication followed by a division, could this be changed to using a different factor followed by a bit shift? Arnd