From: Kirill Smelkov <kirr@navytux.spb.ru>
To: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: Hans Verkuil <hverkuil@xs4all.nl>,
Mauro Carvalho Chehab <mchehab@infradead.org>,
kirr@mns.spb.ru, linux-media@vger.kernel.org
Subject: Re: [PATCH v4] [media] vivi: Teach it to tune FPS
Date: Sat, 17 Nov 2012 14:45:09 +0400 [thread overview]
Message-ID: <20121117104509.GA10789@mini.zxlink> (raw)
In-Reply-To: <50A65FF2.8020801@redhat.com>
On Fri, Nov 16, 2012 at 01:46:58PM -0200, Mauro Carvalho Chehab wrote:
> Em 16-11-2012 11:38, Hans Verkuil escreveu:
> >On Wed November 7 2012 12:30:01 Kirill Smelkov wrote:
[...]
> >>diff --git a/drivers/media/platform/vivi.c b/drivers/media/platform/vivi.c
> >>index 37d0af8..5d1b374 100644
> >>--- a/drivers/media/platform/vivi.c
> >>+++ b/drivers/media/platform/vivi.c
> >>@@ -65,8 +65,11 @@ MODULE_PARM_DESC(vid_limit, "capture memory limit in megabytes");
> >> /* Global font descriptor */
> >> static const u8 *font8x16;
> >>
> >>-/* default to NTSC timeperframe */
> >>-static const struct v4l2_fract TPF_DEFAULT = {.numerator = 1001, .denominator = 30000};
> >>+/* timeperframe: min/max and default */
> >>+static const struct v4l2_fract
> >>+ tpf_min = {.numerator = 1, .denominator = UINT_MAX}, /* 1/infty */
> >>+ tpf_max = {.numerator = UINT_MAX, .denominator = 1}, /* infty */
> >
> >I understand your reasoning here, but I wouldn't go with UINT_MAX here. Something like
> >1/1000 tpf (or 1 ms) up to 86400/1 tpf (or once a day). With UINT_MAX I am afraid we
> >might hit application errors when they manipulate these values. The shortest time
> >between frames is 1 ms anyway.
> >
> >It's the only comment I have, it looks good otherwise.
>
> As those will be a arbitrary values, I suggest to declare a macro for it at the
> beginning of vivi.c file, with some comment explaining the rationale of the choose,
> and what else needs to be changed, if this changes (e. g. less than 1ms would require
> changing the image generation logic, to avoid producing frames with equal content).
Maybe something like this? (please note, I'm not a good text writer. If
this needs adjustment please help me shape the text up)
diff --git a/drivers/media/platform/vivi.c b/drivers/media/platform/vivi.c
index 5d1b374..45b8a81 100644
--- a/drivers/media/platform/vivi.c
+++ b/drivers/media/platform/vivi.c
@@ -36,6 +36,18 @@
#define VIVI_MODULE_NAME "vivi"
+/* Maximum allowed frame rate
+ *
+ * Vivi will allow setting timeperframe in [1/FPS_MAX - FPS_MAX/1] range.
+ *
+ * Ideally FPS_MAX should be infinity, i.e. practically UINT_MAX, but that
+ * might hit application errors when they manipulate these values.
+ *
+ * Besides, for tpf < 1ms image-generation logic should be changed, to avoid
+ * producing frames with equal content.
+ */
+#define FPS_MAX 1000
+
#define MAX_WIDTH 1920
#define MAX_HEIGHT 1200
@@ -67,8 +79,8 @@ static const u8 *font8x16;
/* timeperframe: min/max and default */
static const struct v4l2_fract
- tpf_min = {.numerator = 1, .denominator = UINT_MAX}, /* 1/infty */
- tpf_max = {.numerator = UINT_MAX, .denominator = 1}, /* infty */
+ tpf_min = {.numerator = 1, .denominator = FPS_MAX}, /* ~1/infty */
+ tpf_max = {.numerator = FPS_MAX, .denominator = 1}, /* ~infty */
tpf_default = {.numerator = 1001, .denominator = 30000}; /* NTSC */
#define dprintk(dev, level, fmt, arg...) \
next prev parent reply other threads:[~2012-11-17 10:46 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-22 13:54 [PATCH 1/2] [media] vivi: Kill BUFFER_TIMEOUT macro Kirill Smelkov
2012-10-22 13:54 ` [PATCH 2/2] [media] vivi: Teach it to tune FPS Kirill Smelkov
2012-10-22 14:16 ` Hans Verkuil
2012-10-22 17:01 ` Kirill Smelkov
2012-10-22 17:29 ` Kirill Smelkov
2012-10-23 6:27 ` Hans Verkuil
2012-10-23 6:40 ` Hans Verkuil
2012-10-23 13:35 ` [PATCH v3] " Kirill Smelkov
2012-11-02 14:09 ` Kirill Smelkov
2012-11-02 14:42 ` Hans Verkuil
2012-11-02 16:44 ` Kirill Smelkov
2012-11-07 11:30 ` [PATCH v4] " Kirill Smelkov
2012-11-12 8:12 ` Kirill Smelkov
2012-11-12 9:46 ` Hans Verkuil
2012-11-12 10:45 ` Kirill Smelkov
2012-11-16 13:38 ` Hans Verkuil
2012-11-16 14:48 ` [PATCH v5] " Kirill Smelkov
2012-11-16 14:51 ` Hans Verkuil
2012-11-16 15:02 ` Kirill Smelkov
2012-11-16 15:46 ` [PATCH v4] " Mauro Carvalho Chehab
2012-11-17 10:45 ` Kirill Smelkov [this message]
2012-11-18 9:24 ` Mauro Carvalho Chehab
2012-11-18 9:25 ` Mauro Carvalho Chehab
2012-11-19 5:52 ` [PATCH v6] " Kirill Smelkov
2012-11-30 11:02 ` Kirill Smelkov
2012-11-30 11:10 ` Hans Verkuil
2012-11-30 12:16 ` Kirill Smelkov
2012-10-22 14:16 ` [PATCH 1/2] [media] vivi: Kill BUFFER_TIMEOUT macro Hans Verkuil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121117104509.GA10789@mini.zxlink \
--to=kirr@navytux.spb.ru \
--cc=hverkuil@xs4all.nl \
--cc=kirr@mns.spb.ru \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@infradead.org \
--cc=mchehab@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).