From patchwork Wed Jun 24 13:59:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prashant Laddha X-Patchwork-Id: 6667921 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2A9FD9F399 for ; Wed, 24 Jun 2015 14:00:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 39A5420575 for ; Wed, 24 Jun 2015 14:00:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E7CCC206E5 for ; Wed, 24 Jun 2015 14:00:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752581AbbFXOAI (ORCPT ); Wed, 24 Jun 2015 10:00:08 -0400 Received: from bgl-iport-3.cisco.com ([72.163.197.27]:60938 "EHLO bgl-iport-3.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753183AbbFXOAA (ORCPT ); Wed, 24 Jun 2015 10:00:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=3361; q=dns/txt; s=iport; t=1435154400; x=1436364000; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=G4mMTsbCe9NDnpIHBIi2TNcOdDOBoZk4dU04sWvilpo=; b=JUoVTS+SL4JmPeHCcJIYskm9ArokJhY6TIRTxafXy56zGto2YwYknQlS AUiehdpPEjJ9KnadkCmRqst7Pi2CCObWEoblEjvDKTWWNZN53rfUOl7bx 8eysI6ecci6jfVr/+l/REXhq4C4boSVmDh8bYIlGCrOQ2WhiBR9LIQtPt c=; X-IronPort-AV: E=Sophos;i="5.13,672,1427760000"; d="scan'208";a="18504229" Received: from vla196-nat.cisco.com (HELO bgl-core-2.cisco.com) ([72.163.197.24]) by bgl-iport-3.cisco.com with ESMTP; 24 Jun 2015 13:59:58 +0000 Received: from pla-VB.cisco.com ([10.142.61.237]) by bgl-core-2.cisco.com (8.14.5/8.14.5) with ESMTP id t5ODxuZv020124; Wed, 24 Jun 2015 13:59:57 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:29:55 +0530 Message-Id: <1435154396-11548-2-git-send-email-prladdha@cisco.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1435154396-11548-1-git-send-email-prladdha@cisco.com> References: <1435154396-11548-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 | 7 ++++++- utils/v4l2-ctl/v4l2-ctl-stds.cpp | 2 +- utils/v4l2-ctl/v4l2-ctl.h | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/utils/v4l2-ctl/v4l2-ctl-modes.cpp b/utils/v4l2-ctl/v4l2-ctl-modes.cpp index 88f7b6a..9439b51 100644 --- a/utils/v4l2-ctl/v4l2-ctl-modes.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-modes.cpp @@ -122,6 +122,7 @@ static int v_sync_from_aspect_ratio(int width, int height) * @reduced_blanking: This value, if greater than 0, indicates that * reduced blanking is to be used and value indicates the version. * @interlaced: whether to compute an interlaced mode + * @reduced_fps: reduce fps by factor of 1000 / 1001 * @cvt: stores results of cvt timing calculation * * Returns: @@ -131,7 +132,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 +297,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,