linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] media: vimc: Minor code cleanup and documentation
@ 2019-06-13 15:06 André Almeida
  2019-06-13 15:06 ` [PATCH 1/4] media: vimc: debayer: Fix typos André Almeida
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: André Almeida @ 2019-06-13 15:06 UTC (permalink / raw)
  To: linux-media
  Cc: mchehab, hverkuil, helen.koike, kernel, lkcamp, linux-kernel,
	André Almeida

Hello,

This patch series does some cleanup on the code and add a file for Vimc
at the kernel documentation.

Thanks,
	André

André Almeida (4):
  media: vimc: debayer: Fix typos
  media: vimc: Makefile: file cleanup
  media: vimc: stream: add missing function documentation
  media: docs: create vimc documentation

 Documentation/media/v4l-drivers/index.rst   |  1 +
 Documentation/media/v4l-drivers/vimc.dot    | 22 +++++
 Documentation/media/v4l-drivers/vimc.rst    | 98 +++++++++++++++++++++
 drivers/media/platform/vimc/Makefile        | 12 +--
 drivers/media/platform/vimc/vimc-common.c   |  4 -
 drivers/media/platform/vimc/vimc-debayer.c  |  6 +-
 drivers/media/platform/vimc/vimc-streamer.c | 26 +++++-
 7 files changed, 150 insertions(+), 19 deletions(-)
 create mode 100644 Documentation/media/v4l-drivers/vimc.dot
 create mode 100644 Documentation/media/v4l-drivers/vimc.rst

-- 
2.22.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/4] media: vimc: debayer: Fix typos
  2019-06-13 15:06 [PATCH 0/4] media: vimc: Minor code cleanup and documentation André Almeida
@ 2019-06-13 15:06 ` André Almeida
  2019-06-13 15:06 ` [PATCH 2/4] media: vimc: Makefile: file cleanup André Almeida
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: André Almeida @ 2019-06-13 15:06 UTC (permalink / raw)
  To: linux-media
  Cc: mchehab, hverkuil, helen.koike, kernel, lkcamp, linux-kernel,
	André Almeida

Fix typo on "tranforming". Add a line break so it keeps under 80 columns.
Fix typo on "[it] need".

Signed-off-by: André Almeida <andrealmeid@collabora.com>
---
 drivers/media/platform/vimc/vimc-debayer.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/vimc/vimc-debayer.c b/drivers/media/platform/vimc/vimc-debayer.c
index 310c0d0eefa2..00598fbf3cba 100644
--- a/drivers/media/platform/vimc/vimc-debayer.c
+++ b/drivers/media/platform/vimc/vimc-debayer.c
@@ -16,14 +16,16 @@
 #include "vimc-common.h"
 
 #define VIMC_DEB_DRV_NAME "vimc-debayer"
-/* This module only supports tranforming a bayer format to V4L2_PIX_FMT_RGB24 */
+/* This module only supports transforming a bayer format
+ * to V4L2_PIX_FMT_RGB24
+ */
 #define VIMC_DEB_SRC_PIXFMT V4L2_PIX_FMT_RGB24
 #define VIMC_DEB_SRC_MBUS_FMT_DEFAULT MEDIA_BUS_FMT_RGB888_1X24
 
 static unsigned int deb_mean_win_size = 3;
 module_param(deb_mean_win_size, uint, 0000);
 MODULE_PARM_DESC(deb_mean_win_size, " the window size to calculate the mean.\n"
-	"NOTE: the window size need to be an odd number, as the main pixel "
+	"NOTE: the window size needs to be an odd number, as the main pixel "
 	"stays in the center of the window, otherwise the next odd number "
 	"is considered");
 
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/4] media: vimc: Makefile: file cleanup
  2019-06-13 15:06 [PATCH 0/4] media: vimc: Minor code cleanup and documentation André Almeida
  2019-06-13 15:06 ` [PATCH 1/4] media: vimc: debayer: Fix typos André Almeida
