* [RFC PATCH v2 0/2] v4l2-utils: add support for RB v2 in cvt
@ 2015-06-23 5:56 Prashant Laddha
2015-06-23 5:56 ` [RFC PATCH v2 1/2] v4l2-ctl-modes: add support for reduced blanking version 2 Prashant Laddha
2015-06-23 5:56 ` [RFC PATCH v2 2/2] v4l2-utils: Modify usage for set-dv-timing to support RB V2 Prashant Laddha
0 siblings, 2 replies; 3+ messages in thread
From: Prashant Laddha @ 2015-06-23 5:56 UTC (permalink / raw)
To: linux-media
Posting v2 of patches adding support for reduced blanking version 2 in
v4l2-utils.
Changes compared to v1:
Incorporated comments on v1. Removed an extra option that was added for
use-rb-v2. Instead, it now allows reduced-blanking = 2 to indicate the
version 2 of reduced blanking.
Prashant Laddha (2):
v4l2-ctl-modes: add support for reduced blanking version 2
v4l2-utils: Modify usage for set-dv-timing to support RB V2
utils/v4l2-ctl/v4l2-ctl-modes.cpp | 63 +++++++++++++++++++++++++++++----------
utils/v4l2-ctl/v4l2-ctl-stds.cpp | 19 ++++++------
utils/v4l2-ctl/v4l2-ctl.h | 4 +--
3 files changed, 58 insertions(+), 28 deletions(-)
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
^ permalink raw reply [flat|nested] 3+ messages in thread
* [RFC PATCH v2 1/2] v4l2-ctl-modes: add support for reduced blanking version 2
2015-06-23 5:56 [RFC PATCH v2 0/2] v4l2-utils: add support for RB v2 in cvt Prashant Laddha
@ 2015-06-23 5:56 ` Prashant Laddha
2015-06-23 5:56 ` [RFC PATCH v2 2/2] v4l2-utils: Modify usage for set-dv-timing to support RB V2 Prashant Laddha
1 sibling, 0 replies; 3+ messages in thread
From: Prashant Laddha @ 2015-06-23 5:56 UTC (permalink / raw)
To: linux-media; +Cc: Hans Verkuil, Prashant Laddha
Added support for reduced blanking version 2 (RB V2) in cvt
modeline calculations. Recently, RB V2 support was added to
v4l2-dv-timings. This patch follows up on that work.
Modified calc_cvt/gtf_modeline() api to capture the version of
reduced blanking. Instead of using a flag for reduced-blanking,
it now allows for passing a value to indicate version info.
Cc: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Prashant Laddha <prladdha@cisco.com>
---
utils/v4l2-ctl/v4l2-ctl-modes.cpp | 63 +++++++++++++++++++++++++++++----------
utils/v4l2-ctl/v4l2-ctl-stds.cpp | 12 +++-----
utils/v4l2-ctl/v4l2-ctl.h | 4 +--
3 files changed, 53 insertions(+), 26 deletions(-)
diff --git a/utils/v4l2-ctl/v4l2-ctl-modes.cpp b/utils/v4l2-ctl/v4l2-ctl-modes.cpp
index 7768998..88f7b6a 100644
--- a/utils/v4l2-ctl/v4l2-ctl-modes.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-modes.cpp
@@ -52,6 +52,7 @@ static bool valid_params(int width, int height, int refresh_rate)
*/
#define CVT_PXL_CLK_GRAN (250000) /* pixel clock granularity */
+#define CVT_PXL_CLK_GRAN_RB_V2 (1000) /* granularity for reduced blanking v2*/
/* Normal blanking */
#define CVT_MIN_V_BPORCH (7) /* lines */
@@ -77,6 +78,12 @@ static bool valid_params(int width, int height, int refresh_rate)
#define CVT_RB_H_BPORCH (80) /* pixels */
#define CVT_RB_H_BLANK (160) /* pixels */
+/* Reduce blanking Version 2 */
+#define CVT_RB_V2_H_BLANK 80 /* pixels */
+#define CVT_RB_MIN_V_FPORCH 3 /* lines */
+#define CVT_RB_V2_MIN_V_FPORCH 1 /* lines */
+#define CVT_RB_V_BPORCH 6 /* lines */
+
static int v_sync_from_aspect_ratio(int width, int height)
{
if (((height * 4 / 3) / CVT_CELL_GRAN) * CVT_CELL_GRAN == width)
@@ -112,7 +119,8 @@ static int v_sync_from_aspect_ratio(int width, int height)
* @image_width
* @image_height
* @refresh_rate
- * @reduced_blanking: whether to use reduced blanking
+ * @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
* @cvt: stores results of cvt timing calculation
*
@@ -122,7 +130,7 @@ static int v_sync_from_aspect_ratio(int width, int height)
*/
bool calc_cvt_modeline(int image_width, int image_height,
- int refresh_rate, bool reduced_blanking,
+ int refresh_rate, int reduced_blanking,
bool interlaced, struct v4l2_bt_timings *cvt)
{
int h_sync;
@@ -149,10 +157,18 @@ bool calc_cvt_modeline(int image_width, int image_height,
int interlace;
int v_refresh;
int pixel_clock;
+ int clk_gran;
+ bool use_rb = false;
+ bool rb_v2 = false;
if (!valid_params(image_width, image_height, refresh_rate))
return false;
+ use_rb = (reduced_blanking > 0) ? true : false;
+ rb_v2 = (reduced_blanking == 2) ? true : false;
+
+ clk_gran = rb_v2 ? CVT_PXL_CLK_GRAN_RB_V2 : CVT_PXL_CLK_GRAN;
+
h_pixel = image_width;
v_lines = image_height;
@@ -187,9 +203,9 @@ bool calc_cvt_modeline(int image_width, int image_height,
active_h_pixel = h_pixel_rnd;
active_v_lines = v_lines_rnd;
- v_sync = v_sync_from_aspect_ratio(h_pixel, v_lines);
+ v_sync = rb_v2 ? 8 : v_sync_from_aspect_ratio(h_pixel, v_lines);
- if (!reduced_blanking) {
+ if (!use_rb) {
int tmp1, tmp2;
int ideal_blank_duty_cycle;
int v_sync_bp;
@@ -233,12 +249,13 @@ bool calc_cvt_modeline(int image_width, int image_height,
pixel_clock = ((long long)total_h_pixel * HV_FACTOR * 1000000)
/ h_period;
- pixel_clock -= pixel_clock % CVT_PXL_CLK_GRAN;
+ pixel_clock -= pixel_clock % clk_gran;
} else {
/* Reduced blanking */
int vbi_lines;
int tmp1, tmp2;
+ int min_vbi_lines;
/* estimate horizontal period. */
tmp1 = HV_FACTOR * 1000000 -
@@ -249,10 +266,15 @@ bool calc_cvt_modeline(int image_width, int image_height,
vbi_lines = CVT_RB_MIN_V_BLANK * HV_FACTOR / h_period + 1;
- if (vbi_lines < (CVT_RB_V_FPORCH + v_sync + CVT_MIN_V_BPORCH))
- vbi_lines = CVT_RB_V_FPORCH + v_sync + CVT_MIN_V_BPORCH;
+ if (rb_v2)
+ min_vbi_lines = CVT_RB_V2_MIN_V_FPORCH + v_sync + CVT_RB_V_BPORCH;
+ else
+ min_vbi_lines = CVT_RB_V_FPORCH + v_sync + CVT_MIN_V_BPORCH;
+
+ if (vbi_lines < min_vbi_lines)
+ vbi_lines = min_vbi_lines;
- h_blank = CVT_RB_H_BLANK;
+ h_blank = rb_v2 ? CVT_RB_V2_H_BLANK : CVT_RB_H_BLANK;
v_blank = vbi_lines;
total_h_pixel = active_h_pixel + h_blank;
@@ -263,12 +285,17 @@ bool calc_cvt_modeline(int image_width, int image_height,
h_bp = h_blank / 2;
h_fp = h_blank - h_bp - h_sync;
- v_fp = CVT_RB_V_FPORCH;
- v_bp = v_blank - v_fp - v_sync;
+ if (rb_v2) {
+ v_bp = CVT_RB_V_BPORCH;
+ v_fp = v_blank - v_bp - v_sync;
+ } else {
+ v_fp = CVT_RB_V_FPORCH;
+ v_bp = v_blank - v_fp - v_sync;
+ }
pixel_clock = v_refresh * total_h_pixel *
(2 * total_v_lines + interlace) / 2;
- pixel_clock -= pixel_clock % CVT_PXL_CLK_GRAN;
+ pixel_clock -= pixel_clock % clk_gran;
}
cvt->standards = V4L2_DV_BT_STD_CVT;
@@ -300,7 +327,7 @@ bool calc_cvt_modeline(int image_width, int image_height,
cvt->flags |= V4L2_DV_FL_HALF_LINE;
cvt->il_vbackporch += 1;
}
- if (reduced_blanking) {
+ if (use_rb) {
cvt->polarities = V4L2_DV_HSYNC_POS_POL;
cvt->flags |= V4L2_DV_FL_REDUCED_BLANKING;
} else
@@ -354,7 +381,8 @@ bool calc_cvt_modeline(int image_width, int image_height,
* @image_width
* @image_height
* @refresh_rate
- * @reduced_blanking: whether to use reduced blanking
+ * @reduced_blanking: This value, if greater than 0, indicates that
+ * reduced blanking is to be used.
* @interlaced: whether to compute an interlaced mode
* @gtf: stores results of gtf timing calculation
*
@@ -364,7 +392,7 @@ bool calc_cvt_modeline(int image_width, int image_height,
*/
bool calc_gtf_modeline(int image_width, int image_height,
- int refresh_rate, bool reduced_blanking,
+ int refresh_rate, int reduced_blanking,
bool interlaced, struct v4l2_bt_timings *gtf)
{
int h_sync;
@@ -397,6 +425,7 @@ bool calc_gtf_modeline(int image_width, int image_height,
int v_sync_bp;
int tmp1, tmp2;
int ideal_blank_duty_cycle;
+ bool use_rb = false;
if (!gtf) {
fprintf(stderr, "Null pointer to gtf modeline structure\n");
@@ -406,6 +435,8 @@ bool calc_gtf_modeline(int image_width, int image_height,
if (!valid_params(image_width, image_height, refresh_rate))
return false;
+ use_rb = (reduced_blanking > 0) ? true : false;
+
h_pixel = image_width;
v_lines = image_height;
@@ -452,7 +483,7 @@ bool calc_gtf_modeline(int image_width, int image_height,
h_period = ((long long)h_period_est * v_refresh_est) /
(v_refresh * HV_FACTOR);
- if (!reduced_blanking)
+ if (!use_rb)
ideal_blank_duty_cycle = (GTF_D_C_PRIME * HV_FACTOR) -
GTF_D_M_PRIME * h_period / 1000;
else
@@ -507,7 +538,7 @@ bool calc_gtf_modeline(int image_width, int image_height,
gtf->flags |= V4L2_DV_FL_HALF_LINE;
gtf->il_vbackporch += 1;
}
- if (reduced_blanking) {
+ if (use_rb) {
gtf->polarities = V4L2_DV_HSYNC_POS_POL;
gtf->flags |= V4L2_DV_FL_REDUCED_BLANKING;
} else
diff --git a/utils/v4l2-ctl/v4l2-ctl-stds.cpp b/utils/v4l2-ctl/v4l2-ctl-stds.cpp
index e725fa8..3e54ff6 100644
--- a/utils/v4l2-ctl/v4l2-ctl-stds.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-stds.cpp
@@ -237,15 +237,11 @@ 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 == 1 ? true : false,
- interlaced == 1 ? true : false,
- bt);
+ timings_valid = calc_cvt_modeline(width, height, fps, r_blank,
+ interlaced == 1 ? true : false, bt);
} else {
- timings_valid = calc_gtf_modeline(width, height, fps,
- r_blank == 1 ? true : false,
- interlaced == 1 ? true : false,
- bt);
+ timings_valid = calc_gtf_modeline(width, height, fps, r_blank,
+ interlaced == 1 ? true : false, bt);
}
if (!timings_valid) {
diff --git a/utils/v4l2-ctl/v4l2-ctl.h b/utils/v4l2-ctl/v4l2-ctl.h
index efb5eb3..de65900 100644
--- a/utils/v4l2-ctl/v4l2-ctl.h
+++ b/utils/v4l2-ctl/v4l2-ctl.h
@@ -350,10 +350,10 @@ void edid_get(int fd);
/* v4l2-ctl-modes.cpp */
bool calc_cvt_modeline(int image_width, int image_height,
- int refresh_rate, bool reduced_blanking,
+ int refresh_rate, int reduced_blanking,
bool interlaced, struct v4l2_bt_timings *cvt);
bool calc_gtf_modeline(int image_width, int image_height,
- int refresh_rate, bool reduced_blanking,
+ int refresh_rate, int reduced_blanking,
bool interlaced, struct v4l2_bt_timings *gtf);
#endif
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [RFC PATCH v2 2/2] v4l2-utils: Modify usage for set-dv-timing to support RB V2
2015-06-23 5:56 [RFC PATCH v2 0/2] v4l2-utils: add support for RB v2 in cvt Prashant Laddha
2015-06-23 5:56 ` [RFC PATCH v2 1/2] v4l2-ctl-modes: add support for reduced blanking version 2 Prashant Laddha
@ 2015-06-23 5:56 ` Prashant Laddha
1 sibling, 0 replies; 3+ messages in thread
From: Prashant Laddha @ 2015-06-23 5:56 UTC (permalink / raw)
To: linux-media; +Cc: Hans Verkuil, Prashant Laddha
To support the timings calculations for reduced blanking version 2
(RB v2), command line options now capture version info. Updated the
command usage for the same.
Cc: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Prashant Laddha <prladdha@cisco.com>
---
utils/v4l2-ctl/v4l2-ctl-stds.cpp | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/utils/v4l2-ctl/v4l2-ctl-stds.cpp b/utils/v4l2-ctl/v4l2-ctl-stds.cpp
index 3e54ff6..aea46c9 100644
--- a/utils/v4l2-ctl/v4l2-ctl-stds.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-stds.cpp
@@ -41,7 +41,11 @@ 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>\n"
+ " interlaced=<0/1>,reduced-blanking=<0/1/2>\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"
" or give a fully specified timings:\n"
" width=<width>,height=<height>,interlaced=<0/1>,\n"
" polarities=<polarities mask>,pixelclock=<pixelclock Hz>,\n"
@@ -205,7 +209,6 @@ static void get_cvt_gtf_timings(char *subopt, int standard,
int fps = 0;
int r_blank = 0;
int interlaced = 0;
-
bool timings_valid = false;
char *subopt_str = subopt;
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-06-23 5:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-23 5:56 [RFC PATCH v2 0/2] v4l2-utils: add support for RB v2 in cvt Prashant Laddha
2015-06-23 5:56 ` [RFC PATCH v2 1/2] v4l2-ctl-modes: add support for reduced blanking version 2 Prashant Laddha
2015-06-23 5:56 ` [RFC PATCH v2 2/2] v4l2-utils: Modify usage for set-dv-timing to support RB V2 Prashant Laddha
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).