From patchwork Wed Jun 24 13:52:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prashant Laddha X-Patchwork-Id: 6667831 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5F330C05AC for ; Wed, 24 Jun 2015 13:52:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 703A7206E1 for ; Wed, 24 Jun 2015 13:52:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6CBBB206DE for ; Wed, 24 Jun 2015 13:52:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753601AbbFXNw2 (ORCPT ); Wed, 24 Jun 2015 09:52:28 -0400 Received: from bgl-iport-2.cisco.com ([72.163.197.26]:52049 "EHLO bgl-iport-2.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753565AbbFXNwS (ORCPT ); Wed, 24 Jun 2015 09:52:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=2959; q=dns/txt; s=iport; t=1435153938; x=1436363538; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=THq56fbU/z6JlECRo6WE1t/Ff6DntKGsWmVqxAqdL34=; b=MClIyYNCDjntuAK4MTRstaChGzvX9gsW3lYuAvQmloXeYY0WGziq+7zR tWM1aMpmvm3/xpol6f5/Nfr00yN2FT93vwyu3jQtMDhcb9Ftn8K2blqzy mXtmB4hUfwU78DZ2PNnl0sRnJBCK/KLHC7P08pf2wPDvszZwZgsFfUb68 s=; X-IronPort-AV: E=Sophos;i="5.13,672,1427760000"; d="scan'208";a="53034024" Received: from vla196-nat.cisco.com (HELO bgl-core-4.cisco.com) ([72.163.197.24]) by bgl-iport-2.cisco.com with ESMTP; 24 Jun 2015 13:52:16 +0000 Received: from pla-VB.cisco.com ([10.142.61.237]) by bgl-core-4.cisco.com (8.14.5/8.14.5) with ESMTP id t5ODqFdn010067; Wed, 24 Jun 2015 13:52:15 GMT From: Prashant Laddha To: linux-media@vger.kernel.org Cc: Hans Verkuil , Prashant Laddha Subject: [RFC PATCH v2 1/2] v4l2-utils: add support for reduced fps in cvt modeline Date: Wed, 24 Jun 2015 19:22:14 +0530 Message-Id: <1435153935-11403-2-git-send-email-prladdha@cisco.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1435153935-11403-1-git-send-email-prladdha@cisco.com> References: <1435153935-11403-1-git-send-email-prladdha@cisco.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-15.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY, USER_IN_DEF_DKIM_WL 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 Added reduced fps option in cvt timings calculation. In this case, pixel clock is slowed down by a factor of 1000 / 1001 and all other timing parameters are unchanged. With reduced fps option one could generate timings for refresh rates like 29.97 or 59.94. Pixel clock in this case needs better precision, in the order of 0.001 Khz and hence reduced fps option can be supported only when reduced blanking V2 is enabled. Reduced fps is applicable only to nominal refresh rates which are integer multiple of 6, say 24, 30, 60 etc. Cc: Hans Verkuil Signed-off-by: Prashant Laddha --- utils/v4l2-ctl/v4l2-ctl-modes.cpp | 6 +++++- utils/v4l2-ctl/v4l2-ctl-stds.cpp | 2 +- utils/v4l2-ctl/v4l2-ctl.h | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/utils/v4l2-ctl/v4l2-ctl-modes.cpp b/utils/v4l2-ctl/v4l2-ctl-modes.cpp index 88f7b6a..1912238 100644 --- a/utils/v4l2-ctl/v4l2-ctl-modes.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-modes.cpp @@ -131,7 +131,8 @@ static int v_sync_from_aspect_ratio(int width, int height) bool calc_cvt_modeline(int image_width, int image_height, int refresh_rate, int reduced_blanking, - bool interlaced, struct v4l2_bt_timings *cvt) + bool interlaced, bool reduced_fps, + struct v4l2_bt_timings *cvt) { int h_sync; int v_sync; @@ -295,6 +296,9 @@ bool calc_cvt_modeline(int image_width, int image_height, pixel_clock = v_refresh * total_h_pixel * (2 * total_v_lines + interlace) / 2; + if (reduced_fps && v_refresh % 6 == 0) + pixel_clock = ((long long)pixel_clock * 1000) / 1001; + pixel_clock -= pixel_clock % clk_gran; } diff --git a/utils/v4l2-ctl/v4l2-ctl-stds.cpp b/utils/v4l2-ctl/v4l2-ctl-stds.cpp index aea46c9..e969d08 100644 --- a/utils/v4l2-ctl/v4l2-ctl-stds.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-stds.cpp @@ -241,7 +241,7 @@ static void get_cvt_gtf_timings(char *subopt, int standard, if (standard == V4L2_DV_BT_STD_CVT) { timings_valid = calc_cvt_modeline(width, height, fps, r_blank, - interlaced == 1 ? true : false, bt); + interlaced == 1 ? true : false, false, bt); } else { timings_valid = calc_gtf_modeline(width, height, fps, r_blank, interlaced == 1 ? true : false, bt); diff --git a/utils/v4l2-ctl/v4l2-ctl.h b/utils/v4l2-ctl/v4l2-ctl.h index de65900..113f348 100644 --- a/utils/v4l2-ctl/v4l2-ctl.h +++ b/utils/v4l2-ctl/v4l2-ctl.h @@ -351,7 +351,8 @@ void edid_get(int fd); /* v4l2-ctl-modes.cpp */ bool calc_cvt_modeline(int image_width, int image_height, int refresh_rate, int reduced_blanking, - bool interlaced, struct v4l2_bt_timings *cvt); + bool interlaced, bool reduced_fps, + struct v4l2_bt_timings *cvt); bool calc_gtf_modeline(int image_width, int image_height, int refresh_rate, int reduced_blanking,