All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/2] vivid: reduced fps support
@ 2015-08-23 14:09 Prashant Laddha
  2015-08-23 14:09 ` [RFC PATCH 1/2] vivid: add support for reduced fps in video out Prashant Laddha
  2015-08-23 14:09 ` [RFC PATCH 2/2] vivid: add support for reduced fps in video capture Prashant Laddha
  0 siblings, 2 replies; 5+ messages in thread
From: Prashant Laddha @ 2015-08-23 14:09 UTC (permalink / raw)
  To: linux-media

Hi,

Following patches add reduced fps support in vivid video transmit
and capture. Please review and share your comments.

Regards,
Prashant

Prashant Laddha (2):
  vivid: add support for reduced fps in video out.
  vivid: add support for reduced fps in video capture

 drivers/media/platform/vivid/vivid-core.h    |  1 +
 drivers/media/platform/vivid/vivid-ctrls.c   | 15 ++++++++++++++
 drivers/media/platform/vivid/vivid-vid-cap.c |  7 ++++++-
 drivers/media/platform/vivid/vivid-vid-out.c | 30 +++++++++++++++++++++++++++-
 drivers/media/v4l2-core/v4l2-dv-timings.c    |  5 +++++
 5 files changed, 56 insertions(+), 2 deletions(-)

-- 
1.9.1


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

* [RFC PATCH 1/2] vivid: add support for reduced fps in video out.
  2015-08-23 14:09 [RFC PATCH 0/2] vivid: reduced fps support Prashant Laddha