@ 2019-06-13 15:06 ` André Almeida
  2019-06-13 15:06 ` [PATCH 3/4] media: vimc: stream: add missing function documentation André Almeida
  2019-06-13 15:06 ` [PATCH 4/4] media: docs: create vimc documentation André Almeida
  3 siblings, 0 replies; 9+ messages in thread
From: André Almeida @ 2019-06-13 15:06 UTC (permalink / raw)
  To: linux-media
  Cc: mchehab, hverkuil, helen.koike, kernel, lkcamp, linux-kernel,
	André Almeida

Remove redundant Makefile rules (vimc_capture-objs, ...).

Stop exposing vimc-{common, streamer} as modules, since there's no use
case where they would be individually added/removed from Vimc. As
consequence, remove MODULE_ macros from vimc-{common, streamer}.

`-objs` is fitted for building host programs, change to `-y`, more
straightforward for device drivers.

Signed-off-by: André Almeida <andrealmeid@collabora.com>
Suggested-by: Helen Koike <helen.koike@collabora.com>
---
 drivers/media/platform/vimc/Makefile        | 12 +++---------
 drivers/media/platform/vimc/vimc-common.c   |  4 ----
 drivers/media/platform/vimc/vimc-streamer.c |  4 ----
 3 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/drivers/media/platform/vimc/Makefile b/drivers/media/platform/vimc/Makefile
index c4fc8e7d365a..96d06f030c31 100644
--- a/drivers/media/platform/vimc/Makefile
+++ b/drivers/media/platform/vimc/Makefile
@@ -1,11 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
-vimc-objs := vimc-core.o
-vimc_capture-objs := vimc-capture.o
-vimc_common-objs := vimc-common.o
-vimc_debayer-objs := vimc-debayer.o
-vimc_scaler-objs := vimc-scaler.o
-vimc_sensor-objs := vimc-sensor.o
-vimc_streamer-objs := vimc-streamer.o
+vimc-y := vimc-core.o vimc-common.o vimc-streamer.o
 
-obj-$(CONFIG_VIDEO_VIMC) += vimc.o vimc_capture.o vimc_common.o vimc-debayer.o \
-			    vimc_scaler.o vimc_sensor.o vimc_streamer.o
+obj-$(CONFIG_VIDEO_VIMC) += vimc.o vimc-capture.o vimc-debayer.o \
+                vimc-scaler.o vimc-sensor.o
diff --git a/drivers/media/platform/vimc/vimc-common.c b/drivers/media/platform/vimc/vimc-common.c
index f4d2073076ed..03016f204d05 100644
--- a/drivers/media/platform/vimc/vimc-common.c
+++ b/drivers/media/platform/vimc/vimc-common.c
@@ -377,7 +377,3 @@ void vimc_ent_sd_unregister(struct vimc_ent_device *ved, struct v4l2_subdev *sd)
 	v4l2_device_unregister_subdev(sd);
 }
 EXPORT_SYMBOL_GPL(vimc_ent_sd_unregister);
-
-MODULE_DESCRIPTION("Virtual Media Controller Driver (VIMC) Common");
-MODULE_AUTHOR("Helen Koike <helen.fornazier@gmail.com>");
-MODULE_LICENSE("GPL");
diff --git a/drivers/media/platform/vimc/vimc-streamer.c b/drivers/media/platform/vimc/vimc-streamer.c
index 26b674259489..236ade38f1da 100644
--- a/drivers/media/platform/vimc/vimc-streamer.c
+++ b/drivers/media/platform/vimc/vimc-streamer.c
@@ -188,7 +188,3 @@ int vimc_streamer_s_stream(struct vimc_stream *stream,
 	return 0;
 }
 EXPORT_SYMBOL_GPL(vimc_streamer_s_stream);
-
-MODULE_DESCRIPTION("Virtual Media Controller Driver (VIMC) Streamer");
-MODULE_AUTHOR("Lucas A. M. Magalhães <lucmaga@gmail.com>");
-MODULE_LICENSE("GPL");
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/4] media: vimc: stream: add missing function documentation
  2019-06-13 15:06 [PATCH 0/4] media: vimc: Minor code cleanup and documentation André Almeida
  2019-06-13 15:06 ` [PATCH 1/4] media: vimc: debayer: Fix typos André Almeida
  2019-06-13 15:06 ` [PATCH 2/4] media: vimc: Makefile: file cleanup André Almeida
@ 2019-06-13 15:06 ` André Almeida
  2019-06-14  7:23   ` Hans Verkuil
  2019-06-13 15:06 ` [PATCH 4/4] media: docs: create vimc documentation André Almeida
  3 siblings, 1 reply; 9+ messages in thread
