Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b883ba75 authored by Prashant Laddha's avatar Prashant Laddha Committed by Mauro Carvalho Chehab
Browse files

[media] vivid: add support for reduced fps in video out



If reduced fps flag is set then check if other necessary conditions
are true for the given bt timing. If yes, then reduce the frame rate.
For vivid transmitter, timeperframe_vid_out controls the frame rate.
Adjusting the timeperframe_vid_out by scaling down pixel clock by
factor of 1000 / 1001.

Signed-off-by: default avatarPrashant Laddha <prladdha@cisco.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 8d7322f4
Loading
Loading
Loading
Loading
+8 −1
Original line number Original line Diff line number Diff line
@@ -224,6 +224,7 @@ void vivid_update_format_out(struct vivid_dev *dev)
{
{
	struct v4l2_bt_timings *bt = &dev->dv_timings_out.bt;
	struct v4l2_bt_timings *bt = &dev->dv_timings_out.bt;
	unsigned size, p;
	unsigned size, p;
	u64 pixelclock;


	switch (dev->output_type[dev->output]) {
	switch (dev->output_type[dev->output]) {
	case SVID:
	case SVID:
@@ -245,8 +246,14 @@ void vivid_update_format_out(struct vivid_dev *dev)
		dev->sink_rect.width = bt->width;
		dev->sink_rect.width = bt->width;
		dev->sink_rect.height = bt->height;
		dev->sink_rect.height = bt->height;
		size = V4L2_DV_BT_FRAME_WIDTH(bt) * V4L2_DV_BT_FRAME_HEIGHT(bt);
		size = V4L2_DV_BT_FRAME_WIDTH(bt) * V4L2_DV_BT_FRAME_HEIGHT(bt);

		if (can_reduce_fps(bt) && (bt->flags & V4L2_DV_FL_REDUCED_FPS))
			pixelclock = div_u64(bt->pixelclock * 1000, 1001);
		else
			pixelclock = bt->pixelclock;

		dev->timeperframe_vid_out = (struct v4l2_fract) {
		dev->timeperframe_vid_out = (struct v4l2_fract) {
			size / 100, (u32)bt->pixelclock / 100
			size / 100, (u32)pixelclock / 100
		};
		};
		if (bt->interlaced)
		if (bt->interlaced)
			dev->field_out = V4L2_FIELD_ALTERNATE;
			dev->field_out = V4L2_FIELD_ALTERNATE;