linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/6] R-Car VSP: Add and set media entities functions
@ 2016-05-19 23:40 Laurent Pinchart
  2016-05-19 23:40 ` [PATCH v4 1/6] media: Add video processing entity functions Laurent Pinchart
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Laurent Pinchart @ 2016-05-19 23:40 UTC (permalink / raw)
  To: linux-media; +Cc: Sakari Ailus, Hans Verkuil

Hello,

This patch series adds new media entities functions for video processing and
video statistics computation, and updates the VSP driver to use the new
functions.

Patches 1/6 and 2/6 define and document the new functions. They have been
submitted previously in the "[PATCH v2 00/54] R-Car VSP improvements for v4.7"
patch series, this version takes feedback received over e-mail and IRC into
account.

Patches 3/6 to 5/6 prepare the VSP driver to report the correct entity
functions. They make sure that the LIF will never be exposed to userspace as
no function currently exists for that block, and it isn't clear at the moment
what new function should be added. As the LIF is only needed when the VSP is
controlled directly from the DU driver without being exposed to userspace, a
function isn't needed for the LIF anyway.

Patch 6/6 finally sets functions for all the VSP entities.

The code is based on top of the "[PATCH/RFC v2 0/4] Meta-data video device
type" patch series, although it doesn't strictly depend on it. For convenience
I've pushed all patches to

	git://linuxtv.org/pinchartl/media.git vsp1/functions

Laurent Pinchart (6):
  media: Add video processing entity functions
  media: Add video statistics computation functions
  v4l: vsp1: Base link creation on availability of entities
  v4l: vsp1: Don't register media device when userspace API is disabled
  v4l: vsp1: Don't create LIF entity when the userspace API is enabled
  v4l: vsp1: Set entities functions

 Documentation/DocBook/media/v4l/media-types.xml | 64 +++++++++++++++++++++++++
 drivers/media/platform/vsp1/vsp1_bru.c          |  3 +-
 drivers/media/platform/vsp1/vsp1_drv.c          | 36 +++++++-------
 drivers/media/platform/vsp1/vsp1_entity.c       |  3 +-
 drivers/media/platform/vsp1/vsp1_entity.h       |  2 +-
 drivers/media/platform/vsp1/vsp1_hgo.c          |  3 +-
 drivers/media/platform/vsp1/vsp1_hsit.c         |  5 +-
 drivers/media/platform/vsp1/vsp1_lif.c          |  7 ++-
 drivers/media/platform/vsp1/vsp1_lut.c          |  3 +-
 drivers/media/platform/vsp1/vsp1_rpf.c          |  3 +-
 drivers/media/platform/vsp1/vsp1_sru.c          |  3 +-
 drivers/media/platform/vsp1/vsp1_uds.c          |  3 +-
 drivers/media/platform/vsp1/vsp1_wpf.c          |  3 +-
 include/uapi/linux/media.h                      | 10 ++++
 14 files changed, 119 insertions(+), 29 deletions(-)

-- 
Regards,

Laurent Pinchart


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

* [PATCH v4 1/6] media: Add video processing entity functions
  2016-05-19 23:40 [PATCH v4 0/6] R-Car VSP: Add and set media entities functions Laurent Pinchart
@ 2016-05-19 23:40 ` Laurent Pinchart
  2016-05-23  9:06   ` Hans Verkuil
  2016-05-19 23:40 ` [PATCH v4 2/6] media: Add video statistics computation functions Laurent Pinchart
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 10+ messages in thread
From: Laurent Pinchart @ 2016-05-19 23:40 UTC (permalink / raw)
  To: linux-media; +Cc: Sakari Ailus, Hans Verkuil

Add composer, pixel formatter, pixel encoding converter and scaler
functions.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 Documentation/DocBook/media/v4l/media-types.xml | 55 +++++++++++++++++++++++++
 include/uapi/linux/media.h                      |  9 ++++
 2 files changed, 64 insertions(+)

diff --git a/Documentation/DocBook/media/v4l/media-types.xml b/Documentation/DocBook/media/v4l/media-types.xml
index 5e3f20fdcf17..60fe841f8846 100644
--- a/Documentation/DocBook/media/v4l/media-types.xml
+++ b/Documentation/DocBook/media/v4l/media-types.xml
@@ -121,6 +121,61 @@
 	    <entry><constant>MEDIA_ENT_F_AUDIO_MIXER</constant></entry>
 	    <entry>Audio Mixer Function Entity.</entry>
 	  </row>