From: André Almeida @ 2019-06-13 15:06 UTC (permalink / raw)
  To: linux-media
  Cc: mchehab, hverkuil, helen.koike, kernel, lkcamp, linux-kernel,
	André Almeida

Add comments at vimc_streamer_s_stream and vimc_streamer_thread, making
the vimc-stream totally documented.

Signed-off-by: André Almeida <andrealmeid@collabora.com>
---
 drivers/media/platform/vimc/vimc-streamer.c | 22 +++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/media/platform/vimc/vimc-streamer.c b/drivers/media/platform/vimc/vimc-streamer.c
index 236ade38f1da..8556cc6e8654 100644
--- a/drivers/media/platform/vimc/vimc-streamer.c
+++ b/drivers/media/platform/vimc/vimc-streamer.c
@@ -122,6 +122,14 @@ static int vimc_streamer_pipeline_init(struct vimc_stream *stream,
 	return -EINVAL;
 }
 
+/*
+ * vimc_streamer_thread - process frames through the pipeline
+ *
+ * @data:	vimc_stream struct of the current streaming
+ *
+ * From the source to the sink, gets a frame from each subdevice and send to
+ * the next one of the pipeline in a fixed framerate.
+ */
 static int vimc_streamer_thread(void *data)
 {
 	struct vimc_stream *stream = data;
@@ -149,6 +157,20 @@ static int vimc_streamer_thread(void *data)
 	return 0;
 }
 
+/*
+ * vimc_streamer_s_stream - start/stop the streaming on the media pipeline
+ *
+ * @stream:	the pointer to the stream structure of the current stream
+ * @ved:	pointer to the vimc entity of the entity of the stream
+ * @enable:	flag to determine if stream should start/stop
+ *
+ * When starting, checks if there's no stream->kthread allocated. This should
+ * indicates that a streaming is already running. Then, it's initialize
+ * the pipeline, create and run a kthread to consume buffers through the
+ * pipeline.
+ * When stopping, analogously check's it there's a streaming running, stops
+ * the thread and terminate the pipeline.
+ */
 int vimc_streamer_s_stream(struct vimc_stream *stream,
 			   struct vimc_ent_device *ved,
 			   int enable)
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/4] media: docs: create vimc documentation
  2019-06-13 15:06 [PATCH 0/4] media: vimc: Minor code cleanup and documentation André Almeida
                   ` (2 preceding siblings ...)
  2019-06-13 15:06 ` [PATCH 3/4] media: vimc: stream: add missing function documentation André Almeida
@ 2019-06-13 15:06 ` André Almeida
  2019-06-14  7:30   ` Hans Verkuil
  3 siblings, 1 reply; 9+ messages in thread
From: André Almeida @ 2019-06-13 15:06 UTC (permalink / raw)
  To: linux-media
  Cc: mchehab, hverkuil, helen.koike, kernel, lkcamp, linux-kernel,
	André Almeida

Create vimc documentation file to explain it basics features, it's
topology, how to configure it and to document vimc's subdevices.

Signed-off-by: André Almeida <andrealmeid@collabora.com>
Suggested-by: Helen Koike <helen.koike@collabora.com>
---
 Documentation/media/v4l-drivers/index.rst |  1 +
 Documentation/media/v4l-drivers/vimc.dot  | 22 +++++
 Documentation/media/v4l-drivers/vimc.rst  | 98 +++++++++++++++++++++++
 3 files changed, 121 insertions(+)
 create mode 100644 Documentation/media/v4l-drivers/vimc.dot
 create mode 100644 Documentation/media/v4l-drivers/vimc.rst

diff --git a/Documentation/media/v4l-drivers/index.rst b/Documentation/media/v4l-drivers/index.rst
index 33a055907258..c4c78a28654c 100644
--- a/Documentation/media/v4l-drivers/index.rst
+++ b/Documentation/media/v4l-drivers/index.rst
@@ -64,5 +64,6 @@ For more details see the file COPYING in the source distribution of Linux.
 	si476x
 	soc-camera
 	uvcvideo
