linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH v2 0/2] Support for reduced fps in v4l2-utils
@ 2015-06-24 13:52 Prashant Laddha
  2015-06-24 13:52 ` [RFC PATCH v2 1/2] v4l2-utils: add support for reduced fps in cvt modeline Prashant Laddha
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Prashant Laddha @ 2015-06-24 13:52 UTC (permalink / raw)
  To: linux-media

Change compared to v1:
Updated function description that was missed in v1.

Prashant Laddha (2):
  v4l2-utils: add support for reduced fps in cvt modeline
  v4l2-utils: extend set-dv-timings to support reduced fps

 utils/v4l2-ctl/v4l2-ctl-modes.cpp |  6 +++++-
 utils/v4l2-ctl/v4l2-ctl-stds.cpp  | 14 ++++++++++++--
 utils/v4l2-ctl/v4l2-ctl.h         |  3 ++-
 3 files changed, 19 insertions(+), 4 deletions(-)

-- 
1.9.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [RFC PATCH v2 1/2] v4l2-utils: add support for reduced fps in cvt modeline
  2015-06-24 13:52 [RFC PATCH v2 0/2] Support for reduced fps in v4l2-utils Prashant Laddha
@ 2015-06-24 13:52 ` Prashant Laddha
  2015-06-24 13:52 ` [RFC PATCH v2 2/2] v4l2-utils: extend set-dv-timings to support reduced fps Prashant Laddha
  2015-06-24 13:57 ` [RFC PATCH v2 0/2] Support for reduced fps in v4l2-utils Prashant Laddha (prladdha)
  2 siblings, 0 replies; 4+ messages in thread
From: Prashant Laddha @ 2015-06-24 13:52 UTC (permalink / raw)
  To: linux-media; +Cc: Hans Verkuil, Prashant Laddha

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 <hans.verkuil@cisco.com>
Signed-off-by: Prashant Laddha <prladdha@cisco.com>
---
 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,
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [RFC PATCH v2 2/2] v4l2-utils: extend set-dv-timings to support reduced fps
  2015-06-24 13:52 [RFC PATCH v2 0/2] Support for reduced fps in v4l2-utils Prashant Laddha
  2015-06-24 13:52 ` [RFC PATCH v2 1/2] v4l2-utils: add support for reduced fps in cvt modeline Prashant Laddha
@ 2015-06-24 13:52 ` Prashant Laddha
  2015-06-24 13:57 ` [RFC PATCH v2 0/2] Support for reduced fps in v4l2-utils Prashant Laddha (prladdha)
  2 siblings, 0 replies; 4+ messages in thread
From: Prashant Laddha @ 2015-06-24 13:52 UTC (permalink / raw)
  To: linux-media; +Cc: Hans Verkuil, Prashant Laddha

Extended command line option for set-dv-timings to support timings
calculations for reduced fps. This will allow supporting NTSC frame
rates like 29.97 or 59.94.

Cc: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Prashant Laddha <prladdha@cisco.com>
---
 utils/v4l2-ctl/v4l2-ctl-stds.cpp | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/utils/v4l2-ctl/v4l2-ctl-stds.cpp b/utils/v4l2-ctl/v4l2-ctl-stds.cpp
index e969d08..3987ba1 100644
--- a/utils/v4l2-ctl/v4l2-ctl-stds.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-stds.cpp
@@ -41,11 +41,15 @@ void stds_usage(void)
 	       "                     index=<index>: use the index as provided by --list-dv-timings\n"
 	       "                     or specify timings using cvt/gtf options as follows:\n"
 	       "                     cvt/gtf,width=<width>,height=<height>,fps=<frames per sec>\n"
-	       "                     interlaced=<0/1>,reduced-blanking=<0/1/2>\n"
+	       "                     interlaced=<0/1>,reduced-blanking=<0/1/2>,reduced-fps=<0/1>\n"
 	       "                     The value of reduced-blanking, if greater than 0, indicates\n"
 	       "                     that reduced blanking is to be used and the value indicate the\n"
 	       "                     version. For gtf, there is no version 2 for reduced blanking, and\n"
 	       "		     the value 1 or 2 will give same results.\n"
+	       "		     reduced-fps = 1, slows down pixel clock by factor of 1000 / 1001, allowing\n"
+	       "		     to support NTSC frame rates like 29.97 or 59.94.\n"
+	       "		     Reduced fps flag takes effect only with reduced blanking version 2 and,\n"
+	       "		     when refresh rate is an integer multiple of 6, say, fps = 24,30,60 etc.\n"
 	       "                     or give a fully specified timings:\n"
 	       "                     width=<width>,height=<height>,interlaced=<0/1>,\n"
 	       "                     polarities=<polarities mask>,pixelclock=<pixelclock Hz>,\n"
@@ -152,6 +156,7 @@ enum timing_opts {
 	GTF,
 	FPS,
 	REDUCED_BLANK,
+	REDUCED_FPS,
 };
 
 static int parse_timing_subopt(char **subopt_str, int *value)
@@ -179,6 +184,7 @@ static int parse_timing_subopt(char **subopt_str, int *value)
 		"gtf",
 		"fps",
 		"reduced-blanking",
+		"reduced-fps",
 		NULL
 	};
 
@@ -209,6 +215,7 @@ static void get_cvt_gtf_timings(char *subopt, int standard,
 	int fps = 0;
 	int r_blank = 0;
 	int interlaced = 0;
+	bool reduced_fps = false;
 	bool timings_valid = false;
 
 	char *subopt_str = subopt;
@@ -234,6 +241,9 @@ static void get_cvt_gtf_timings(char *subopt, int standard,
 		case INTERLACED:
 			interlaced = opt_val;
 			break;
+		case REDUCED_FPS:
+			reduced_fps = (opt_val == 1) ? true : false;
+			break;
 		default:
 			break;
 		}
@@ -241,7 +251,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, false, bt);
+						  interlaced == 1 ? true : false, reduced_fps, bt);
 	} else {
 		timings_valid = calc_gtf_modeline(width, height, fps, r_blank,
 						  interlaced == 1 ? true : false, bt);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH v2 0/2] Support for reduced fps in v4l2-utils
  2015-06-24 13:52 [RFC PATCH v2 0/2] Support for reduced fps in v4l2-utils Prashant Laddha
  2015-06-24 13:52 ` [RFC PATCH v2 1/2] v4l2-utils: add support for reduced fps in cvt modeline Prashant Laddha
  2015-06-24 13:52 ` [RFC PATCH v2 2/2] v4l2-utils: extend set-dv-timings to support reduced fps Prashant Laddha
@ 2015-06-24 13:57 ` Prashant Laddha (prladdha)
  2 siblings, 0 replies; 4+ messages in thread