+	  <row>
+	    <entry><constant>MEDIA_ENT_F_PROC_VIDEO_COMPOSER</constant></entry>
+	    <entry>Video composer (blender). An entity capable of video
+		   composing must have at least two sink pads and one source
+		   pad, and composes input video frames onto output video
+		   frames. Composition can be performed using alpha blending,
+		   color keying, raster operations (ROP), stitching or any other
+		   means.
+	    </entry>
+	  </row>
+	  <row>
+	    <entry><constant>MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER</constant></entry>
+	    <entry>Video pixel formatter. An entity capable of pixel formatting
+		   must have at least one sink pad and one source pad. Read
+		   pixel formatters read pixels from memory and perform a subset
+		   of unpacking, cropping, color keying, alpha multiplication
+		   and pixel encoding conversion. Write pixel formatters perform
+		   a subset of dithering, pixel encoding conversion and packing
+		   and write pixels to memory.
+	    </entry>
+	  </row>
+	  <row>
+	    <entry><constant>MEDIA_ENT_F_PROC_VIDEO_PIXEL_ENC_CONV</constant></entry>
+	    <entry>Video pixel encoding converter. An entity capable of pixel
+		   enconding conversion must have at least one sink pad and one
+		   source pad, and convert the encoding of pixels received on
+		   its sink pad(s) to a different encoding output on its source
+		   pad(s). Pixel encoding conversion includes but isn't limited
+		   to RGB to/from HSV, RGB to/from YUV and CFA (Bayer) to RGB
+		   conversions.
+	    </entry>
+	  </row>
+	  <row>
+	    <entry><constant>MEDIA_ENT_F_PROC_VIDEO_LUT</constant></entry>
+	    <entry>Video look-up table. An entity capable of video lookup table
+		   processing must have one sink pad and one source pad. It uses
+		   the values of the pixels received on its sink pad to look up
+		   entries in internal tables and output them on its source pad.
+		   The lookup processing can be performed on all components
+		   separately or combine them for multi-dimensional table
+		   lookups.
+	    </entry>
+	  </row>
+	  <row>
+	    <entry><constant>MEDIA_ENT_F_PROC_VIDEO_SCALER</constant></entry>
+	    <entry>Video scaler. An entity capable of video scaling must have
+		   at least one sink pad and one source pad, and scale the
+		   video frame(s) received on its sink pad(s) to a different
+		   resolution output on its source pad(s). The range of
+		   supported scaling ratios is entity-specific and can differ
+		   between the horizontal and vertical directions (in particular
+		   scaling can be supported in one direction only). Binning and
+		   skipping are considered as scaling.
+	    </entry>
+	  </row>
 	</tbody>
       </tgroup>
     </table>
diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h
index e226bc35c639..bff3ffdfd55f 100644
--- a/include/uapi/linux/media.h
+++ b/include/uapi/linux/media.h
@@ -96,6 +96,15 @@ struct media_device_info {
 #define MEDIA_ENT_F_AUDIO_MIXER		(MEDIA_ENT_F_BASE + 0x03003)
 
 /*
+ * Processing entities
+ */
+#define MEDIA_ENT_F_PROC_VIDEO_COMPOSER		(MEDIA_ENT_F_BASE + 0x4001)
+#define MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER	(MEDIA_ENT_F_BASE + 0x4002)
+#define MEDIA_ENT_F_PROC_VIDEO_PIXEL_ENC_CONV	(MEDIA_ENT_F_BASE + 0x4003)
+#define MEDIA_ENT_F_PROC_VIDEO_LUT		(MEDIA_ENT_F_BASE + 0x4004)
+#define MEDIA_ENT_F_PROC_VIDEO_SCALER		(MEDIA_ENT_F_BASE + 0x4005)
+
+/*
  * Connectors
  */
 /* It is a responsibility of the entity drivers to add connectors and links */
-- 
2.7.3


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

* [PATCH v4 2/6] media: Add video statistics computation functions
  2016-05-19 23:40 [PATCH v4 0/6] R-Car VSP: Add and set media entities functions Laurent Pinchart
  2016-05-19 23:40 ` [PATCH v4 1/6] media: Add video processing entity functions Laurent Pinchart
@ 2016-05-19 23:40 ` Laurent Pinchart
  2016-05-23  9:10   ` Hans Verkuil
  2016-05-19 23:40 ` [PATCH v4 3/6] v4l: vsp1: Base link creation on availability of entities Laurent Pinchart
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 10+ messages in thread
From: Laurent Pinchart @ 2016-05-19 23:40 UTC (permalink / raw)
  To: linux-media; +Cc: Sakari Ailus, Hans Verkuil

The video statistics function describes entities such as video histogram
engines or 3A statistics engines.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 Documentation/DocBook/media/v4l/media-types.xml | 9 +++++++++
 include/uapi/linux/media.h                      | 1 +
 2 files changed, 10 insertions(+)

diff --git a/Documentation/DocBook/media/v4l/media-types.xml b/Documentation/DocBook/media/v4l/media-types.xml
index 60fe841f8846..95aa1f9c836a 100644
--- a/Documentation/DocBook/media/v4l/media-types.xml
+++ b/Documentation/DocBook/media/v4l/media-types.xml
@@ -176,6 +176,15 @@
 		   skipping are considered as scaling.
 	    </entry>
 	  </row>
+	  <row>
+	    <entry><constant>MEDIA_ENT_F_PROC_VIDEO_STATISTICS</constant></entry>
+	    <entry>Video statistics computation (histogram, 3A, ...). An entity
+		   capable of statistics computation must have one sink pad and
+		   one source pad. It computes statistics over the frames
+		   received on its sink pad and outputs the statistics data on
+		   its source pad.
+	    </entry>
+	  </row>
 	</tbody>
       </tgroup>
     </table>
diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h
index bff3ffdfd55f..4580328c4093 100644
--- a/include/uapi/linux/media.h
+++ b/include/uapi/linux/media.h
@@ -103,6 +103,7 @@ struct media_device_info {
 #define MEDIA_ENT_F_PROC_VIDEO_PIXEL_ENC_CONV	(MEDIA_ENT_F_BASE + 0x4003)
 #define MEDIA_ENT_F_PROC_VIDEO_LUT		(MEDIA_ENT_F_BASE + 0x4004)
 #define MEDIA_ENT_F_PROC_VIDEO_SCALER		(MEDIA_ENT_F_BASE + 0x4005)
+#define MEDIA_ENT_F_PROC_VIDEO_STATISTICS	(MEDIA_ENT_F_BASE + 0x4006)
 
 /*
  * Connectors
-- 
2.7.3


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

* [PATCH v4 3/6] v4l: vsp1: Base link creation on availability of entities
  2016-05-19 23:40 [PATCH v4 0/6] R-Car VSP: Add and set media entities functions Laurent Pinchart
  2016-05-19 23:40 ` [PATCH v4 1/6] media: Add video processing entity functions Laurent Pinchart
  2016-05-19 23:40 ` [PATCH v4 2/6] media: Add video statistics computation functions Laurent Pinchart
@ 2016-05-19 23:40 ` Laurent Pinchart
  2016-05-19 23:40 ` [PATCH v4 4/6] v4l: vsp1: Don't register media device when userspace API is disabled Laurent Pinchart
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Laurent Pinchart @ 2016-05-19 23:40 UTC (permalink / raw)
  To: linux-media; +Cc: Sakari Ailus, Hans Verkuil

Check the entity pointer instead of the feature flag to see if the
entity is available before creating related links. The two methods are
currently equivalent, but will differ in the future as we implement
support for ignoring some of the entities present in the hardware.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/media/platform/vsp1/vsp1_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c
index c737f15ad1f4..d369fad797aa 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -149,7 +149,7 @@ static int vsp1_uapi_create_links(struct vsp1_device *vsp1)
 			return ret;
 	}
 
-	if (vsp1->info->features & VSP1_HAS_HGO) {
+	if (vsp1->hgo) {
 		ret = media_create_pad_link(&vsp1->hgo->entity.subdev.entity,
 					    HGO_PAD_SOURCE,
 					    &vsp1->hgo->histo.video.entity, 0,
@@ -159,7 +159,7 @@ static int vsp1_uapi_create_links(struct vsp1_device *vsp1)
 			return ret;
 	}
 
-	if (vsp1->info->features & VSP1_HAS_LIF) {
+	if (vsp1->lif) {
 		ret = media_create_pad_link(&vsp1->wpf[0]->entity.subdev.entity,
 					    RWPF_PAD_SOURCE,
 					    &vsp1->lif->entity.subdev.entity,
-- 
2.7.3


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

* [PATCH v4 4/6] v4l: vsp1: Don't register media device when userspace API is disabled
  2016-05-19 23:40 [PATCH v4 0/6] R-Car VSP: Add and set media entities functions Laurent Pinchart
                   ` (2 preceding siblings ...)
  2016-05-19 23:40 ` [PATCH v4 3/6] v4l: vsp1: Base link creation on availability of entities Laurent Pinchart
@ 2016-05-19 23:40 ` Laurent Pinchart
  2016-05-19 23:40 ` [PATCH v4 5/6] v4l: vsp1: Don't create LIF entity when the userspace API is enabled Laurent Pinchart
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Laurent Pinchart @ 2016-05-19 23:40 UTC (permalink / raw)
  To: linux-media; +Cc: Sakari Ailus, Hans Verkuil

The media device doesn't need to be exposed to userspace when the VSP is
fully controlled by the DU driver. Don't register it in that case.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/media/platform/vsp1/vsp1_drv.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c
index d369fad797aa..c7e28cc97bdc 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -218,7 +218,8 @@ static void vsp1_destroy_entities(struct vsp1_device *vsp1)
 	}
 
 	v4l2_device_unregister(&vsp1->v4l2_dev);
-	media_device_unregister(&vsp1->media_dev);
+	if (vsp1->info->uapi)
+		media_device_unregister(&vsp1->media_dev);
 	media_device_cleanup(&vsp1->media_dev);
 
 	if (!vsp1->info->uapi)
@@ -403,14 +404,15 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
 	/* Register subdev nodes if the userspace API is enabled or initialize
 	 * the DRM pipeline otherwise.
 	 */
-	if (vsp1->info->uapi)
+	if (vsp1->info->uapi) {
 		ret = v4l2_device_register_subdev_nodes(&vsp1->v4l2_dev);
-	else
-		ret = vsp1_drm_init(vsp1);
-	if (ret < 0)
-		goto done;
+		if (ret < 0)
+			goto done;
 
-	ret = media_device_register(mdev);
+		ret = media_device_register(mdev);
+	} else {
+		ret = vsp1_drm_init(vsp1);
+	}
 
 done:
 	if (ret < 0)
-- 
2.7.3


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

* [PATCH v4 5/6] v4l: vsp1: Don't create LIF entity when the userspace API is enabled
  2016-05-19 23:40 [PATCH v4 0/6] R-Car VSP: Add and set media entities functions Laurent Pinchart
                   ` (3 preceding siblings ...)
  2016-05-19 23:40 ` [PATCH v4 4/6] v4l: vsp1: Don't register media device when userspace API is disabled Laurent Pinchart
@ 2016-05-19 23:40 ` Laurent Pinchart
  2016-05-19 23:40 ` [PATCH v4 6/6] v4l: vsp1: Set entities functions Laurent Pinchart
  2016-05-23 13:52 ` [PATCH v4 0/6] R-Car VSP: Add and set media " Sakari Ailus
  6 siblings, 0 replies; 10+ messages in thread
From: Laurent Pinchart @ 2016-05-19 23:40 UTC (permalink / raw)
  To: linux-media; +Cc: Sakari Ailus, Hans Verkuil

The LIF is only used when feeding the VSP output to the DU. The only way
to do so is by controlling the VSP directly from the DU driver and
disabling the VSP userspace API. There is thus no need to create a LIF
entity when the userspace API is enabled, as it can't be used in that
case.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/media/platform/vsp1/vsp1_drv.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c
index c7e28cc97bdc..de575b4215f8 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -182,19 +182,15 @@ static int vsp1_uapi_create_links(struct vsp1_device *vsp1)
 
 	for (i = 0; i < vsp1->info->wpf_count; ++i) {
 		/* Connect the video device to the WPF. All connections are
-		 * immutable except for the WPF0 source link if a LIF is
-		 * present.
+		 * immutable.
 		 */
 		struct vsp1_rwpf *wpf = vsp1->wpf[i];
-		unsigned int flags = MEDIA_LNK_FL_ENABLED;
-
-		if (!(vsp1->info->features & VSP1_HAS_LIF) || i != 0)
-			flags |= MEDIA_LNK_FL_IMMUTABLE;
 
 		ret = media_create_pad_link(&wpf->entity.subdev.entity,
 					    RWPF_PAD_SOURCE,
 					    &wpf->video->video.entity, 0,
-					    flags);
+					    MEDIA_LNK_FL_IMMUTABLE |
+					    MEDIA_LNK_FL_ENABLED);
 		if (ret < 0)
 			return ret;
 	}
@@ -293,7 +289,11 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
 		list_add_tail(&vsp1->hgo->entity.list_dev, &vsp1->entities);
 	}
 
-	if (vsp1->info->features & VSP1_HAS_LIF) {
+	/* The LIF is only supported when used in conjunction with the DU, in
+	 * which case the userspace API is disabled. If the userspace API is
+	 * enabled skip the LIF, even when present.
+	 */
+	if (vsp1->info->features & VSP1_HAS_LIF && !vsp1->info->uapi) {
 		vsp1->lif = vsp1_lif_create(vsp1);
 		if (IS_ERR(vsp1->lif)) {
 			ret = PTR_ERR(vsp1->lif);
-- 
2.7.3


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

* [PATCH v4 6/6] v4l: vsp1: Set entities functions
  2016-05-19 23:40 [PATCH v4 0/6] R-Car VSP: Add and set media entities functions Laurent Pinchart
                   ` (4 preceding siblings ...)
  2016-05-19 23:40 ` [PATCH v4 5/6] v4l: vsp1: Don't create LIF entity when the userspace API is enabled Laurent Pinchart
@ 2016-05-19 23:40 ` Laurent Pinchart
  2016-05-23 13:52 ` [PATCH v4 0/6] R-Car VSP: Add and set media " Sakari Ailus
  6 siblings, 0 replies; 10+ messages in thread
From: Laurent Pinchart @ 2016-05-19 23:40 UTC (permalink / raw)
  To: linux-media; +Cc: Sakari Ailus, Hans Verkuil

Initialize the function field of all subdev entities instantiated by the
driver. This gets rids of multiple warnings printed by the media
controller core.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/media/platform/vsp1/vsp1_bru.c    | 3 ++-
 drivers/media/platform/vsp1/vsp1_entity.c | 3 ++-
 drivers/media/platform/vsp1/vsp1_entity.h | 2 +-
 drivers/media/platform/vsp1/vsp1_hgo.c    | 3 ++-
 drivers/media/platform/vsp1/vsp1_hsit.c   | 5 +++--
 drivers/media/platform/vsp1/vsp1_lif.c    | 7 ++++++-
 drivers/media/platform/vsp1/vsp1_lut.c    | 3 ++-
 drivers/media/platform/vsp1/vsp1_rpf.c    | 3 ++-
 drivers/media/platform/vsp1/vsp1_sru.c    | 3 ++-
 drivers/media/platform/vsp1/vsp1_uds.c    | 3 ++-
 drivers/media/platform/vsp1/vsp1_wpf.c    | 3 ++-
 11 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_bru.c b/drivers/media/platform/vsp1/vsp1_bru.c
index b1068c018011..835593dd88b3 100644
--- a/drivers/media/platform/vsp1/vsp1_bru.c
+++ b/drivers/media/platform/vsp1/vsp1_bru.c
@@ -390,7 +390,8 @@ struct vsp1_bru *vsp1_bru_create(struct vsp1_device *vsp1)
 	bru->entity.type = VSP1_ENTITY_BRU;
 
 	ret = vsp1_entity_init(vsp1, &bru->entity, "bru",
-			       vsp1->info->num_bru_inputs + 1, &bru_ops);
+			       vsp1->info->num_bru_inputs + 1, &bru_ops,
+			       MEDIA_ENT_F_PROC_VIDEO_COMPOSER);
 	if (ret < 0)
 		return ERR_PTR(ret);
 
diff --git a/drivers/media/platform/vsp1/vsp1_entity.c b/drivers/media/platform/vsp1/vsp1_entity.c
index 2d278583ce17..86499433441f 100644
--- a/drivers/media/platform/vsp1/vsp1_entity.c
+++ b/drivers/media/platform/vsp1/vsp1_entity.c
@@ -443,7 +443,7 @@ static const struct vsp1_route vsp1_routes[] = {
 
 int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity,
 		     const char *name, unsigned int num_pads,
-		     const struct v4l2_subdev_ops *ops)
+		     const struct v4l2_subdev_ops *ops, u32 function)
 {
 	struct v4l2_subdev *subdev;
 	unsigned int i;
@@ -486,6 +486,7 @@ int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity,
 	subdev = &entity->subdev;
 	v4l2_subdev_init(subdev, ops);
 
+	subdev->entity.function = function;
 	subdev->entity.ops = &vsp1->media_ops;
 	subdev->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
 
diff --git a/drivers/media/platform/vsp1/vsp1_entity.h b/drivers/media/platform/vsp1/vsp1_entity.h
index ea3f4125aa1c..777f89608882 100644
--- a/drivers/media/platform/vsp1/vsp1_entity.h
+++ b/drivers/media/platform/vsp1/vsp1_entity.h
@@ -106,7 +106,7 @@ static inline struct vsp1_entity *to_vsp1_entity(struct v4l2_subdev *subdev)
 
 int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity,
 		     const char *name, unsigned int num_pads,
-		     const struct v4l2_subdev_ops *ops);
+		     const struct v4l2_subdev_ops *ops, u32 function);
 void vsp1_entity_destroy(struct vsp1_entity *entity);
 
 extern const struct v4l2_subdev_internal_ops vsp1_subdev_internal_ops;
diff --git a/drivers/media/platform/vsp1/vsp1_hgo.c b/drivers/media/platform/vsp1/vsp1_hgo.c
index 8ca0ac3900bd..eeb08879fb87 100644
--- a/drivers/media/platform/vsp1/vsp1_hgo.c
+++ b/drivers/media/platform/vsp1/vsp1_hgo.c
@@ -465,7 +465,8 @@ struct vsp1_hgo *vsp1_hgo_create(struct vsp1_device *vsp1)
 	hgo->entity.ops = &hgo_entity_ops;
 	hgo->entity.type = VSP1_ENTITY_HGO;
 
-	ret = vsp1_entity_init(vsp1, &hgo->entity, "hgo", 2, &hgo_ops);
+	ret = vsp1_entity_init(vsp1, &hgo->entity, "hgo", 2, &hgo_ops,
+			       MEDIA_ENT_F_PROC_VIDEO_STATISTICS);
 	if (ret < 0)
 		return ERR_PTR(ret);
 
diff --git a/drivers/media/platform/vsp1/vsp1_hsit.c b/drivers/media/platform/vsp1/vsp1_hsit.c
index 68b8567b374d..41b09e49e659 100644
--- a/drivers/media/platform/vsp1/vsp1_hsit.c
+++ b/drivers/media/platform/vsp1/vsp1_hsit.c
@@ -161,8 +161,9 @@ struct vsp1_hsit *vsp1_hsit_create(struct vsp1_device *vsp1, bool inverse)
 	else
 		hsit->entity.type = VSP1_ENTITY_HST;
 
-	ret = vsp1_entity_init(vsp1, &hsit->entity, inverse ? "hsi" : "hst", 2,
-			       &hsit_ops);
+	ret = vsp1_entity_init(vsp1, &hsit->entity, inverse ? "hsi" : "hst",
+			       2, &hsit_ops,
+			       MEDIA_ENT_F_PROC_VIDEO_PIXEL_ENC_CONV);
 	if (ret < 0)
 		return ERR_PTR(ret);
 
diff --git a/drivers/media/platform/vsp1/vsp1_lif.c b/drivers/media/platform/vsp1/vsp1_lif.c
index 0217393f22df..60d26b600768 100644
--- a/drivers/media/platform/vsp1/vsp1_lif.c
+++ b/drivers/media/platform/vsp1/vsp1_lif.c
@@ -165,7 +165,12 @@ struct vsp1_lif *vsp1_lif_create(struct vsp1_device *vsp1)
 	lif->entity.ops = &lif_entity_ops;
 	lif->entity.type = VSP1_ENTITY_LIF;
 
-	ret = vsp1_entity_init(vsp1, &lif->entity, "lif", 2, &lif_ops);
+	/* The LIF is never exposed to userspace, but media entity registration
+	 * requires a function to be set. Use PROC_VIDEO_PIXEL_FORMATTER just to
+	 * avoid triggering a WARN_ON(), the value won't be seen anywhere.
+	 */
+	ret = vsp1_entity_init(vsp1, &lif->entity, "lif", 2, &lif_ops,
+			       MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER);
 	if (ret < 0)
 		return ERR_PTR(ret);
 
diff --git a/drivers/media/platform/vsp1/vsp1_lut.c b/drivers/media/platform/vsp1/vsp1_lut.c
index aa09e59f0ab8..2c367cb9755c 100644
--- a/drivers/media/platform/vsp1/vsp1_lut.c
+++ b/drivers/media/platform/vsp1/vsp1_lut.c
@@ -204,7 +204,8 @@ struct vsp1_lut *vsp1_lut_create(struct vsp1_device *vsp1)
 	lut->entity.ops = &lut_entity_ops;
 	lut->entity.type = VSP1_ENTITY_LUT;
 
-	ret = vsp1_entity_init(vsp1, &lut->entity, "lut", 2, &lut_ops);
+	ret = vsp1_entity_init(vsp1, &lut->entity, "lut", 2, &lut_ops,
+			       MEDIA_ENT_F_PROC_VIDEO_LUT);
 	if (ret < 0)
 		return ERR_PTR(ret);
 
diff --git a/drivers/media/platform/vsp1/vsp1_rpf.c b/drivers/media/platform/vsp1/vsp1_rpf.c
index 64dfbddf2aba..4895038c5fc0 100644
--- a/drivers/media/platform/vsp1/vsp1_rpf.c
+++ b/drivers/media/platform/vsp1/vsp1_rpf.c
@@ -237,7 +237,8 @@ struct vsp1_rwpf *vsp1_rpf_create(struct vsp1_device *vsp1, unsigned int index)
 	rpf->entity.index = index;
 
 	sprintf(name, "rpf.%u", index);
-	ret = vsp1_entity_init(vsp1, &rpf->entity, name, 2, &rpf_ops);
+	ret = vsp1_entity_init(vsp1, &rpf->entity, name, 2, &rpf_ops,
+			       MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER);
 	if (ret < 0)
 		return ERR_PTR(ret);
 
diff --git a/drivers/media/platform/vsp1/vsp1_sru.c b/drivers/media/platform/vsp1/vsp1_sru.c
index 97ef997ae735..9dc7c77c74f8 100644
--- a/drivers/media/platform/vsp1/vsp1_sru.c
+++ b/drivers/media/platform/vsp1/vsp1_sru.c
@@ -308,7 +308,8 @@ struct vsp1_sru *vsp1_sru_create(struct vsp1_device *vsp1)
 	sru->entity.ops = &sru_entity_ops;
 	sru->entity.type = VSP1_ENTITY_SRU;
 
-	ret = vsp1_entity_init(vsp1, &sru->entity, "sru", 2, &sru_ops);
+	ret = vsp1_entity_init(vsp1, &sru->entity, "sru", 2, &sru_ops,
+			       MEDIA_ENT_F_PROC_VIDEO_SCALER);
 	if (ret < 0)
 		return ERR_PTR(ret);
 
diff --git a/drivers/media/platform/vsp1/vsp1_uds.c b/drivers/media/platform/vsp1/vsp1_uds.c
index 1875e29da184..26f7393d278e 100644
--- a/drivers/media/platform/vsp1/vsp1_uds.c
+++ b/drivers/media/platform/vsp1/vsp1_uds.c
@@ -314,7 +314,8 @@ struct vsp1_uds *vsp1_uds_create(struct vsp1_device *vsp1, unsigned int index)
 	uds->entity.index = index;
 
 	sprintf(name, "uds.%u", index);
-	ret = vsp1_entity_init(vsp1, &uds->entity, name, 2, &uds_ops);
+	ret = vsp1_entity_init(vsp1, &uds->entity, name, 2, &uds_ops,
+			       MEDIA_ENT_F_PROC_VIDEO_SCALER);
 	if (ret < 0)
 		return ERR_PTR(ret);
 
diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c b/drivers/media/platform/vsp1/vsp1_wpf.c
index 6c91eaa35e75..4e391ccf8ba4 100644
--- a/drivers/media/platform/vsp1/vsp1_wpf.c
+++ b/drivers/media/platform/vsp1/vsp1_wpf.c
@@ -216,7 +216,8 @@ struct vsp1_rwpf *vsp1_wpf_create(struct vsp1_device *vsp1, unsigned int index)
 	wpf->entity.index = index;
 
 	sprintf(name, "wpf.%u", index);
-	ret = vsp1_entity_init(vsp1, &wpf->entity, name, 2, &wpf_ops);
+	ret = vsp1_entity_init(vsp1, &wpf->entity, name, 2, &wpf_ops,
+			       MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER);
 	if (ret < 0)
 		return ERR_PTR(ret);
 
-- 
2.7.3


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

* Re: [PATCH v4 1/6] media: Add video processing entity functions
  2016-05-19 23:40 ` [PATCH v4 1/6] media: Add video processing entity functions Laurent Pinchart
@ 2016-05-23  9:06   ` Hans Verkuil
  0 siblings, 0 replies; 10+ messages in thread
From: Hans Verkuil @ 2016-05-23  9:06 UTC (permalink / raw)
  To: Laurent Pinchart, linux-media; +Cc: Sakari Ailus

On 05/20/2016 01:40 AM, Laurent Pinchart wrote:
> Add composer, pixel formatter, pixel encoding converter and scaler
> functions.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

Looks good!

	Hans

> ---
>  Documentation/DocBook/media/v4l/media-types.xml | 55 +++++++++++++++++++++++++
>  include/uapi/linux/media.h                      |  9 ++++
>  2 files changed, 64 insertions(+)
> 
> diff --git a/Documentation/DocBook/media/v4l/media-types.xml b/Documentation/DocBook/media/v4l/media-types.xml
> index 5e3f20fdcf17..60fe841f8846 100644
> --- a/Documentation/DocBook/media/v4l/media-types.xml
> +++ b/Documentation/DocBook/media/v4l/media-types.xml
> @@ -121,6 +121,61 @@
>  	    <entry><constant>MEDIA_ENT_F_AUDIO_MIXER</constant></entry>
>  	    <entry>Audio Mixer Function Entity.</entry>
>  	  </row>
> +	  <row>
> +	    <entry><constant>MEDIA_ENT_F_PROC_VIDEO_COMPOSER</constant></entry>
> +	    <entry>Video composer (blender). An entity capable of video
> +		   composing must have at least two sink pads and one source
> +		   pad, and composes input video frames onto output video
> +		   frames. Composition can be performed using alpha blending,
> +		   color keying, raster operations (ROP), stitching or any other
> +		   means.
> +	    </entry>
> +	  </row>
> +	  <row>
> +	    <entry><constant>MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER</constant></entry>
> +	    <entry>Video pixel formatter. An entity capable of pixel formatting
> +		   must have at least one sink pad and one source pad. Read
> +		   pixel formatters read pixels from memory and perform a subset
> +		   of unpacking, cropping, color keying, alpha multiplication
> +		   and pixel encoding conversion. Write pixel formatters perform
> +		   a subset of dithering, pixel encoding conversion and packing
> +		   and write pixels to memory.
> +	    </entry>
> +	  </row>
> +	  <row>
> +	    <entry><constant>MEDIA_ENT_F_PROC_VIDEO_PIXEL_ENC_CONV</constant></entry>
> +	    <entry>Video pixel encoding converter. An entity capable of pixel
> +		   enconding conversion must have at least one sink pad and one
> +		   source pad, and convert the encoding of pixels received on
> +		   its sink pad(s) to a different encoding output on its source
> +		   pad(s). Pixel encoding conversion includes but isn't limited
> +		   to RGB to/from HSV, RGB to/from YUV and CFA (Bayer) to RGB
> +		   conversions.
> +	    </entry>
> +	  </row>
> +	  <row>
> +	    <entry><constant>MEDIA_ENT_F_PROC_VIDEO_LUT</constant></entry>
> +	    <entry>Video look-up table. An entity capable of video lookup table
> +		   processing must have one sink pad and one source pad. It uses
> +		   the values of the pixels received on its sink pad to look up
> +		   entries in internal tables and output them on its source pad.
> +		   The lookup processing can be performed on all components
> +		   separately or combine them for multi-dimensional table
> +		   lookups.
> +	    </entry>
> +	  </row>
> +	  <row>
> +	    <entry><constant>MEDIA_ENT_F_PROC_VIDEO_SCALER</constant></entry>
> +	    <entry>Video scaler. An entity capable of video scaling must have
> +		   at least one sink pad and one source pad, and scale the
> +		   video frame(s) received on its sink pad(s) to a different
> +		   resolution output on its source pad(s). The range of
> +		   supported scaling ratios is entity-specific and can differ
> +		   between the horizontal and vertical directions (in particular
> +		   scaling can be supported in one direction only). Binning and
> +		   skipping are considered as scaling.
> +	    </entry>
> +	  </row>
>  	</tbody>
>        </tgroup>
>      </table>
> diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h
> index e226bc35c639..bff3ffdfd55f 100644
> --- a/include/uapi/linux/media.h
> +++ b/include/uapi/linux/media.h
> @@ -96,6 +96,15 @@ struct media_device_info {
>  #define MEDIA_ENT_F_AUDIO_MIXER		(MEDIA_ENT_F_BASE + 0x03003)
>  
>  /*
> + * Processing entities
> + */
> +#define MEDIA_ENT_F_PROC_VIDEO_COMPOSER		(MEDIA_ENT_F_BASE + 0x4001)
> +#define MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER	(MEDIA_ENT_F_BASE + 0x4002)
> +#define MEDIA_ENT_F_PROC_VIDEO_PIXEL_ENC_CONV	(MEDIA_ENT_F_BASE + 0x4003)
> +#define MEDIA_ENT_F_PROC_VIDEO_LUT		(MEDIA_ENT_F_BASE + 0x4004)
> +#define MEDIA_ENT_F_PROC_VIDEO_SCALER		(MEDIA_ENT_F_BASE + 0x4005)
> +
> +/*
>   * Connectors
>   */
>  /* It is a responsibility of the entity drivers to add connectors and links */
> 

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

* Re: [PATCH v4 2/6] media: Add video statistics computation functions
  2016-05-19 23:40 ` [PATCH v4 2/6] media: Add video statistics computation functions Laurent Pinchart
@ 2016-05-23  9:10   ` Hans Verkuil
  0 siblings, 0 replies; 10+ messages in thread
From: Hans Verkuil @ 2016-05-23  9:10 UTC (permalink / raw)
  To: Laurent Pinchart, linux-media; +Cc: Sakari Ailus

On 05/20/2016 01:40 AM, Laurent Pinchart wrote:
> The video statistics function describes entities such as video histogram
> engines or 3A statistics engines.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

Regards,

	Hans

> ---
>  Documentation/DocBook/media/v4l/media-types.xml | 9 +++++++++
>  include/uapi/linux/media.h                      | 1 +
>  2 files changed, 10 insertions(+)
> 
> diff --git a/Documentation/DocBook/media/v4l/media-types.xml b/Documentation/DocBook/media/v4l/media-types.xml
> index 60fe841f8846..95aa1f9c836a 100644
> --- a/Documentation/DocBook/media/v4l/media-types.xml
> +++ b/Documentation/DocBook/media/v4l/media-types.xml
> @@ -176,6 +176,15 @@
>  		   skipping are considered as scaling.
>  	    </entry>
>  	  </row>
> +	  <row>
> +	    <entry><constant>MEDIA_ENT_F_PROC_VIDEO_STATISTICS</constant></entry>
> +	    <entry>Video statistics computation (histogram, 3A, ...). An entity
> +		   capable of statistics computation must have one sink pad and
> +		   one source pad. It computes statistics over the frames
> +		   received on its sink pad and outputs the statistics data on
> +		   its source pad.
> +	    </entry>
> +	  </row>
>  	</tbody>
>        </tgroup>
>      </table>
> diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h
> index bff3ffdfd55f..4580328c4093 100644
> --- a/include/uapi/linux/media.h
> +++ b/include/uapi/linux/media.h
> @@ -103,6 +103,7 @@ struct media_device_info {
>  #define MEDIA_ENT_F_PROC_VIDEO_PIXEL_ENC_CONV	(MEDIA_ENT_F_BASE + 0x4003)
>  #define MEDIA_ENT_F_PROC_VIDEO_LUT		(MEDIA_ENT_F_BASE + 0x4004)
>  #define MEDIA_ENT_F_PROC_VIDEO_SCALER		(MEDIA_ENT_F_BASE + 0x4005)
> +#define MEDIA_ENT_F_PROC_VIDEO_STATISTICS	(MEDIA_ENT_F_BASE + 0x4006)
>  
>  /*
>   * Connectors
> 

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

* Re: [PATCH v4 0/6] R-Car VSP: Add and set media entities functions
  2016-05-19 23:40 [PATCH v4 0/6] R-Car VSP: Add and set media entities functions Laurent Pinchart
                   ` (5 preceding siblings ...)
  2016-05-19 23:40 ` [PATCH v4 6/6] v4l: vsp1: Set entities functions Laurent Pinchart
@ 2016-05-23 13:52 ` Sakari Ailus
  6 siblings, 0 replies; 10+ messages in thread
From: Sakari Ailus @ 2016-05-23 13:52 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: linux-media, Hans Verkuil

On Fri, May 20, 2016 at 02:40:26AM +0300, Laurent Pinchart wrote:
> Hello,
> 
> This patch series adds new media entities functions for video processing and
> video statistics computation, and updates the VSP driver to use the new
> functions.
> 
> Patches 1/6 and 2/6 define and document the new functions. They have been
> submitted previously in the "[PATCH v2 00/54] R-Car VSP improvements for v4.7"
> patch series, this version takes feedback received over e-mail and IRC into
> account.
> 
> Patches 3/6 to 5/6 prepare the VSP driver to report the correct entity
> functions. They make sure that the LIF will never be exposed to userspace as
> no function currently exists for that block, and it isn't clear at the moment
> what new function should be added. As the LIF is only needed when the VSP is
> controlled directly from the DU driver without being exposed to userspace, a
> function isn't needed for the LIF anyway.
> 
> Patch 6/6 finally sets functions for all the VSP entities.
> 
> The code is based on top of the "[PATCH/RFC v2 0/4] Meta-data video device
> type" patch series, although it doesn't strictly depend on it. For convenience
> I've pushed all patches to

Thanks!

For patches 1 and 2:

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>

-- 
Sakari Ailus
e-mail: sakari.ailus@iki.fi	XMPP: sailus@retiisi.org.uk

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

end of thread, other threads:[~2016-05-23 13:52 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-19 23:40 [PATCH v4 0/6] R-Car VSP: Add and set media entities functions Laurent Pinchart
2016-05-19 23:40 ` [PATCH v4 1/6] media: Add video processing entity functions Laurent Pinchart
2016-05-23  9:06   ` Hans Verkuil
2016-05-19 23:40 ` [PATCH v4 2/6] media: Add video statistics computation functions Laurent Pinchart
2016-05-23  9:10   ` Hans Verkuil
2016-05-19 23:40 ` [PATCH v4 3/6] v4l: vsp1: Base link creation on availability of entities Laurent Pinchart
2016-05-19 23:40 ` [PATCH v4 4/6] v4l: vsp1: Don't register media device when userspace API is disabled Laurent Pinchart
2016-05-19 23:40 ` [PATCH v4 5/6] v4l: vsp1: Don't create LIF entity when the userspace API is enabled Laurent Pinchart
2016-05-19 23:40 ` [PATCH v4 6/6] v4l: vsp1: Set entities functions Laurent Pinchart
2016-05-23 13:52 ` [PATCH v4 0/6] R-Car VSP: Add and set media " Sakari Ailus

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).