+	vimc
 	vivid
 	zr364xx
diff --git a/Documentation/media/v4l-drivers/vimc.dot b/Documentation/media/v4l-drivers/vimc.dot
new file mode 100644
index 000000000000..57863a13fa39
--- /dev/null
+++ b/Documentation/media/v4l-drivers/vimc.dot
@@ -0,0 +1,22 @@
+# SPDX-License-Identifier: GPL-2.0
+
+digraph board {
+	rankdir=TB
+	n00000001 [label="{{} | Sensor A\n/dev/v4l-subdev0 | {<port0> 0}}", shape=Mrecord, style=filled, fillcolor=green]
+	n00000001:port0 -> n00000005:port0 [style=bold]
+	n00000001:port0 -> n0000000b [style=bold]
+	n00000003 [label="{{} | Sensor B\n/dev/v4l-subdev1 | {<port0> 0}}", shape=Mrecord, style=filled, fillcolor=green]
+	n00000003:port0 -> n00000008:port0 [style=bold]
+	n00000003:port0 -> n0000000f [style=bold]
+	n00000005 [label="{{<port0> 0} | Debayer A\n/dev/v4l-subdev2 | {<port1> 1}}", shape=Mrecord, style=filled, fillcolor=green]
+	n00000005:port1 -> n00000017:port0
+	n00000008 [label="{{<port0> 0} | Debayer B\n/dev/v4l-subdev3 | {<port1> 1}}", shape=Mrecord, style=filled, fillcolor=green]
+	n00000008:port1 -> n00000017:port0 [style=dashed]
+	n0000000b [label="Raw Capture 0\n/dev/video0", shape=box, style=filled, fillcolor=yellow]
+	n0000000f [label="Raw Capture 1\n/dev/video1", shape=box, style=filled, fillcolor=yellow]
+	n00000013 [label="RGB/YUV Input\n/dev/video2", shape=box, style=filled, fillcolor=yellow]
+	n00000013 -> n00000017:port0 [style=dashed]
+	n00000017 [label="{{<port0> 0} | Scaler\n/dev/v4l-subdev4 | {<port1> 1}}", shape=Mrecord, style=filled, fillcolor=green]
+	n00000017:port1 -> n0000001a [style=bold]
+	n0000001a [label="RGB/YUV Capture\n/dev/video3", shape=box, style=filled, fillcolor=yellow]
+}
diff --git a/Documentation/media/v4l-drivers/vimc.rst b/Documentation/media/v4l-drivers/vimc.rst
new file mode 100644
index 000000000000..bd98c55a0025
--- /dev/null
+++ b/Documentation/media/v4l-drivers/vimc.rst
@@ -0,0 +1,98 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+The Virtual Media Controller Driver (vimc)
+==========================================
+
+The Vimc driver emulates the V4L2 API and the Media API as well. Its goal is to
+emulate complex devices and topologies. In the actual state, it has a capture
+device and three subdevices: sensor, debayer and scaler.
+
+Topology
+--------
+
+The topology is hardcoded, although you could modify it on vimc-core and
+recompile the driver to achieve your own topology. This is the default topology:
+
+.. _vimc_topology_graph:
+
+.. kernel-figure:: vimc.dot
+    :alt:   vimc.dot
+    :align: center
+
+    Media pipeline graph on Vimc
+
+Configuring the topology
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+Each subdevice will come with its default configuration (pixelformat, height,
+width, ...). One needs to configure the topology in order to match the
+configuration on each linked subdevice to stream frames through the pipeline.
+If the configuration doesn't match, the stream will fail. The ``v4l2-utils``
+is a bundle of user-space applications, that comes with ``media-ctl`` and
+``v4l2-clt`` that can be used in combination to configure. This sequence of
+commands fits for the default topology:
+
+.. code-block:: bash
+
+        media-ctl -d platform:vimc -V '"Sensor A":0[fmt:SBGGR8_1X8/640x480]'
+        media-ctl -d platform:vimc -V '"Debayer A":0[fmt:SBGGR8_1X8/640x480]'
+        media-ctl -d platform:vimc -V '"Sensor B":0[fmt:SBGGR8_1X8/640x480]'
+        media-ctl -d platform:vimc -V '"Debayer B":0[fmt:SBGGR8_1X8/640x480]'
+        v4l2-ctl -z platform:vimc -d "RGB/YUV Capture" -v width=1920,height=1440
+        v4l2-ctl -z platform:vimc -d "Raw Capture 0" -v pixelformat=BA81
+        v4l2-ctl -z platform:vimc -d "Raw Capture 1" -v pixelformat=BA81
+
+Subdevices
+----------
+
+Subdevices define the behavior of an entity in the topology. Depending on the
+subdevice, the entity can have multiple pads of type source or sink.
+
+vimc-sensor:
+	Generates images in several formats using video test pattern generator.
+	Exposes:
+
+	* 1 Pad source
+
+vimc-debayer:
+	Transforms images in bayer format into a non-bayer format.
+	Exposes:
+
+	* 1 Pad sink
+	* 1 Pad source
+
+vimc-scaler:
+	Multiplies the size of the image by 9 (this value can be configured,
+        see at `Modules options`_).
+	Exposes:
+
+	* 1 Pad sink
+	* 1 Pad source
+
+vimc-capture:
+	Exposes node /dev/videoX to allow userspace to capture the stream.
+	Exposes:
+
+	* 1 Pad sink
+	* 1 Pad source
+
+Modules options
+---------------
+
+Vimc has a few module parameters to configure the driver. You should pass
+those arguments to each subdevice, not for the Vimc module. For example::
+
+        vimc_subvice.param=value
+
+* ``vimc_scaler.sca_mult=<unsigned int>``
+
+        Image size multiplier factor to be used to multiply both width and
+        height, so the image size will be ``sca_mult^2`` bigger than the
+        original one. Currently, only supports scaling up (the default value
+        is 3).
+
+* ``vimc_debayer.deb_mean_win_size=<unsigned int>``
+
+        Window size to calculate the mean. Note: the window size needs to be an
+        odd number, as the main pixel stays in the center of the window,
+        otherwise the next odd number is considered (the default value is 3).
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/4] media: vimc: stream: add missing function documentation
  2019-06-13 15:06 ` [PATCH 3/4] media: vimc: stream: add missing function documentation André Almeida
@ 2019-06-14  7:23   ` Hans Verkuil
  0 siblings, 0 replies; 9+ messages in thread
