Skip to contentSkip to conversation

document types of hardware control for V4L2

PATCH Superseded Mauro Carvalho Chehab 7 participants 23 messages Aug 25, 2017

Subsystems (26)

v1 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

cover document types of hardware control for V4L2

On 2010, we introduced a new way to control complex V4L2 devices used on embedded systems, but this was never documented, nor it is possible for an userspace applicatin to detect the kind of control a device supports.

This series fill the gap.

Mauro Carvalho Chehab (3):
media: open.rst: document devnode-centric and mc-centric types
media: videodev2: add a flag for vdev-centric devices
media: add V4L2_CAP_VDEV_CENTERED flag on vdev-centric drivers

 Documentation/media/uapi/v4l/open.rst            | 56 ++++++++++++++++++++++++
 Documentation/media/uapi/v4l/vidioc-querycap.rst |  4 ++
 drivers/media/pci/bt8xx/bttv-driver.c            |  4 +-
 drivers/media/pci/cobalt/cobalt-v4l2.c           |  3 +-
 drivers/media/pci/cx18/cx18-ioctl.c              |  4 +-
 drivers/media/pci/cx23885/cx23885-417.c          |  2 +-
 drivers/media/pci/cx23885/cx23885-video.c        |  3 +-
 drivers/media/pci/cx25821/cx25821-video.c        |  6 ++-
 drivers/media/pci/cx88/cx88-video.c              |  3 +-
 drivers/media/pci/dt3155/dt3155.c                |  3 +-
 drivers/media/pci/ivtv/ivtv-ioctl.c              |  5 ++-
 drivers/media/pci/meye/meye.c                    |  2 +-
 drivers/media/pci/saa7134/saa7134-video.c        |  3 +-
 drivers/media/pci/saa7164/saa7164-encoder.c      |  3 +-
 drivers/media/pci/saa7164/saa7164-vbi.c          |  3 +-
 drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c   |  3 +-
 drivers/media/pci/solo6x10/solo6x10-v4l2.c       |  3 +-
 drivers/media/pci/sta2x11/sta2x11_vip.c          |  3 +-
 drivers/media/pci/tw5864/tw5864-video.c          |  2 +-
 drivers/media/pci/tw68/tw68-video.c              |  3 +-
 drivers/media/pci/tw686x/tw686x-video.c          |  2 +-
 drivers/media/pci/zoran/zoran_driver.c           |  3 +-
 drivers/media/platform/rcar_drif.c               |  3 +-
 drivers/media/platform/vivid/vivid-core.c        |  2 +-
 drivers/media/usb/airspy/airspy.c                |  3 +-
 drivers/media/usb/au0828/au0828-video.c          |  3 +-
 drivers/media/usb/cpia2/cpia2_v4l.c              |  5 ++-
 drivers/media/usb/cx231xx/cx231xx-video.c        |  5 ++-
 drivers/media/usb/em28xx/em28xx-video.c          | 11 +++--
 drivers/media/usb/go7007/go7007-v4l2.c           |  2 +-
 drivers/media/usb/gspca/gspca.c                  |  3 +-
 drivers/media/usb/hackrf/hackrf.c                |  8 ++--
 drivers/media/usb/hdpvr/hdpvr-video.c            |  2 +-
 drivers/media/usb/msi2500/msi2500.c              |  3 +-
 drivers/media/usb/pvrusb2/pvrusb2-v4l2.c         |  6 ++-
 drivers/media/usb/pwc/pwc-v4l.c                  |  2 +-
 drivers/media/usb/s2255/s2255drv.c               |  2 +-
 drivers/media/usb/stk1160/stk1160-v4l.c          |  3 +-
 drivers/media/usb/stkwebcam/stk-webcam.c         |  3 +-
 drivers/media/usb/tm6000/tm6000-video.c          |  5 ++-
 drivers/media/usb/usbtv/usbtv-video.c            |  2 +-
 drivers/media/usb/usbvision/usbvision-video.c    |  5 ++-
 drivers/media/usb/uvc/uvc_v4l2.c                 |  8 ++--
 drivers/media/usb/zr364xx/zr364xx.c              |  5 ++-
 include/uapi/linux/videodev2.h                   |  2 +
 45 files changed, 158 insertions(+), 58 deletions(-)
Signature · 1 line
2.13.3
#1 lore raw

PATCH 1/3 media: open.rst: document devnode-centric and mc-centric types

From: "[email protected]" <[email protected]>

When we added support for omap3, back in 2010, we added a new type of V4L2 devices that aren't fully controlled via the V4L2 device node. Yet, we never made it clear, at the V4L2 spec, about the differences between both types.

Let's document them with the current implementation.

---
 Documentation/media/uapi/v4l/open.rst | 50 +++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
Documentation/media/uapi/v4l/open.rst +50 -0
index afd116edb40d..a72d142897c0 100644
@@ -6,6 +6,56 @@
 Opening and Closing Devices
 ***************************
 
+Types of V4L2 hardware control
+==============================
+
+V4L2 devices are usually complex: they are implemented via a main driver and
+often several additional drivers. The main driver always exposes one or
+more **V4L2 device** devnodes (see :ref:`v4l2_device_naming`).
+
+The other drivers are called **V4L2 sub-devices** and provide control to
+other parts of the hardware usually connected via a serial bus (like
+I²C, SMBus or SPI). They can be implicitly controlled directly by the
+main driver or explicitly through via the **V4L2 sub-device API** interface.
+
+When V4L2 was originally designed, there was only one type of device control.
+The entire device was controlled via the **V4L2 device nodes**. We refer to
+this kind of control as **V4L2 device node centric** (or, simply,
+**vdev-centric**).
+
+Since the end of 2010, a new type of V4L2 device control was added in order
+to support complex devices that are common for embedded systems. Those
+devices are controlled mainly via the media controller and sub-devices.
+So, they're called: **Media controller centric** (or, simply,
+"**MC-centric**").
+
+For **vdev-centric** control, the device and their corresponding hardware
+pipelines are controlled via the **V4L2 device** node. They may optionally
+expose via the :ref:`media controller API <media_controller>`.
+
+For **MC-centric** control, before using the V4L2 device, it is required to
+set the hardware pipelines via the
+:ref:`media controller API <media_controller>`. For those devices, the
+sub-devices' configuration can be controlled via the
+:ref:`sub-device API <subdev>`, with creates one device node per sub device.
+
+In summary, for **MC-centric** devices:
+
+- The **V4L2 device** node is responsible for controlling the streaming
+  features;
+- The **media controller device** is responsible to setup the pipelines;
+- The **V4L2 sub-devices** are responsible for sub-device
+  specific settings.
+
+.. note::
+
+   A **vdev-centric** may optionally expose V4L2 sub-devices via
+   :ref:`sub-device API <subdev>`. In that case, it has to implement
+   the :ref:`media controller API <media_controller>` as well.
+
+
+
+.. _v4l2_device_naming:
 
 Device Naming
 =============
Signature · 1 line
2.13.3
#2 lore raw

Re: [PATCH 1/3] media: open.rst: document devnode-centric and mc-centric types

Quoted 19 lines · Mauro Carvalho Chehab

From: "[email protected]" <[email protected]>

When we added support for omap3, back in 2010, we added a new type of V4L2 devices that aren't fully controlled via the V4L2 device node. Yet, we never made it clear, at the V4L2 spec, about the differences between both types.

Let's document them with the current implementation.

---
 Documentation/media/uapi/v4l/open.rst | 50 +++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
Documentation/media/uapi/v4l/open.rst +0 -0
index afd116edb40d..a72d142897c0 100644

Documentation/media/uapi/v4l/open.rst line 12

Quoted 7 lines
Documentation/media/uapi/v4l/open.rst +4 -0
@@ -6,6 +6,56 @@
 Opening and Closing Devices
 ***************************
 
+Types of V4L2 hardware control
+==============================
+
+V4L2 devices are usually complex: they are implemented via a main driver and

V4L2 hardware is usually complex: support for the hardware is implemented...

Documentation/media/uapi/v4l/open.rst line 13

Quoted 1 line
Documentation/media/uapi/v4l/open.rst +1 -0
+often several additional drivers. The main driver always exposes one or

Should we change this to "via a main (also known as 'bridge') driver"?

To help understanding terminology that we use?

Documentation/media/uapi/v4l/open.rst line 21

Quoted 8 lines
Documentation/media/uapi/v4l/open.rst +8 -0
+more **V4L2 device** devnodes (see :ref:`v4l2_device_naming`).
+
+The other drivers are called **V4L2 sub-devices** and provide control to
+other parts of the hardware usually connected via a serial bus (like
+I²C, SMBus or SPI). They can be implicitly controlled directly by the
+main driver or explicitly through via the **V4L2 sub-device API** interface.
+
+When V4L2 was originally designed, there was only one type of device control.

hardware control

Documentation/media/uapi/v4l/open.rst line 22

Quoted 1 line
Documentation/media/uapi/v4l/open.rst +1 -0
+The entire device was controlled via the **V4L2 device nodes**. We refer to

entire V4L2 hardware

Documentation/media/uapi/v4l/open.rst line 26

Quoted 4 lines
Documentation/media/uapi/v4l/open.rst +4 -0
+this kind of control as **V4L2 device node centric** (or, simply,
+**vdev-centric**).
+
+Since the end of 2010, a new type of V4L2 device control was added in order

hardware control

Documentation/media/uapi/v4l/open.rst line 29

Quoted 3 lines
Documentation/media/uapi/v4l/open.rst +3 -0
+to support complex devices that are common for embedded systems. Those
+devices are controlled mainly via the media controller and sub-devices.
+So, they're called: **Media controller centric** (or, simply,

they are

Documentation/media/uapi/v4l/open.rst line 32

Quoted 3 lines
Documentation/media/uapi/v4l/open.rst +3 -0
+"**MC-centric**").
+
+For **vdev-centric** control, the device and their corresponding hardware

s/control/hardware control/

s/the device and their corresponding hardware pipelines are/the hardware is/

(let's keep it simple).

Documentation/media/uapi/v4l/open.rst line 33

Quoted 1 line
Documentation/media/uapi/v4l/open.rst +1 -0
+pipelines are controlled via the **V4L2 device** node. They may optionally

node -> node (or nodes, if there is more than one V4L2 device node)

Documentation/media/uapi/v4l/open.rst line 34

Quoted 1 line
Documentation/media/uapi/v4l/open.rst +1 -0
+expose via the :ref:`media controller API <media_controller>`.

I'd say: "support the :ref:media controller API <media_controller> as well in order to let the application know which device nodes are available.

Documentation/media/uapi/v4l/open.rst line 36

Quoted 2 lines
Documentation/media/uapi/v4l/open.rst +2 -0
+
+For **MC-centric** control, before using the V4L2 device, it is required to

s/control/hardware control/

s/device/hardware/ (I think. Or did you mean "device node"?)

Documentation/media/uapi/v4l/open.rst line 40

Quoted 4 lines
Documentation/media/uapi/v4l/open.rst +4 -0
+set the hardware pipelines via the
+:ref:`media controller API <media_controller>`. For those devices, the
+sub-devices' configuration can be controlled via the
+:ref:`sub-device API <subdev>`, with creates one device node per sub device.

s/with/which/

Documentation/media/uapi/v4l/open.rst line 42

Quoted 2 lines
Documentation/media/uapi/v4l/open.rst +2 -0
+
+In summary, for **MC-centric** devices:

s/devices/hardware/

Documentation/media/uapi/v4l/open.rst line 54

Quoted 12 lines
Documentation/media/uapi/v4l/open.rst +12 -0
+
+- The **V4L2 device** node is responsible for controlling the streaming
+  features;
+- The **media controller device** is responsible to setup the pipelines;
+- The **V4L2 sub-devices** are responsible for sub-device
+  specific settings.
+
+.. note::
+
+   A **vdev-centric** may optionally expose V4L2 sub-devices via
+   :ref:`sub-device API <subdev>`. In that case, it has to implement
+   the :ref:`media controller API <media_controller>` as well.

This note should be moved up to the vdev-centric description. It's weird now as it comes after the MC centric summary, but deals with a vdev-centric driver.

Documentation/media/uapi/v4l/open.rst line 61

Quoted 8 lines
Documentation/media/uapi/v4l/open.rst +4 -0
+
+
+
+.. _v4l2_device_naming:
 
 Device Naming
 =============

Regards,

Hans

#3 lore raw

Re: [PATCH 1/3] media: open.rst: document devnode-centric and mc-centric types

In reply to Mauro Carvalho Chehab

Hi Mauro,

Thanks for the update. A few more small comments below.

Quoted 19 lines · Mauro Carvalho Chehab

From: "[email protected]" <[email protected]>

When we added support for omap3, back in 2010, we added a new type of V4L2 devices that aren't fully controlled via the V4L2 device node. Yet, we never made it clear, at the V4L2 spec, about the differences between both types.

Let's document them with the current implementation.

---
 Documentation/media/uapi/v4l/open.rst | 50 +++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
Documentation/media/uapi/v4l/open.rst +0 -0
index afd116edb40d..a72d142897c0 100644

Documentation/media/uapi/v4l/open.rst line 14

Quoted 9 lines
Documentation/media/uapi/v4l/open.rst +6 -0
@@ -6,6 +6,56 @@
 Opening and Closing Devices
 ***************************
 
+Types of V4L2 hardware control
+==============================
+
+V4L2 devices are usually complex: they are implemented via a main driver and
+often several additional drivers. The main driver always exposes one or
+more **V4L2 device** devnodes (see :ref:`v4l2_device_naming`).

s/V4L2 device\*\* devnodes/V4L2 device nodes\*\*/

(As you also have a few paragraphs below.)

Documentation/media/uapi/v4l/open.rst line 18

Quoted 4 lines
Documentation/media/uapi/v4l/open.rst +4 -0
+
+The other drivers are called **V4L2 sub-devices** and provide control to
+other parts of the hardware usually connected via a serial bus (like
+I²C, SMBus or SPI). They can be implicitly controlled directly by the

s/They/Depending on the main driver, they/

Documentation/media/uapi/v4l/open.rst line 19

Quoted 1 line
Documentation/media/uapi/v4l/open.rst +1 -0
+main driver or explicitly through via the **V4L2 sub-device API** interface.

Through or via, but not both. " interface" is redundant.

Documentation/media/uapi/v4l/open.rst line 24

Quoted 5 lines
Documentation/media/uapi/v4l/open.rst +5 -0
+
+When V4L2 was originally designed, there was only one type of device control.
+The entire device was controlled via the **V4L2 device nodes**. We refer to
+this kind of control as **V4L2 device node centric** (or, simply,
+**vdev-centric**).

s/vdev-centric/V4L2-centric/ ?

Documentation/media/uapi/v4l/open.rst line 33

Quoted 9 lines
Documentation/media/uapi/v4l/open.rst +9 -0
+
+Since the end of 2010, a new type of V4L2 device control was added in order
+to support complex devices that are common for embedded systems. Those
+devices are controlled mainly via the media controller and sub-devices.
+So, they're called: **Media controller centric** (or, simply,
+"**MC-centric**").
+
+For **vdev-centric** control, the device and their corresponding hardware
+pipelines are controlled via the **V4L2 device** node. They may optionally

I'd add highlighting to " node" as well.

Documentation/media/uapi/v4l/open.rst line 45

Quoted 12 lines
Documentation/media/uapi/v4l/open.rst +12 -0
+expose via the :ref:`media controller API <media_controller>`.
+
+For **MC-centric** control, before using the V4L2 device, it is required to
+set the hardware pipelines via the
+:ref:`media controller API <media_controller>`. For those devices, the
+sub-devices' configuration can be controlled via the
+:ref:`sub-device API <subdev>`, with creates one device node per sub device.
+
+In summary, for **MC-centric** devices:
+
+- The **V4L2 device** node is responsible for controlling the streaming
+  features;

Same here. Or, just remove node. The other device nodes are just as much nodes as this one.

Documentation/media/uapi/v4l/open.rst line 54

Quoted 9 lines
Documentation/media/uapi/v4l/open.rst +9 -0
+- The **media controller device** is responsible to setup the pipelines;
+- The **V4L2 sub-devices** are responsible for sub-device
+  specific settings.
+
+.. note::
+
+   A **vdev-centric** may optionally expose V4L2 sub-devices via
+   :ref:`sub-device API <subdev>`. In that case, it has to implement
+   the :ref:`media controller API <media_controller>` as well.

Looks good!

Quoted 7 lines
Documentation/media/uapi/v4l/open.rst +4 -0
+
+
+
+.. _v4l2_device_naming:
 
 Device Naming
 =============
Signature · 4 lines
Kind regards,

Sakari Ailus
e-mail: [email protected]
maintainer
#4 lore raw

Re: [PATCH 1/3] media: open.rst: document devnode-centric and mc-centric types

In reply to Mauro Carvalho Chehab

Hi Mauro,

Thank you for the patch.

Quoted 6 lines · On Friday, 25 August 2017 12:40:05 EEST Mauro Carvalho Chehab wrote:

From: "[email protected]" <[email protected]>

When we added support for omap3, back in 2010, we added a new type of V4L2 devices that aren't fully controlled via the V4L2 device node. Yet, we never made it clear, at the V4L2 spec, about the differences between both types.

Nitpicking (and there will be lots of nitpicking in this review as I think it's very important to get this piece of the documentation right down to details):

s/at the V4L2 spec/in the V4L2 spec/

"make it clear about" doesn't sound good to me. How about the following ?

"Yet, we have never clearly documented in the V4L2 specification the differences between the two types."

Quoted 1 line

Let's document them with the current implementation.

s/with the/based on the/

Quoted 20 lines
---
 Documentation/media/uapi/v4l/open.rst | 50 ++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
(quoted diff) +0 -0

b/Documentation/media/uapi/v4l/open.rst index afd116edb40d..a72d142897c0 100644

Documentation/media/uapi/v4l/open.rst +4 -0
@@ -6,6 +6,56 @@
 Opening and Closing Devices
 ***************************
 
+Types of V4L2 hardware control
+==============================
+
+V4L2 devices are usually complex: they are implemented via a main driver

and

Documentation/media/uapi/v4l/open.rst line 14

Quoted 2 lines
Documentation/media/uapi/v4l/open.rst +2 -0
+often several additional drivers. The main driver always exposes one or
+more **V4L2 device** devnodes (see :ref:`v4l2_device_naming`).

First of all, as stated in a previous e-mail, I think we should start by defining the terms we are going to use. The word "device" is ambiguous, it can mean

- device node

The /dev device node through which a character- or block-based API is exposed through userspace.

The term "device node" is commonly used in the kernel, I think we can use it as-is without ambiguity.

- kernel struct device

An instance of the kernel struct device. Kernel devices are used to represent hardware devices (and are then embedded in bus-specific device structure such as platform_device, pci_device or i2c_client) and logical devices (and are then embedded in class-spcific device structures such as struct video_device or struct net_device).

For now I believe this isn't relevant to the V4L2 userspace API discussion, so we can leave it out.

- hardware device

The hardware counterpart of the first category of the kernel struct device, a hardware (and thus physical) device such as an SoC IP core or an I2C chip.

We could call this "hardware device" or "hardware component". Other proposals are welcome.

- hardware peripheral

A group of hardware devices that together make a larger user-facing functional peripheral. For instance the SoC ISP IP cores and external camera sensors together make a camera peripheral.

If we call the previous device a "hardware component" this could be called "hardware device". Otherwise "hardware peripheral" is a possible name, but we can probably come up with a better name.

- software peripheral

The software counterpart of the hardware peripheral. In V4L2 this is modeled by a struct v4l2_device, often associated with a struct media_device.

I don't like the name "software peripheral", other proposals are welcome.

Once we agree on names and definitions I'll comment on the reworked version of this patch, as it's pointless to bikeshed the wording without first agreeing on clear definitions of the concepts we're discussing. Please still see below for a few comments not related to particular wording.

Quoted 11 lines
Documentation/media/uapi/v4l/open.rst +4 -0
+The other drivers are called **V4L2 sub-devices** and provide control to
+other parts of the hardware usually connected via a serial bus (like
+I²C, SMBus or SPI). They can be implicitly controlled directly by the
+main driver or explicitly through via the **V4L2 sub-device API**

interface.

Documentation/media/uapi/v4l/open.rst +2 -0
+
+When V4L2 was originally designed, there was only one type of device

control.

Documentation/media/uapi/v4l/open.rst +2 -0
+The entire device was controlled via the **V4L2 device nodes**. We refer to
+this kind of control as **V4L2 device node centric** (or,

simply, +**vdev-centric**).

Documentation/media/uapi/v4l/open.rst line 30

Quoted 6 lines
Documentation/media/uapi/v4l/open.rst +6 -0
+
+Since the end of 2010, a new type of V4L2 device control was added in order
+to support complex devices that are common for embedded systems. Those
+devices are controlled mainly via the media controller and sub-devices.
+So, they're called: **Media controller centric** (or, simply,
+"**MC-centric**").

