linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>
Subject: Some comments on the new autocluster patches
Date: Fri, 01 Jul 2011 17:06:43 +0200	[thread overview]
Message-ID: <4E0DE283.2030107@redhat.com> (raw)

Hi Hans (et all),

I've been working on doing a much needed cleanup to the pwc driver,
converting it to videobuf2 and using the new ctrl framework.

I hope to be able to send a pull request for this, this weekend.

I saw your pull request and I'm looking forward to be able to
play with ctrl events. I do have some comments on your autofoo
cluster patches and related changes though.

First of all there is:
"v4l2-ctrls: fix and improve volatile control handling."

I must admit I was a bit confused about needing to set
cur.val rather then just val from the g_volatile_ctrl op
myself at first too, but I've gotten used to it now :)

With that said I'm not quite sure I like to proposed change
though, where g_ctrl will return the new value as long as the
control is volatile and then jump to the old cur val when
it turns non volatile (ie autogain is turned off) this seems
wrong to me, it will certainly surprise both driver writers
and v4l2 app users alike!

Also this requires special care taking by drivers when ie
autogain gets turned off, either they need to update cur.val
with the real current value, or they need to send the cur.val
to the device at this point to ensure the device's setting
and cur.val match.

Actually this brings me to the second point, making ie gain
non volatile as soon as autogain gets turned off, can be wrong,
as the gain may have changed between the last g_volatile_ctrl
call and the autogain getting turned off. I admit that
your solution of simply not updating cur.val and at all as long
as the ctrl is volatile and then jump back to cur.val avoids
this, but I find that less then ideal.

The entire model of having a separate manual value (stored in
cur.val) and an autocontrolled value stored in val as long
as the control is volatile, seems to assume a device with
2 separate registers for gain, one with the active gain,
and one with a manual gain preset. Where in auto mode only
the active gain is controlled and switching to manual
gain mode copies the manual gain value to the active gain.

This is IMHO a pretty limited model of reality, I know
you have experience with a device which happens to work
like that, but many do not work like that.

Actually the pwc has 2 registers, but when switching to
manual mode, it updates the manual setting register, with
the last value set in the active register by the autogain,
so the other way around then your model assumes.


But we should not be looking at existing hardware at all,
instead we should be looking at the user experience, and
build our model from there. Drivers will have to cope
with all the different variations on this theme at the
driver level IMHO.

And looking from the users perspective the right choice
is obvious IMHO. When the user turns of auto-foo, then
following the principle of least surprise, the right
thing to do is to leave the control at its current
setting, because likely the user wants to make some
adjustments to the auto-foo chosen value for foo.
Rather then to start over with some $random (from the
users perspective) value for foo. Imagine that
auto-foo has been on since driver loading, then the
value in cur.val has never been seen by the user before,
yet switching to manual all of a sudden switches
to this unseen value -> confused user

I suggest that when an auto-foo control gets turned of
the code calls g_volatile_ctrl one last time after
actually turning it off and stores the result in cur.val

Actually in my current pwc code I've done this by moving
the clearing of the volatile flag to the g_volatile_ctrl
op, when g_volatile_ctrl-foo gets called and auto-foo is
off, then g_volatile_ctrl-foo clears the volatile flag.

This avoid needlessly calling g_volatile_ctrl-foo if
auto-foo gets turned off, but no one cares about the
value of foo after that.

Note that this depends on the old behavior of
g_volatile_ctrl setting cur.val rather then just val.

Regards,

Hans

             reply	other threads:[~2011-07-01 15:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-01 15:06 Hans de Goede [this message]
2011-07-01 16:21 ` Some comments on the new autocluster patches Hans Verkuil
2011-07-02 10:28   ` Hans de Goede
2011-07-02 11:10     ` Hans Verkuil
2011-07-02 14:31       ` Hans de Goede
2011-07-04  9:43         ` Hans Verkuil
2011-07-12 13:25           ` Hans de Goede
2011-07-26  9:26             ` Hans Verkuil
2011-07-26 13:51               ` Hans de Goede
2011-07-26 14:19                 ` Hans Verkuil
2011-07-26 14:38                   ` Hans de Goede
2011-07-26 14:39                     ` Hans Verkuil
2011-07-02  0:55 ` Mauro Carvalho Chehab
2011-07-02  9:36   ` Hans Verkuil
2011-07-02 18:33     ` Mauro Carvalho Chehab

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=4E0DE283.2030107@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    /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).