From: Hans Verkuil @ 2019-06-14  7:23 UTC (permalink / raw)
  To: André Almeida, linux-media
  Cc: mchehab, helen.koike, kernel, lkcamp, linux-kernel

On 6/13/19 5:06 PM, André Almeida wrote:
> Add comments at vimc_streamer_s_stream and vimc_streamer_thread, making
> the vimc-stream totally documented.
> 
> Signed-off-by: André Almeida <andrealmeid@collabora.com>
> ---
>  drivers/media/platform/vimc/vimc-streamer.c | 22 +++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/drivers/media/platform/vimc/vimc-streamer.c b/drivers/media/platform/vimc/vimc-streamer.c
> index 236ade38f1da..8556cc6e8654 100644
> --- a/drivers/media/platform/vimc/vimc-streamer.c
> +++ b/drivers/media/platform/vimc/vimc-streamer.c
> @@ -122,6 +122,14 @@ static int vimc_streamer_pipeline_init(struct vimc_stream *stream,
>  	return -EINVAL;
>  }
>  
> +/*
> + * vimc_streamer_thread - process frames through the pipeline
> + *
> + * @data:	vimc_stream struct of the current streaming
> + *
> + * From the source to the sink, gets a frame from each subdevice and send to
> + * the next one of the pipeline in a fixed framerate.
> + */
>  static int vimc_streamer_thread(void *data)
>  {
>  	struct vimc_stream *stream = data;
> @@ -149,6 +157,20 @@ static int vimc_streamer_thread(void *data)
>  	return 0;
>  }
>  
> +/*
> + * vimc_streamer_s_stream - start/stop the streaming on the media pipeline
> + *
> + * @stream:	the pointer to the stream structure of the current stream
> + * @ved:	pointer to the vimc entity of the entity of the stream
> + * @enable:	flag to determine if stream should start/stop
> + *
> + * When starting, checks if there's no stream->kthread allocated. This should

checks -> check
there's -> there is

> + * indicates that a streaming is already running. Then, it's initialize

indicates -> indicate
it's initialize -> it initializes

> + * the pipeline, create and run a kthread to consume buffers through the

create and run -> creates and runs

> + * pipeline.
> + * When stopping, analogously check's it there's a streaming running, stops

check's it there's a streaming -> check if there is a stream



> + * the thread and terminate the pipeline.

terminate -> terminates

> + */
>  int vimc_streamer_s_stream(struct vimc_stream *stream,
>  			   struct vimc_ent_device *ved,
>  			   int enable)
> 