@ 2015-08-23 14:09 ` Prashant Laddha
  2015-09-04 13:04   ` Hans Verkuil
  2015-08-23 14:09 ` [RFC PATCH 2/2] vivid: add support for reduced fps in video capture Prashant Laddha
  1 sibling, 1 reply; 5+ messages in thread
From: Prashant Laddha @ 2015-08-23 14:09 UTC (permalink / raw)
  To: linux-media; +Cc: Hans Verkuil, Prashant Laddha

If bt timing has REDUCED_FPS flag set, then reduce the frame rate
by factor of 1000 / 1001. For vivid, timeperframe_vid_out indicates
the frame timings used by video out thread. The timeperframe_vid_out
is derived from pixel clock. Adjusting the timeperframe_vid_out by
scaling down pixel clock with factor of 1000 / 1001.

The reduced fps is supported for CVT timings if reduced blanking v2
(indicated by vsync = 8) is true. For CEA861 timings, reduced fps is
supported if V4L2_DV_FL_CAN_REDUCE_FPS flag is true. For GTF timings,
reduced fps is not supported.

The reduced fps will allow refresh rates like 29.97, 59.94 etc.

Cc: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Prashant Laddha <prladdha@cisco.com>
---
 drivers/media/platform/vivid/vivid-vid-out.c | 30 +++++++++++++++++++++++++++-
 drivers/media/v4l2-core/v4l2-dv-timings.c    |  5 +++++
 2 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/vivid/vivid-vid-out.c b/drivers/media/platform/vivid/vivid-vid-out.c
index c404e27..ca6ec78 100644
--- a/drivers/media/platform/vivid/vivid-vid-out.c
+++ b/drivers/media/platform/vivid/vivid-vid-out.c
@@ -213,6 +213,27 @@ const struct vb2_ops vivid_vid_out_qops = {
 };
 
 /*
+ * Called to check conditions for reduced fps. For CVT timings, reduced
+ * fps is allowed only with reduced blanking v2 (vsync == 8). For CEA861
+ * timings, reduced fps is allowed if V4L2_DV_FL_CAN_REDUCE_FPS flag is
+ * true.
+ */
+static bool reduce_fps(struct v4l2_bt_timings *bt)
+{
+	if (!(bt->flags & V4L2_DV_FL_REDUCED_FPS))
+		return false;
+
+	if ((bt->standards & V4L2_DV_BT_STD_CVT) && (bt->vsync == 8))
+			return true;
+
+	if ((bt->standards & V4L2_DV_BT_STD_CEA861) &&
+	    (bt->flags & V4L2_DV_FL_CAN_REDUCE_FPS))
+			return true;
+
+	return false;
+}
+
+/*
  * Called whenever the format has to be reset which can occur when
  * changing outputs, standard, timings, etc.
  */
@@ -220,6 +241,7 @@ void vivid_update_format_out(struct vivid_dev *dev)
 {
 	struct v4l2_bt_timings *bt = &dev->dv_timings_out.bt;
 	unsigned size, p;
+	u64 pixelclock;
 
 	switch (dev->output_type[dev->output]) {
 	case SVID:
@@ -241,8 +263,14 @@ void vivid_update_format_out(struct vivid_dev *dev)
 		dev->sink_rect.width = bt->width;
 		dev->sink_rect.height = bt->height;
 		size = V4L2_DV_BT_FRAME_WIDTH(bt) * V4L2_DV_BT_FRAME_HEIGHT(bt);
+
+		if (reduce_fps(bt))
+			pixelclock = div_u64((bt->pixelclock * 1000), 1001);
+		else
+			pixelclock = bt->pixelclock;
+
 		dev->timeperframe_vid_out = (struct v4l2_fract) {
-			size / 100, (u32)bt->pixelclock / 100
+			size / 100, (u32)pixelclock / 100
 		};
 		if (bt->interlaced)
 			dev->field_out = V4L2_FIELD_ALTERNATE;
diff --git a/drivers/media/v4l2-core/v4l2-dv-timings.c b/drivers/media/v4l2-core/v4l2-dv-timings.c
index 6a83d61..adc03bd 100644
--- a/drivers/media/v4l2-core/v4l2-dv-timings.c
+++ b/drivers/media/v4l2-core/v4l2-dv-timings.c
@@ -210,7 +210,12 @@ bool v4l2_find_dv_timings_cap(struct v4l2_dv_timings *t,
 					  fnc, fnc_handle) &&
 		    v4l2_match_dv_timings(t, v4l2_dv_timings_presets + i,
 					  pclock_delta)) {
+			u32 flags = t->bt.flags & V4L2_DV_FL_REDUCED_FPS;
+
 			*t = v4l2_dv_timings_presets[i];
+			if (t->bt.flags & V4L2_DV_FL_CAN_REDUCE_FPS)
+				t->bt.flags |= flags;
+
 			return true;
 		}
 	}
-- 
1.9.1


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

* [RFC PATCH 2/2] vivid: add support for reduced fps in video capture
  2015-08-23 14:09 [RFC PATCH 0/2] vivid: reduced fps support Prashant Laddha
  2015-08-23 14:09 ` [RFC PATCH 1/2] vivid: add support for reduced fps in video out Prashant Laddha
@ 2015-08-23 14:09 ` Prashant Laddha
  2015-09-04 13:24   ` Hans Verkuil
  1 sibling, 1 reply; 5+ messages in thread
From: Prashant Laddha @ 2015-08-23 14:09 UTC (permalink / raw)
  To: linux-media; +Cc: Hans Verkuil, Prashant Laddha

With this patch, vivid capture thread can now generate reduced
fps by factor of 1000 / 1001. This is controlled using a boolean
VIVID_CID_REDUCED_FPS added in vivid control. For reduced fps,
capture time is controlled by scaling down timeperframe_vid_cap
with a factor of 1000 / 1001 if VIVID_CID_REDUCED_FPS is true.

