Re: [ANN] Meeting to discuss improvements to support MC-based cameras on generic apps

2018-05-19 Thread Laurent Pinchart
Hi Dave,

On Friday, 18 May 2018 18:37:01 EEST Dave Stevenson wrote:
> On 18 May 2018 at 16:05, Mauro Carvalho Chehab wrote:
> > Em Fri, 18 May 2018 15:27:24 +0300
> 
> 
> 
> >>> There, instead of an USB camera, the hardware is equipped with a
> >>> MC-based ISP, connected to its camera. Currently, despite having
> >>> a Kernel driver for it, the camera doesn't work with any
> >>> userspace application.
> >>> 
> >>> I'm also aware of other projects that are considering the usage of
> >>> mc-based devices for non-dedicated hardware.
> >> 
> >> What are those projects ?
> > 
> > Well, cheap ARM-based hardware like RPi3 already has this issue: they
> > have an ISP (or some GPU firmware meant to emulate an ISP). While
> > those hardware could have multiple sensors, typically they have just
> > one.
> 
> Slight hijack, but a closely linked issue for the Pi.
> The way I understand the issue of V4L2 / MC on Pi is a more
> fundamental mismatch in architecture. Please correct me if I'm wrong
> here.
> 
> The Pi CSI2 receiver peripheral always writes the incoming data to
> SDRAM, and the ISP is then a memory to memory device.
> 
> V4L2 subdevices are not dma controllers and therefore have no buffers
> allocated to them. So to support the full complexity of the pipeline
> in V4L2 requires that something somewhere would have to be dequeuing
> the buffers from the CSI receiver V4L2 device and queuing them to the
> input of a (theoretical) ISP M2M V4L2 device, and returning them once
> processed. The application only cares about the output of the ISP M2M
> device.

Regardless of the software stack architecture, something running on the CPU 
has to perform that job. We have decided that that "something" needs to run in 
userspace, to avoid pushing use-case-dependent code to the kernel.

Note that this isn't specific to the RPi. The OMAP3 ISP, while integrating the 
CSI-2 receiver and being able to process data on the fly, can also write the 
raw images to memory and then process them in memory-to-memory mode. This 
feature is used mostly for still image capture to perform pre-processing with 
the CPU (or possibly GPU) on the raw images before processing them in the ISP. 
There's no way we could implement this fully in the kernel.

> So I guess my question is whether there is a sane mechanism to remove
> that buffer allocation and handling from the app? Without it we are
> pretty much forced to hide bigger blobs of functionality to even
> vaguely fit in with V4L2.

We need a way to remove that from the application, but it won't be pushed down 
to the kernel. These tasks should be handled by a userspace framework, 
transparently for the application. The purpose of this discussion is to decide 
on the design of the framework.

> I'm at the point where it shouldn't be a huge amount of work to create
> at least a basic ISP V4L2 M2M device, but I'm not planning on doing it
> if it pushes the above buffer handling onto the app because it simply
> won't get used beyond demo apps. The likes of Cheese, Scratch, etc,
> just won't do it.
> 
> 
> To avoid ambiguity, the Pi has a hardware ISP block. There are other
> SoCs that use either GPU code or a DSP to implement their ISP.

Is that ISP documented publicly ?

-- 
Regards,

Laurent Pinchart





Re: [PATCH v3 8/9] media: rcar-vin: Rename _rcar_info to rcar_info

2018-05-19 Thread Sergei Shtylyov

Hello!

On 5/18/2018 5:40 PM, Jacopo Mondi wrote:


Remove trailing underscore to align all rcar_group_route structure


   Leading, not trailing (judging on the patch).


declarations.
 Signed-off-by: Jacopo Mondi 
---
  drivers/media/platform/rcar-vin/rcar-core.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/rcar-vin/rcar-core.c 
b/drivers/media/platform/rcar-vin/rcar-core.c
index dcebb42..b740f41 100644
--- a/drivers/media/platform/rcar-vin/rcar-core.c
+++ b/drivers/media/platform/rcar-vin/rcar-core.c
@@ -1060,7 +1060,7 @@ static const struct rvin_info rcar_info_r8a7796 = {
.routes = rcar_info_r8a7796_routes,
  };
  