Do we really need to explain the development history with dates ? I don't think it helps understanding the separation between vdev-centric and MC- centric devices. For instance the previous paragraph that explains that V4L2 originally had a single type of device control that we now call vdev-centric doesn't really help understanding what a vdev-centric device is.

It would be clearer in my opinion to explain the two kind of devices with an associated use case, without referring to the history.

Quoted 10 lines
Documentation/media/uapi/v4l/open.rst +9 -0
+For **vdev-centric** control, the device and their corresponding hardware
+pipelines are controlled via the **V4L2 device** node. They may optionally
+expose via the :ref:`media controller API <media_controller>`.
+
+For **MC-centric** control, before using the V4L2 device, it is required to
+set the hardware pipelines via the
+:ref:`media controller API <media_controller>`. For those devices, the
+sub-devices' configuration can be controlled via the
+:ref:`sub-device API <subdev>`, with creates one device node per sub

device.

Documentation/media/uapi/v4l/open.rst line 48

Quoted 8 lines
Documentation/media/uapi/v4l/open.rst +8 -0
+
+In summary, for **MC-centric** devices:
+
+- The **V4L2 device** node is responsible for controlling the streaming
+  features;
+- The **media controller device** is responsible to setup the pipelines;
+- The **V4L2 sub-devices** are responsible for sub-device
+  specific settings.

How about a summary of vdev-centric devices too ? Or, possibly, no summary at all ? The need to summarize 5 short paragraphs probably indicates that those paragraphis are not clear enough :-)

I can try to help by proposing enhancements to the documentation once we agree on the glossary above.

Documentation/media/uapi/v4l/open.rst line 54

Quoted 5 lines

+.. note::

Documentation/media/uapi/v4l/open.rst +4 -0
+
+   A **vdev-centric** may optionally expose V4L2 sub-devices via
+   :ref:`sub-device API <subdev>`. In that case, it has to implement
+   the :ref:`media controller API <media_controller>` as well.

The separation between vdev-centric and MC-centric devices is quite clear. If we allow a vdev-centric device to expose subdev nodes we will open the door to all kind of hybrid implementations that have no clear definition today. It will be very important in that case to document in details what is allowed and what isn't, and how the video device nodes and subdev device nodes interact with each other. I prefer not giving a green light to such implementations until we have to, and I also prefer discussing this topic separately. It will require a fair amount of work to document (and thus first agree on), and there's no need to block the rest of this patch until we complete that work. For those reasons I would like to explicitly disallow those hybrid devices in this patch, and start discussing the use cases we have for them, and how they would operate.

Quoted 4 lines

+.. _v4l2_device_naming:

Device Naming
=============

Signature · 3 lines
Regards,

Laurent Pinchart
#5 lore raw

Re: [PATCH 1/3] media: open.rst: document devnode-centric and mc-centric types

Em Fri, 25 Aug 2017 16:11:15 +0300
Laurent Pinchart <[email protected]> escreveu:

Quoted 7 lines

Hi Mauro,

Thank you for the patch.

Quoted 2 lines · On Friday, 25 August 2017 12:40:05 EEST Mauro Carvalho Chehab wrote:

From: "[email protected]" <[email protected]>

Quoted 8 lines
Quoted 4 lines

When we added support for omap3, back in 2010, we added a new type of V4L2 devices that aren't fully controlled via the V4L2 device node. Yet, we never made it clear, at the V4L2 spec, about the differences between both types.

Nitpicking (and there will be lots of nitpicking in this review as I think it's very important to get this piece of the documentation right down to details):

Sure.

Quoted 11 lines

s/at the V4L2 spec/in the V4L2 spec/

"make it clear about" doesn't sound good to me. How about the following ?

"Yet, we have never clearly documented in the V4L2 specification the differences between the two types."

Quoted 1 line

Let's document them with the current implementation.

s/with the/based on the/

OK.

Quoted 16 lines
Quoted 16 lines
---
 Documentation/media/uapi/v4l/open.rst | 50 ++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
(quoted diff) +0 -0

b/Documentation/media/uapi/v4l/open.rst index afd116edb40d..a72d142897c0 100644

Documentation/media/uapi/v4l/open.rst +0 -0
@@ -6,6 +6,56 @@
 Opening and Closing Devices
 ***************************
 
Quoted 10 lines

Documentation/media/uapi/v4l/open.rst line 14

Quoted 7 lines
Documentation/media/uapi/v4l/open.rst +4 -0
+Types of V4L2 hardware control
+==============================
+
+V4L2 devices are usually complex: they are implemented via a main driver

and

Documentation/media/uapi/v4l/open.rst +2 -0
+often several additional drivers. The main driver always exposes one or
+more **V4L2 device** devnodes (see :ref:`v4l2_device_naming`).  

First of all, as stated in a previous e-mail, I think we should start by defining the terms we are going to use.

Well, we can add a Glossary at the spec, but this is a huge work, as we'll need to seek for other terms and to adjust all references to use the Glossary wording. This is a separate work than what this patch proposes to solve.

Yet, I agree that ambiguity should be solved. I believe that the second version of this patch series address it.

Quoted 10 lines

The word "device" is ambiguous, it can
mean

- device node

The /dev device node through which a character- or block-based API is exposed through userspace.

The term "device node" is commonly used in the kernel, I think we can use it as-is without ambiguity.

Yes. IMO, we should use:

- "device node" when it may refer to any device node, including mc and subdev;
- "V4L2 device node" when it refers only to the devices that are now described at the "V4L2 Device Node Naming" section (see patch 1 of the new patch series).

Quoted 11 lines

- kernel struct device

An instance of the kernel struct device. Kernel devices are used to represent hardware devices (and are then embedded in bus-specific device structure such as platform_device, pci_device or i2c_client) and logical devices (and are then embedded in class-spcific device structures such as struct video_device or struct net_device).

For now I believe this isn't relevant to the V4L2 userspace API discussion, so we can leave it out.

Yes. Let's leave it out.

Quoted 7 lines

- hardware device

The hardware counterpart of the first category of the kernel struct device, a hardware (and thus physical) device such as an SoC IP core or an I2C chip.

We could call this "hardware device" or "hardware component". Other proposals are welcome.

as proposed by Hans, on the newer version, we're just using "hardware".

Quoted 11 lines

- hardware peripheral

A group of hardware devices that together make a larger user-facing functional peripheral. For instance the SoC ISP IP cores and external camera sensors together make a camera peripheral.

If we call the previous device a "hardware component" this could be called "hardware device". Otherwise "hardware peripheral" is a possible name, but we can probably come up with a better name.

Quoted 6 lines

- software peripheral

The software counterpart of the hardware peripheral. In V4L2 this is modeled by a struct v4l2_device, often associated with a struct media_device.

I don't like the name "software peripheral", other proposals are welcome.

I don't see the need of using those "peripheral" wording terms in this chapter. Let's leave it out for now.

Quoted 18 lines

Once we agree on names and definitions I'll comment on the reworked version of this patch, as it's pointless to bikeshed the wording without first agreeing on clear definitions of the concepts we're discussing. Please still see below for a few comments not related to particular wording.

Quoted 13 lines
Documentation/media/uapi/v4l/open.rst +4 -0
+The other drivers are called **V4L2 sub-devices** and provide control to
+other parts of the hardware usually connected via a serial bus (like
+I²C, SMBus or SPI). They can be implicitly controlled directly by the
+main driver or explicitly through via the **V4L2 sub-device API**

interface.

Documentation/media/uapi/v4l/open.rst +2 -0
+
+When V4L2 was originally designed, there was only one type of device

control.

Documentation/media/uapi/v4l/open.rst +2 -0
+The entire device was controlled via the **V4L2 device nodes**. We refer to
+this kind of control as **V4L2 device node centric** (or,

simply, +**vdev-centric**).

Documentation/media/uapi/v4l/open.rst +2 -0
+
+Since the end of 2010, a new type of V4L2 device control was added in order
Quoted 8 lines

Documentation/media/uapi/v4l/open.rst line 30

Quoted 4 lines
Documentation/media/uapi/v4l/open.rst +4 -0
+to support complex devices that are common for embedded systems. Those
+devices are controlled mainly via the media controller and sub-devices.
+So, they're called: **Media controller centric** (or, simply,
+"**MC-centric**").  

Do we really need to explain the development history with dates ? I don't think it helps understanding the separation between vdev-centric and MC- centric devices.

No, but it helps to identify when drivers became incompatible with generic apps. We could, instead point on what Kernel version it happened. That probably makes more sense and will match the history part of the spec.

Quoted 6 lines

For instance the previous paragraph that explains that V4L2 originally had a single type of device control that we now call vdev-centric doesn't really help understanding what a vdev-centric device is.

It would be clearer in my opinion to explain the two kind of devices with an associated use case, without referring to the history.

The history is important for app developers, as they need to know what Kernel versions are affected by V4L2 device nodes that look like vdev-centric ones but aren't.

Yet, you're right on one point: the date doesn't matter, but, instead, the Kernel version where the first mc-centric driver were added.

Quoted 14 lines
Quoted 14 lines
Documentation/media/uapi/v4l/open.rst +9 -0
+For **vdev-centric** control, the device and their corresponding hardware
+pipelines are controlled via the **V4L2 device** node. They may optionally
+expose via the :ref:`media controller API <media_controller>`.
+
+For **MC-centric** control, before using the V4L2 device, it is required to
+set the hardware pipelines via the
+:ref:`media controller API <media_controller>`. For those devices, the
+sub-devices' configuration can be controlled via the
+:ref:`sub-device API <subdev>`, with creates one device node per sub

device.

Documentation/media/uapi/v4l/open.rst +4 -0
+
+In summary, for **MC-centric** devices:
+
+- The **V4L2 device** node is responsible for controlling the streaming
Quoted 8 lines

Documentation/media/uapi/v4l/open.rst line 48

Quoted 4 lines
Documentation/media/uapi/v4l/open.rst +4 -0
+  features;
+- The **media controller device** is responsible to setup the pipelines;
+- The **V4L2 sub-devices** are responsible for sub-device
+  specific settings.  

How about a summary of vdev-centric devices too ? Or, possibly, no summary at all ? The need to summarize 5 short paragraphs probably indicates that those paragraphis are not clear enough :-)

Done at version 2, already submitted.

Quoted 10 lines

I can try to help by proposing enhancements to the documentation once we agree on the glossary above.

Documentation/media/uapi/v4l/open.rst line 54

Quoted 5 lines

+.. note::

Documentation/media/uapi/v4l/open.rst +4 -0
+
+   A **vdev-centric** may optionally expose V4L2 sub-devices via
+   :ref:`sub-device API <subdev>`. In that case, it has to implement
+   the :ref:`media controller API <media_controller>` as well.  
Quoted 3 lines

The separation between vdev-centric and MC-centric devices is quite clear. If we allow a vdev-centric device to expose subdev nodes we will open the door to all kind of hybrid implementations that have no clear definition today.

There are already such devices, as discussed at #media-maint ML. We're just documenting the existing status.

Quoted 10 lines

It
will be very important in that case to document in details what is allowed and what isn't, and how the video device nodes and subdev device nodes interact with each other. I prefer not giving a green light to such implementations until we have to, and I also prefer discussing this topic separately. It will require a fair amount of work to document (and thus first agree on), and there's no need to block the rest of this patch until we complete that work. For those reasons I would like to explicitly disallow those hybrid devices in this patch, and start discussing the use cases we have for them, and how they would operate.

What we can do is to add a notice that this is not recommended or that people should not add it without a discussion about what that is needed.

Quoted 7 lines
Quoted 5 lines

+.. _v4l2_device_naming:

Device Naming
=============

Thanks,
Mauro

maintainer
#6 lore raw

Re: [PATCH 1/3] media: open.rst: document devnode-centric and mc-centric types

Hi Mauro,

Quoted 54 lines · On Friday, 25 August 2017 16:38:23 EEST Mauro Carvalho Chehab wrote:

Em Fri, 25 Aug 2017 16:11:15 +0300 Laurent Pinchart escreveu:

Quoted 12 lines · On Friday, 25 August 2017 12:40:05 EEST Mauro Carvalho Chehab wrote:
Quoted 6 lines

From: "[email protected]" <[email protected]>

When we added support for omap3, back in 2010, we added a new type of V4L2 devices that aren't fully controlled via the V4L2 device node. Yet, we never made it clear, at the V4L2 spec, about the differences between both types.

Nitpicking (and there will be lots of nitpicking in this review as I think it's very important to get this piece of the documentation right down to details):

Sure.

Quoted 10 lines

s/at the V4L2 spec/in the V4L2 spec/

"make it clear about" doesn't sound good to me. How about the following ?

"Yet, we have never clearly documented in the V4L2 specification the differences between the two types."

Quoted 1 line

Let's document them with the current implementation.

s/with the/based on the/

OK.

Quoted 15 lines
Quoted 15 lines

---

 Documentation/media/uapi/v4l/open.rst | 50 +++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
(quoted diff) +0 -0

b/Documentation/media/uapi/v4l/open.rst index afd116edb40d..a72d142897c0 100644

Documentation/media/uapi/v4l/open.rst +0 -0
@@ -6,6 +6,56 @@
 Opening and Closing Devices
 ***************************
 
Quoted 10 lines

Documentation/media/uapi/v4l/open.rst line 14

Quoted 7 lines
Documentation/media/uapi/v4l/open.rst +4 -0
+Types of V4L2 hardware control
+==============================
+
+V4L2 devices are usually complex: they are implemented via a main

driver and

Documentation/media/uapi/v4l/open.rst +2 -0
+often several additional drivers. The main driver always exposes one or
+more **V4L2 device** devnodes (see :ref:`v4l2_device_naming`).

First of all, as stated in a previous e-mail, I think we should start by defining the terms we are going to use.

Quoted 7 lines

Well, we can add a Glossary at the spec, but this is a huge work, as we'll need to seek for other terms and to adjust all references to use the Glossary wording. This is a separate work than what this patch proposes to solve.

Yet, I agree that ambiguity should be solved. I believe that the second version of this patch series address it.

As discussed over IRC we don't need a full glossary. We can start with definitions of the terms we use here, and enrich it incrementally in the future.

Quoted 10 lines
Quoted 9 lines

The word "device" is ambiguous, it can mean

- device node

The /dev device node through which a character- or block-based API is exposed through userspace.

The term "device node" is commonly used in the kernel, I think we can use it as-is without ambiguity.

Quoted 7 lines

Yes. IMO, we should use:

- "device node" when it may refer to any device node, including mc and subdev;
- "V4L2 device node" when it refers only to the devices that are now described at the "V4L2 Device Node Naming" section (see patch 1 of the new patch series).

And "V4L2 subdev device node" and "MC device node" when we want to refer specifically to the /dev/v4l-subdev* and /dev/media* device nodes ?

Quoted 15 lines
Quoted 10 lines

- kernel struct device

An instance of the kernel struct device. Kernel devices are used to represent hardware devices (and are then embedded in bus-specific device structure such as platform_device, pci_device or i2c_client) and logical devices (and are then embedded in class-spcific device structures such as struct video_device or struct net_device).

For now I believe this isn't relevant to the V4L2 userspace API discussion, so we can leave it out.

Yes. Let's leave it out.

Quoted 2 lines

- hardware device

Quoted 8 lines
Quoted 6 lines

The hardware counterpart of the first category of the kernel struct device, a hardware (and thus physical) device such as an SoC IP core or an I2C chip.

We could call this "hardware device" or "hardware component". Other proposals are welcome.

as proposed by Hans, on the newer version, we're just using "hardware".

Hardware is very generic too. A PCI capture card is hardware, an antenna connector is hardware, a TV tuner is hardware, a DMA engine is hardware.

The distinction between components and peripherals is in my opinion important, otherwise we wouldn't have both struct video_device and struct v4l2_device. Userspace middleware developers (I include libv4l2 in this category) will be more interested in components, which applications developers will be more interested in peripherals. In the longer term, we should introduce a peripheral concept for userspace too (in the interface between middlewares and applications), the same way we have done it in the kernel with struct v4l2_device.

Quoted 12 lines
Quoted 12 lines

- hardware peripheral

A group of hardware devices that together make a larger user-facing functional peripheral. For instance the SoC ISP IP cores and external camera sensors together make a camera peripheral.

If we call the previous device a "hardware component" this could be called "hardware device". Otherwise "hardware peripheral" is a possible name, but we can probably come up with a better name.

- software peripheral

Quoted 8 lines
Quoted 5 lines

The software counterpart of the hardware peripheral. In V4L2 this is modeled by a struct v4l2_device, often associated with a struct media_device.

I don't like the name "software peripheral", other proposals are welcome.

I don't see the need of using those "peripheral" wording terms in this chapter. Let's leave it out for now.

I think they're needed. When you talk about pipeline configuration for instance, you talk about peripherals. Individual components don't have pipelines, they are assembled in a pipeline in a peripheral. For instance, when you say "The entire device was controlled via the V4L2 device nodes", the usage of the word "device" is ambiguous. I think we should avoid using "device" without any qualifier except in context where there can be no confusion (for instance in a section that repeatedly talk about device nodes and devices nodes only, the word "device" could be used in some places as a shortcut).

Quoted 31 lines
Quoted 22 lines

Once we agree on names and definitions I'll comment on the reworked version of this patch, as it's pointless to bikeshed the wording without first agreeing on clear definitions of the concepts we're discussing. Please still see below for a few comments not related to particular wording.

Quoted 16 lines

+The other drivers are called **V4L2 sub-devices** and provide control to

Documentation/media/uapi/v4l/open.rst +3 -0
+other parts of the hardware usually connected via a serial bus (like
+I²C, SMBus or SPI). They can be implicitly controlled directly by the
+main driver or explicitly through via the **V4L2 sub-device API**

interface.

Documentation/media/uapi/v4l/open.rst +2 -0
+
+When V4L2 was originally designed, there was only one type of device

control.
+The entire device was controlled via the **V4L2 device nodes**. We refer to

Documentation/media/uapi/v4l/open.rst +4 -0
+this kind of control as **V4L2 device node centric** (or, simply,
+**vdev-centric**).
+
+Since the end of 2010, a new type of V4L2 device control was added in

order

Quoted 8 lines

Documentation/media/uapi/v4l/open.rst line 30

Quoted 4 lines
Documentation/media/uapi/v4l/open.rst +4 -0
+to support complex devices that are common for embedded systems. Those
+devices are controlled mainly via the media controller and sub-devices.
+So, they're called: **Media controller centric** (or, simply,
+"**MC-centric**").

Do we really need to explain the development history with dates ? I don't think it helps understanding the separation between vdev-centric and MC- centric devices.

