From: Hans Verkuil <hverkuil@xs4all.nl>
To: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>,
Hans Verkuil <hans.verkuil@cisco.com>,
Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
Dimitrios Katsaros <patcherwork@gmail.com>
Subject: Re: [PATCH] v4l2-core/v4l2-ctrls: Filter NOOP CH_RANGE events
Date: Wed, 11 Nov 2015 13:11:15 +0100 [thread overview]
Message-ID: <56433063.3010401@xs4all.nl> (raw)
In-Reply-To: <1447243114-1011-1-git-send-email-ricardo.ribalda@gmail.com>
On 11/11/15 12:58, Ricardo Ribalda Delgado wrote:
> If modify_range is called but no range is changed, do not send the
> CH_RANGE event.
While not opposed to this patch, I do wonder what triggered this patch?
Is it just a matter of efficiency? And since it is a driver that calls
this, shouldn't the driver only call this function when something
actually changes?
In other words, can you give some background information?
Regards,
Hans
PS: still haven't processed your V4L2_CTRL_WHICH_DEF_VAL patch series. Hope
to do this next week at the latest.
>
> Reported-by: Dimitrios Katsaros <patcherwork@gmail.com>
> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
> ---
> drivers/media/v4l2-core/v4l2-ctrls.c | 23 ++++++++++++++---------
> 1 file changed, 14 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
> index 4a1d9fdd14bb..f9c0e8150bd1 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
> @@ -3300,7 +3300,8 @@ EXPORT_SYMBOL(v4l2_ctrl_notify);
> int __v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl,
> s64 min, s64 max, u64 step, s64 def)
> {
> - bool changed;
> + bool value_changed;
> + bool range_changed = false;
> int ret;
>
> lockdep_assert_held(ctrl->handler->lock);
> @@ -3324,10 +3325,14 @@ int __v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl,
> default:
> return -EINVAL;
> }
> - ctrl->minimum = min;
> - ctrl->maximum = max;
> - ctrl->step = step;
> - ctrl->default_value = def;
> + if ((ctrl->minimum != min) || (ctrl->maximum != max) ||
> + (ctrl->step != step) || ctrl->default_value != def) {
> + range_changed = true;
> + ctrl->minimum = min;
> + ctrl->maximum = max;
> + ctrl->step = step;
> + ctrl->default_value = def;
> + }
> cur_to_new(ctrl);
> if (validate_new(ctrl, ctrl->p_new)) {
> if (ctrl->type == V4L2_CTRL_TYPE_INTEGER64)
> @@ -3337,12 +3342,12 @@ int __v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl,
> }
>
> if (ctrl->type == V4L2_CTRL_TYPE_INTEGER64)
> - changed = *ctrl->p_new.p_s64 != *ctrl->p_cur.p_s64;
> + value_changed = *ctrl->p_new.p_s64 != *ctrl->p_cur.p_s64;
> else
> - changed = *ctrl->p_new.p_s32 != *ctrl->p_cur.p_s32;
> - if (changed)
> + value_changed = *ctrl->p_new.p_s32 != *ctrl->p_cur.p_s32;
> + if (value_changed)
> ret = set_ctrl(NULL, ctrl, V4L2_EVENT_CTRL_CH_RANGE);
> - else
> + else if (range_changed)
> send_event(NULL, ctrl, V4L2_EVENT_CTRL_CH_RANGE);
> return ret;
> }
>
next prev parent reply other threads:[~2015-11-11 12:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-11 11:58 [PATCH] v4l2-core/v4l2-ctrls: Filter NOOP CH_RANGE events Ricardo Ribalda Delgado
2015-11-11 12:11 ` Hans Verkuil [this message]
2015-11-11 12:20 ` Ricardo Ribalda Delgado
2015-11-11 12:33 ` 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=56433063.3010401@xs4all.nl \
--to=hverkuil@xs4all.nl \
--cc=hans.verkuil@cisco.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@osg.samsung.com \
--cc=patcherwork@gmail.com \
--cc=ricardo.ribalda@gmail.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 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.