Skip to content

Commit 078ab3e

Browse files
Sakari Ailusmchehab
authored andcommitted
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. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
1 parent cd9fd6f commit 078ab3e

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

drivers/media/Kconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,19 @@ config MEDIA_CONTROLLER_DVB
110110

111111
This is currently experimental.
112112

113+
config MEDIA_CONTROLLER_REQUEST_API
114+
bool "Enable Media controller Request API (EXPERIMENTAL)"
115+
depends on MEDIA_CONTROLLER && STAGING_MEDIA
116+
default n
117+
---help---
118+
DO NOT ENABLE THIS OPTION UNLESS YOU KNOW WHAT YOU'RE DOING.
119+
120+
This option enables the Request API for the Media controller and V4L2
121+
interfaces. It is currently needed by a few stateless codec drivers.
122+
123+
There is currently no intention to provide API or ABI stability for
124+
this new API as of yet.
125+
113126
#
114127
# Video4Linux support
115128
# Only enables if one of the V4L2 types (ATV, webcam, radio) is selected

drivers/media/common/videobuf2/videobuf2-v4l2.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,8 +634,10 @@ static void fill_buf_caps(struct vb2_queue *q, u32 *caps)
634634
*caps |= V4L2_BUF_CAP_SUPPORTS_USERPTR;
635635
if (q->io_modes & VB2_DMABUF)
636636
*caps |= V4L2_BUF_CAP_SUPPORTS_DMABUF;
637+
#ifdef CONFIG_MEDIA_CONTROLLER_REQUEST_API
637638
if (q->supports_requests)
638639
*caps |= V4L2_BUF_CAP_SUPPORTS_REQUESTS;
640+
#endif
639641
}
640642

641643
int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req)

drivers/media/media-device.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,10 +381,14 @@ static long media_device_get_topology(struct media_device *mdev, void *arg)
381381
static long media_device_request_alloc(struct media_device *mdev,
382382
int *alloc_fd)
383383
{
384+
#ifdef CONFIG_MEDIA_CONTROLLER_REQUEST_API
384385
if (!mdev->ops || !mdev->ops->req_validate || !mdev->ops->req_queue)
385386
return -ENOTTY;
386387

387388
return media_request_alloc(mdev, alloc_fd);
389+
#else
390+
return -ENOTTY;
391+
#endif
388392
}
389393

390394
static long copy_arg_from_user(void *karg, void __user *uarg, unsigned int cmd)

drivers/staging/media/sunxi/cedrus/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ config VIDEO_SUNXI_CEDRUS
33
depends on VIDEO_DEV && VIDEO_V4L2 && MEDIA_CONTROLLER
44
depends on HAS_DMA
55
depends on OF
6+
depends on MEDIA_CONTROLLER_REQUEST_API
67
select SUNXI_SRAM
78
select VIDEOBUF2_DMA_CONTIG
89
select V4L2_MEM2MEM_DEV

0 commit comments

Comments
 (0)