Regards,

	Hans

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/4] media: docs: create vimc documentation
  2019-06-13 15:06 ` [PATCH 4/4] media: docs: create vimc documentation André Almeida
@ 2019-06-14  7:30   ` Hans Verkuil
  2019-06-14 14:14     ` André Almeida
  0 siblings, 1 reply; 9+ messages in thread
From: Hans Verkuil @ 2019-06-14  7:30 UTC (permalink / raw)
  To: André Almeida, linux-media
  Cc: mchehab, helen.koike, kernel, lkcamp, linux-kernel

Hi André,

Thanks for working one this, very nice to have this documentation.

Some comments below:

On 6/13/19 5:06 PM, André Almeida wrote:
> Create vimc documentation file to explain it basics features, it's
> topology, how to configure it and to document vimc's subdevices.
> 
> Signed-off-by: André Almeida <andrealmeid@collabora.com>
> Suggested-by: Helen Koike <helen.koike@collabora.com>
> ---
>  Documentation/media/v4l-drivers/index.rst |  1 +
>  Documentation/media/v4l-drivers/vimc.dot  | 22 +++++
>  Documentation/media/v4l-drivers/vimc.rst  | 98 +++++++++++++++++++++++
>  3 files changed, 121 insertions(+)
>  create mode 100644 Documentation/media/v4l-drivers/vimc.dot
>  create mode 100644 Documentation/media/v4l-drivers/vimc.rst
> 
> diff --git a/Documentation/media/v4l-drivers/index.rst b/Documentation/media/v4l-drivers/index.rst
> index 33a055907258..c4c78a28654c 100644
> --- a/Documentation/media/v4l-drivers/index.rst
> +++ b/Documentation/media/v4l-drivers/index.rst
> @@ -64,5 +64,6 @@ For more details see the file COPYING in the source distribution of Linux.
>  	si476x
>  	soc-camera
>  	uvcvideo
> +	vimc
>  	vivid
>  	zr364xx
> diff --git a/Documentation/media/v4l-drivers/vimc.dot b/Documentation/media/v4l-drivers/vimc.dot
> new file mode 100644
> index 000000000000..57863a13fa39
> --- /dev/null
> +++ b/Documentation/media/v4l-drivers/vimc.dot
> @@ -0,0 +1,22 @@
> +# SPDX-License-Identifier: GPL-2.0
> +
> +digraph board {
> +	rankdir=TB
> +	n00000001 [label="{{} | Sensor A\n/dev/v4l-subdev0 | {<port0> 0}}", shape=Mrecord, style=filled, fillcolor=green]
> +	n00000001:port0 -> n00000005:port0 [style=bold]
> +	n00000001:port0 -> n0000000b [style=bold]
> +	n00000003 [label="{{} | Sensor B\n/dev/v4l-subdev1 | {<port0> 0}}", shape=Mrecord, style=filled, fillcolor=green]
> +	n00000003:port0 -> n00000008:port0 [style=bold]
> +	n00000003:port0 -> n0000000f [style=bold]
> +	n00000005 [label="{{<port0> 0} | Debayer A\n/dev/v4l-subdev2 | {<port1> 1}}", shape=Mrecord, style=filled, fillcolor=green]
> +	n00000005:port1 -> n00000017:port0
> +	n00000008 [label="{{<port0> 0} | Debayer B\n/dev/v4l-subdev3 | {<port1> 1}}", shape=Mrecord, style=filled, fillcolor=green]
> +	n00000008:port1 -> n00000017:port0 [style=dashed]
> +	n0000000b [label="Raw Capture 0\n/dev/video0", shape=box, style=filled, fillcolor=yellow]
> +	n0000000f [label="Raw Capture 1\n/dev/video1", shape=box, style=filled, fillcolor=yellow]
> +	n00000013 [label="RGB/YUV Input\n/dev/video2", shape=box, style=filled, fillcolor=yellow]
> +	n00000013 -> n00000017:port0 [style=dashed]
> +	n00000017 [label="{{<port0> 0} | Scaler\n/dev/v4l-subdev4 | {<port1> 1}}", shape=Mrecord, style=filled, fillcolor=green]
> +	n00000017:port1 -> n0000001a [style=bold]
> +	n0000001a [label="RGB/YUV Capture\n/dev/video3", shape=box, style=filled, fillcolor=yellow]
> +}
> diff --git a/Documentation/media/v4l-drivers/vimc.rst b/Documentation/media/v4l-drivers/vimc.rst
> new file mode 100644
> index 000000000000..bd98c55a0025
> --- /dev/null
> +++ b/Documentation/media/v4l-drivers/vimc.rst
> @@ -0,0 +1,98 @@
> +.. SPDX-License-Identifier: GPL-2.0
> +
> +The Virtual Media Controller Driver (vimc)
> +==========================================
> +
> +The Vimc driver emulates the V4L2 API and the Media API as well. Its goal is to

Vimc -> vimc

It doesn't emulate these APIs, it emulates complex video hardware using these APIs.

> +emulate complex devices and topologies. In the actual state, it has a capture

Drop 'In the actual state, '.

> +device and three subdevices: sensor, debayer and scaler.
> +
> +Topology
> +--------
> +
> +The topology is hardcoded, although you could modify it on vimc-core and

on -> in

> +recompile the driver to achieve your own topology. This is the default topology:
> +
> +.. _vimc_topology_graph:
> +
> +.. kernel-figure:: vimc.dot
> +    :alt:   vimc.dot
> +    :align: center
> +
> +    Media pipeline graph on Vimc
> +
> +Configuring the topology
> +~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +Each subdevice will come with its default configuration (pixelformat, height,
> +width, ...). One needs to configure the topology in order to match the
> +configuration on each linked subdevice to stream frames through the pipeline.
> +If the configuration doesn't match, the stream will fail. The ``v4l2-utils``
> +is a bundle of user-space applications, that comes with ``media-ctl`` and
> +``v4l2-clt`` that can be used in combination to configure. This sequence of

v4l2-clt -> v4l2-ctl

in combination to configure -> to configure the vimc configuration.

> +commands fits for the default topology:
> +
> +.. code-block:: bash
> +
> +        media-ctl -d platform:vimc -V '"Sensor A":0[fmt:SBGGR8_1X8/640x480]'
> +        media-ctl -d platform:vimc -V '"Debayer A":0[fmt:SBGGR8_1X8/640x480]'
> +        media-ctl -d platform:vimc -V '"Sensor B":0[fmt:SBGGR8_1X8/640x480]'
> +        media-ctl -d platform:vimc -V '"Debayer B":0[fmt:SBGGR8_1X8/640x480]'
> +        v4l2-ctl -z platform:vimc -d "RGB/YUV Capture" -v width=1920,height=1440
> +        v4l2-ctl -z platform:vimc -d "Raw Capture 0" -v pixelformat=BA81
> +        v4l2-ctl -z platform:vimc -d "Raw Capture 1" -v pixelformat=BA81
> +
> +Subdevices
> +----------
> +
> +Subdevices define the behavior of an entity in the topology. Depending on the
> +subdevice, the entity can have multiple pads of type source or sink.
> +
> +vimc-sensor:
> +	Generates images in several formats using video test pattern generator.
> +	Exposes:
> +
> +	* 1 Pad source
> +
> +vimc-debayer:
> +	Transforms images in bayer format into a non-bayer format.
> +	Exposes:
> +
> +	* 1 Pad sink
> +	* 1 Pad source
> +
> +vimc-scaler:
> +	Multiplies the size of the image by 9 (this value can be configured,
> +        see at `Modules options`_).

It's a bit ambiguous: I assume you mean that the images is scaled up by a
factor of 3? So 640x480 becomes 1920x1440?

> +	Exposes:
> +
> +	* 1 Pad sink
> +	* 1 Pad source
> +
> +vimc-capture:
> +	Exposes node /dev/videoX to allow userspace to capture the stream.
> +	Exposes:
> +
> +	* 1 Pad sink
> +	* 1 Pad source
> +
> +Modules options

Modules -> Module

> +---------------
> +
> +Vimc has a few module parameters to configure the driver. You should pass
> +those arguments to each subdevice, not for the Vimc module. For example::

for the -> to the

> +
> +        vimc_subvice.param=value

subvice -> subdevice

> +
> +* ``vimc_scaler.sca_mult=<unsigned int>``
> +
> +        Image size multiplier factor to be used to multiply both width and
> +        height, so the image size will be ``sca_mult^2`` bigger than the
> +        original one. Currently, only supports scaling up (the default value
> +        is 3).
> +
> +* ``vimc_debayer.deb_mean_win_size=<unsigned int>``
> +
> +        Window size to calculate the mean. Note: the window size needs to be an
> +        odd number, as the main pixel stays in the center of the window,
> +        otherwise the next odd number is considered (the default value is 3).
> 

Regards,

	Hans

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/4] media: docs: create vimc documentation
  2019-06-14  7:30   ` Hans Verkuil
