Skip to contentSkip to conversation

media: Add a Kconfig option for the Request API

PATCH Superseded Sakari Ailus 2 participants 2 messages Dec 5, 2018

Subsystems (5)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: Add a Kconfig option for the Request API

The Request API is now merged to the kernel but the confidence on the stability of that API is not great, especially regarding the interaction with V4L2.

Add a Kconfig option for the API, with a scary-looking warning.

The patch itself disables request creation as well as does not advertise them as buffer flags. The driver requiring requests (cedrus) now depends on the Kconfig option as well.

---
I hope this covers now everything... I was thinking how to make the option name itself more worrisome but I couldn't come up with a better language that would be compact enough. The "(EXPERIMENTAL)" notion is a bit too worn to be effective. :-I

The patch can and should be reverted once we're entirely happy and confident with the API.

 drivers/media/Kconfig                           | 13 +++++++++++++
 drivers/media/common/videobuf2/videobuf2-v4l2.c |  2 ++
 drivers/media/media-device.c                    |  2 ++
 drivers/staging/media/sunxi/cedrus/Kconfig      |  1 +
 4 files changed, 18 insertions(+)
drivers/media/Kconfig +13 -0
index 8add62a18293..102eb35fcf3f 100644
@@ -110,6 +110,19 @@ config MEDIA_CONTROLLER_DVB
 
 	  This is currently experimental.
 
+config MEDIA_CONTROLLER_REQUEST_API
+	bool "Enable Media controller Request API (EXPERIMENTAL)"
+	depends on MEDIA_CONTROLLER && STAGING_MEDIA
+	default n
+	---help---
+	  DO NOT ENABLE THIS OPTION UNLESS YOU KNOW WHAT YOU'RE DOING.
+
+	  This option enables the Request API for the Media controller and V4L2
+	  interfaces. It is currently needed by a few stateless codec drivers.
+
+	  There is currently no intention to provide API or ABI stability for
+	  this new API as of yet.
+
 #
 # Video4Linux support
 #	Only enables if one of the V4L2 types (ATV, webcam, radio) is selected
drivers/media/common/videobuf2/videobuf2-v4l2.c +2 -0
index 1244c246d0c4..83c3c0c49e56 100644
@@ -630,8 +630,10 @@ static void fill_buf_caps(struct vb2_queue *q, u32 *caps)
 		*caps |= V4L2_BUF_CAP_SUPPORTS_USERPTR;
 	if (q->io_modes & VB2_DMABUF)
 		*caps |= V4L2_BUF_CAP_SUPPORTS_DMABUF;
+#ifdef CONFIG_MEDIA_CONTROLLER_REQUEST_API
 	if (q->supports_requests)
 		*caps |= V4L2_BUF_CAP_SUPPORTS_REQUESTS;
+#endif
 }
 
 int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req)