Cc: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Prashant Laddha <prladdha@cisco.com>
---
 drivers/media/platform/vivid/vivid-core.h    |  1 +
 drivers/media/platform/vivid/vivid-ctrls.c   | 15 +++++++++++++++
 drivers/media/platform/vivid/vivid-vid-cap.c |  7 ++++++-
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/vivid/vivid-core.h b/drivers/media/platform/vivid/vivid-core.h
index c72349c..4a2c8b7 100644
--- a/drivers/media/platform/vivid/vivid-core.h
+++ b/drivers/media/platform/vivid/vivid-core.h
@@ -263,6 +263,7 @@ struct vivid_dev {
 	bool				vflip;
 	bool				vbi_cap_interlaced;
 	bool				loop_video;
+	bool				reduced_fps;
 
 	/* Framebuffer */
 	unsigned long			video_pbase;
diff --git a/drivers/media/platform/vivid/vivid-ctrls.c b/drivers/media/platform/vivid/vivid-ctrls.c
index 339c8b7..6becdfe 100644
--- a/drivers/media/platform/vivid/vivid-ctrls.c
+++ b/drivers/media/platform/vivid/vivid-ctrls.c
@@ -78,6 +78,7 @@
 #define VIVID_CID_TIME_WRAP		(VIVID_CID_VIVID_BASE + 39)
 #define VIVID_CID_MAX_EDID_BLOCKS	(VIVID_CID_VIVID_BASE + 40)
 #define VIVID_CID_PERCENTAGE_FILL	(VIVID_CID_VIVID_BASE + 41)
+#define VIVID_CID_REDUCED_FPS		(VIVID_CID_VIVID_BASE + 42)
 
 #define VIVID_CID_STD_SIGNAL_MODE	(VIVID_CID_VIVID_BASE + 60)
 #define VIVID_CID_STANDARD		(VIVID_CID_VIVID_BASE + 61)
@@ -422,6 +423,10 @@ static int vivid_vid_cap_s_ctrl(struct v4l2_ctrl *ctrl)
 		dev->sensor_vflip = ctrl->val;
 		tpg_s_vflip(&dev->tpg, dev->sensor_vflip ^ dev->vflip);
 		break;
+	case VIVID_CID_REDUCED_FPS:
+		dev->reduced_fps = ctrl->val;
+		vivid_update_format_cap(dev, true);
+		break;
 	case VIVID_CID_HAS_CROP_CAP:
 		dev->has_crop_cap = ctrl->val;
 		vivid_update_format_cap(dev, true);
@@ -599,6 +604,15 @@ static const struct v4l2_ctrl_config vivid_ctrl_vflip = {
 	.step = 1,
 };
 
+static const struct v4l2_ctrl_config vivid_ctrl_reduced_fps = {
+	.ops = &vivid_vid_cap_ctrl_ops,
+	.id = VIVID_CID_REDUCED_FPS,
+	.name = "Reduced fps",
+	.type = V4L2_CTRL_TYPE_BOOLEAN,
+	.max = 1,
+	.step = 1,
+};
+
 static const struct v4l2_ctrl_config vivid_ctrl_has_crop_cap = {
 	.ops = &vivid_vid_cap_ctrl_ops,
 	.id = VIVID_CID_HAS_CROP_CAP,
@@ -1379,6 +1393,7 @@ int vivid_create_controls(struct vivid_dev *dev, bool show_ccs_cap,
 		v4l2_ctrl_new_custom(hdl_vid_cap, &vivid_ctrl_vflip, NULL);
 		v4l2_ctrl_new_custom(hdl_vid_cap, &vivid_ctrl_insert_sav, NULL);
 		v4l2_ctrl_new_custom(hdl_vid_cap, &vivid_ctrl_insert_eav, NULL);
+		v4l2_ctrl_new_custom(hdl_vid_cap, &vivid_ctrl_reduced_fps, NULL);
 		if (show_ccs_cap) {
 			dev->ctrl_has_crop_cap = v4l2_ctrl_new_custom(hdl_vid_cap,
 				&vivid_ctrl_has_crop_cap, NULL);
diff --git a/drivers/media/platform/vivid/vivid-vid-cap.c b/drivers/media/platform/vivid/vivid-vid-cap.c
index ed0b878..2b26059 100644
--- a/drivers/media/platform/vivid/vivid-vid-cap.c
+++ b/drivers/media/platform/vivid/vivid-vid-cap.c
@@ -401,6 +401,7 @@ void vivid_update_format_cap(struct vivid_dev *dev, bool keep_controls)
 {
 	struct v4l2_bt_timings *bt = &dev->dv_timings_cap.bt;
 	unsigned size;
+	u64 pixelclock;
 
 	switch (dev->input_type[dev->input]) {
 	case WEBCAM:
@@ -430,8 +431,12 @@ void vivid_update_format_cap(struct vivid_dev *dev, bool keep_controls)
 		dev->src_rect.width = bt->width;
 		dev->src_rect.height = bt->height;
 		size = V4L2_DV_BT_FRAME_WIDTH(bt) * V4L2_DV_BT_FRAME_HEIGHT(bt);
+		if (dev->reduced_fps)
+			pixelclock = div_u64((bt->pixelclock * 1000), 1001);
+		else
+			pixelclock = bt->pixelclock;
 		dev->timeperframe_vid_cap = (struct v4l2_fract) {
-			size / 100, (u32)bt->pixelclock / 100
+			size / 100, (u32)pixelclock / 100
 		};
 		if (bt->interlaced)
 			dev->field_cap = V4L2_FIELD_ALTERNATE;
-- 
1.9.1


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

* Re: [RFC PATCH 1/2] vivid: add support for reduced fps in video out.
  2015-08-23 14:09 ` [RFC PATCH 1/2] vivid: add support for reduced fps in video out Prashant Laddha
@ 2015-09-04 13:04   ` Hans Verkuil
  0 siblings, 0 replies; 5+ messages in thread
From: Hans Verkuil @ 2015-09-04 13:04 UTC (permalink / raw)
  To: Prashant Laddha, linux-media; +Cc: Hans Verkuil

Hi Prashant,

Sorry for the late review, but here it is (finally):

On 08/23/2015 04:09 PM, Prashant Laddha wrote:
> If bt timing has REDUCED_FPS flag set, then reduce the frame rate
> by factor of 1000 / 1001. For vivid, timeperframe_vid_out indicates
> the frame timings used by video out thread. The timeperframe_vid_out
> is derived from pixel clock. Adjusting the timeperframe_vid_out by
> scaling down pixel clock with factor of 1000 / 1001.
> 
> The reduced fps is supported for CVT timings if reduced blanking v2
> (indicated by vsync = 8) is true. For CEA861 timings, reduced fps is
> supported if V4L2_DV_FL_CAN_REDUCE_FPS flag is true. For GTF timings,
> reduced fps is not supported.
> 
> The reduced fps will allow refresh rates like 29.97, 59.94 etc.
> 
> Cc: Hans Verkuil <hans.verkuil@cisco.com>
> Signed-off-by: Prashant Laddha <prladdha@cisco.com>
> ---
>  drivers/media/platform/vivid/vivid-vid-out.c | 30 +++++++++++++++++++++++++++-
>  drivers/media/v4l2-core/v4l2-dv-timings.c    |  5 +++++
>  2 files changed, 34 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/vivid/vivid-vid-out.c b/drivers/media/platform/vivid/vivid-vid-out.c
> index c404e27..ca6ec78 100644
> --- a/drivers/media/platform/vivid/vivid-vid-out.c
> +++ b/drivers/media/platform/vivid/vivid-vid-out.c
> @@ -213,6 +213,27 @@ const struct vb2_ops vivid_vid_out_qops = {
>  };
>  
>  /*
> + * Called to check conditions for reduced fps. For CVT timings, reduced
> + * fps is allowed only with reduced blanking v2 (vsync == 8). For CEA861
> + * timings, reduced fps is allowed if V4L2_DV_FL_CAN_REDUCE_FPS flag is
> + * true.
> + */
> +static bool reduce_fps(struct v4l2_bt_timings *bt)
> +{
> +	if (!(bt->flags & V4L2_DV_FL_REDUCED_FPS))
> +		return false;
> +
> +	if ((bt->standards & V4L2_DV_BT_STD_CVT) && (bt->vsync == 8))

I propose that you add a static inline helper function to v4l2-dv-timings.h
to test for reduced blanking v2. This condition is way too magical...

If you add such a helper, then you should check if there is existing code
that could switch to this helper.

> +			return true;

Bad indentation (one tab too far to the right).

> +
> +	if ((bt->standards & V4L2_DV_BT_STD_CEA861) &&
> +	    (bt->flags & V4L2_DV_FL_CAN_REDUCE_FPS))
> +			return true;

Ditto.

> +
> +	return false;
> +}
> +
> +/*
>   * Called whenever the format has to be reset which can occur when
>   * changing outputs, standard, timings, etc.
>   */
> @@ -220,6 +241,7 @@ void vivid_update_format_out(struct vivid_dev *dev)
>  {
>  	struct v4l2_bt_timings *bt = &dev->dv_timings_out.bt;
>  	unsigned size, p;
> +	u64 pixelclock;
>  
>  	switch (dev->output_type[dev->output]) {
>  	case SVID:
> @@ -241,8 +263,14 @@ void vivid_update_format_out(struct vivid_dev *dev)
>  		dev->sink_rect.width = bt->width;
>  		dev->sink_rect.height = bt->height;
>  		size = V4L2_DV_BT_FRAME_WIDTH(bt) * V4L2_DV_BT_FRAME_HEIGHT(bt);
> +
> +		if (reduce_fps(bt))
> +			pixelclock = div_u64((bt->pixelclock * 1000), 1001);

No need for the parenthesis around bt->pixelclock * 1000.

> +		else
> +			pixelclock = bt->pixelclock;
> +
>  		dev->timeperframe_vid_out = (struct v4l2_fract) {
> -			size / 100, (u32)bt->pixelclock / 100
> +			size / 100, (u32)pixelclock / 100
>  		};
>  		if (bt->interlaced)
>  			dev->field_out = V4L2_FIELD_ALTERNATE;
> diff --git a/drivers/media/v4l2-core/v4l2-dv-timings.c b/drivers/media/v4l2-core/v4l2-dv-timings.c
> index 6a83d61..adc03bd 100644
> --- a/drivers/media/v4l2-core/v4l2-dv-timings.c
> +++ b/drivers/media/v4l2-core/v4l2-dv-timings.c
> @@ -210,7 +210,12 @@ bool v4l2_find_dv_timings_cap(struct v4l2_dv_timings *t,
>  					  fnc, fnc_handle) &&
>  		    v4l2_match_dv_timings(t, v4l2_dv_timings_presets + i,
>  					  pclock_delta)) {
> +			u32 flags = t->bt.flags & V4L2_DV_FL_REDUCED_FPS;
> +
>  			*t = v4l2_dv_timings_presets[i];
> +			if (t->bt.flags & V4L2_DV_FL_CAN_REDUCE_FPS)
> +				t->bt.flags |= flags;
> +

This isn't quite right. This doesn't support V4L2_DV_BT_DMT_4096X2160P60_RB
which is a CVT format with reduced blanking v2 and so it should support reduced
fps.

In theory the 'if' above should check for both the V4L2_DV_FL_CAN_REDUCE_FPS and
for CVT RB v2 (using the helper function I've proposed). However, that would
cause weird behavior with the V4L2_DV_BT_DMT_4096X2160P59_94_RB timings since
these are already reduced fps.

I think the best approach is to add V4L2_DV_FL_CAN_REDUCE_FPS to the
V4L2_DV_BT_DMT_4096X2160P60_RB definition in v4l2-dv-timings.h.

That way the code above is unchanged, and it will work as expected with
V4L2_DV_BT_DMT_4096X2160P60_RB.

Regards,

	Hans

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

* Re: [RFC PATCH 2/2] vivid: add support for reduced fps in video capture
  2015-08-23 14:09 ` [RFC PATCH 2/2] vivid: add support for reduced fps in video capture Prashant Laddha
@ 2015-09-04 13:24   ` Hans Verkuil
  0 siblings, 0 replies; 5+ messages in thread
From: Hans Verkuil @ 2015-09-04 13:24 UTC (permalink / raw)
  To: Prashant Laddha, linux-media; +Cc: Hans Verkuil

On 08/23/2015 04:09 PM, Prashant Laddha wrote:
> With this patch, vivid capture thread can now generate reduced
> fps by factor of 1000 / 1001. This is controlled using a boolean
> VIVID_CID_REDUCED_FPS added in vivid control. For reduced fps,
> capture time is controlled by scaling down timeperframe_vid_cap
> with a factor of 1000 / 1001 if VIVID_CID_REDUCED_FPS is true.
> 
> Cc: Hans Verkuil <hans.verkuil@cisco.com>
> Signed-off-by: Prashant Laddha <prladdha@cisco.com>
> ---
>  drivers/media/platform/vivid/vivid-core.h    |  1 +
>  drivers/media/platform/vivid/vivid-ctrls.c   | 15 +++++++++++++++
>  drivers/media/platform/vivid/vivid-vid-cap.c |  7 ++++++-
>  3 files changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/vivid/vivid-core.h b/drivers/media/platform/vivid/vivid-core.h
> index c72349c..4a2c8b7 100644
> --- a/drivers/media/platform/vivid/vivid-core.h
> +++ b/drivers/media/platform/vivid/vivid-core.h
> @@ -263,6 +263,7 @@ struct vivid_dev {
>  	bool				vflip;
>  	bool				vbi_cap_interlaced;
>  	bool				loop_video;
> +	bool				reduced_fps;
>  
>  	/* Framebuffer */
>  	unsigned long			video_pbase;
> diff --git a/drivers/media/platform/vivid/vivid-ctrls.c b/drivers/media/platform/vivid/vivid-ctrls.c
> index 339c8b7..6becdfe 100644
> --- a/drivers/media/platform/vivid/vivid-ctrls.c
> +++ b/drivers/media/platform/vivid/vivid-ctrls.c
> @@ -78,6 +78,7 @@
>  #define VIVID_CID_TIME_WRAP		(VIVID_CID_VIVID_BASE + 39)
>  #define VIVID_CID_MAX_EDID_BLOCKS	(VIVID_CID_VIVID_BASE + 40)
>  #define VIVID_CID_PERCENTAGE_FILL	(VIVID_CID_VIVID_BASE + 41)
> +#define VIVID_CID_REDUCED_FPS		(VIVID_CID_VIVID_BASE + 42)
>  
>  #define VIVID_CID_STD_SIGNAL_MODE	(VIVID_CID_VIVID_BASE + 60)
>  #define VIVID_CID_STANDARD		(VIVID_CID_VIVID_BASE + 61)
> @@ -422,6 +423,10 @@ static int vivid_vid_cap_s_ctrl(struct v4l2_ctrl *ctrl)
>  		dev->sensor_vflip = ctrl->val;
>  		tpg_s_vflip(&dev->tpg, dev->sensor_vflip ^ dev->vflip);
>  		break;
> +	case VIVID_CID_REDUCED_FPS:
> +		dev->reduced_fps = ctrl->val;
> +		vivid_update_format_cap(dev, true);
> +		break;
>  	case VIVID_CID_HAS_CROP_CAP:
>  		dev->has_crop_cap = ctrl->val;
>  		vivid_update_format_cap(dev, true);
> @@ -599,6 +604,15 @@ static const struct v4l2_ctrl_config vivid_ctrl_vflip = {
>  	.step = 1,
>  };
>  
> +static const struct v4l2_ctrl_config vivid_ctrl_reduced_fps = {
> +	.ops = &vivid_vid_cap_ctrl_ops,
> +	.id = VIVID_CID_REDUCED_FPS,
> +	.name = "Reduced fps",

I think "Reduced Framerate" is a better description.

> +	.type = V4L2_CTRL_TYPE_BOOLEAN,
> +	.max = 1,
> +	.step = 1,
> +};
> +
>  static const struct v4l2_ctrl_config vivid_ctrl_has_crop_cap = {
>  	.ops = &vivid_vid_cap_ctrl_ops,
>  	.id = VIVID_CID_HAS_CROP_CAP,
> @@ -1379,6 +1393,7 @@ int vivid_create_controls(struct vivid_dev *dev, bool show_ccs_cap,
>  		v4l2_ctrl_new_custom(hdl_vid_cap, &vivid_ctrl_vflip, NULL);
>  		v4l2_ctrl_new_custom(hdl_vid_cap, &vivid_ctrl_insert_sav, NULL);
>  		v4l2_ctrl_new_custom(hdl_vid_cap, &vivid_ctrl_insert_eav, NULL);
> +		v4l2_ctrl_new_custom(hdl_vid_cap, &vivid_ctrl_reduced_fps, NULL);
>  		if (show_ccs_cap) {
>  			dev->ctrl_has_crop_cap = v4l2_ctrl_new_custom(hdl_vid_cap,
>  				&vivid_ctrl_has_crop_cap, NULL);
> diff --git a/drivers/media/platform/vivid/vivid-vid-cap.c b/drivers/media/platform/vivid/vivid-vid-cap.c
> index ed0b878..2b26059 100644
> --- a/drivers/media/platform/vivid/vivid-vid-cap.c
> +++ b/drivers/media/platform/vivid/vivid-vid-cap.c
> @@ -401,6 +401,7 @@ void vivid_update_format_cap(struct vivid_dev *dev, bool keep_controls)
>  {
>  	struct v4l2_bt_timings *bt = &dev->dv_timings_cap.bt;
>  	unsigned size;
> +	u64 pixelclock;
>  
>  	switch (dev->input_type[dev->input]) {
>  	case WEBCAM:
> @@ -430,8 +431,12 @@ void vivid_update_format_cap(struct vivid_dev *dev, bool keep_controls)
>  		dev->src_rect.width = bt->width;
>  		dev->src_rect.height = bt->height;
>  		size = V4L2_DV_BT_FRAME_WIDTH(bt) * V4L2_DV_BT_FRAME_HEIGHT(bt);
> +		if (dev->reduced_fps)

This needs a check similar to reduce_fps() in patch 1/2. Except for the fact
that the bt->flags & V4L2_DV_FL_REDUCED_FPS check is invalid for receivers.
Perhaps that check should be moved out of reduce_fps() so that that function
can be shared between capture and output.

The reduced_fps flag should only be honored for timings that allow it.

> +			pixelclock = div_u64((bt->pixelclock * 1000), 1001);

No parenthesis needed around bt->pixelclock * 1000.

> +		else
> +			pixelclock = bt->pixelclock;
>  		dev->timeperframe_vid_cap = (struct v4l2_fract) {
> -			size / 100, (u32)bt->pixelclock / 100
> +			size / 100, (u32)pixelclock / 100
>  		};
>  		if (bt->interlaced)
>  			dev->field_cap = V4L2_FIELD_ALTERNATE;
> 

Regards,

	Hans

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

end of thread, other threads:[~2015-09-04 13:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-23 14:09 [RFC PATCH 0/2] vivid: reduced fps support Prashant Laddha
2015-08-23 14:09 ` [RFC PATCH 1/2] vivid: add support for reduced fps in video out Prashant Laddha
2015-09-04 13:04   ` Hans Verkuil
2015-08-23 14:09 ` [RFC PATCH 2/2] vivid: add support for reduced fps in video capture Prashant Laddha
2015-09-04 13:24   ` Hans Verkuil

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.