-static const struct rvin_group_route _rcar_info_r8a77970_routes[] = {

+static const struct rvin_group_route rcar_info_r8a77970_routes[] = {
{ .csi = RVIN_CSI40, .channel = 0, .vin = 0, .mask = BIT(0) | BIT(3) },
{ .csi = RVIN_CSI40, .channel = 0, .vin = 1, .mask = BIT(2) },
{ .csi = RVIN_CSI40, .channel = 1, .vin = 1, .mask = BIT(3) },
@@ -1076,7 +1076,7 @@ static const struct rvin_info rcar_info_r8a77970 = {
.use_mc = true,
.max_width = 4096,
.max_height = 4096,
-   .routes = _rcar_info_r8a77970_routes,
+   .routes = rcar_info_r8a77970_routes,
  };
  
  static const struct of_device_id rvin_of_id_table[] = {


MBR, Sergei


Re: [PATCH] media: imx319: Add imx319 camera sensor driver

2018-05-19 Thread kbuild test robot
Hi Bingbu,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on v4.17-rc5 next-20180517]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/bingbu-cao-intel-com/media-imx319-Add-imx319-camera-sensor-driver/20180519-213616
base:   git://linuxtv.org/media_tree.git master
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

>> drivers/media/i2c/imx319.c:219:24: sparse: symbol 'imx319_global_setting' 
>> was not declared. Should it be static?

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


[RFC PATCH] media: imx319: imx319_global_setting can be static

2018-05-19 Thread kbuild test robot

Fixes: aa51064f24f3 ("media: imx319: Add imx319 camera sensor driver")
Signed-off-by: kbuild test robot 
---
 imx319.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/imx319.c b/drivers/media/i2c/imx319.c
index e6a918e..44a9bda 100644
--- a/drivers/media/i2c/imx319.c
+++ b/drivers/media/i2c/imx319.c
@@ -216,7 +216,7 @@ static const struct imx319_reg imx319_global_regs[] = {
{ 0xf2d9, 0x02 },
 };
 
-struct imx319_reg_list imx319_global_setting = {
+static struct imx319_reg_list imx319_global_setting = {
.num_of_regs = ARRAY_SIZE(imx319_global_regs),
.regs = imx319_global_regs,
 };


cron job: media_tree daily build: ERRORS

2018-05-19 Thread Hans Verkuil
This message is generated daily by a cron job that builds media_tree for
the kernels and architectures in the list below.

Results of the daily build of media_tree:

date:   Sun May 20 05:00:10 CEST 2018
media-tree git hash:7e6b6b945272c20f6b78d319e07f27897a8373c9
media_build git hash:   b165bbec0a605da346b1724ef1d20b69cea34544
v4l-utils git hash: e2038ec6451293787b929338c2a671c732b8693d
gcc version:i686-linux-gcc (GCC) 8.1.0
sparse version: 0.5.2-RC1
smatch version: 0.5.1
host hardware:  x86_64
host os:4.15.0-3-amd64

linux-git-arm-at91: WARNINGS
linux-git-arm-davinci: OK
linux-git-arm-multi: WARNINGS
linux-git-arm-pxa: WARNINGS
linux-git-arm-stm32: OK
linux-git-arm64: WARNINGS
linux-git-i686: WARNINGS
linux-git-mips: OK
linux-git-powerpc64: WARNINGS
linux-git-sh: OK
linux-git-x86_64: WARNINGS
Check COMPILE_TEST: OK
linux-2.6.36.4-i686: ERRORS
linux-2.6.36.4-x86_64: ERRORS
linux-2.6.37.6-i686: ERRORS
linux-2.6.37.6-x86_64: ERRORS
linux-2.6.38.8-i686: ERRORS
linux-2.6.38.8-x86_64: ERRORS
linux-2.6.39.4-i686: ERRORS
linux-2.6.39.4-x86_64: ERRORS
linux-3.0.101-i686: ERRORS
linux-3.0.101-x86_64: ERRORS
linux-3.1.10-i686: ERRORS
linux-3.1.10-x86_64: ERRORS
linux-3.2.101-i686: ERRORS
linux-3.2.101-x86_64: ERRORS
linux-3.3.8-i686: ERRORS
linux-3.3.8-x86_64: ERRORS
linux-3.4.113-i686: ERRORS
linux-3.4.113-x86_64: ERRORS
linux-3.5.7-i686: ERRORS
linux-3.5.7-x86_64: ERRORS
linux-3.6.11-i686: ERRORS
linux-3.6.11-x86_64: ERRORS
linux-3.7.10-i686: ERRORS
linux-3.7.10-x86_64: ERRORS
linux-3.8.13-i686: ERRORS
linux-3.8.13-x86_64: ERRORS
linux-3.9.11-i686: ERRORS
linux-3.9.11-x86_64: ERRORS
linux-3.10.108-i686: ERRORS
linux-3.10.108-x86_64: ERRORS
linux-3.11.10-i686: ERRORS
linux-3.11.10-x86_64: ERRORS
linux-3.12.74-i686: ERRORS
linux-3.12.74-x86_64: ERRORS
linux-3.13.11-i686: ERRORS
linux-3.13.11-x86_64: ERRORS
linux-3.14.79-i686: ERRORS
linux-3.14.79-x86_64: ERRORS
linux-3.15.10-i686: ERRORS
linux-3.15.10-x86_64: ERRORS
linux-3.16.56-i686: ERRORS
linux-3.16.56-x86_64: ERRORS
linux-3.17.8-i686: ERRORS
linux-3.17.8-x86_64: ERRORS
linux-3.18.102-i686: ERRORS
linux-3.18.102-x86_64: ERRORS
linux-3.19.8-i686: ERRORS
linux-3.19.8-x86_64: ERRORS
linux-4.0.9-i686: ERRORS
linux-4.0.9-x86_64: ERRORS
linux-4.1.51-i686: ERRORS
linux-4.1.51-x86_64: ERRORS
linux-4.2.8-i686: ERRORS
linux-4.2.8-x86_64: ERRORS
linux-4.3.6-i686: ERRORS
linux-4.3.6-x86_64: ERRORS
linux-4.4.109-i686: ERRORS
linux-4.4.109-x86_64: ERRORS
linux-4.5.7-i686: ERRORS
linux-4.5.7-x86_64: ERRORS
linux-4.6.7-i686: ERRORS
linux-4.6.7-x86_64: ERRORS
linux-4.7.10-i686: ERRORS
linux-4.7.10-x86_64: ERRORS
linux-4.8.17-i686: ERRORS
linux-4.8.17-x86_64: ERRORS
linux-4.9.91-i686: ERRORS
linux-4.9.91-x86_64: ERRORS
linux-4.10.17-i686: OK
linux-4.10.17-x86_64: WARNINGS
linux-4.11.12-i686: OK
linux-4.11.12-x86_64: WARNINGS
linux-4.12.14-i686: OK
linux-4.12.14-x86_64: WARNINGS
linux-4.13.16-i686: WARNINGS
linux-4.13.16-x86_64: WARNINGS
linux-4.14.31-i686: WARNINGS
linux-4.14.31-x86_64: WARNINGS
linux-4.15.14-i686: WARNINGS
linux-4.15.14-x86_64: WARNINGS
linux-4.16.8-i686: WARNINGS
linux-4.16.8-x86_64: WARNINGS
linux-4.17-rc4-i686: WARNINGS
linux-4.17-rc4-x86_64: WARNINGS
apps: OK
spec-git: OK
sparse: WARNINGS

Detailed results are available here:

http://www.xs4all.nl/~hverkuil/logs/Sunday.log

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Sunday.tar.bz2

The Media Infrastructure API from this daily build is here:

http://www.xs4all.nl/~hverkuil/spec/index.html


[PATCH 6/7] media: tm6000: don't check number of messages in the driver

2018-05-19 Thread Wolfram Sang
Since commit 1eace8344c02 ("i2c: add param sanity check to
i2c_transfer()"), the I2C core does this check now. We can remove it
from drivers.

Signed-off-by: Wolfram Sang 
---

Only build tested.

 drivers/media/usb/tm6000/tm6000-i2c.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/media/usb/tm6000/tm6000-i2c.c 
b/drivers/media/usb/tm6000/tm6000-i2c.c
index 659b63febf85..ccd1adf862b1 100644
--- a/drivers/media/usb/tm6000/tm6000-i2c.c
+++ b/drivers/media/usb/tm6000/tm6000-i2c.c
@@ -145,8 +145,6 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap,
struct tm6000_core *dev = i2c_adap->algo_data;
int addr, rc, i, byte;
 
-   if (num <= 0)
-   return 0;
for (i = 0; i < num; i++) {
addr = (msgs[i].addr << 1) & 0xff;
i2c_dprintk(2, "%s %s addr=0x%x len=%d:",
-- 
2.11.0



[PATCH 7/7] media: dvb-usb: don't check number of messages in the driver

2018-05-19 Thread Wolfram Sang
Since commit 1eace8344c02 ("i2c: add param sanity check to
i2c_transfer()"), the I2C core does this check now. We can remove it
from drivers.

Signed-off-by: Wolfram Sang 
---

Only build tested.

 drivers/media/usb/dvb-usb/m920x.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/media/usb/dvb-usb/m920x.c 
b/drivers/media/usb/dvb-usb/m920x.c
index 32081c2ce0da..a6ab6688cbb3 100644
--- a/drivers/media/usb/dvb-usb/m920x.c
+++ b/drivers/media/usb/dvb-usb/m920x.c
@@ -255,9 +255,6 @@ static int m920x_i2c_xfer(struct i2c_adapter *adap, struct 
i2c_msg msg[], int nu
int i, j;
int ret = 0;
 
-   if (!num)
-   return -EINVAL;
-
if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
return -EAGAIN;
 
-- 
2.11.0



[PATCH 5/7] media: hdpvr: don't check number of messages in the driver

2018-05-19 Thread Wolfram Sang
Since commit 1eace8344c02 ("i2c: add param sanity check to
i2c_transfer()"), the I2C core does this check now. We can remove it
from drivers.

Signed-off-by: Wolfram Sang 
---

Only build tested.

 drivers/media/usb/hdpvr/hdpvr-i2c.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/media/usb/hdpvr/hdpvr-i2c.c 
b/drivers/media/usb/hdpvr/hdpvr-i2c.c
index 4720d79b0282..c97dcf981b3f 100644
--- a/drivers/media/usb/hdpvr/hdpvr-i2c.c
+++ b/drivers/media/usb/hdpvr/hdpvr-i2c.c
@@ -117,9 +117,6 @@ static int hdpvr_transfer(struct i2c_adapter *i2c_adapter, 
struct i2c_msg *msgs,
struct hdpvr_device *dev = i2c_get_adapdata(i2c_adapter);
int retval = 0, addr;
 
-   if (num <= 0)
-   return 0;
-
mutex_lock(&dev->i2c_mutex);
 
addr = msgs[0].addr << 1;
-- 
2.11.0



[PATCH 0/7] don't check number of I2C messages in drivers

2018-05-19 Thread Wolfram Sang
The core does it now, we can simplify drivers.

Based on v4.17-rc5. buildbot is happy. I'd suggest the media tree.

Thanks,

   Wolfram

Wolfram Sang (7):
  media: netup_unidvb: don't check number of messages in the driver
  media: si4713: don't check number of messages in the driver
  media: cx231xx: don't check number of messages in the driver
  media: em28xx: don't check number of messages in the driver
  media: hdpvr: don't check number of messages in the driver
  media: tm6000: don't check number of messages in the driver
  media: dvb-usb: don't check number of messages in the driver

 drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c | 5 -
 drivers/media/radio/si4713/radio-usb-si4713.c | 3 ---
 drivers/media/usb/cx231xx/cx231xx-i2c.c   | 2 --
 drivers/media/usb/dvb-usb/m920x.c | 3 ---
 drivers/media/usb/em28xx/em28xx-i2c.c | 4 
 drivers/media/usb/hdpvr/hdpvr-i2c.c   | 3 ---
 drivers/media/usb/tm6000/tm6000-i2c.c | 2 --
 7 files changed, 22 deletions(-)

-- 
2.11.0



[PATCH 2/7] media: si4713: don't check number of messages in the driver

2018-05-19 Thread Wolfram Sang
Since commit 1eace8344c02 ("i2c: add param sanity check to
i2c_transfer()"), the I2C core does this check now. We can remove it
from drivers.

Signed-off-by: Wolfram Sang 
---

Only build tested.

 drivers/media/radio/si4713/radio-usb-si4713.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/media/radio/si4713/radio-usb-si4713.c 
b/drivers/media/radio/si4713/radio-usb-si4713.c
index 05c66701a899..1ebbf0217142 100644
--- a/drivers/media/radio/si4713/radio-usb-si4713.c
+++ b/drivers/media/radio/si4713/radio-usb-si4713.c
@@ -370,9 +370,6 @@ static int si4713_transfer(struct i2c_adapter *i2c_adapter,
int retval = -EINVAL;
int i;
 
-   if (num <= 0)
-   return 0;
-
for (i = 0; i < num; i++) {
if (msgs[i].flags & I2C_M_RD)
retval = si4713_i2c_read(radio, msgs[i].buf, 
msgs[i].len);
-- 
2.11.0



[PATCH 4/7] media: em28xx: don't check number of messages in the driver

2018-05-19 Thread Wolfram Sang
Since commit 1eace8344c02 ("i2c: add param sanity check to
i2c_transfer()"), the I2C core does this check now. We can remove it
from drivers.

Signed-off-by: Wolfram Sang 
---

Only build tested.

 drivers/media/usb/em28xx/em28xx-i2c.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/media/usb/em28xx/em28xx-i2c.c 
b/drivers/media/usb/em28xx/em28xx-i2c.c
index 6458682bc6e2..e19d6342e0d0 100644
--- a/drivers/media/usb/em28xx/em28xx-i2c.c
+++ b/drivers/media/usb/em28xx/em28xx-i2c.c
@@ -559,10 +559,6 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap,
dev->cur_i2c_bus = bus;
}
 
-   if (num <= 0) {
-   rt_mutex_unlock(&dev->i2c_bus_lock);
-   return 0;
-   }
for (i = 0; i < num; i++) {
addr = msgs[i].addr << 1;
if (!msgs[i].len) {
-- 
2.11.0



[PATCH 1/7] media: netup_unidvb: don't check number of messages in the driver

2018-05-19 Thread Wolfram Sang
Since commit 1eace8344c02 ("i2c: add param sanity check to
i2c_transfer()"), the I2C core does this check now. We can remove it
from drivers.

Signed-off-by: Wolfram Sang 
---

Only build tested.

 drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c 
b/drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c
index b13e319d24b7..5f1613aec93c 100644
--- a/drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c
+++ b/drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c
@@ -214,11 +214,6 @@ static int netup_i2c_xfer(struct i2c_adapter *adap,
struct netup_i2c *i2c = i2c_get_adapdata(adap);
u16 reg;
 
-   if (num <= 0) {
-   dev_dbg(i2c->adap.dev.parent,
-   "%s(): num == %d\n", __func__, num);
-   return -EINVAL;
-   }
spin_lock_irqsave(&i2c->lock, flags);
if (i2c->state != STATE_DONE) {
dev_dbg(i2c->adap.dev.parent,
-- 
2.11.0



[PATCH 3/7] media: cx231xx: don't check number of messages in the driver

2018-05-19 Thread Wolfram Sang
Since commit 1eace8344c02 ("i2c: add param sanity check to
i2c_transfer()"), the I2C core does this check now. We can remove it
from drivers.

Signed-off-by: Wolfram Sang 
---

Only build tested.

 drivers/media/usb/cx231xx/cx231xx-i2c.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c 
b/drivers/media/usb/cx231xx/cx231xx-i2c.c
index 6e1bef2a45bb..15a91169e749 100644
--- a/drivers/media/usb/cx231xx/cx231xx-i2c.c
+++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c
@@ -376,8 +376,6 @@ static int cx231xx_i2c_xfer(struct i2c_adapter *i2c_adap,
struct cx231xx *dev = bus->dev;
int addr, rc, i, byte;
 
-   if (num <= 0)
-   return 0;
mutex_lock(&dev->i2c_lock);
for (i = 0; i < num; i++) {
 
-- 
2.11.0