drivers/media/media-device.c +2 -0
index bed24372e61f..2ef114ce38d0 100644
@@ -381,7 +381,9 @@ static long media_device_get_topology(struct media_device *mdev, void *arg)
 static long media_device_request_alloc(struct media_device *mdev,
 				       int *alloc_fd)
 {
+#ifndef CONFIG_MEDIA_CONTROLLER_REQUEST_API
 	if (!mdev->ops || !mdev->ops->req_validate || !mdev->ops->req_queue)
+#endif
 		return -ENOTTY;
 
 	return media_request_alloc(mdev, alloc_fd);
drivers/staging/media/sunxi/cedrus/Kconfig +1 -0
index a7a34e89c42d..3252efa422f9 100644
@@ -3,6 +3,7 @@ config VIDEO_SUNXI_CEDRUS
 	depends on VIDEO_DEV && VIDEO_V4L2 && MEDIA_CONTROLLER
 	depends on HAS_DMA
 	depends on OF
+	depends on MEDIA_CONTROLLER_REQUEST_API
 	select SUNXI_SRAM
 	select VIDEOBUF2_DMA_CONTIG
 	select V4L2_MEM2MEM_DEV
Signature · 1 line
2.11.0
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Sakari Ailus

The Request API is now merged to the kernel but the confidence on the stability of that API is not great, especially regarding the interaction with V4L2.

Add a Kconfig option for the API, with a scary-looking warning.

The patch itself disables request creation as well as does not advertise them as buffer flags. The driver requiring requests (cedrus) now depends on the Kconfig option as well.

Quoted 81 lines

---
I hope this covers now everything... I was thinking how to make the option name itself more worrisome but I couldn't come up with a better language that would be compact enough. The "(EXPERIMENTAL)" notion is a bit too worn to be effective. :-I

The patch can and should be reverted once we're entirely happy and confident with the API.

 drivers/media/Kconfig                           | 13 +++++++++++++
 drivers/media/common/videobuf2/videobuf2-v4l2.c |  2 ++
 drivers/media/media-device.c                    |  2 ++
 drivers/staging/media/sunxi/cedrus/Kconfig      |  1 +
 4 files changed, 18 insertions(+)
drivers/media/Kconfig +13 -0
index 8add62a18293..102eb35fcf3f 100644
@@ -110,6 +110,19 @@ config MEDIA_CONTROLLER_DVB
 
 	  This is currently experimental.
 
+config MEDIA_CONTROLLER_REQUEST_API
+	bool "Enable Media controller Request API (EXPERIMENTAL)"
+	depends on MEDIA_CONTROLLER && STAGING_MEDIA
+	default n
+	---help---
+	  DO NOT ENABLE THIS OPTION UNLESS YOU KNOW WHAT YOU'RE DOING.
+
+	  This option enables the Request API for the Media controller and V4L2
+	  interfaces. It is currently needed by a few stateless codec drivers.
+
+	  There is currently no intention to provide API or ABI stability for
+	  this new API as of yet.
+
 #
 # Video4Linux support
 #	Only enables if one of the V4L2 types (ATV, webcam, radio) is selected
drivers/media/common/videobuf2/videobuf2-v4l2.c +2 -0
index 1244c246d0c4..83c3c0c49e56 100644
@@ -630,8 +630,10 @@ static void fill_buf_caps(struct vb2_queue *q, u32 *caps)
 		*caps |= V4L2_BUF_CAP_SUPPORTS_USERPTR;
 	if (q->io_modes & VB2_DMABUF)
 		*caps |= V4L2_BUF_CAP_SUPPORTS_DMABUF;
+#ifdef CONFIG_MEDIA_CONTROLLER_REQUEST_API
 	if (q->supports_requests)
 		*caps |= V4L2_BUF_CAP_SUPPORTS_REQUESTS;
+#endif
 }
 
 int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req)
drivers/media/media-device.c +2 -0
index bed24372e61f..2ef114ce38d0 100644
@@ -381,7 +381,9 @@ static long media_device_get_topology(struct media_device *mdev, void *arg)
 static long media_device_request_alloc(struct media_device *mdev,
 				       int *alloc_fd)
 {
+#ifndef CONFIG_MEDIA_CONTROLLER_REQUEST_API
 	if (!mdev->ops || !mdev->ops->req_validate || !mdev->ops->req_queue)
+#endif
 		return -ENOTTY;
 
 	return media_request_alloc(mdev, alloc_fd);
drivers/staging/media/sunxi/cedrus/Kconfig +1 -0
index a7a34e89c42d..3252efa422f9 100644
@@ -3,6 +3,7 @@ config VIDEO_SUNXI_CEDRUS
 	depends on VIDEO_DEV && VIDEO_V4L2 && MEDIA_CONTROLLER
 	depends on HAS_DMA
 	depends on OF
+	depends on MEDIA_CONTROLLER_REQUEST_API
 	select SUNXI_SRAM
 	select VIDEOBUF2_DMA_CONTIG
 	select V4L2_MEM2MEM_DEV