@ 2019-06-14 14:14     ` André Almeida
  2019-06-15  7:32       ` Hans Verkuil
  0 siblings, 1 reply; 9+ messages in thread
From: André Almeida @ 2019-06-14 14:14 UTC (permalink / raw)
  To: Hans Verkuil, linux-media
  Cc: mchehab, helen.koike, kernel, lkcamp, linux-kernel

Hello Hans,

On 6/14/19 4:30 AM, Hans Verkuil wrote:
> Hi André,
>
> Thanks for working one this, very nice to have this documentation.
>
> Some comments below:
>
> [...]
>
> Regards,
>
> 	Hans
Thanks for the feedback! I saw that 1/4 and 2/4 already are at your [GIT
PULL v5.3], so my v2 should only have 3/4 and 4/4, right?

Thanks,
        André


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/4] media: docs: create vimc documentation
  2019-06-14 14:14     ` André Almeida
@ 2019-06-15  7:32       ` Hans Verkuil
  0 siblings, 0 replies; 9+ messages in thread
From: Hans Verkuil @ 2019-06-15  7:32 UTC (permalink / raw)
  To: André Almeida, linux-media
  Cc: mchehab, helen.koike, kernel, lkcamp, linux-kernel

On 6/14/19 4:14 PM, André Almeida wrote:
> Hello Hans,
> 
> On 6/14/19 4:30 AM, Hans Verkuil wrote:
>> Hi André,
>>
>> Thanks for working one this, very nice to have this documentation.
>>
>> Some comments below:
>>
>> [...]
>>
>> Regards,
>>
>> 	Hans
> Thanks for the feedback! I saw that 1/4 and 2/4 already are at your [GIT
> PULL v5.3], so my v2 should only have 3/4 and 4/4, right?

Yes please!

Thanks,

	Hans

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-06-15  7:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-13 15:06 [PATCH 0/4] media: vimc: Minor code cleanup and documentation André Almeida
2019-06-13 15:06 ` [PATCH 1/4] media: vimc: debayer: Fix typos André Almeida
2019-06-13 15:06 ` [PATCH 2/4] media: vimc: Makefile: file cleanup André Almeida
2019-06-13 15:06 ` [PATCH 3/4] media: vimc: stream: add missing function documentation André Almeida
2019-06-14  7:23   ` Hans Verkuil
2019-06-13 15:06 ` [PATCH 4/4] media: docs: create vimc documentation André Almeida
2019-06-14  7:30   ` Hans Verkuil
2019-06-14 14:14     ` André Almeida
2019-06-15  7:32       ` Hans Verkuil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).