Quoted 4 lines

No, but it helps to identify when drivers became incompatible with generic apps. We could, instead point on what Kernel version it happened. That probably makes more sense and will match the history part of the spec.

That was v2.6.39. Do you expect userspace developers to target kernels older than that ? :-)

Quoted 41 lines
Quoted 7 lines

For instance the previous paragraph that explains that V4L2 originally had a single type of device control that we now call vdev-centric doesn't really help understanding what a vdev-centric device is.

It would be clearer in my opinion to explain the two kind of devices with an associated use case, without referring to the history.

The history is important for app developers, as they need to know what Kernel versions are affected by V4L2 device nodes that look like vdev-centric ones but aren't.

Yet, you're right on one point: the date doesn't matter, but, instead, the Kernel version where the first mc-centric driver were added.

Quoted 17 lines
Quoted 17 lines

+For **vdev-centric** control, the device and their corresponding hardware
+pipelines are controlled via the **V4L2 device** node. They may optionally

Documentation/media/uapi/v4l/open.rst +3 -0
+expose via the :ref:`media controller API <media_controller>`.
+
+For **MC-centric** control, before using the V4L2 device, it is

required to +set the hardware pipelines via the
+:ref:media controller API <media_controller>. For those devices, the +sub-devices' configuration can be controlled via the +:ref:sub-device API <subdev>, with creates one device node per sub device.

Documentation/media/uapi/v4l/open.rst +5 -0
+
+In summary, for **MC-centric** devices:
+
+- The **V4L2 device** node is responsible for controlling the streaming
+  features;
Quoted 8 lines
Quoted 4 lines

+- The **media controller device** is responsible to setup the pipelines;

+- The **V4L2 sub-devices** are responsible for sub-device
+  specific settings.

How about a summary of vdev-centric devices too ? Or, possibly, no summary at all ? The need to summarize 5 short paragraphs probably indicates that those paragraphis are not clear enough :-)

Quoted 1 line

Done at version 2, already submitted.

I'll review v3 once we agree on definitions for device-related terms :-)

Quoted 9 lines
Quoted 9 lines

I can try to help by proposing enhancements to the documentation once we agree on the glossary above.

Quoted 5 lines

+.. note::

Documentation/media/uapi/v4l/open.rst +4 -0
+
+   A **vdev-centric** may optionally expose V4L2 sub-devices via
+   :ref:`sub-device API <subdev>`. In that case, it has to implement
+   the :ref:`media controller API <media_controller>` as well.
Quoted 7 lines
Quoted 4 lines

The separation between vdev-centric and MC-centric devices is quite clear. If we allow a vdev-centric device to expose subdev nodes we will open the door to all kind of hybrid implementations that have no clear definition today.

There are already such devices, as discussed at #media-maint ML. We're just documenting the existing status.

The specification doesn't need to document the odd cases that we would have rejected if we had known better.

Quoted 10 lines
Quoted 9 lines

It will be very important in that case to document in details what is allowed and what isn't, and how the video device nodes and subdev device nodes interact with each other. I prefer not giving a green light to such implementations until we have to, and I also prefer discussing this topic separately. It will require a fair amount of work to document (and thus first agree on), and there's no need to block the rest of this patch until we complete that work. For those reasons I would like to explicitly disallow those hybrid devices in this patch, and start discussing the use cases we have for them, and how they would operate.

Quoted 3 lines

What we can do is to add a notice that this is not recommended or that people should not add it without a discussion about what that is needed.

How about just saying that's it's forbidden by the specification ? We will have a few drivers that don't comply, but we will obviously not blame their authors.

I prefer using the strongest possible wording when we want to discourage something. There will always be developers who will still try, but the stronger the wording, the lower the risk.

Signature · 3 lines
Regards,

Laurent Pinchart
#7 lore raw

Re: [PATCH 1/3] media: open.rst: document devnode-centric and mc-centric types

In reply to Laurent Pinchart
Quoted 54 lines · Laurent Pinchart

Hi Mauro,

Thank you for the patch.

Quoted 6 lines · On Friday, 25 August 2017 12:40:05 EEST Mauro Carvalho Chehab wrote:

From: "[email protected]" <[email protected]>

When we added support for omap3, back in 2010, we added a new type of V4L2 devices that aren't fully controlled via the V4L2 device node. Yet, we never made it clear, at the V4L2 spec, about the differences between both types.

Nitpicking (and there will be lots of nitpicking in this review as I think it's very important to get this piece of the documentation right down to details):

s/at the V4L2 spec/in the V4L2 spec/

"make it clear about" doesn't sound good to me. How about the following ?

"Yet, we have never clearly documented in the V4L2 specification the differences between the two types."

Quoted 1 line

Let's document them with the current implementation.

s/with the/based on the/

Quoted 20 lines
---
 Documentation/media/uapi/v4l/open.rst | 50 ++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
(quoted diff) +0 -0

b/Documentation/media/uapi/v4l/open.rst index afd116edb40d..a72d142897c0 100644

Documentation/media/uapi/v4l/open.rst +4 -0
@@ -6,6 +6,56 @@
 Opening and Closing Devices
 ***************************
 
+Types of V4L2 hardware control
+==============================
+
+V4L2 devices are usually complex: they are implemented via a main driver

and

Documentation/media/uapi/v4l/open.rst line 14

Quoted 2 lines
Documentation/media/uapi/v4l/open.rst +2 -0
+often several additional drivers. The main driver always exposes one or
+more **V4L2 device** devnodes (see :ref:`v4l2_device_naming`).

First of all, as stated in a previous e-mail, I think we should start by defining the terms we are going to use. The word "device" is ambiguous, it can mean

Quoted 7 lines

- device node

The /dev device node through which a character- or block-based API is exposed through userspace.

The term "device node" is commonly used in the kernel, I think we can use it as-is without ambiguity.

Ack.

Quoted 11 lines

- kernel struct device

An instance of the kernel struct device. Kernel devices are used to represent hardware devices (and are then embedded in bus-specific device structure such as platform_device, pci_device or i2c_client) and logical devices (and are then embedded in class-spcific device structures such as struct video_device or struct net_device).

For now I believe this isn't relevant to the V4L2 userspace API discussion, so we can leave it out.

Agree.

Quoted 8 lines

- hardware device

The hardware counterpart of the first category of the kernel struct device, a hardware (and thus physical) device such as an SoC IP core or an I2C chip.

We could call this "hardware device" or "hardware component". Other proposals are welcome.

I like "hardware component". I prefer to avoid the word 'device' as much as possible.

Quoted 10 lines

- hardware peripheral

A group of hardware devices that together make a larger user-facing functional peripheral. For instance the SoC ISP IP cores and external camera sensors together make a camera peripheral.

If we call the previous device a "hardware component" this could be called "hardware device". Otherwise "hardware peripheral" is a possible name, but we can probably come up with a better name.

"hardware device" can be used provided it is clearly defined as being a collection of hardware components that together form the fully functioning device. Or something along those lines.

Quoted 5 lines

- software peripheral

The software counterpart of the hardware peripheral. In V4L2 this is modeled by a struct v4l2_device, often associated with a struct media_device.

struct v4l2_device isn't visible to userspace (and is an awful name, I'm really sorry about that, guys!).

Quoted 2 lines

I don't like the name "software peripheral", other proposals are welcome.

Where would you use the term "software peripheral"? In what context? Do we need this at all?

Quoted 30 lines

Once we agree on names and definitions I'll comment on the reworked version of this patch, as it's pointless to bikeshed the wording without first agreeing on clear definitions of the concepts we're discussing. Please still see below for a few comments not related to particular wording.

Quoted 11 lines
Documentation/media/uapi/v4l/open.rst +4 -0
+The other drivers are called **V4L2 sub-devices** and provide control to
+other parts of the hardware usually connected via a serial bus (like
+I²C, SMBus or SPI). They can be implicitly controlled directly by the
+main driver or explicitly through via the **V4L2 sub-device API**

interface.

Documentation/media/uapi/v4l/open.rst +2 -0
+
+When V4L2 was originally designed, there was only one type of device

control.

Documentation/media/uapi/v4l/open.rst +2 -0
+The entire device was controlled via the **V4L2 device nodes**. We refer to
+this kind of control as **V4L2 device node centric** (or,

simply, +**vdev-centric**).

Documentation/media/uapi/v4l/open.rst line 30

Quoted 6 lines
Documentation/media/uapi/v4l/open.rst +6 -0
+
+Since the end of 2010, a new type of V4L2 device control was added in order
+to support complex devices that are common for embedded systems. Those
+devices are controlled mainly via the media controller and sub-devices.
+So, they're called: **Media controller centric** (or, simply,
+"**MC-centric**").

Do we really need to explain the development history with dates ? I don't think it helps understanding the separation between vdev-centric and MC- centric devices. For instance the previous paragraph that explains that V4L2 originally had a single type of device control that we now call vdev-centric doesn't really help understanding what a vdev-centric device is.

Quoted 2 lines

It would be clearer in my opinion to explain the two kind of devices with an associated use case, without referring to the history.

It doesn't hurt to mention that MC-centric came later. There are after all API oddities that are due to the history of the API. But we can simply say "Later" instead of "Since the end of 2010".

Quoted 14 lines
Quoted 14 lines
Documentation/media/uapi/v4l/open.rst +9 -0
+For **vdev-centric** control, the device and their corresponding hardware
+pipelines are controlled via the **V4L2 device** node. They may optionally
+expose via the :ref:`media controller API <media_controller>`.
+
+For **MC-centric** control, before using the V4L2 device, it is required to
+set the hardware pipelines via the
+:ref:`media controller API <media_controller>`. For those devices, the
+sub-devices' configuration can be controlled via the
+:ref:`sub-device API <subdev>`, with creates one device node per sub

device.

Documentation/media/uapi/v4l/open.rst +4 -0
+
+In summary, for **MC-centric** devices:
+
+- The **V4L2 device** node is responsible for controlling the streaming
Quoted 8 lines

Documentation/media/uapi/v4l/open.rst line 48

Quoted 4 lines
Documentation/media/uapi/v4l/open.rst +4 -0
+  features;
+- The **media controller device** is responsible to setup the pipelines;
+- The **V4L2 sub-devices** are responsible for sub-device
+  specific settings.

How about a summary of vdev-centric devices too ? Or, possibly, no summary at all ? The need to summarize 5 short paragraphs probably indicates that those paragraphis are not clear enough :-)

I was thinking the same. It should probably be dropped.

Quoted 9 lines

I can try to help by proposing enhancements to the documentation once we agree on the glossary above.

Documentation/media/uapi/v4l/open.rst line 54

Quoted 5 lines

+.. note::

Documentation/media/uapi/v4l/open.rst +4 -0
+
+   A **vdev-centric** may optionally expose V4L2 sub-devices via
+   :ref:`sub-device API <subdev>`. In that case, it has to implement
+   the :ref:`media controller API <media_controller>` as well.
Quoted 7 lines

The separation between vdev-centric and MC-centric devices is quite clear. If we allow a vdev-centric device to expose subdev nodes we will open the door to all kind of hybrid implementations that have no clear definition today. It will be very important in that case to document in details what is allowed and what isn't, and how the video device nodes and subdev device nodes interact with each other. I prefer not giving a green light to such implementations until we have to

Well, they exist already. The original MC design that I made allowed for this. In practice the only reason for doing this is to set private controls for subdevs (i.e. controls not inherited by the video device node).

Three drivers use this: rcar-drif, cobalt (not an issue, I can just remove support for this as Cisco is the only user) and I know there was a third one that you found, but I keep forgetting the name of that driver.

Quoted 6 lines

, and I also prefer discussing this topic separately. It will require a fair amount of work to document (and thus first agree on), and there's no need to block the rest of this patch until we complete that work. For those reasons I would like to explicitly disallow those hybrid devices in this patch, and start discussing the use cases we have for them, and how they would operate.

I have no objection to dropping this note for the first version.

Regards,

Hans

Quoted 7 lines
Quoted 5 lines

+.. _v4l2_device_naming:

Device Naming
=============

#8 lore raw

PATCH 2/3 media: videodev2: add a flag for vdev-centric devices

In reply to Mauro Carvalho Chehab

From: Mauro Carvalho Chehab <[email protected]>

As both vdev-centric and mc-centric devices may implement the same APIs, we need a flag to allow userspace to distinguish between them.

---
 Documentation/media/uapi/v4l/open.rst            | 6 ++++++
 Documentation/media/uapi/v4l/vidioc-querycap.rst | 4 ++++
 include/uapi/linux/videodev2.h                   | 2 ++
 3 files changed, 12 insertions(+)
Documentation/media/uapi/v4l/open.rst +6 -0
index a72d142897c0..eb3f0ec57edb 100644
@@ -33,6 +33,12 @@ For **vdev-centric** control, the device and their corresponding hardware
 pipelines are controlled via the **V4L2 device** node. They may optionally
 expose via the :ref:`media controller API <media_controller>`.
 
+.. note::
+
+   **vdev-centric** devices should report V4L2_VDEV_CENTERED
+   :c:type:`v4l2_capability` flag (see :ref:`VIDIOC_QUERYCAP`).
+
+
 For **MC-centric** control, before using the V4L2 device, it is required to
 set the hardware pipelines via the
 :ref:`media controller API <media_controller>`. For those devices, the
Documentation/media/uapi/v4l/vidioc-querycap.rst +4 -0
index 12e0d9a63cd8..4856821b7608 100644
@@ -252,6 +252,10 @@ specification the ioctl returns an ``EINVAL`` error code.
     * - ``V4L2_CAP_TOUCH``
       - 0x10000000
       - This is a touch device.
