Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1635220

Re: [patch] autogain support for bayer10 format (was Re: [patch] propagating controls in libv4l2)

From Russell King - ARM Linux <linux@armlinux.org.uk>
Newsgroups linux.kernel
Subject Re: [patch] autogain support for bayer10 format (was Re: [patch] propagating controls in libv4l2)
Date 2017-05-03 21:10 +0200
Message-ID <tD7OW-13Q-7@gated-at.bofh.it> (permalink)
References (5 earlier) <tzXM5-6p1-1@gated-at.bofh.it> <tAsPU-197-21@gated-at.bofh.it> <tAt9f-1vX-3@gated-at.bofh.it> <tAvb4-2OA-13@gated-at.bofh.it> <tAxmy-4e9-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Apr 26, 2017 at 06:43:54PM +0300, Ivaylo Dimitrov wrote:
> >+static int get_luminosity_bayer10(uint16_t *buf, const struct v4l2_format *fmt)
> >+{
> >+	long long avg_lum = 0;
> >+	int x, y;
> >+	
> >+	buf += fmt->fmt.pix.height * fmt->fmt.pix.bytesperline / 4 +
> >+		fmt->fmt.pix.width / 4;
> >+
> >+	for (y = 0; y < fmt->fmt.pix.height / 2; y++) {
> >+		for (x = 0; x < fmt->fmt.pix.width / 2; x++)
> 
> That would take some time :). AIUI, we have NEON support in ARM kernels
> (CONFIG_KERNEL_MODE_NEON), I wonder if it makes sense (me) to convert the
> above loop to NEON-optimized when it comes to it? Are there any drawbacks in
> using NEON code in kernel?

Using neon without the VFP state saved and restored corrupts userspace's
FP state.  So, you have to save the entire VFP state to use neon in kernel
mode.  There are helper functions for this: kernel_neon_begin() and
kernel_neon_end().

You can't build C code with the compiler believing that neon is available
as the compiler could emit neon instructions in unprotected kernel code.

Note that kernel_neon_begin() is only allowed to be called outside
interrupt context and with preemption disabled.

Given that, do we really want to be walking over multi-megabytes of image
data in the kernel with preemption disabled - it sounds like a recipe for
a very sluggish system.  I think this should (and can only sensibly be
done) in userspace.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: support autofocus / autogain in libv4l2 Pavel Machek <pavel@ucw.cz> - 2017-04-24 23:30 +0200
  Re: support autofocus / autogain in libv4l2 Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2017-04-25 03:50 +0200
    Re: support autofocus / autogain in libv4l2 Pavel Machek <pavel@ucw.cz> - 2017-04-25 10:10 +0200
      Re: support autofocus / autogain in libv4l2 Pali Rohár <pali.rohar@gmail.com> - 2017-04-25 10:20 +0200
        Re: support autofocus / autogain in libv4l2 Pavel Machek <pavel@ucw.cz> - 2017-04-25 13:30 +0200
          Re: support autofocus / autogain in libv4l2 Pali Rohár <pali.rohar@gmail.com> - 2017-04-25 13:40 +0200
            Re: support autofocus / autogain in libv4l2 Pavel Machek <pavel@ucw.cz> - 2017-04-25 14:30 +0200
              Re: support autofocus / autogain in libv4l2 Pali Rohár <pali.rohar@gmail.com> - 2017-04-25 15:00 +0200
            Re: support autofocus / autogain in libv4l2 Nicolas Dufresne <nicolas@ndufresne.ca> - 2017-04-25 19:00 +0200
        Re: support autofocus / autogain in libv4l2 Nicolas Dufresne <nicolas@ndufresne.ca> - 2017-04-25 19:00 +0200
      Re: support autofocus / autogain in libv4l2 Nicolas Dufresne <nicolas@ndufresne.ca> - 2017-04-25 19:00 +0200
        Re: support autofocus / autogain in libv4l2 Pavel Machek <pavel@ucw.cz> - 2017-04-26 13:00 +0200
    [patch] propagating controls in libv4l2 was Re: support autofocus /  autogain in libv4l2 Pavel Machek <pavel@ucw.cz> - 2017-04-26 13:00 +0200
      Re: [patch] propagating controls in libv4l2 was Re: support  autofocus / autogain in libv4l2 Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2017-04-26 13:20 +0200
        [patch] autogain support for bayer10 format (was Re: [patch]  propagating controls in libv4l2) Pavel Machek <pavel@ucw.cz> - 2017-04-26 15:30 +0200
          Re: [patch] autogain support for bayer10 format (was Re: [patch]  propagating controls in libv4l2) Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> - 2017-04-26 17:50 +0200
            Re: [patch] autogain support for bayer10 format (was Re: [patch]  propagating controls in libv4l2) Pavel Machek <pavel@ucw.cz> - 2017-04-27 01:00 +0200
              Re: [patch] autogain support for bayer10 format (was Re: [patch]  propagating controls in libv4l2) Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> - 2017-04-27 08:00 +0200
            Re: [patch] autogain support for bayer10 format (was Re: [patch]  propagating controls in libv4l2) Russell King - ARM Linux <linux@armlinux.org.uk> - 2017-05-03 21:10 +0200
              Re: [patch] autogain support for bayer10 format (was Re: [patch]  propagating controls in libv4l2) Pavel Machek <pavel@ucw.cz> - 2017-05-03 22:00 +0200
          Re: [patch] autogain support for bayer10 format (was Re: [patch]  propagating controls in libv4l2) Pavel Machek <pavel@ucw.cz> - 2017-05-01 00:50 +0200
      Re: [patch] propagating controls in libv4l2 was Re: support  autofocus / autogain in libv4l2 Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2017-04-26 13:30 +0200
        Re: [patch] propagating controls in libv4l2 was Re: support  autofocus / autogain in libv4l2 Pavel Machek <pavel@ucw.cz> - 2017-04-29 11:20 +0200

csiph-web