From: Prashant Laddha (prladdha) @ 2015-06-24 13:57 UTC (permalink / raw)
  To: Prashant Laddha (prladdha), linux-media

Please ignore v2 patches. By mistake I posted v1 again.

On 24/06/15 7:22 pm, "Prashant Laddha (prladdha)" <prladdha@cisco.com>
wrote:

>Change compared to v1:
>Updated function description that was missed in v1.
>
>Prashant Laddha (2):
>  v4l2-utils: add support for reduced fps in cvt modeline
>  v4l2-utils: extend set-dv-timings to support reduced fps
>
> utils/v4l2-ctl/v4l2-ctl-modes.cpp |  6 +++++-
> utils/v4l2-ctl/v4l2-ctl-stds.cpp  | 14 ++++++++++++--
> utils/v4l2-ctl/v4l2-ctl.h         |  3 ++-
> 3 files changed, 19 insertions(+), 4 deletions(-)
>
>-- 
>1.9.1
>
>--
>To unsubscribe from this list: send the line "unsubscribe linux-media" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-06-24 13:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-24 13:52 [RFC PATCH v2 0/2] Support for reduced fps in v4l2-utils Prashant Laddha
2015-06-24 13:52 ` [RFC PATCH v2 1/2] v4l2-utils: add support for reduced fps in cvt modeline Prashant Laddha
2015-06-24 13:52 ` [RFC PATCH v2 2/2] v4l2-utils: extend set-dv-timings to support reduced fps Prashant Laddha
2015-06-24 13:57 ` [RFC PATCH v2 0/2] Support for reduced fps in v4l2-utils Prashant Laddha (prladdha)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).