+    * - ``V4L2_VDEV_CENTERED``
+      - 0x20000000
+      - This is controlled via V4L2 device nodes (radio, video, vbi,
+        sdr
     * - ``V4L2_CAP_DEVICE_CAPS``
       - 0x80000000
       - The driver fills the ``device_caps`` field. This capability can
include/uapi/linux/videodev2.h +2 -0
index 45cf7359822c..d89090d99042 100644
@@ -460,6 +460,8 @@ struct v4l2_capability {
 
 #define V4L2_CAP_TOUCH                  0x10000000  /* Is a touch device */
 
+#define V4L2_CAP_VDEV_CENTERED          0x20000000  /* V4L2 Device is controlled via V4L2 device devnode */
+
 #define V4L2_CAP_DEVICE_CAPS            0x80000000  /* sets device capabilities field */
 
 /*
Signature · 1 line
2.13.3
#9 lore raw

Re: [PATCH 2/3] media: videodev2: add a flag for vdev-centric devices

Quoted 19 lines · Mauro Carvalho Chehab

From: Mauro Carvalho Chehab <[email protected]>

As both vdev-centric and mc-centric devices may implement the same APIs, we need a flag to allow userspace to distinguish between them.

---
 Documentation/media/uapi/v4l/open.rst            | 6 ++++++
 Documentation/media/uapi/v4l/vidioc-querycap.rst | 4 ++++
 include/uapi/linux/videodev2.h                   | 2 ++
 3 files changed, 12 insertions(+)
Documentation/media/uapi/v4l/open.rst +0 -0
index a72d142897c0..eb3f0ec57edb 100644

Documentation/media/uapi/v4l/open.rst For **vdev-centric** control, the device and their corresponding hardware · line 38

Quoted 6 lines
Documentation/media/uapi/v4l/open.rst +3 -0
@@ -33,6 +33,12 @@ For **vdev-centric** control, the device and their corresponding hardware
 pipelines are controlled via the **V4L2 device** node. They may optionally
 expose via the :ref:`media controller API <media_controller>`.
 
+.. note::
+
+   **vdev-centric** devices should report V4L2_VDEV_CENTERED

You mean CENTRIC, not CENTERED.

But I would change this to MC_CENTRIC: the vast majority of drivers are VDEV centric, so it makes a lot more sense to keep that as the default and only set the cap for MC-centric drivers.

Regards,

Hans

Quoted 35 lines
Documentation/media/uapi/v4l/open.rst +3 -0
+   :c:type:`v4l2_capability` flag (see :ref:`VIDIOC_QUERYCAP`).
+
+
 For **MC-centric** control, before using the V4L2 device, it is required to
 set the hardware pipelines via the
 :ref:`media controller API <media_controller>`. For those devices, the
Documentation/media/uapi/v4l/vidioc-querycap.rst +4 -0
index 12e0d9a63cd8..4856821b7608 100644
@@ -252,6 +252,10 @@ specification the ioctl returns an ``EINVAL`` error code.
     * - ``V4L2_CAP_TOUCH``
       - 0x10000000
       - This is a touch device.
+    * - ``V4L2_VDEV_CENTERED``
+      - 0x20000000
+      - This is controlled via V4L2 device nodes (radio, video, vbi,
+        sdr
     * - ``V4L2_CAP_DEVICE_CAPS``
       - 0x80000000
       - The driver fills the ``device_caps`` field. This capability can
include/uapi/linux/videodev2.h +2 -0
index 45cf7359822c..d89090d99042 100644
@@ -460,6 +460,8 @@ struct v4l2_capability {
 
 #define V4L2_CAP_TOUCH                  0x10000000  /* Is a touch device */
 
+#define V4L2_CAP_VDEV_CENTERED          0x20000000  /* V4L2 Device is controlled via V4L2 device devnode */
+
 #define V4L2_CAP_DEVICE_CAPS            0x80000000  /* sets device capabilities field */
 
 /*
#10 lore raw

Re: [PATCH 2/3] media: videodev2: add a flag for vdev-centric devices

Em Fri, 25 Aug 2017 11:44:27 +0200
Hans Verkuil <[email protected]> escreveu:

Quoted 23 lines · Mauro Carvalho Chehab
Quoted 22 lines

From: Mauro Carvalho Chehab <[email protected]>

As both vdev-centric and mc-centric devices may implement the same APIs, we need a flag to allow userspace to distinguish between them.

---
 Documentation/media/uapi/v4l/open.rst            | 6 ++++++
 Documentation/media/uapi/v4l/vidioc-querycap.rst | 4 ++++
 include/uapi/linux/videodev2.h                   | 2 ++
 3 files changed, 12 insertions(+)
Documentation/media/uapi/v4l/open.rst +0 -0
index a72d142897c0..eb3f0ec57edb 100644
@@ -33,6 +33,12 @@ For **vdev-centric** control, the device and their corresponding hardware
 pipelines are controlled via the **V4L2 device** node. They may optionally
 expose via the :ref:`media controller API <media_controller>`.
 
Quoted 5 lines

Documentation/media/uapi/v4l/open.rst For **vdev-centric** control, the device and their corresponding hardware · line 38

Quoted 3 lines
Documentation/media/uapi/v4l/open.rst +3 -0
+.. note::
+
+   **vdev-centric** devices should report V4L2_VDEV_CENTERED  

You mean CENTRIC, not CENTERED.

Yeah, true. I'll fix it.

Quoted 3 lines

But I would change this to MC_CENTRIC: the vast majority of drivers are VDEV centric, so it makes a lot more sense to keep that as the default and only set the cap for MC-centric drivers.

I actually focused it on what an userspace application would do.

An specialized application for a given hardware will likely just ignore whatever flag is added, and use vdev, mc and subdev APIs as it pleases. So, those applications don't need any flag at all.

However, a generic application needs a flag to allow them to check if a given hardware can be controlled by the traditional way to control the device (e. g. if it accepts vdev-centric type of hardware control).

It is an old desire (since when MC was designed) to allow that generic V4L2 apps to also work with MC-centric hardware somehow.

At the moment we add that (either in Kernelspace, as proposed for iMX6 [1] or via libv4l), a mc-centric hardware can also be vdev-centric.

[1] one alternative proposed for iMX6 driver, would be to enable vdev-centric control only for hardware with a single camera slot, like those cheap RPi3-camera compatible hardware, by using some info at the DT.

Quoted 32 lines

Regards,

Hans

Quoted 27 lines
Documentation/media/uapi/v4l/open.rst +3 -0
+   :c:type:`v4l2_capability` flag (see :ref:`VIDIOC_QUERYCAP`).
+
+
 For **MC-centric** control, before using the V4L2 device, it is required to
 set the hardware pipelines via the
 :ref:`media controller API <media_controller>`. For those devices, the
Documentation/media/uapi/v4l/vidioc-querycap.rst +4 -0
index 12e0d9a63cd8..4856821b7608 100644
@@ -252,6 +252,10 @@ specification the ioctl returns an ``EINVAL`` error code.
     * - ``V4L2_CAP_TOUCH``
       - 0x10000000
       - This is a touch device.
+    * - ``V4L2_VDEV_CENTERED``
+      - 0x20000000
+      - This is controlled via V4L2 device nodes (radio, video, vbi,
+        sdr
     * - ``V4L2_CAP_DEVICE_CAPS``
       - 0x80000000
       - The driver fills the ``device_caps`` field. This capability can
include/uapi/linux/videodev2.h +0 -0
index 45cf7359822c..d89090d99042 100644
@@ -460,6 +460,8 @@ struct v4l2_capability {
 
Quoted 9 lines

include/uapi/linux/videodev2.h struct v4l2_capability { · line 467

Quoted 8 lines
include/uapi/linux/videodev2.h +2 -0
 #define V4L2_CAP_TOUCH                  0x10000000  /* Is a touch device */
 
+#define V4L2_CAP_VDEV_CENTERED          0x20000000  /* V4L2 Device is controlled via V4L2 device devnode */
+
 #define V4L2_CAP_DEVICE_CAPS            0x80000000  /* sets device capabilities field */
 
 /*

Thanks,
Mauro

#11 lore raw

Re: [PATCH 2/3] media: videodev2: add a flag for vdev-centric devices

Quoted 44 lines · Mauro Carvalho Chehab

Em Fri, 25 Aug 2017 11:44:27 +0200
Hans Verkuil <[email protected]> escreveu:

Quoted 23 lines · Mauro Carvalho Chehab
Quoted 22 lines

From: Mauro Carvalho Chehab <[email protected]>

As both vdev-centric and mc-centric devices may implement the same APIs, we need a flag to allow userspace to distinguish between them.

---
 Documentation/media/uapi/v4l/open.rst            | 6 ++++++
 Documentation/media/uapi/v4l/vidioc-querycap.rst | 4 ++++
 include/uapi/linux/videodev2.h                   | 2 ++
 3 files changed, 12 insertions(+)
Documentation/media/uapi/v4l/open.rst +0 -0
index a72d142897c0..eb3f0ec57edb 100644
@@ -33,6 +33,12 @@ For **vdev-centric** control, the device and their corresponding hardware
 pipelines are controlled via the **V4L2 device** node. They may optionally
 expose via the :ref:`media controller API <media_controller>`.
 
Quoted 5 lines

Documentation/media/uapi/v4l/open.rst For **vdev-centric** control, the device and their corresponding hardware · line 38

Quoted 3 lines
Documentation/media/uapi/v4l/open.rst +3 -0
+.. note::
+
+   **vdev-centric** devices should report V4L2_VDEV_CENTERED  

You mean CENTRIC, not CENTERED.

Yeah, true. I'll fix it.

Quoted 3 lines

But I would change this to MC_CENTRIC: the vast majority of drivers are VDEV centric, so it makes a lot more sense to keep that as the default and only set the cap for MC-centric drivers.

I actually focused it on what an userspace application would do.

An specialized application for a given hardware will likely just ignore whatever flag is added, and use vdev, mc and subdev APIs as it pleases. So, those applications don't need any flag at all.

Quoted 7 lines

However, a generic application needs a flag to allow them to check if a given hardware can be controlled by the traditional way to control the device (e. g. if it accepts vdev-centric type of hardware control).

It is an old desire (since when MC was designed) to allow that generic V4L2 apps to also work with MC-centric hardware somehow.

No, not true. The desire is that they can use the MC to find the various device nodes (video, radio, vbi, rc, cec, ...). But they remain vdev-centric. vdev vs mc centric has nothing to do with the presence of the MC. It's how they are controlled.

Regarding userspace applications: they can't check for a VDEV_CENTRIC cap since we never had any. I.e., if they do:

	if (!(caps & VDEV_CENTRIC))
		/* unsupported device */

then they would fail for older kernels that do not set this flag.

But this works:

	if (caps & MC_CENTRIC)
		/* unsupported device */

So this really needs to be an MC_CENTRIC capability.

Regards,

Hans

Quoted 57 lines

At the moment we add that (either in Kernelspace, as proposed for iMX6 [1] or via libv4l), a mc-centric hardware can also be vdev-centric.

[1] one alternative proposed for iMX6 driver, would be to enable vdev-centric control only for hardware with a single camera slot, like those cheap RPi3-camera compatible hardware, by using some info at the DT.

Quoted 32 lines

Regards,

Hans

Quoted 27 lines
Documentation/media/uapi/v4l/open.rst +3 -0
+   :c:type:`v4l2_capability` flag (see :ref:`VIDIOC_QUERYCAP`).
+
+
 For **MC-centric** control, before using the V4L2 device, it is required to
 set the hardware pipelines via the
 :ref:`media controller API <media_controller>`. For those devices, the
Documentation/media/uapi/v4l/vidioc-querycap.rst +4 -0
index 12e0d9a63cd8..4856821b7608 100644
@@ -252,6 +252,10 @@ specification the ioctl returns an ``EINVAL`` error code.
     * - ``V4L2_CAP_TOUCH``
       - 0x10000000
       - This is a touch device.
+    * - ``V4L2_VDEV_CENTERED``
+      - 0x20000000
+      - This is controlled via V4L2 device nodes (radio, video, vbi,
+        sdr
     * - ``V4L2_CAP_DEVICE_CAPS``
       - 0x80000000
       - The driver fills the ``device_caps`` field. This capability can
include/uapi/linux/videodev2.h +0 -0
index 45cf7359822c..d89090d99042 100644
@@ -460,6 +460,8 @@ struct v4l2_capability {
 
Quoted 9 lines

include/uapi/linux/videodev2.h struct v4l2_capability { · line 467

Quoted 8 lines
include/uapi/linux/videodev2.h +2 -0
 #define V4L2_CAP_TOUCH                  0x10000000  /* Is a touch device */
 
+#define V4L2_CAP_VDEV_CENTERED          0x20000000  /* V4L2 Device is controlled via V4L2 device devnode */
+
 #define V4L2_CAP_DEVICE_CAPS            0x80000000  /* sets device capabilities field */
 
 /*

Thanks,
Mauro

#12 lore raw

Re: [PATCH 2/3] media: videodev2: add a flag for vdev-centric devices

Em Fri, 25 Aug 2017 12:13:53 +0200
Hans Verkuil <[email protected]> escreveu:

Quoted 50 lines · Mauro Carvalho Chehab
Quoted 49 lines

Em Fri, 25 Aug 2017 11:44:27 +0200
Hans Verkuil <[email protected]> escreveu:

Quoted 23 lines · Mauro Carvalho Chehab
Quoted 22 lines

From: Mauro Carvalho Chehab <[email protected]>

As both vdev-centric and mc-centric devices may implement the same APIs, we need a flag to allow userspace to distinguish between them.

---
 Documentation/media/uapi/v4l/open.rst            | 6 ++++++
 Documentation/media/uapi/v4l/vidioc-querycap.rst | 4 ++++
 include/uapi/linux/videodev2.h                   | 2 ++
 3 files changed, 12 insertions(+)
Documentation/media/uapi/v4l/open.rst +0 -0
index a72d142897c0..eb3f0ec57edb 100644
@@ -33,6 +33,12 @@ For **vdev-centric** control, the device and their corresponding hardware
 pipelines are controlled via the **V4L2 device** node. They may optionally
 expose via the :ref:`media controller API <media_controller>`.
 
Quoted 5 lines

Documentation/media/uapi/v4l/open.rst For **vdev-centric** control, the device and their corresponding hardware · line 38

Quoted 3 lines
Documentation/media/uapi/v4l/open.rst +3 -0
+.. note::
+
+   **vdev-centric** devices should report V4L2_VDEV_CENTERED    

You mean CENTRIC, not CENTERED.

Yeah, true. I'll fix it.

Quoted 3 lines

But I would change this to MC_CENTRIC: the vast majority of drivers are VDEV centric, so it makes a lot more sense to keep that as the default and only set the cap for MC-centric drivers.

I actually focused it on what an userspace application would do.

An specialized application for a given hardware will likely just ignore whatever flag is added, and use vdev, mc and subdev APIs as it pleases. So, those applications don't need any flag at all.

However, a generic application needs a flag to allow them to check if a given hardware can be controlled by the traditional way to control the device (e. g. if it accepts vdev-centric type of hardware control).

Quoted 7 lines
Quoted 2 lines

It is an old desire (since when MC was designed) to allow that generic V4L2 apps to also work with MC-centric hardware somehow.

No, not true. The desire is that they can use the MC to find the various device nodes (video, radio, vbi, rc, cec, ...). But they remain vdev-centric. vdev vs mc centric has nothing to do with the presence of the MC. It's how they are controlled.

No, that's not I'm talking about. I'm talking about libv4l plugin (or whatever) that would allow a generic app to work with a mc-centric device. That's there for a long time (since when we were reviewing the MC patches back in 2009 or 2010).

Quoted 7 lines

Regarding userspace applications: they can't check for a VDEV_CENTRIC cap since we never had any. I.e., if they do:

	if (!(caps & VDEV_CENTRIC))
		/* unsupported device */
Quoted 8 lines

then they would fail for older kernels that do not set this flag.

But this works:

	if (caps & MC_CENTRIC)
		/* unsupported device */

So this really needs to be an MC_CENTRIC capability.

That won't work. The test should take into account the API version too.

Assuming that such flag would be added for version 4.15, with a VDEV_CENTRIC, the check would be:

/*
* There's no need to check version here: libv4l may override it
* to support a mc-centric device even for older versions of the
* Kernel
*/
if (caps & V4L2_CAP_VDEV_CENTRIC)
is_supported = true;

/*
* For API version lower than 4.15, there's no way to know for
* sure if the device is vdev-centric or not. So, either additional
* tests are needed, or it would assume vdev-centric and output
* some note about that.
*/
if (version < KERNEL_VERSION(4, 15, 0))
maybe_supported = true;

Thanks,
Mauro

#13 lore raw

Re: [PATCH 2/3] media: videodev2: add a flag for vdev-centric devices

Quoted 61 lines · Mauro Carvalho Chehab

Em Fri, 25 Aug 2017 12:13:53 +0200
Hans Verkuil <[email protected]> escreveu:

Quoted 50 lines · Mauro Carvalho Chehab
Quoted 49 lines

Em Fri, 25 Aug 2017 11:44:27 +0200
Hans Verkuil <[email protected]> escreveu:

Quoted 23 lines · Mauro Carvalho Chehab
Quoted 22 lines

From: Mauro Carvalho Chehab <[email protected]>

As both vdev-centric and mc-centric devices may implement the same APIs, we need a flag to allow userspace to distinguish between them.

---
 Documentation/media/uapi/v4l/open.rst            | 6 ++++++
 Documentation/media/uapi/v4l/vidioc-querycap.rst | 4 ++++
 include/uapi/linux/videodev2.h                   | 2 ++
 3 files changed, 12 insertions(+)
Documentation/media/uapi/v4l/open.rst +0 -0
index a72d142897c0..eb3f0ec57edb 100644
@@ -33,6 +33,12 @@ For **vdev-centric** control, the device and their corresponding hardware
 pipelines are controlled via the **V4L2 device** node. They may optionally
 expose via the :ref:`media controller API <media_controller>`.
 
Quoted 5 lines

Documentation/media/uapi/v4l/open.rst For **vdev-centric** control, the device and their corresponding hardware · line 38

Quoted 3 lines
Documentation/media/uapi/v4l/open.rst +3 -0
+.. note::
+
+   **vdev-centric** devices should report V4L2_VDEV_CENTERED    

You mean CENTRIC, not CENTERED.

Yeah, true. I'll fix it.

Quoted 3 lines

But I would change this to MC_CENTRIC: the vast majority of drivers are VDEV centric, so it makes a lot more sense to keep that as the default and only set the cap for MC-centric drivers.

I actually focused it on what an userspace application would do.

An specialized application for a given hardware will likely just ignore whatever flag is added, and use vdev, mc and subdev APIs as it pleases. So, those applications don't need any flag at all.

However, a generic application needs a flag to allow them to check if a given hardware can be controlled by the traditional way to control the device (e. g. if it accepts vdev-centric type of hardware control).

Quoted 7 lines
Quoted 2 lines

It is an old desire (since when MC was designed) to allow that generic V4L2 apps to also work with MC-centric hardware somehow.

No, not true. The desire is that they can use the MC to find the various device nodes (video, radio, vbi, rc, cec, ...). But they remain vdev-centric. vdev vs mc centric has nothing to do with the presence of the MC. It's how they are controlled.

Quoted 4 lines

No, that's not I'm talking about. I'm talking about libv4l plugin (or whatever) that would allow a generic app to work with a mc-centric device. That's there for a long time (since when we were reviewing the MC patches back in 2009 or 2010).

So? Such a plugin would obviously remove the MC_CENTRIC cap. Which makes perfect sense.

There are a lot of userspace applications that do not use libv4l. It's optional, not required, to use that library. We cannot design our API with the assumption that this library will be used.

Quoted 32 lines
Quoted 8 lines

Regarding userspace applications: they can't check for a VDEV_CENTRIC cap since we never had any. I.e., if they do:

	if (!(caps & VDEV_CENTRIC))
		/* unsupported device */
Quoted 8 lines

then they would fail for older kernels that do not set this flag.

But this works:

	if (caps & MC_CENTRIC)
		/* unsupported device */

So this really needs to be an MC_CENTRIC capability.

That won't work. The test should take into account the API version too.

Assuming that such flag would be added for version 4.15, with a VDEV_CENTRIC, the check would be:

/*
* There's no need to check version here: libv4l may override it
* to support a mc-centric device even for older versions of the
* Kernel
*/
if (caps & V4L2_CAP_VDEV_CENTRIC)
is_supported = true;

Quoted 8 lines

/*
* For API version lower than 4.15, there's no way to know for
* sure if the device is vdev-centric or not. So, either additional
* tests are needed, or it would assume vdev-centric and output
* some note about that.
*/
if (version < KERNEL_VERSION(4, 15, 0))
maybe_supported = true;

	is_supported = true;
	if (caps & V4L2_CAP_MC_CENTRIC)
		is_supported = false;

if (version < KERNEL_VERSION(4, 15, 0))
maybe_supported = true;

I don't see the difference. BTW, no application will ever do that version check. It doesn't help them in any way to know that it 'may' be supported.

Regards,

Hans

#14 lore raw

Re: [PATCH 2/3] media: videodev2: add a flag for vdev-centric devices

Em Fri, 25 Aug 2017 12:42:51 +0200
Hans Verkuil <[email protected]> escreveu:

Quoted 122 lines · Mauro Carvalho Chehab
Quoted 61 lines

Em Fri, 25 Aug 2017 12:13:53 +0200
Hans Verkuil <[email protected]> escreveu:

Quoted 50 lines · Mauro Carvalho Chehab
Quoted 49 lines

Em Fri, 25 Aug 2017 11:44:27 +0200
Hans Verkuil <[email protected]> escreveu:

Quoted 23 lines · Mauro Carvalho Chehab
Quoted 22 lines

From: Mauro Carvalho Chehab <[email protected]>

As both vdev-centric and mc-centric devices may implement the same APIs, we need a flag to allow userspace to distinguish between them.

---
 Documentation/media/uapi/v4l/open.rst            | 6 ++++++
 Documentation/media/uapi/v4l/vidioc-querycap.rst | 4 ++++
 include/uapi/linux/videodev2.h                   | 2 ++
 3 files changed, 12 insertions(+)
Documentation/media/uapi/v4l/open.rst +0 -0
index a72d142897c0..eb3f0ec57edb 100644
@@ -33,6 +33,12 @@ For **vdev-centric** control, the device and their corresponding hardware
 pipelines are controlled via the **V4L2 device** node. They may optionally
 expose via the :ref:`media controller API <media_controller>`.
 
Quoted 5 lines

Documentation/media/uapi/v4l/open.rst For **vdev-centric** control, the device and their corresponding hardware · line 38

Quoted 3 lines
Documentation/media/uapi/v4l/open.rst +3 -0
+.. note::
+
+   **vdev-centric** devices should report V4L2_VDEV_CENTERED      

You mean CENTRIC, not CENTERED.

Yeah, true. I'll fix it.

Quoted 3 lines

But I would change this to MC_CENTRIC: the vast majority of drivers are VDEV centric, so it makes a lot more sense to keep that as the default and only set the cap for MC-centric drivers.

I actually focused it on what an userspace application would do.

An specialized application for a given hardware will likely just ignore whatever flag is added, and use vdev, mc and subdev APIs as it pleases. So, those applications don't need any flag at all.

However, a generic application needs a flag to allow them to check if a given hardware can be controlled by the traditional way to control the device (e. g. if it accepts vdev-centric type of hardware control).

Quoted 7 lines
Quoted 2 lines

It is an old desire (since when MC was designed) to allow that generic V4L2 apps to also work with MC-centric hardware somehow.

No, not true. The desire is that they can use the MC to find the various device nodes (video, radio, vbi, rc, cec, ...). But they remain vdev-centric. vdev vs mc centric has nothing to do with the presence of the MC. It's how they are controlled.

Quoted 4 lines

No, that's not I'm talking about. I'm talking about libv4l plugin (or whatever) that would allow a generic app to work with a mc-centric device. That's there for a long time (since when we were reviewing the MC patches back in 2009 or 2010).

So? Such a plugin would obviously remove the MC_CENTRIC cap. Which makes perfect sense.

There are a lot of userspace applications that do not use libv4l. It's optional, not required, to use that library. We cannot design our API with the assumption that this library will be used.

Quoted 32 lines
Quoted 8 lines

Regarding userspace applications: they can't check for a VDEV_CENTRIC cap since we never had any. I.e., if they do:

	if (!(caps & VDEV_CENTRIC))
		/* unsupported device */
Quoted 8 lines

then they would fail for older kernels that do not set this flag.

But this works:

	if (caps & MC_CENTRIC)
		/* unsupported device */

So this really needs to be an MC_CENTRIC capability.

That won't work. The test should take into account the API version too.

Assuming that such flag would be added for version 4.15, with a VDEV_CENTRIC, the check would be:

/*
* There's no need to check version here: libv4l may override it
* to support a mc-centric device even for older versions of the
* Kernel
*/
if (caps & V4L2_CAP_VDEV_CENTRIC)
is_supported = true;

Quoted 8 lines

/*
* For API version lower than 4.15, there's no way to know for
* sure if the device is vdev-centric or not. So, either additional
* tests are needed, or it would assume vdev-centric and output
* some note about that.
*/
if (version < KERNEL_VERSION(4, 15, 0))
maybe_supported = true;

	is_supported = true;
	if (caps & V4L2_CAP_MC_CENTRIC)
		is_supported = false;
(quoted diff) +0 -0
 	if (version < KERNEL_VERSION(4, 15, 0))
 		maybe_supported = true;
Quoted 2 lines

I don't see the difference. BTW, no application will ever do that version check. It doesn't help them in any way to know that it 'may' be supported.

Yeah, this can work. The only drawback is that, if we end by implementing vdev compatible support is that such drivers will have to clean the V4L2_CAP_MC_CENTRIC flag.

Thanks,
Mauro

#15 lore raw

Re: [PATCH 2/3] media: videodev2: add a flag for vdev-centric devices

Quoted 125 lines · Mauro Carvalho Chehab

Em Fri, 25 Aug 2017 12:42:51 +0200
Hans Verkuil <[email protected]> escreveu:

Quoted 122 lines · Mauro Carvalho Chehab
Quoted 61 lines

Em Fri, 25 Aug 2017 12:13:53 +0200
Hans Verkuil <[email protected]> escreveu:

Quoted 50 lines · Mauro Carvalho Chehab
Quoted 49 lines

Em Fri, 25 Aug 2017 11:44:27 +0200
Hans Verkuil <[email protected]> escreveu:

Quoted 23 lines · Mauro Carvalho Chehab
Quoted 22 lines

From: Mauro Carvalho Chehab <[email protected]>

As both vdev-centric and mc-centric devices may implement the same APIs, we need a flag to allow userspace to distinguish between them.

---
 Documentation/media/uapi/v4l/open.rst            | 6 ++++++
 Documentation/media/uapi/v4l/vidioc-querycap.rst | 4 ++++
 include/uapi/linux/videodev2.h                   | 2 ++
 3 files changed, 12 insertions(+)
Documentation/media/uapi/v4l/open.rst +0 -0
index a72d142897c0..eb3f0ec57edb 100644
@@ -33,6 +33,12 @@ For **vdev-centric** control, the device and their corresponding hardware
 pipelines are controlled via the **V4L2 device** node. They may optionally
 expose via the :ref:`media controller API <media_controller>`.
 
Quoted 5 lines

Documentation/media/uapi/v4l/open.rst For **vdev-centric** control, the device and their corresponding hardware · line 38

Quoted 3 lines
Documentation/media/uapi/v4l/open.rst +3 -0
+.. note::
+
+   **vdev-centric** devices should report V4L2_VDEV_CENTERED      

You mean CENTRIC, not CENTERED.

Yeah, true. I'll fix it.

Quoted 3 lines

But I would change this to MC_CENTRIC: the vast majority of drivers are VDEV centric, so it makes a lot more sense to keep that as the default and only set the cap for MC-centric drivers.

I actually focused it on what an userspace application would do.

An specialized application for a given hardware will likely just ignore whatever flag is added, and use vdev, mc and subdev APIs as it pleases. So, those applications don't need any flag at all.

However, a generic application needs a flag to allow them to check if a given hardware can be controlled by the traditional way to control the device (e. g. if it accepts vdev-centric type of hardware control).

Quoted 7 lines
Quoted 2 lines

It is an old desire (since when MC was designed) to allow that generic V4L2 apps to also work with MC-centric hardware somehow.

No, not true. The desire is that they can use the MC to find the various device nodes (video, radio, vbi, rc, cec, ...). But they remain vdev-centric. vdev vs mc centric has nothing to do with the presence of the MC. It's how they are controlled.

Quoted 4 lines

No, that's not I'm talking about. I'm talking about libv4l plugin (or whatever) that would allow a generic app to work with a mc-centric device. That's there for a long time (since when we were reviewing the MC patches back in 2009 or 2010).

So? Such a plugin would obviously remove the MC_CENTRIC cap. Which makes perfect sense.

There are a lot of userspace applications that do not use libv4l. It's optional, not required, to use that library. We cannot design our API with the assumption that this library will be used.

Quoted 32 lines
Quoted 8 lines

Regarding userspace applications: they can't check for a VDEV_CENTRIC cap since we never had any. I.e., if they do:

	if (!(caps & VDEV_CENTRIC))
		/* unsupported device */
Quoted 8 lines

then they would fail for older kernels that do not set this flag.

But this works:

	if (caps & MC_CENTRIC)
		/* unsupported device */

So this really needs to be an MC_CENTRIC capability.

That won't work. The test should take into account the API version too.

Assuming that such flag would be added for version 4.15, with a VDEV_CENTRIC, the check would be:

/*
* There's no need to check version here: libv4l may override it
* to support a mc-centric device even for older versions of the
* Kernel
*/
if (caps & V4L2_CAP_VDEV_CENTRIC)
is_supported = true;

Quoted 8 lines

/*
* For API version lower than 4.15, there's no way to know for
* sure if the device is vdev-centric or not. So, either additional
* tests are needed, or it would assume vdev-centric and output
* some note about that.
*/
if (version < KERNEL_VERSION(4, 15, 0))
maybe_supported = true;

	is_supported = true;
	if (caps & V4L2_CAP_MC_CENTRIC)
		is_supported = false;
(quoted diff) +0 -0
 	if (version < KERNEL_VERSION(4, 15, 0))
 		maybe_supported = true;
Quoted 6 lines
Quoted 2 lines

I don't see the difference. BTW, no application will ever do that version check. It doesn't help them in any way to know that it 'may' be supported.

Yeah, this can work. The only drawback is that, if we end by implementing vdev compatible support is that such drivers will have to clean the V4L2_CAP_MC_CENTRIC flag.

You mean implementing vdev compatible support in libv4l? (Just making sure I understand you correctly)

In that case it doesn't matter if the libv4l code would set the VDEV_CENTRIC flag or remove the MC_CENTRIC flag. That makes no difference, or course.

Regards,

Hans

#16 lore raw

Re: [PATCH 2/3] media: videodev2: add a flag for vdev-centric devices

Em Fri, 25 Aug 2017 12:56:30 +0200
Hans Verkuil <[email protected]> escreveu:

Quoted 129 lines · Mauro Carvalho Chehab
Quoted 128 lines

Em Fri, 25 Aug 2017 12:42:51 +0200
Hans Verkuil <[email protected]> escreveu:

Quoted 124 lines · Mauro Carvalho Chehab
Quoted 61 lines

Em Fri, 25 Aug 2017 12:13:53 +0200
Hans Verkuil <[email protected]> escreveu:

Quoted 50 lines · Mauro Carvalho Chehab
Quoted 49 lines

Em Fri, 25 Aug 2017 11:44:27 +0200
Hans Verkuil <[email protected]> escreveu:

Quoted 23 lines · Mauro Carvalho Chehab
Quoted 22 lines

From: Mauro Carvalho Chehab <[email protected]>

As both vdev-centric and mc-centric devices may implement the same APIs, we need a flag to allow userspace to distinguish between them.

---
 Documentation/media/uapi/v4l/open.rst            | 6 ++++++
 Documentation/media/uapi/v4l/vidioc-querycap.rst | 4 ++++
 include/uapi/linux/videodev2.h                   | 2 ++
 3 files changed, 12 insertions(+)
Documentation/media/uapi/v4l/open.rst +0 -0
index a72d142897c0..eb3f0ec57edb 100644
@@ -33,6 +33,12 @@ For **vdev-centric** control, the device and their corresponding hardware
 pipelines are controlled via the **V4L2 device** node. They may optionally
 expose via the :ref:`media controller API <media_controller>`.
 
Quoted 5 lines

Documentation/media/uapi/v4l/open.rst For **vdev-centric** control, the device and their corresponding hardware · line 38

Quoted 3 lines
Documentation/media/uapi/v4l/open.rst +3 -0
+.. note::
+
+   **vdev-centric** devices should report V4L2_VDEV_CENTERED        

You mean CENTRIC, not CENTERED.

Yeah, true. I'll fix it.

Quoted 3 lines

But I would change this to MC_CENTRIC: the vast majority of drivers are VDEV centric, so it makes a lot more sense to keep that as the default and only set the cap for MC-centric drivers.

I actually focused it on what an userspace application would do.

An specialized application for a given hardware will likely just ignore whatever flag is added, and use vdev, mc and subdev APIs as it pleases. So, those applications don't need any flag at all.

However, a generic application needs a flag to allow them to check if a given hardware can be controlled by the traditional way to control the device (e. g. if it accepts vdev-centric type of hardware control).

Quoted 7 lines
Quoted 2 lines

It is an old desire (since when MC was designed) to allow that generic V4L2 apps to also work with MC-centric hardware somehow.

No, not true. The desire is that they can use the MC to find the various device nodes (video, radio, vbi, rc, cec, ...). But they remain vdev-centric. vdev vs mc centric has nothing to do with the presence of the MC. It's how they are controlled.

Quoted 4 lines

No, that's not I'm talking about. I'm talking about libv4l plugin (or whatever) that would allow a generic app to work with a mc-centric device. That's there for a long time (since when we were reviewing the MC patches back in 2009 or 2010).

So? Such a plugin would obviously remove the MC_CENTRIC cap. Which makes perfect sense.

There are a lot of userspace applications that do not use libv4l. It's optional, not required, to use that library. We cannot design our API with the assumption that this library will be used.

Quoted 32 lines
Quoted 8 lines

Regarding userspace applications: they can't check for a VDEV_CENTRIC cap since we never had any. I.e., if they do:

	if (!(caps & VDEV_CENTRIC))
		/* unsupported device */
Quoted 8 lines

then they would fail for older kernels that do not set this flag.

But this works:

	if (caps & MC_CENTRIC)
		/* unsupported device */

So this really needs to be an MC_CENTRIC capability.

That won't work. The test should take into account the API version too.

Assuming that such flag would be added for version 4.15, with a VDEV_CENTRIC, the check would be:

/*
* There's no need to check version here: libv4l may override it
* to support a mc-centric device even for older versions of the
* Kernel
*/
if (caps & V4L2_CAP_VDEV_CENTRIC)
is_supported = true;

Quoted 8 lines

/*
* For API version lower than 4.15, there's no way to know for
* sure if the device is vdev-centric or not. So, either additional
* tests are needed, or it would assume vdev-centric and output
* some note about that.
*/
if (version < KERNEL_VERSION(4, 15, 0))
maybe_supported = true;

	is_supported = true;
	if (caps & V4L2_CAP_MC_CENTRIC)
		is_supported = false;
(quoted diff) +0 -0
 	if (version < KERNEL_VERSION(4, 15, 0))
 		maybe_supported = true;

I don't see the difference. BTW, no application will ever do that version check. It doesn't help them in any way to know that it 'may' be supported.

Quoted 6 lines
Quoted 3 lines

Yeah, this can work. The only drawback is that, if we end by implementing vdev compatible support is that such drivers will have to clean the V4L2_CAP_MC_CENTRIC flag.

You mean implementing vdev compatible support in libv4l? (Just making sure I understand you correctly)

Yes, either there or at the Kernel, as it seems we'll never have it there, as nobody is working on it anymore.

Quoted 2 lines

In that case it doesn't matter if the libv4l code would set the VDEV_CENTRIC flag or remove the MC_CENTRIC flag. That makes no difference, or course.

True, but the text will have to be clear that a MC_CENTRIC device is a device that can't be controlled by a V4L2-centric application.

Thanks,
Mauro

#17 lore raw

Re: [PATCH 2/3] media: videodev2: add a flag for vdev-centric devices

Em Fri, 25 Aug 2017 08:15:03 -0300
Mauro Carvalho Chehab <[email protected]> escreveu:

Quoted 139 lines

Em Fri, 25 Aug 2017 12:56:30 +0200
Hans Verkuil <[email protected]> escreveu:

Quoted 129 lines · Mauro Carvalho Chehab
Quoted 128 lines

Em Fri, 25 Aug 2017 12:42:51 +0200
Hans Verkuil <[email protected]> escreveu:

Quoted 124 lines · Mauro Carvalho Chehab
Quoted 61 lines

Em Fri, 25 Aug 2017 12:13:53 +0200
Hans Verkuil <[email protected]> escreveu:

Quoted 50 lines · Mauro Carvalho Chehab
Quoted 49 lines

Em Fri, 25 Aug 2017 11:44:27 +0200
Hans Verkuil <[email protected]> escreveu:

Quoted 23 lines · Mauro Carvalho Chehab
Quoted 22 lines

From: Mauro Carvalho Chehab <[email protected]>

As both vdev-centric and mc-centric devices may implement the same APIs, we need a flag to allow userspace to distinguish between them.

---
 Documentation/media/uapi/v4l/open.rst            | 6 ++++++
 Documentation/media/uapi/v4l/vidioc-querycap.rst | 4 ++++
 include/uapi/linux/videodev2.h                   | 2 ++
 3 files changed, 12 insertions(+)
Documentation/media/uapi/v4l/open.rst +0 -0
index a72d142897c0..eb3f0ec57edb 100644
@@ -33,6 +33,12 @@ For **vdev-centric** control, the device and their corresponding hardware
 pipelines are controlled via the **V4L2 device** node. They may optionally
 expose via the :ref:`media controller API <media_controller>`.
 
Quoted 5 lines

Documentation/media/uapi/v4l/open.rst For **vdev-centric** control, the device and their corresponding hardware · line 38

Quoted 3 lines
Documentation/media/uapi/v4l/open.rst +3 -0
+.. note::
+
+   **vdev-centric** devices should report V4L2_VDEV_CENTERED          

You mean CENTRIC, not CENTERED.

Yeah, true. I'll fix it.

Quoted 3 lines

But I would change this to MC_CENTRIC: the vast majority of drivers are VDEV centric, so it makes a lot more sense to keep that as the default and only set the cap for MC-centric drivers.

I actually focused it on what an userspace application would do.

An specialized application for a given hardware will likely just ignore whatever flag is added, and use vdev, mc and subdev APIs as it pleases. So, those applications don't need any flag at all.

However, a generic application needs a flag to allow them to check if a given hardware can be controlled by the traditional way to control the device (e. g. if it accepts vdev-centric type of hardware control).

Quoted 7 lines
Quoted 2 lines

It is an old desire (since when MC was designed) to allow that generic V4L2 apps to also work with MC-centric hardware somehow.

No, not true. The desire is that they can use the MC to find the various device nodes (video, radio, vbi, rc, cec, ...). But they remain vdev-centric. vdev vs mc centric has nothing to do with the presence of the MC. It's how they are controlled.

Quoted 4 lines

No, that's not I'm talking about. I'm talking about libv4l plugin (or whatever) that would allow a generic app to work with a mc-centric device. That's there for a long time (since when we were reviewing the MC patches back in 2009 or 2010).

So? Such a plugin would obviously remove the MC_CENTRIC cap. Which makes perfect sense.

There are a lot of userspace applications that do not use libv4l. It's optional, not required, to use that library. We cannot design our API with the assumption that this library will be used.

Quoted 32 lines
Quoted 8 lines

Regarding userspace applications: they can't check for a VDEV_CENTRIC cap since we never had any. I.e., if they do:

	if (!(caps & VDEV_CENTRIC))
		/* unsupported device */
Quoted 8 lines

then they would fail for older kernels that do not set this flag.

But this works:

	if (caps & MC_CENTRIC)
		/* unsupported device */

So this really needs to be an MC_CENTRIC capability.

That won't work. The test should take into account the API version too.

Assuming that such flag would be added for version 4.15, with a VDEV_CENTRIC, the check would be:

/*
* There's no need to check version here: libv4l may override it
* to support a mc-centric device even for older versions of the
* Kernel
*/
if (caps & V4L2_CAP_VDEV_CENTRIC)
is_supported = true;

Quoted 8 lines

/*
* For API version lower than 4.15, there's no way to know for
* sure if the device is vdev-centric or not. So, either additional
* tests are needed, or it would assume vdev-centric and output
* some note about that.
*/
if (version < KERNEL_VERSION(4, 15, 0))
maybe_supported = true;

	is_supported = true;
	if (caps & V4L2_CAP_MC_CENTRIC)
		is_supported = false;
(quoted diff) +0 -0
 	if (version < KERNEL_VERSION(4, 15, 0))
 		maybe_supported = true;

I don't see the difference. BTW, no application will ever do that version check. It doesn't help them in any way to know that it 'may' be supported.

Quoted 6 lines
Quoted 3 lines

Yeah, this can work. The only drawback is that, if we end by implementing vdev compatible support is that such drivers will have to clean the V4L2_CAP_MC_CENTRIC flag.

You mean implementing vdev compatible support in libv4l? (Just making sure I understand you correctly)

Quoted 8 lines

Yes, either there or at the Kernel, as it seems we'll never have it there, as nobody is working on it anymore.

Quoted 2 lines

In that case it doesn't matter if the libv4l code would set the VDEV_CENTRIC flag or remove the MC_CENTRIC flag. That makes no difference, or course.

True, but the text will have to be clear that a MC_CENTRIC device is a device that can't be controlled by a V4L2-centric application.

Ok, that's the "reverse" patch. IMHO, it is very confusing, as we're actually using MC_CENTRIC to actually describe the lack of a capability.

Perhaps we should name it as NOT_VDEV_CENTRIC instead.

Regards,
Mauro

---

media: videodev2: add a flag for mc-centric devices

As both vdev-centric and mc-centric devices may implement the same APIs, we need a flag to allow userspace to distinguish between them.

Documentation/media/uapi/v4l/open.rst +9 -0
index a72d142897c0..4b2f807269e7 100644
@@ -6,6 +6,8 @@
 Opening and Closing Devices
 ***************************
 
+.. _v4l2_hardware_control:
+
 Types of V4L2 hardware control
 ==============================
 
@@ -33,6 +35,13 @@ For **vdev-centric** control, the device and their corresponding hardware
 pipelines are controlled via the **V4L2 device** node. They may optionally
 expose via the :ref:`media controller API <media_controller>`.
 
+.. note::
+
+   Devices that are **not** capable of **vdev-centric** hardware control
+   should report a ``V4L2_MC_CENTRIC`` :c:type:`v4l2_capability` flag
+   (see :ref:`VIDIOC_QUERYCAP`).
+
+
 For **MC-centric** control, before using the V4L2 device, it is required to
 set the hardware pipelines via the
 :ref:`media controller API <media_controller>`. For those devices, the
Documentation/media/uapi/v4l/vidioc-querycap.rst +5 -0
index 12e0d9a63cd8..299a53d66032 100644
@@ -252,6 +252,11 @@ specification the ioctl returns an ``EINVAL`` error code.
     * - ``V4L2_CAP_TOUCH``
       - 0x10000000
       - This is a touch device.
+    * - ``V4L2_MC_CENTRIC``
+      - 0x20000000
+      - Indicates that the device only provides **mc-centric** hardware
+        control, and can't be used by **v4l2-centric** applications.
+        See :ref:`v4l2_hardware_control` for more details.
     * - ``V4L2_CAP_DEVICE_CAPS``
       - 0x80000000
       - The driver fills the ``device_caps`` field. This capability can
include/uapi/linux/videodev2.h +2 -0
index 45cf7359822c..569eef0630ab 100644
@@ -460,6 +460,8 @@ struct v4l2_capability {
 
 #define V4L2_CAP_TOUCH                  0x10000000  /* Is a touch device */
 
+#define V4L2_CAP_MC_CENTRIC             0x20000000  /* Device can't be controlled via V4L2 device devnodes */
+
 #define V4L2_CAP_DEVICE_CAPS            0x80000000  /* sets device capabilities field */
 
 /*
#18 lore raw

Re: [PATCH 2/3] media: videodev2: add a flag for vdev-centric devices

Em Fri, 25 Aug 2017 08:30:37 -0300
Mauro Carvalho Chehab <[email protected]> escreveu:

Quoted 148 lines

Em Fri, 25 Aug 2017 08:15:03 -0300
Mauro Carvalho Chehab <[email protected]> escreveu:

Quoted 145 lines

Em Fri, 25 Aug 2017 12:56:30 +0200
Hans Verkuil <[email protected]> escreveu:

Quoted 129 lines · Mauro Carvalho Chehab
Quoted 128 lines

Em Fri, 25 Aug 2017 12:42:51 +0200
Hans Verkuil <[email protected]> escreveu:

Quoted 124 lines · Mauro Carvalho Chehab
Quoted 61 lines

Em Fri, 25 Aug 2017 12:13:53 +0200
Hans Verkuil <[email protected]> escreveu:

Quoted 50 lines · Mauro Carvalho Chehab
Quoted 49 lines

Em Fri, 25 Aug 2017 11:44:27 +0200
Hans Verkuil <[email protected]> escreveu:

Quoted 23 lines · Mauro Carvalho Chehab
Quoted 22 lines

From: Mauro Carvalho Chehab <[email protected]>

As both vdev-centric and mc-centric devices may implement the same APIs, we need a flag to allow userspace to distinguish between them.

---
 Documentation/media/uapi/v4l/open.rst            | 6 ++++++
 Documentation/media/uapi/v4l/vidioc-querycap.rst | 4 ++++
 include/uapi/linux/videodev2.h                   | 2 ++
 3 files changed, 12 insertions(+)
Documentation/media/uapi/v4l/open.rst +0 -0
index a72d142897c0..eb3f0ec57edb 100644
@@ -33,6 +33,12 @@ For **vdev-centric** control, the device and their corresponding hardware
 pipelines are controlled via the **V4L2 device** node. They may optionally
 expose via the :ref:`media controller API <media_controller>`.
 
Quoted 5 lines

Documentation/media/uapi/v4l/open.rst For **vdev-centric** control, the device and their corresponding hardware · line 38

Quoted 3 lines
Documentation/media/uapi/v4l/open.rst +3 -0
+.. note::
+
+   **vdev-centric** devices should report V4L2_VDEV_CENTERED          

You mean CENTRIC, not CENTERED.

Yeah, true. I'll fix it.

Quoted 3 lines

But I would change this to MC_CENTRIC: the vast majority of drivers are VDEV centric, so it makes a lot more sense to keep that as the default and only set the cap for MC-centric drivers.

I actually focused it on what an userspace application would do.

An specialized application for a given hardware will likely just ignore whatever flag is added, and use vdev, mc and subdev APIs as it pleases. So, those applications don't need any flag at all.

However, a generic application needs a flag to allow them to check if a given hardware can be controlled by the traditional way to control the device (e. g. if it accepts vdev-centric type of hardware control).

Quoted 7 lines
Quoted 2 lines

It is an old desire (since when MC was designed) to allow that generic V4L2 apps to also work with MC-centric hardware somehow.

No, not true. The desire is that they can use the MC to find the various device nodes (video, radio, vbi, rc, cec, ...). But they remain vdev-centric. vdev vs mc centric has nothing to do with the presence of the MC. It's how they are controlled.

Quoted 4 lines

No, that's not I'm talking about. I'm talking about libv4l plugin (or whatever) that would allow a generic app to work with a mc-centric device. That's there for a long time (since when we were reviewing the MC patches back in 2009 or 2010).

So? Such a plugin would obviously remove the MC_CENTRIC cap. Which makes perfect sense.

There are a lot of userspace applications that do not use libv4l. It's optional, not required, to use that library. We cannot design our API with the assumption that this library will be used.

Quoted 32 lines
Quoted 8 lines

Regarding userspace applications: they can't check for a VDEV_CENTRIC cap since we never had any. I.e., if they do:

	if (!(caps & VDEV_CENTRIC))
		/* unsupported device */
Quoted 8 lines

then they would fail for older kernels that do not set this flag.

But this works:

	if (caps & MC_CENTRIC)
		/* unsupported device */

So this really needs to be an MC_CENTRIC capability.

That won't work. The test should take into account the API version too.

Assuming that such flag would be added for version 4.15, with a VDEV_CENTRIC, the check would be:

/*
* There's no need to check version here: libv4l may override it
* to support a mc-centric device even for older versions of the
* Kernel
*/
if (caps & V4L2_CAP_VDEV_CENTRIC)
is_supported = true;

Quoted 8 lines

/*
* For API version lower than 4.15, there's no way to know for
* sure if the device is vdev-centric or not. So, either additional
* tests are needed, or it would assume vdev-centric and output
* some note about that.
*/
if (version < KERNEL_VERSION(4, 15, 0))
maybe_supported = true;

	is_supported = true;
	if (caps & V4L2_CAP_MC_CENTRIC)
		is_supported = false;
(quoted diff) +0 -0
 	if (version < KERNEL_VERSION(4, 15, 0))
 		maybe_supported = true;

I don't see the difference. BTW, no application will ever do that version check. It doesn't help them in any way to know that it 'may' be supported.

Quoted 6 lines
Quoted 3 lines

Yeah, this can work. The only drawback is that, if we end by implementing vdev compatible support is that such drivers will have to clean the V4L2_CAP_MC_CENTRIC flag.

You mean implementing vdev compatible support in libv4l? (Just making sure I understand you correctly)

Yes, either there or at the Kernel, as it seems we'll never have it there, as nobody is working on it anymore.

Quoted 2 lines

In that case it doesn't matter if the libv4l code would set the VDEV_CENTRIC flag or remove the MC_CENTRIC flag. That makes no difference, or course.

Quoted 7 lines
Quoted 2 lines

True, but the text will have to be clear that a MC_CENTRIC device is a device that can't be controlled by a V4L2-centric application.

Ok, that's the "reverse" patch. IMHO, it is very confusing, as we're actually using MC_CENTRIC to actually describe the lack of a capability.

Perhaps we should name it as NOT_VDEV_CENTRIC instead.

Hans suggested an alternative word at the IRC ("require"), with actually sounds better. Patch follows.

I can live it that :-)

Regards,
Mauro

-

media: videodev2: add a flag for vdev-centric devices

As both vdev-centric and mc-centric devices may implement the same APIs, we need a flag to allow userspace to distinguish between them.

Documentation/media/uapi/v4l/open.rst +9 -0
index a72d142897c0..4b344dccd2ac 100644
@@ -6,6 +6,8 @@
 Opening and Closing Devices
 ***************************
 
+.. _v4l2_hardware_control:
+
 Types of V4L2 hardware control
 ==============================
 
@@ -33,6 +35,13 @@ For **vdev-centric** control, the device and their corresponding hardware
 pipelines are controlled via the **V4L2 device** node. They may optionally
 expose via the :ref:`media controller API <media_controller>`.
 
+.. note::
+
+   Devices that require **mc-centric** hardware control should report
+   a ``V4L2_MC_CENTRIC`` :c:type:`v4l2_capability` flag
+   (see :ref:`VIDIOC_QUERYCAP`).
+
+
 For **MC-centric** control, before using the V4L2 device, it is required to
 set the hardware pipelines via the
 :ref:`media controller API <media_controller>`. For those devices, the
Documentation/media/uapi/v4l/vidioc-querycap.rst +5 -0
index 12e0d9a63cd8..2b08723375bc 100644
@@ -252,6 +252,11 @@ specification the ioctl returns an ``EINVAL`` error code.
     * - ``V4L2_CAP_TOUCH``
       - 0x10000000
       - This is a touch device.
+    * - ``V4L2_MC_CENTRIC``
+      - 0x20000000
+      - Indicates that the device require **mc-centric** hardware
+        control, and thus can't be used by **v4l2-centric** applications.
+        See :ref:`v4l2_hardware_control` for more details.
     * - ``V4L2_CAP_DEVICE_CAPS``
       - 0x80000000
       - The driver fills the ``device_caps`` field. This capability can
include/uapi/linux/videodev2.h +2 -0
index 45cf7359822c..7b490fe97980 100644
@@ -460,6 +460,8 @@ struct v4l2_capability {
 
 #define V4L2_CAP_TOUCH                  0x10000000  /* Is a touch device */
 
+#define V4L2_CAP_MC_CENTRIC             0x20000000  /* Device require mc-centric hardware control */
+
 #define V4L2_CAP_DEVICE_CAPS            0x80000000  /* sets device capabilities field */
 
 /*
Signature · 2 lines
Thanks,
Mauro
#19 lore raw

Re: [PATCH 2/3] media: videodev2: add a flag for vdev-centric devices

Quoted 191 lines · Mauro Carvalho Chehab

Em Fri, 25 Aug 2017 08:30:37 -0300
Mauro Carvalho Chehab <[email protected]> escreveu:

Quoted 148 lines

Em Fri, 25 Aug 2017 08:15:03 -0300
Mauro Carvalho Chehab <[email protected]> escreveu:

Quoted 145 lines

Em Fri, 25 Aug 2017 12:56:30 +0200
Hans Verkuil <[email protected]> escreveu:

Quoted 129 lines · Mauro Carvalho Chehab
Quoted 128 lines

Em Fri, 25 Aug 2017 12:42:51 +0200
Hans Verkuil <[email protected]> escreveu:

Quoted 124 lines · Mauro Carvalho Chehab
Quoted 61 lines

Em Fri, 25 Aug 2017 12:13:53 +0200
Hans Verkuil <[email protected]> escreveu:

Quoted 50 lines · Mauro Carvalho Chehab
Quoted 49 lines

Em Fri, 25 Aug 2017 11:44:27 +0200
Hans Verkuil <[email protected]> escreveu:

Quoted 23 lines · Mauro Carvalho Chehab
Quoted 22 lines

From: Mauro Carvalho Chehab <[email protected]>

As both vdev-centric and mc-centric devices may implement the same APIs, we need a flag to allow userspace to distinguish between them.

---
 Documentation/media/uapi/v4l/open.rst            | 6 ++++++
 Documentation/media/uapi/v4l/vidioc-querycap.rst | 4 ++++
 include/uapi/linux/videodev2.h                   | 2 ++
 3 files changed, 12 insertions(+)
Documentation/media/uapi/v4l/open.rst +0 -0
index a72d142897c0..eb3f0ec57edb 100644
@@ -33,6 +33,12 @@ For **vdev-centric** control, the device and their corresponding hardware
 pipelines are controlled via the **V4L2 device** node. They may optionally
 expose via the :ref:`media controller API <media_controller>`.
 
Quoted 5 lines

Documentation/media/uapi/v4l/open.rst For **vdev-centric** control, the device and their corresponding hardware

Quoted 3 lines
Documentation/media/uapi/v4l/open.rst +3 -0
+.. note::
+
+   **vdev-centric** devices should report V4L2_VDEV_CENTERED          

You mean CENTRIC, not CENTERED.

Yeah, true. I'll fix it.

Quoted 3 lines

But I would change this to MC_CENTRIC: the vast majority of drivers are VDEV centric, so it makes a lot more sense to keep that as the default and only set the cap for MC-centric drivers.

I actually focused it on what an userspace application would do.

An specialized application for a given hardware will likely just ignore whatever flag is added, and use vdev, mc and subdev APIs as it pleases. So, those applications don't need any flag at all.

However, a generic application needs a flag to allow them to check if a given hardware can be controlled by the traditional way to control the device (e. g. if it accepts vdev-centric type of hardware control).

Quoted 7 lines
Quoted 2 lines

It is an old desire (since when MC was designed) to allow that generic V4L2 apps to also work with MC-centric hardware somehow.

No, not true. The desire is that they can use the MC to find the various device nodes (video, radio, vbi, rc, cec, ...). But they remain vdev-centric. vdev vs mc centric has nothing to do with the presence of the MC. It's how they are controlled.

Quoted 4 lines

No, that's not I'm talking about. I'm talking about libv4l plugin (or whatever) that would allow a generic app to work with a mc-centric device. That's there for a long time (since when we were reviewing the MC patches back in 2009 or 2010).

So? Such a plugin would obviously remove the MC_CENTRIC cap. Which makes perfect sense.

There are a lot of userspace applications that do not use libv4l. It's optional, not required, to use that library. We cannot design our API with the assumption that this library will be used.

Quoted 32 lines
Quoted 8 lines

Regarding userspace applications: they can't check for a VDEV_CENTRIC cap since we never had any. I.e., if they do:

	if (!(caps & VDEV_CENTRIC))
		/* unsupported device */
Quoted 8 lines

then they would fail for older kernels that do not set this flag.

But this works:

	if (caps & MC_CENTRIC)
		/* unsupported device */

So this really needs to be an MC_CENTRIC capability.

That won't work. The test should take into account the API version too.

Assuming that such flag would be added for version 4.15, with a VDEV_CENTRIC, the check would be:

/*
* There's no need to check version here: libv4l may override it
* to support a mc-centric device even for older versions of the
* Kernel
*/
if (caps & V4L2_CAP_VDEV_CENTRIC)
is_supported = true;

Quoted 8 lines

/*
* For API version lower than 4.15, there's no way to know for
* sure if the device is vdev-centric or not. So, either additional
* tests are needed, or it would assume vdev-centric and output
* some note about that.
*/
if (version < KERNEL_VERSION(4, 15, 0))
maybe_supported = true;

	is_supported = true;
	if (caps & V4L2_CAP_MC_CENTRIC)
		is_supported = false;
(quoted diff) +0 -0
 	if (version < KERNEL_VERSION(4, 15, 0))
 		maybe_supported = true;

I don't see the difference. BTW, no application will ever do that version check. It doesn't help them in any way to know that it 'may' be supported.

Quoted 6 lines
Quoted 3 lines

Yeah, this can work. The only drawback is that, if we end by implementing vdev compatible support is that such drivers will have to clean the V4L2_CAP_MC_CENTRIC flag.

You mean implementing vdev compatible support in libv4l? (Just making sure I understand you correctly)

Yes, either there or at the Kernel, as it seems we'll never have it there, as nobody is working on it anymore.

Quoted 2 lines

In that case it doesn't matter if the libv4l code would set the VDEV_CENTRIC flag or remove the MC_CENTRIC flag. That makes no difference, or course.

Quoted 7 lines
Quoted 2 lines

True, but the text will have to be clear that a MC_CENTRIC device is a device that can't be controlled by a V4L2-centric application.

Ok, that's the "reverse" patch. IMHO, it is very confusing, as we're actually using MC_CENTRIC to actually describe the lack of a capability.

Perhaps we should name it as NOT_VDEV_CENTRIC instead.

Hans suggested an alternative word at the IRC ("require"), with actually sounds better. Patch follows.

I can live it that :-)

Regards,
Mauro

-

media: videodev2: add a flag for vdev-centric devices

As both vdev-centric and mc-centric devices may implement the same APIs, we need a flag to allow userspace to distinguish between them.

Documentation/media/uapi/v4l/open.rst +2 -0
index a72d142897c0..4b344dccd2ac 100644
@@ -6,6 +6,8 @@
 Opening and Closing Devices
 ***************************
 
+.. _v4l2_hardware_control:
+
 Types of V4L2 hardware control
 ==============================
 

Documentation/media/uapi/v4l/open.rst For **vdev-centric** control, the device and their corresponding hardware · line 40

Quoted 6 lines
Documentation/media/uapi/v4l/open.rst +3 -0
@@ -33,6 +35,13 @@ For **vdev-centric** control, the device and their corresponding hardware
 pipelines are controlled via the **V4L2 device** node. They may optionally
 expose via the :ref:`media controller API <media_controller>`.
 
+.. note::
+
+   Devices that require **mc-centric** hardware control should report

s/should/shall/

Shouldn't we use MC-centric? (i.e. capital MC) I think that's better.

Documentation/media/uapi/v4l/open.rst For **vdev-centric** control, the device and their corresponding hardware · line 41

Quoted 1 line
Documentation/media/uapi/v4l/open.rst +1 -0
+   a ``V4L2_MC_CENTRIC`` :c:type:`v4l2_capability` flag

s/a/the/

Quoted 11 lines
Documentation/media/uapi/v4l/open.rst +3 -0
+   (see :ref:`VIDIOC_QUERYCAP`).
+
+
 For **MC-centric** control, before using the V4L2 device, it is required to
 set the hardware pipelines via the
 :ref:`media controller API <media_controller>`. For those devices, the
Documentation/media/uapi/v4l/vidioc-querycap.rst +0 -0
index 12e0d9a63cd8..2b08723375bc 100644

Documentation/media/uapi/v4l/vidioc-querycap.rst specification the ioctl returns an ``EINVAL`` error code. · line 257

Quoted 6 lines
Documentation/media/uapi/v4l/vidioc-querycap.rst +3 -0
@@ -252,6 +252,11 @@ specification the ioctl returns an ``EINVAL`` error code.
     * - ``V4L2_CAP_TOUCH``
       - 0x10000000
       - This is a touch device.
+    * - ``V4L2_MC_CENTRIC``
+      - 0x20000000
+      - Indicates that the device require **mc-centric** hardware

requires

Documentation/media/uapi/v4l/vidioc-querycap.rst specification the ioctl returns an ``EINVAL`` error code. · line 258

Quoted 1 line
Documentation/media/uapi/v4l/vidioc-querycap.rst +1 -0
+        control, and thus can't be used by **v4l2-centric** applications.

So are we using V4L2-centric or vdev-centric? It seems to be mixed now. And if we use V4L2-centric then it should be capitals as well.

include/uapi/linux/videodev2.h struct v4l2_capability { · line 463

Quoted 13 lines
Documentation/media/uapi/v4l/vidioc-querycap.rst +1 -0
+        See :ref:`v4l2_hardware_control` for more details.
     * - ``V4L2_CAP_DEVICE_CAPS``
       - 0x80000000
       - The driver fills the ``device_caps`` field. This capability can
include/uapi/linux/videodev2.h +1 -0
index 45cf7359822c..7b490fe97980 100644
@@ -460,6 +460,8 @@ struct v4l2_capability {
 
 #define V4L2_CAP_TOUCH                  0x10000000  /* Is a touch device */
 
+#define V4L2_CAP_MC_CENTRIC             0x20000000  /* Device require mc-centric hardware control */

requires

include/uapi/linux/videodev2.h struct v4l2_capability { · line 467

Quoted 5 lines
include/uapi/linux/videodev2.h +1 -0
+
 #define V4L2_CAP_DEVICE_CAPS            0x80000000  /* sets device capabilities field */
 
 /*

This is getting close. Can you post the whole patch series for the next revision? It's a bit hard to review with patches in replies.

Regards,

Hans

maintainer
#20 lore raw

Re: [PATCH 2/3] media: videodev2: add a flag for vdev-centric devices

In reply to Mauro Carvalho Chehab

Hi Mauro,

Quoted 54 lines · On Friday, 25 August 2017 13:06:32 EEST Mauro Carvalho Chehab wrote:

Em Fri, 25 Aug 2017 11:44:27 +0200 Hans Verkuil escreveu:

Quoted 27 lines · Mauro Carvalho Chehab
Quoted 26 lines

From: Mauro Carvalho Chehab <[email protected]>

As both vdev-centric and mc-centric devices may implement the same APIs, we need a flag to allow userspace to distinguish between them.

---

 Documentation/media/uapi/v4l/open.rst            | 6 ++++++
 Documentation/media/uapi/v4l/vidioc-querycap.rst | 4 ++++
 include/uapi/linux/videodev2.h                   | 2 ++
 3 files changed, 12 insertions(+)
(quoted diff) +0 -0

b/Documentation/media/uapi/v4l/open.rst index
a72d142897c0..eb3f0ec57edb 100644

Documentation/media/uapi/v4l/open.rst +0 -0
@@ -33,6 +33,12 @@ For **vdev-centric** control, the device and their

corresponding hardware> >
pipelines are controlled via the **V4L2 device** node. They may optionally
expose via the :ref:media controller API <media_controller>.

Quoted 5 lines

Documentation/media/uapi/v4l/open.rst For **vdev-centric** control, the device and their corresponding hardware · line 38

Quoted 3 lines

+.. note::

Documentation/media/uapi/v4l/open.rst +2 -0
+
+   **vdev-centric** devices should report V4L2_VDEV_CENTERED

You mean CENTRIC, not CENTERED.

Yeah, true. I'll fix it.

Quoted 3 lines

But I would change this to MC_CENTRIC: the vast majority of drivers are VDEV centric, so it makes a lot more sense to keep that as the default and only set the cap for MC-centric drivers.

I actually focused it on what an userspace application would do.

An specialized application for a given hardware will likely just ignore whatever flag is added, and use vdev, mc and subdev APIs as it pleases. So, those applications don't need any flag at all.

However, a generic application needs a flag to allow them to check if a given hardware can be controlled by the traditional way to control the device (e. g. if it accepts vdev-centric type of hardware control).

It is an old desire (since when MC was designed) to allow that generic V4L2 apps to also work with MC-centric hardware somehow.

Quoted 8 lines

At the moment we add that (either in Kernelspace, as proposed for iMX6 [1] or via libv4l), a mc-centric hardware can also be vdev-centric.

[1] one alternative proposed for iMX6 driver, would be to enable vdev-centric control only for hardware with a single camera slot, like those cheap RPi3-camera compatible hardware, by using some info at the DT.

DT isn't the right place for this, it should describe the hardware, not how it gets exposed by the kernel to userspace. It could be up to each device driver to decide, based on the complexity of the hardware as defined in DT, whether to expose a vdev-centric or MC-centric API, but I wouldn't recommend that as it would drasticly increase the complexity of the driver.

Quoted 41 lines
Quoted 41 lines
Quoted 41 lines
Documentation/media/uapi/v4l/open.rst +3 -0
+   :c:type:`v4l2_capability` flag (see :ref:`VIDIOC_QUERYCAP`).
+
+
 For **MC-centric** control, before using the V4L2 device, it is
 required to set the hardware pipelines via the
 :ref:`media controller API <media_controller>`. For those devices, the
(quoted diff) +0 -0

b/Documentation/media/uapi/v4l/vidioc-querycap.rst index 12e0d9a63cd8..4856821b7608 100644

Documentation/media/uapi/v4l/vidioc-querycap.rst +0 -0
@@ -252,6 +252,10 @@ specification the ioctl returns an ``EINVAL`` error

code.
* - ``V4L2_CAP_TOUCH``
- 0x10000000
- This is a touch device.

Documentation/media/uapi/v4l/vidioc-querycap.rst +4 -0
+    * - ``V4L2_VDEV_CENTERED``
+      - 0x20000000
+      - This is controlled via V4L2 device nodes (radio, video, vbi,
+        sdr
     * - ``V4L2_CAP_DEVICE_CAPS``
       - 0x80000000
       - The driver fills the ``device_caps`` field. This capability can
(quoted diff) +0 -0

b/include/uapi/linux/videodev2.h index 45cf7359822c..d89090d99042 100644

include/uapi/linux/videodev2.h +1 -0
@@ -460,6 +460,8 @@ struct v4l2_capability {
 
 #define V4L2_CAP_TOUCH                  0x10000000  /* Is a touch
 device */
 
+#define V4L2_CAP_VDEV_CENTERED          0x20000000  /* V4L2 Device is

controlled via V4L2 device devnode */ +

#define V4L2_CAP_DEVICE_CAPS 0x80000000 /* sets device
capabilities field */

/*

Signature · 3 lines
Regards,

Laurent Pinchart
#21 lore raw

PATCH 3/3 media: add V4L2_CAP_VDEV_CENTERED flag on vdev-centric drivers

In reply to Mauro Carvalho Chehab

From: Mauro Carvalho Chehab <[email protected]>

Those devices are controlled via their V4L2 device. Add a flag to indicate them as such.

---
 drivers/media/pci/bt8xx/bttv-driver.c          |  4 +++-
 drivers/media/pci/cobalt/cobalt-v4l2.c         |  3 ++-
 drivers/media/pci/cx18/cx18-ioctl.c            |  4 ++--
 drivers/media/pci/cx23885/cx23885-417.c        |  2 +-
 drivers/media/pci/cx23885/cx23885-video.c      |  3 ++-
 drivers/media/pci/cx25821/cx25821-video.c      |  6 ++++--
 drivers/media/pci/cx88/cx88-video.c            |  3 ++-
 drivers/media/pci/dt3155/dt3155.c              |  3 ++-
 drivers/media/pci/ivtv/ivtv-ioctl.c            |  5 +++--
 drivers/media/pci/meye/meye.c                  |  2 +-
 drivers/media/pci/saa7134/saa7134-video.c      |  3 ++-
 drivers/media/pci/saa7164/saa7164-encoder.c    |  3 ++-
 drivers/media/pci/saa7164/saa7164-vbi.c        |  3 ++-
 drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c |  3 ++-
 drivers/media/pci/solo6x10/solo6x10-v4l2.c     |  3 ++-
 drivers/media/pci/sta2x11/sta2x11_vip.c        |  3 ++-
 drivers/media/pci/tw5864/tw5864-video.c        |  2 +-
 drivers/media/pci/tw68/tw68-video.c            |  3 ++-
 drivers/media/pci/tw686x/tw686x-video.c        |  2 +-
 drivers/media/pci/zoran/zoran_driver.c         |  3 ++-
 drivers/media/platform/rcar_drif.c             |  3 ++-
 drivers/media/platform/vivid/vivid-core.c      |  2 +-
 drivers/media/usb/airspy/airspy.c              |  3 ++-
 drivers/media/usb/au0828/au0828-video.c        |  3 ++-
 drivers/media/usb/cpia2/cpia2_v4l.c            |  5 +++--
 drivers/media/usb/cx231xx/cx231xx-video.c      |  5 +++--
 drivers/media/usb/em28xx/em28xx-video.c        | 11 +++++++----
 drivers/media/usb/go7007/go7007-v4l2.c         |  2 +-
 drivers/media/usb/gspca/gspca.c                |  3 ++-
 drivers/media/usb/hackrf/hackrf.c              |  8 +++++---
 drivers/media/usb/hdpvr/hdpvr-video.c          |  2 +-
 drivers/media/usb/msi2500/msi2500.c            |  3 ++-
 drivers/media/usb/pvrusb2/pvrusb2-v4l2.c       |  6 ++++--
 drivers/media/usb/pwc/pwc-v4l.c                |  2 +-
 drivers/media/usb/s2255/s2255drv.c             |  2 +-
 drivers/media/usb/stk1160/stk1160-v4l.c        |  3 ++-
 drivers/media/usb/stkwebcam/stk-webcam.c       |  3 ++-
 drivers/media/usb/tm6000/tm6000-video.c        |  5 +++--
 drivers/media/usb/usbtv/usbtv-video.c          |  2 +-
 drivers/media/usb/usbvision/usbvision-video.c  |  5 +++--
 drivers/media/usb/uvc/uvc_v4l2.c               |  8 +++++---
 drivers/media/usb/zr364xx/zr364xx.c            |  5 +++--
 42 files changed, 96 insertions(+), 58 deletions(-)
drivers/media/pci/bt8xx/bttv-driver.c +3 -1
index 40110be4e986..382cc76b954b 100644
@@ -2481,6 +2481,7 @@ static int bttv_querycap(struct file *file, void  *priv,
 		V4L2_CAP_VIDEO_CAPTURE |
 		V4L2_CAP_READWRITE |
 		V4L2_CAP_STREAMING |
+		V4L2_CAP_VDEV_CENTERED |
 		V4L2_CAP_DEVICE_CAPS;
 	if (no_overlay <= 0)
 		cap->capabilities |= V4L2_CAP_VIDEO_OVERLAY;
@@ -2511,7 +2512,8 @@ static int bttv_querycap(struct file *file, void  *priv,
 			 V4L2_CAP_STREAMING |
 			 V4L2_CAP_TUNER);
 	else {
-		cap->device_caps = V4L2_CAP_RADIO | V4L2_CAP_TUNER;
+		cap->device_caps = V4L2_CAP_RADIO | V4L2_CAP_TUNER |
+				   V4L2_CAP_VDEV_CENTERED;
 		if (btv->has_saa6588)
 			cap->device_caps |= V4L2_CAP_READWRITE |
 						V4L2_CAP_RDS_CAPTURE;
drivers/media/pci/cobalt/cobalt-v4l2.c +2 -1
index def4a3b37084..803a9cf09a9f 100644
@@ -495,7 +495,8 @@ static int cobalt_querycap(struct file *file, void *priv_fh,
 	strlcpy(vcap->card, "cobalt", sizeof(vcap->card));
 	snprintf(vcap->bus_info, sizeof(vcap->bus_info),
 		 "PCIe:%s", pci_name(cobalt->pci_dev));
-	vcap->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_READWRITE;
+	vcap->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_READWRITE |
+			    V4L2_CAP_VDEV_CENTERED;
 	if (s->is_output)
 		vcap->device_caps |= V4L2_CAP_VIDEO_OUTPUT;
 	else
drivers/media/pci/cx18/cx18-ioctl.c +2 -2
index 80b902b12a78..3e258fdc6685 100644
@@ -402,8 +402,8 @@ static int cx18_querycap(struct file *file, void *fh,
 	snprintf(vcap->bus_info, sizeof(vcap->bus_info),
 		 "PCI:%s", pci_name(cx->pci_dev));
 	vcap->capabilities = cx->v4l2_cap;	/* capabilities */
-	vcap->device_caps = s->v4l2_dev_caps;	/* device capabilities */
-	vcap->capabilities |= V4L2_CAP_DEVICE_CAPS;
+	vcap->device_caps = V4L2_CAP_VDEV_CENTERED | s->v4l2_dev_caps;	/* device capabilities */
+	vcap->capabilities |= V4L2_CAP_DEVICE_CAPS | V4L2_CAP_VDEV_CENTERED;
 	return 0;
 }
 
drivers/media/pci/cx23885/cx23885-417.c +1 -1
index a71f3c7569ce..69a35e8ee894 100644
@@ -1334,7 +1334,7 @@ static int vidioc_querycap(struct file *file, void  *priv,
 		sizeof(cap->card));
 	sprintf(cap->bus_info, "PCIe:%s", pci_name(dev->pci));
 	cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
-			   V4L2_CAP_STREAMING;
+			   V4L2_CAP_STREAMING | V4L2_CAP_VDEV_CENTERED;
 	if (dev->tuner_type != TUNER_ABSENT)
 		cap->device_caps |= V4L2_CAP_TUNER;
 	cap->capabilities = cap->device_caps | V4L2_CAP_VBI_CAPTURE |
drivers/media/pci/cx23885/cx23885-video.c +2 -1
index ecc580af0148..073c4201de34 100644
@@ -642,7 +642,8 @@ static int vidioc_querycap(struct file *file, void  *priv,
 	strlcpy(cap->card, cx23885_boards[dev->board].name,
 		sizeof(cap->card));
 	sprintf(cap->bus_info, "PCIe:%s", pci_name(dev->pci));
-	cap->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING | V4L2_CAP_AUDIO;
+	cap->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING |
+			   V4L2_CAP_AUDIO | V4L2_CAP_VDEV_CENTERED;
 	if (dev->tuner_type != TUNER_ABSENT)
 		cap->device_caps |= V4L2_CAP_TUNER;
 	if (vdev->vfl_type == VFL_TYPE_VBI)
drivers/media/pci/cx25821/cx25821-video.c +4 -2
index dbaf42ec26cd..6356f823bac2 100644
@@ -438,8 +438,10 @@ static int cx25821_vidioc_querycap(struct file *file, void *priv,
 	struct cx25821_channel *chan = video_drvdata(file);
 	struct cx25821_dev *dev = chan->dev;
 	const u32 cap_input = V4L2_CAP_VIDEO_CAPTURE |
-			V4L2_CAP_READWRITE | V4L2_CAP_STREAMING;
-	const u32 cap_output = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_READWRITE;
+			      V4L2_CAP_READWRITE | V4L2_CAP_STREAMING |
+			      V4L2_CAP_VDEV_CENTERED;
+	const u32 cap_output = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_READWRITE |
+			       V4L2_CAP_VDEV_CENTERED;
 
 	strcpy(cap->driver, "cx25821");
 	strlcpy(cap->card, cx25821_boards[dev->board].name, sizeof(cap->card));
drivers/media/pci/cx88/cx88-video.c +2 -1
index 7d25ecd4404b..51fa90f56a3e 100644
@@ -812,7 +812,8 @@ void cx88_querycap(struct file *file, struct cx88_core *core,
 	struct video_device *vdev = video_devdata(file);
 
 	strlcpy(cap->card, core->board.name, sizeof(cap->card));
-	cap->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING;
+	cap->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING |
+			   V4L2_CAP_VDEV_CENTERED;
 	if (core->board.tuner_type != UNSET)
 		cap->device_caps |= V4L2_CAP_TUNER;
 	switch (vdev->vfl_type) {
drivers/media/pci/dt3155/dt3155.c +2 -1
index 6a219694b225..77771e070338 100644
@@ -311,7 +311,8 @@ static int dt3155_querycap(struct file *filp, void *p,
 	strcpy(cap->card, DT3155_NAME " frame grabber");
 	sprintf(cap->bus_info, "PCI:%s", pci_name(pd->pdev));
 	cap->device_caps = V4L2_CAP_VIDEO_CAPTURE |
-		V4L2_CAP_STREAMING | V4L2_CAP_READWRITE;
+			   V4L2_CAP_STREAMING | V4L2_CAP_READWRITE |
+			   V4L2_CAP_VDEV_CENTERED;
 	cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
 	return 0;
 }
drivers/media/pci/ivtv/ivtv-ioctl.c +3 -2
index 670462d195b5..d8d25f4ccac7 100644
@@ -750,8 +750,9 @@ static int ivtv_querycap(struct file *file, void *fh, struct v4l2_capability *vc
 	strlcpy(vcap->driver, IVTV_DRIVER_NAME, sizeof(vcap->driver));
 	strlcpy(vcap->card, itv->card_name, sizeof(vcap->card));
 	snprintf(vcap->bus_info, sizeof(vcap->bus_info), "PCI:%s", pci_name(itv->pdev));
-	vcap->capabilities = itv->v4l2_cap | V4L2_CAP_DEVICE_CAPS;
-	vcap->device_caps = s->caps;
+	vcap->capabilities = itv->v4l2_cap | V4L2_CAP_VDEV_CENTERED
+			     | V4L2_CAP_DEVICE_CAPS;
+	vcap->device_caps = s->caps | V4L2_CAP_VDEV_CENTERED;
 	if ((s->caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY) &&
 	    !itv->osd_video_pbase) {
 		vcap->capabilities &= ~V4L2_CAP_VIDEO_OUTPUT_OVERLAY;
drivers/media/pci/meye/meye.c +1 -1
index 0fe76bea2393..d13723c9af2c 100644
@@ -1024,7 +1024,7 @@ static int vidioc_querycap(struct file *file, void *fh,
 	sprintf(cap->bus_info, "PCI:%s", pci_name(meye.mchip_dev));
 
 	cap->device_caps = V4L2_CAP_VIDEO_CAPTURE |
-			    V4L2_CAP_STREAMING;
+			   V4L2_CAP_STREAMING | V4L2_CAP_VDEV_CENTERED;
 	cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
 
 	return 0;
drivers/media/pci/saa7134/saa7134-video.c +2 -1
index 51d42bbf969e..4b7449622db1 100644
@@ -1507,7 +1507,8 @@ int saa7134_querycap(struct file *file, void *priv,
 		sizeof(cap->card));
 	sprintf(cap->bus_info, "PCI:%s", pci_name(dev->pci));
 
-	cap->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING;
+	cap->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING
+			   | V4L2_CAP_VDEV_CENTERED;
 	if ((tuner_type != TUNER_ABSENT) && (tuner_type != UNSET))
 		cap->device_caps |= V4L2_CAP_TUNER;
 
drivers/media/pci/saa7164/saa7164-encoder.c +2 -1
index f21c245a54f7..fa6e63607868 100644
@@ -505,7 +505,8 @@ static int vidioc_querycap(struct file *file, void  *priv,
 	cap->device_caps =
 		V4L2_CAP_VIDEO_CAPTURE |
 		V4L2_CAP_READWRITE |
-		V4L2_CAP_TUNER;
+		V4L2_CAP_TUNER |
+		V4L2_CAP_VDEV_CENTERED;
 
 	cap->capabilities = cap->device_caps |
 		V4L2_CAP_VBI_CAPTURE |
drivers/media/pci/saa7164/saa7164-vbi.c +2 -1
index 9255d7d23947..a86e1fcfc792 100644
@@ -216,7 +216,8 @@ static int vidioc_querycap(struct file *file, void  *priv,
 	cap->device_caps =
 		V4L2_CAP_VBI_CAPTURE |
 		V4L2_CAP_READWRITE |
-		V4L2_CAP_TUNER;
+		V4L2_CAP_TUNER |
+		V4L2_CAP_VDEV_CENTERED;
 
 	cap->capabilities = cap->device_caps |
 		V4L2_CAP_VIDEO_CAPTURE |
drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c +2 -1
index 25f9f2ebff1d..dce9ee5086c7 100644
@@ -781,7 +781,8 @@ static int solo_enc_querycap(struct file *file, void  *priv,
 	snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s",
 		 pci_name(solo_dev->pdev));
 	cap->device_caps = V4L2_CAP_VIDEO_CAPTURE |
-			V4L2_CAP_READWRITE | V4L2_CAP_STREAMING;
+			   V4L2_CAP_READWRITE | V4L2_CAP_STREAMING |
+			   V4L2_CAP_VDEV_CENTERED;
 	cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
 	return 0;
 }
drivers/media/pci/solo6x10/solo6x10-v4l2.c +2 -1
index 3266fc21825f..b832e607e0fd 100644
@@ -388,7 +388,8 @@ static int solo_querycap(struct file *file, void  *priv,
 	snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s",
 		 pci_name(solo_dev->pdev));
 	cap->device_caps = V4L2_CAP_VIDEO_CAPTURE |
-			V4L2_CAP_READWRITE | V4L2_CAP_STREAMING;
+			   V4L2_CAP_READWRITE | V4L2_CAP_STREAMING |
+			   V4L2_CAP_VDEV_CENTERED;
 	cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
 	return 0;
 }
drivers/media/pci/sta2x11/sta2x11_vip.c +2 -1
index 6343d24eb1d5..37badd722d94 100644
@@ -419,7 +419,8 @@ static int vidioc_querycap(struct file *file, void *priv,
 	snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s",
 		 pci_name(vip->pdev));
 	cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
-			   V4L2_CAP_STREAMING;
+			   V4L2_CAP_STREAMING |
+			   V4L2_CAP_VDEV_CENTERED;
 	cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
 
 	return 0;
drivers/media/pci/tw5864/tw5864-video.c +1 -1
index e7bd2b8484e3..2cb94183de82 100644
@@ -930,7 +930,7 @@ static const struct video_device tw5864_video_template = {
 	.release = video_device_release_empty,
 	.tvnorms = TW5864_NORMS,
 	.device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
-		V4L2_CAP_STREAMING,
+		       V4L2_CAP_STREAMING | V4L2_CAP_VDEV_CENTERED,
 };
 
 /* Motion Detection Threshold matrix */
drivers/media/pci/tw68/tw68-video.c +2 -1
index 58c4dd75bfa1..8b9645e67703 100644
@@ -741,7 +741,8 @@ static int tw68_querycap(struct file *file, void  *priv,
 	cap->device_caps =
 		V4L2_CAP_VIDEO_CAPTURE |
 		V4L2_CAP_READWRITE |
-		V4L2_CAP_STREAMING;
+		V4L2_CAP_STREAMING |
+		V4L2_CAP_VDEV_CENTERED;
 
 	cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
 	return 0;
drivers/media/pci/tw686x/tw686x-video.c +1 -1
index c3fafa97b2d0..1915cf3365ee 100644
@@ -770,7 +770,7 @@ static int tw686x_querycap(struct file *file, void *priv,
 	snprintf(cap->bus_info, sizeof(cap->bus_info),
 		 "PCI:%s", pci_name(dev->pci_dev));
 	cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING |
-			   V4L2_CAP_READWRITE;
+			   V4L2_CAP_READWRITE | V4L2_CAP_VDEV_CENTERED;
 	cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
 	return 0;
 }
drivers/media/pci/zoran/zoran_driver.c +2 -1
index a11cb501c550..9d9725aec8fb 100644
@@ -1514,7 +1514,8 @@ static int zoran_querycap(struct file *file, void *__fh, struct v4l2_capability
 	snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s",
 		 pci_name(zr->pci_dev));
 	cap->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_CAPTURE |
-			   V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_VIDEO_OVERLAY;
+			   V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_VIDEO_OVERLAY |
+			   V4L2_CAP_VDEV_CENTERED;
 	cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
 	return 0;
 }
drivers/media/platform/rcar_drif.c +2 -1
index 522364ff0d5d..2faba25dec8e 100644
@@ -1079,7 +1079,8 @@ static int rcar_drif_sdr_register(struct rcar_drif_sdr *sdr)
 	sdr->vdev->ctrl_handler = &sdr->ctrl_hdl;
 	sdr->vdev->v4l2_dev = &sdr->v4l2_dev;
 	sdr->vdev->device_caps = V4L2_CAP_SDR_CAPTURE | V4L2_CAP_TUNER |
-		V4L2_CAP_STREAMING | V4L2_CAP_READWRITE;
+				 V4L2_CAP_STREAMING | V4L2_CAP_READWRITE |
+				 V4L2_CAP_VDEV_CENTERED;
 	video_set_drvdata(sdr->vdev, sdr);
 
 	/* Register V4L2 SDR device */
drivers/media/platform/vivid/vivid-core.c +1 -1
index ef344b9a48af..2286b3088e5f 100644
@@ -1172,7 +1172,7 @@ static int vivid_create_instance(struct platform_device *pdev, int inst)
 			 "vivid-%03d-vid-cap", inst);
 		vfd->fops = &vivid_fops;
 		vfd->ioctl_ops = &vivid_ioctl_ops;
-		vfd->device_caps = dev->vid_cap_caps;
+		vfd->device_caps = dev->vid_cap_caps | V4L2_CAP_VDEV_CENTERED;
 		vfd->release = video_device_release_empty;
 		vfd->v4l2_dev = &dev->v4l2_dev;
 		vfd->queue = &dev->vb_vid_cap_q;
drivers/media/usb/airspy/airspy.c +2 -1
index 07f3f4e7144a..ab8ff78d2088 100644
@@ -623,7 +623,8 @@ static int airspy_querycap(struct file *file, void *fh,
 	strlcpy(cap->card, s->vdev.name, sizeof(cap->card));
 	usb_make_path(s->udev, cap->bus_info, sizeof(cap->bus_info));
 	cap->device_caps = V4L2_CAP_SDR_CAPTURE | V4L2_CAP_STREAMING |
-			V4L2_CAP_READWRITE | V4L2_CAP_TUNER;
+			   V4L2_CAP_READWRITE | V4L2_CAP_TUNER |
+			   V4L2_CAP_VDEV_CENTERED;
 	cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
 
 	return 0;
drivers/media/usb/au0828/au0828-video.c +2 -1
index 9342402b92f7..b5e53f8252b4 100644
@@ -1199,7 +1199,8 @@ static int vidioc_querycap(struct file *file, void  *priv,
 	cap->device_caps = V4L2_CAP_AUDIO |
 		V4L2_CAP_READWRITE |
 		V4L2_CAP_STREAMING |
-		V4L2_CAP_TUNER;
+		V4L2_CAP_TUNER |
+		V4L2_CAP_VDEV_CENTERED;
 	if (vdev->vfl_type == VFL_TYPE_GRABBER)
 		cap->device_caps |= V4L2_CAP_VIDEO_CAPTURE;
 	else
drivers/media/usb/cpia2/cpia2_v4l.c +3 -2
index 7122023e7004..b73f44f31253 100644
@@ -261,8 +261,9 @@ static int cpia2_querycap(struct file *file, void *fh, struct v4l2_capability *v
 		memset(vc->bus_info,0, sizeof(vc->bus_info));
 
 	vc->device_caps = V4L2_CAP_VIDEO_CAPTURE |
-			   V4L2_CAP_READWRITE |
-			   V4L2_CAP_STREAMING;
+			  V4L2_CAP_READWRITE |
+			  V4L2_CAP_STREAMING |
+			  V4L2_CAP_VDEV_CENTERED;
 	vc->capabilities = vc->device_caps |
 			   V4L2_CAP_DEVICE_CAPS;
 
drivers/media/usb/cx231xx/cx231xx-video.c +3 -2
index 179b8481a870..2255a8135337 100644
@@ -1558,9 +1558,10 @@ int cx231xx_querycap(struct file *file, void *priv,
 	usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info));
 
 	if (vdev->vfl_type == VFL_TYPE_RADIO)
-		cap->device_caps = V4L2_CAP_RADIO;
+		cap->device_caps = V4L2_CAP_RADIO | V4L2_CAP_VDEV_CENTERED;
 	else {
-		cap->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING;
+		cap->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING
+				   | V4L2_CAP_VDEV_CENTERED;
 		if (vdev->vfl_type == VFL_TYPE_VBI)
 			cap->device_caps |= V4L2_CAP_VBI_CAPTURE;
 		else
drivers/media/usb/em28xx/em28xx-video.c +7 -4
index 8d253a5df0a9..7b3026dbfa71 100644
@@ -1872,11 +1872,13 @@ static int vidioc_querycap(struct file *file, void  *priv,
 
 	if (vdev->vfl_type == VFL_TYPE_GRABBER)
 		cap->device_caps = V4L2_CAP_READWRITE |
-			V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
+			 	   V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING |
+				   V4L2_CAP_VDEV_CENTERED;
 	else if (vdev->vfl_type == VFL_TYPE_RADIO)
-		cap->device_caps = V4L2_CAP_RADIO;
+		cap->device_caps = V4L2_CAP_RADIO | V4L2_CAP_VDEV_CENTERED;
 	else
-		cap->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_VBI_CAPTURE;
+		cap->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_VBI_CAPTURE |
+				   V4L2_CAP_VDEV_CENTERED;
 
 	if (dev->int_audio_type != EM28XX_INT_AUDIO_NONE)
 		cap->device_caps |= V4L2_CAP_AUDIO;
@@ -1885,7 +1887,8 @@ static int vidioc_querycap(struct file *file, void  *priv,
 		cap->device_caps |= V4L2_CAP_TUNER;
 
 	cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS |
-		V4L2_CAP_READWRITE | V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
+			    V4L2_CAP_READWRITE | V4L2_CAP_VIDEO_CAPTURE |
+			    V4L2_CAP_STREAMING;
 	if (video_is_registered(&v4l2->vbi_dev))
 		cap->capabilities |= V4L2_CAP_VBI_CAPTURE;
 	if (video_is_registered(&v4l2->radio_dev))
drivers/media/usb/go7007/go7007-v4l2.c +1 -1
index 445f17b850c5..fa3f3508844f 100644
@@ -289,7 +289,7 @@ static int vidioc_querycap(struct file *file, void  *priv,
 	strlcpy(cap->bus_info, go->bus_info, sizeof(cap->bus_info));
 
 	cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
-				V4L2_CAP_STREAMING;
+			   V4L2_CAP_STREAMING | V4L2_CAP_VDEV_CENTERED;
 
 	if (go->board_info->num_aud_inputs)
 		cap->device_caps |= V4L2_CAP_AUDIO;
drivers/media/usb/gspca/gspca.c +2 -1
index 0f141762abf1..30813741e706 100644
@@ -1345,7 +1345,8 @@ static int vidioc_querycap(struct file *file, void  *priv,
 			sizeof(cap->bus_info));
 	cap->device_caps = V4L2_CAP_VIDEO_CAPTURE
 			  | V4L2_CAP_STREAMING
-			  | V4L2_CAP_READWRITE;
+			  | V4L2_CAP_READWRITE
+			  | V4L2_CAP_VDEV_CENTERED;
 	cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
 	return 0;
 }
drivers/media/usb/hackrf/hackrf.c +5 -3
index a41b305c55d4..1a0905651450 100644
@@ -911,16 +911,18 @@ static int hackrf_querycap(struct file *file, void *fh,
 
 	if (vdev->vfl_dir == VFL_DIR_RX)
 		cap->device_caps = V4L2_CAP_SDR_CAPTURE | V4L2_CAP_TUNER |
-				   V4L2_CAP_STREAMING | V4L2_CAP_READWRITE;
+				   V4L2_CAP_STREAMING | V4L2_CAP_READWRITE |
+				   V4L2_CAP_VDEV_CENTERED;
 
 	else
 		cap->device_caps = V4L2_CAP_SDR_OUTPUT | V4L2_CAP_MODULATOR |
-				   V4L2_CAP_STREAMING | V4L2_CAP_READWRITE;
+				   V4L2_CAP_STREAMING | V4L2_CAP_READWRITE |
+				   V4L2_CAP_VDEV_CENTERED;
 
 	cap->capabilities = V4L2_CAP_SDR_CAPTURE | V4L2_CAP_TUNER |
 			    V4L2_CAP_SDR_OUTPUT | V4L2_CAP_MODULATOR |
 			    V4L2_CAP_STREAMING | V4L2_CAP_READWRITE |
-			    V4L2_CAP_DEVICE_CAPS;
+			    V4L2_CAP_VDEV_CENTERED | V4L2_CAP_DEVICE_CAPS;
 	strlcpy(cap->driver, KBUILD_MODNAME, sizeof(cap->driver));
 	strlcpy(cap->card, dev->rx_vdev.name, sizeof(cap->card));
 	usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info));
drivers/media/usb/hdpvr/hdpvr-video.c +1 -1
index 7fb036d6a86e..8ee4f78ada94 100644
@@ -582,7 +582,7 @@ static int vidioc_querycap(struct file *file, void  *priv,
 	strcpy(cap->card, "Hauppauge HD PVR");
 	usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info));
 	cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_AUDIO |
-			    V4L2_CAP_READWRITE;
+			    V4L2_CAP_READWRITE | V4L2_CAP_VDEV_CENTERED;
 	cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
 	return 0;
 }
drivers/media/usb/msi2500/msi2500.c +2 -1
index 79bfd2dbe649..2c5f65a994e2 100644
@@ -608,7 +608,8 @@ static int msi2500_querycap(struct file *file, void *fh,
 	strlcpy(cap->card, dev->vdev.name, sizeof(cap->card));
 	usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info));
 	cap->device_caps = V4L2_CAP_SDR_CAPTURE | V4L2_CAP_STREAMING |
-			V4L2_CAP_READWRITE | V4L2_CAP_TUNER;
+			   V4L2_CAP_READWRITE | V4L2_CAP_TUNER |
+			   V4L2_CAP_VDEV_CENTERED;
 	cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
 	return 0;
 }
drivers/media/usb/pvrusb2/pvrusb2-v4l2.c +4 -2
index 8f13c60198ed..debc99b5f179 100644
@@ -145,7 +145,8 @@ static int pvr2_querycap(struct file *file, void *priv, struct v4l2_capability *
 	strlcpy(cap->card, pvr2_hdw_get_desc(hdw), sizeof(cap->card));
 	cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_TUNER |
 			    V4L2_CAP_AUDIO | V4L2_CAP_RADIO |
-			    V4L2_CAP_READWRITE | V4L2_CAP_DEVICE_CAPS;
+			    V4L2_CAP_READWRITE | V4L2_CAP_VDEV_CENTERED |
+			    V4L2_CAP_DEVICE_CAPS;
 	switch (fh->pdi->devbase.vfl_type) {
 	case VFL_TYPE_GRABBER:
 		cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_AUDIO;
@@ -154,7 +155,8 @@ static int pvr2_querycap(struct file *file, void *priv, struct v4l2_capability *
 		cap->device_caps = V4L2_CAP_RADIO;
 		break;
 	}
-	cap->device_caps |= V4L2_CAP_TUNER | V4L2_CAP_READWRITE;
+	cap->device_caps |= V4L2_CAP_TUNER | V4L2_CAP_READWRITE |
+			    V4L2_CAP_VDEV_CENTERED;
 	return 0;
 }
 
drivers/media/usb/pwc/pwc-v4l.c +1 -1
index 043b2b97cee6..3066ca5ff21e 100644
@@ -496,7 +496,7 @@ static int pwc_querycap(struct file *file, void *fh, struct v4l2_capability *cap
 	strlcpy(cap->card, pdev->vdev.name, sizeof(cap->card));
 	usb_make_path(pdev->udev, cap->bus_info, sizeof(cap->bus_info));
 	cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING |
-					V4L2_CAP_READWRITE;
+			   V4L2_CAP_READWRITE | V4L2_CAP_VDEV_CENTERED;
 	cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
 	return 0;
 }
drivers/media/usb/s2255/s2255drv.c +1 -1
index 23f606e7cd73..a82b7df0e271 100644
@@ -733,7 +733,7 @@ static int vidioc_querycap(struct file *file, void *priv,
 	strlcpy(cap->card, "s2255", sizeof(cap->card));
 	usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info));
 	cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING |
-		V4L2_CAP_READWRITE;
+			   V4L2_CAP_READWRITE | V4L2_CAP_VDEV_CENTERED;
 	cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
 	return 0;
 }
drivers/media/usb/stk1160/stk1160-v4l.c +2 -1
index a132faa590df..23908a688e30 100644
@@ -350,7 +350,8 @@ static int vidioc_querycap(struct file *file,
 	cap->device_caps =
 		V4L2_CAP_VIDEO_CAPTURE |
 		V4L2_CAP_STREAMING |
-		V4L2_CAP_READWRITE;
+		V4L2_CAP_READWRITE |
+		V4L2_CAP_VDEV_CENTERED;
 	cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
 	return 0;
 }
drivers/media/usb/stkwebcam/stk-webcam.c +2 -1
index 39abb58c65dd..5aee0f110f59 100644
@@ -797,7 +797,8 @@ static int stk_vidioc_querycap(struct file *filp,
 	usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info));
 
 	cap->device_caps = V4L2_CAP_VIDEO_CAPTURE
-		| V4L2_CAP_READWRITE | V4L2_CAP_STREAMING;
+			   | V4L2_CAP_READWRITE | V4L2_CAP_STREAMING
+			   | V4L2_CAP_VDEV_CENTERED;
 	cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
 	return 0;
 }
drivers/media/usb/tm6000/tm6000-video.c +3 -2
index ec8c4d2534dc..2ca27e53a4a7 100644
@@ -877,9 +877,10 @@ static int vidioc_querycap(struct file *file, void  *priv,
 	if (vdev->vfl_type == VFL_TYPE_GRABBER)
 		cap->device_caps |= V4L2_CAP_VIDEO_CAPTURE |
 				V4L2_CAP_STREAMING |
-				V4L2_CAP_READWRITE;
+				V4L2_CAP_READWRITE |
+				V4L2_CAP_VDEV_CENTERED;
 	else
-		cap->device_caps |= V4L2_CAP_RADIO;
+		cap->device_caps |= V4L2_CAP_RADIO | V4L2_CAP_VDEV_CENTERED;
 	cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS |
 		V4L2_CAP_RADIO | V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE;
 
drivers/media/usb/usbtv/usbtv-video.c +1 -1
index 8135614f395a..724dbcb8de9b 100644
@@ -520,7 +520,7 @@ static int usbtv_querycap(struct file *file, void *priv,
 	strlcpy(cap->driver, "usbtv", sizeof(cap->driver));
 	strlcpy(cap->card, "usbtv", sizeof(cap->card));
 	usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info));
-	cap->device_caps = V4L2_CAP_VIDEO_CAPTURE;
+	cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VDEV_CENTERED;
 	cap->device_caps |= V4L2_CAP_READWRITE | V4L2_CAP_STREAMING;
 	cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
 	return 0;
drivers/media/usb/usbvision/usbvision-video.c +3 -2
index 756322c4ac05..816dbb7ba29f 100644
@@ -476,9 +476,10 @@ static int vidioc_querycap(struct file *file, void  *priv,
 	vc->device_caps = usbvision->have_tuner ? V4L2_CAP_TUNER : 0;
 	if (vdev->vfl_type == VFL_TYPE_GRABBER)
 		vc->device_caps |= V4L2_CAP_VIDEO_CAPTURE |
-			V4L2_CAP_READWRITE | V4L2_CAP_STREAMING;
+				   V4L2_CAP_READWRITE | V4L2_CAP_STREAMING |
+				   V4L2_CAP_VDEV_CENTERED;
 	else
-		vc->device_caps |= V4L2_CAP_RADIO;
+		vc->device_caps |= V4L2_CAP_RADIO | V4L2_CAP_VDEV_CENTERED;
 
 	vc->capabilities = vc->device_caps | V4L2_CAP_VIDEO_CAPTURE |
 		V4L2_CAP_READWRITE | V4L2_CAP_STREAMING | V4L2_CAP_DEVICE_CAPS;
drivers/media/usb/uvc/uvc_v4l2.c +5 -3
index 3e7e283a44a8..95430bb8d2a4 100644
@@ -567,11 +567,13 @@ static int uvc_ioctl_querycap(struct file *file, void *fh,
 	strlcpy(cap->card, vdev->name, sizeof(cap->card));
 	usb_make_path(stream->dev->udev, cap->bus_info, sizeof(cap->bus_info));
 	cap->capabilities = V4L2_CAP_DEVICE_CAPS | V4L2_CAP_STREAMING
-			  | chain->caps;
+			  V4L2_CAP_VDEV_CENTERED | chain->caps;
 	if (stream->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
-		cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
+		cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING
+				   | V4L2_CAP_VDEV_CENTERED;
 	else
-		cap->device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING;
+		cap->device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING
+				   | V4L2_CAP_VDEV_CENTERED;
 
 	return 0;
 }
drivers/media/usb/zr364xx/zr364xx.c +3 -2
index d4bb56baad9b..bb3597bce912 100644
@@ -710,8 +710,9 @@ static int zr364xx_vidioc_querycap(struct file *file, void *priv,
 	strlcpy(cap->bus_info, dev_name(&cam->udev->dev),
 		sizeof(cap->bus_info));
 	cap->device_caps = V4L2_CAP_VIDEO_CAPTURE |
-			    V4L2_CAP_READWRITE |
-			    V4L2_CAP_STREAMING;
+			   V4L2_CAP_READWRITE |
+			   V4L2_CAP_STREAMING |
+			   V4L2_CAP_VDEV_CENTERED;
 	cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
 
 	return 0;
Signature · 1 line
2.13.3
Acked-by on v1 3/3
#22 lore raw

Re: [PATCH 3/3] media: add V4L2_CAP_VDEV_CENTERED flag on vdev-centric drivers

Quoted 7 lines · Mauro Carvalho Chehab

From: Mauro Carvalho Chehab <[email protected]>

Those devices are controlled via their V4L2 device. Add a flag to indicate them as such.

for the usbtv driver.

Quoted 17 lines
---
 drivers/media/usb/usbtv/usbtv-video.c          |  2 +-
drivers/media/usb/usbtv/usbtv-video.c +1 -1
index 8135614f395a..724dbcb8de9b 100644
@@ -520,7 +520,7 @@ static int usbtv_querycap(struct file *file, void *priv,
 	strlcpy(cap->driver, "usbtv", sizeof(cap->driver));
 	strlcpy(cap->card, "usbtv", sizeof(cap->card));
 	usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info));
-	cap->device_caps = V4L2_CAP_VIDEO_CAPTURE;
+	cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VDEV_CENTERED;
 	cap->device_caps |= V4L2_CAP_READWRITE | V4L2_CAP_STREAMING;
 	cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
 	return 0;