2021-09-03 15:27:30

by Guillaume Tucker

[permalink] [raw]
Subject: [PATCH v3] media: vivid: drop FB dependency with new VIDEO_VIVID_FB

Drop the vivid dependency on CONFIG_FB by introducing a new
CONFIG_VIDEO_VIVID_FB option which depends on CONFIG_FB instead and
selects the generic CFB options when enabled. Compile out parts of
the code that make use of the framebuffer API when not enabled. This
is particularly useful as CONFIG_FB is not selected by
CONFIG_DRM_FBDEV_EMULATION any more.

Suggested-by: Hans Verkuil <[email protected]>
Signed-off-by: Guillaume Tucker <[email protected]>
---

Notes:
Changes in v3:
* use CONFIG_VIDEO_VIVID_FB instead of CONFIG_FB
* select CFB options to fix linkage issue

Changes in v2:
* fix Makefile conditional for when CONFIG_FB=m
* compile-out bit 16 (framebuffer) when no CONFIG_FB

drivers/media/test-drivers/vivid/Kconfig | 16 ++++++++++++----
drivers/media/test-drivers/vivid/Makefile | 5 ++++-
drivers/media/test-drivers/vivid/vivid-core.c | 9 +++++++++
drivers/media/test-drivers/vivid/vivid-ctrls.c | 4 ++++
4 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/drivers/media/test-drivers/vivid/Kconfig b/drivers/media/test-drivers/vivid/Kconfig
index c3abde2986b2..7cadaefea010 100644
--- a/drivers/media/test-drivers/vivid/Kconfig
+++ b/drivers/media/test-drivers/vivid/Kconfig
@@ -1,13 +1,10 @@
# SPDX-License-Identifier: GPL-2.0-only
config VIDEO_VIVID
tristate "Virtual Video Test Driver"
- depends on VIDEO_DEV && VIDEO_V4L2 && !SPARC32 && !SPARC64 && FB
+ depends on VIDEO_DEV && VIDEO_V4L2 && !SPARC32 && !SPARC64
depends on HAS_DMA
select FONT_SUPPORT
select FONT_8x16
- select FB_CFB_FILLRECT
- select FB_CFB_COPYAREA
- select FB_CFB_IMAGEBLIT
select VIDEOBUF2_VMALLOC
select VIDEOBUF2_DMA_CONTIG
select VIDEO_V4L2_TPG
@@ -41,3 +38,14 @@ config VIDEO_VIVID_MAX_DEVS
help
This allows you to specify the maximum number of devices supported
by the vivid driver.
+
+config VIDEO_VIVID_FB
+ bool "Enable framebuffer for testing overlays"
+ depends on VIDEO_VIVID
+ depends on FB
+ select FB_CFB_FILLRECT
+ select FB_CFB_COPYAREA
+ select FB_CFB_IMAGEBLIT
+ default y
+ help
+ Enable vivid framebuffer support for testing overlays.
diff --git a/drivers/media/test-drivers/vivid/Makefile b/drivers/media/test-drivers/vivid/Makefile
index b12ad0152a3e..b48bd13239f5 100644
--- a/drivers/media/test-drivers/vivid/Makefile
+++ b/drivers/media/test-drivers/vivid/Makefile
@@ -3,10 +3,13 @@ vivid-objs := vivid-core.o vivid-ctrls.o vivid-vid-common.o vivid-vbi-gen.o \
vivid-vid-cap.o vivid-vid-out.o vivid-kthread-cap.o vivid-kthread-out.o \
vivid-radio-rx.o vivid-radio-tx.o vivid-radio-common.o \
vivid-rds-gen.o vivid-sdr-cap.o vivid-vbi-cap.o vivid-vbi-out.o \
- vivid-osd.o vivid-meta-cap.o vivid-meta-out.o \
+ vivid-meta-cap.o vivid-meta-out.o \
vivid-kthread-touch.o vivid-touch-cap.o
ifeq ($(CONFIG_VIDEO_VIVID_CEC),y)
vivid-objs += vivid-cec.o
endif
+ifeq ($(CONFIG_VIDEO_VIVID_FB),y)
+ vivid-objs += vivid-osd.o
+endif

obj-$(CONFIG_VIDEO_VIVID) += vivid.o
diff --git a/drivers/media/test-drivers/vivid/vivid-core.c b/drivers/media/test-drivers/vivid/vivid-core.c
index 87f27c7524ec..3e785c6ce5dd 100644
--- a/drivers/media/test-drivers/vivid/vivid-core.c
+++ b/drivers/media/test-drivers/vivid/vivid-core.c
@@ -126,7 +126,9 @@ MODULE_PARM_DESC(node_types, " node types, default is 0xe1d3d. Bitmask with the
"\t\t bit 8: Video Output node\n"
"\t\t bit 10-11: VBI Output node: 0 = none, 1 = raw vbi, 2 = sliced vbi, 3 = both\n"
"\t\t bit 12: Radio Transmitter node\n"
+#if IS_ENABLED(CONFIG_VIDEO_VIVID_FB)
"\t\t bit 16: Framebuffer for testing overlays\n"
+#endif
"\t\t bit 17: Metadata Capture node\n"
"\t\t bit 18: Metadata Output node\n"
"\t\t bit 19: Touch Capture node\n");
@@ -1031,9 +1033,11 @@ static int vivid_detect_feature_set(struct vivid_dev *dev, int inst,
/* do we have a modulator? */
*has_modulator = dev->has_radio_tx;

+#if IS_ENABLED(CONFIG_VIDEO_VIVID_FB)
if (dev->has_vid_cap)
/* do we have a framebuffer for overlay testing? */
dev->has_fb = node_type & 0x10000;
+#endif

/* can we do crop/compose/scaling while capturing? */
if (no_error_inj && *ccs_cap == -1)
@@ -1365,6 +1369,7 @@ static int vivid_create_queues(struct vivid_dev *dev)
return ret;
}

+#if IS_ENABLED(CONFIG_VIDEO_VIVID_FB)
if (dev->has_fb) {
/* Create framebuffer for testing capture/output overlay */
ret = vivid_fb_init(dev);
@@ -1373,6 +1378,8 @@ static int vivid_create_queues(struct vivid_dev *dev)
v4l2_info(&dev->v4l2_dev, "Framebuffer device registered as fb%d\n",
dev->fb_info.node);
}
+#endif
+
return 0;
}

@@ -2079,12 +2086,14 @@ static int vivid_remove(struct platform_device *pdev)
video_device_node_name(&dev->radio_tx_dev));
video_unregister_device(&dev->radio_tx_dev);
}
+#if IS_ENABLED(CONFIG_VIDEO_VIVID_FB)
if (dev->has_fb) {
v4l2_info(&dev->v4l2_dev, "unregistering fb%d\n",
dev->fb_info.node);
unregister_framebuffer(&dev->fb_info);
vivid_fb_release_buffers(dev);
}
+#endif
if (dev->has_meta_cap) {
v4l2_info(&dev->v4l2_dev, "unregistering %s\n",
video_device_node_name(&dev->meta_cap_dev));
diff --git a/drivers/media/test-drivers/vivid/vivid-ctrls.c b/drivers/media/test-drivers/vivid/vivid-ctrls.c
index 8dc50fe22972..6cfd4808b38c 100644
--- a/drivers/media/test-drivers/vivid/vivid-ctrls.c
+++ b/drivers/media/test-drivers/vivid/vivid-ctrls.c
@@ -305,6 +305,7 @@ static const struct v4l2_ctrl_config vivid_ctrl_ro_int32 = {

/* Framebuffer Controls */

+#if IS_ENABLED(CONFIG_VIDEO_VIVID_FB)
static int vivid_fb_s_ctrl(struct v4l2_ctrl *ctrl)
{
struct vivid_dev *dev = container_of(ctrl->handler,
@@ -328,6 +329,7 @@ static const struct v4l2_ctrl_config vivid_ctrl_clear_fb = {
.name = "Clear Framebuffer",
.type = V4L2_CTRL_TYPE_BUTTON,
};
+#endif /* IS_ENABLED(CONFIG_VIDEO_VIVID_FB) */


/* Video User Controls */
@@ -1761,8 +1763,10 @@ int vivid_create_controls(struct vivid_dev *dev, bool show_ccs_cap,
(dev->has_vbi_cap && dev->has_vbi_out))
v4l2_ctrl_new_custom(hdl_loop_cap, &vivid_ctrl_loop_video, NULL);

+#if IS_ENABLED(CONFIG_VIDEO_VIVID_FB)
if (dev->has_fb)
v4l2_ctrl_new_custom(hdl_fb, &vivid_ctrl_clear_fb, NULL);
+#endif

if (dev->has_radio_rx) {
v4l2_ctrl_new_custom(hdl_radio_rx, &vivid_ctrl_radio_hw_seek_mode, NULL);
--
2.20.1


2021-09-06 19:30:31

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v3] media: vivid: drop FB dependency with new VIDEO_VIVID_FB

Hi Guillaume,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on v5.14]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Guillaume-Tucker/media-vivid-drop-FB-dependency-with-new-VIDEO_VIVID_FB/20210903-232914
base: git://linuxtv.org/media_tree.git master
config: x86_64-randconfig-r001-20210906 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/d730c581d478b1bddea0e3d6c0884f54487330ff
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Guillaume-Tucker/media-vivid-drop-FB-dependency-with-new-VIDEO_VIVID_FB/20210903-232914
git checkout d730c581d478b1bddea0e3d6c0884f54487330ff
# save the attached .config to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

ld: drivers/media/test-drivers/vivid/vivid-core.o: in function `vivid_remove':
>> drivers/media/test-drivers/vivid/vivid-core.c:2083: undefined reference to `unregister_framebuffer'
ld: drivers/media/test-drivers/vivid/vivid-osd.o: in function `vivid_fb_release_buffers':
>> drivers/media/test-drivers/vivid/vivid-osd.c:346: undefined reference to `fb_dealloc_cmap'
ld: drivers/media/test-drivers/vivid/vivid-osd.o: in function `vivid_fb_init_vidmode':
>> drivers/media/test-drivers/vivid/vivid-osd.c:327: undefined reference to `fb_alloc_cmap'
ld: drivers/media/test-drivers/vivid/vivid-osd.o: in function `vivid_fb_init':
>> drivers/media/test-drivers/vivid/vivid-osd.c:379: undefined reference to `register_framebuffer'
>> ld: drivers/media/test-drivers/vivid/vivid-osd.o:(.rodata+0x78): undefined reference to `cfb_fillrect'
>> ld: drivers/media/test-drivers/vivid/vivid-osd.o:(.rodata+0x80): undefined reference to `cfb_copyarea'
>> ld: drivers/media/test-drivers/vivid/vivid-osd.o:(.rodata+0x88): undefined reference to `cfb_imageblit'


vim +2083 drivers/media/test-drivers/vivid/vivid-core.c

945b07b1630fd1 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2018-05-21 2043
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2044 if (dev->has_vid_cap) {
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2045 v4l2_info(&dev->v4l2_dev, "unregistering %s\n",
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2046 video_device_node_name(&dev->vid_cap_dev));
bda24f433013d6 drivers/media/test-drivers/vivid/vivid-core.c Hans Verkuil 2020-07-13 2047 vb2_video_unregister_device(&dev->vid_cap_dev);
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2048 }
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2049 if (dev->has_vid_out) {
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2050 v4l2_info(&dev->v4l2_dev, "unregistering %s\n",
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2051 video_device_node_name(&dev->vid_out_dev));
bda24f433013d6 drivers/media/test-drivers/vivid/vivid-core.c Hans Verkuil 2020-07-13 2052 vb2_video_unregister_device(&dev->vid_out_dev);
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2053 }
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2054 if (dev->has_vbi_cap) {
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2055 v4l2_info(&dev->v4l2_dev, "unregistering %s\n",
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2056 video_device_node_name(&dev->vbi_cap_dev));
bda24f433013d6 drivers/media/test-drivers/vivid/vivid-core.c Hans Verkuil 2020-07-13 2057 vb2_video_unregister_device(&dev->vbi_cap_dev);
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2058 }
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2059 if (dev->has_vbi_out) {
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2060 v4l2_info(&dev->v4l2_dev, "unregistering %s\n",
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2061 video_device_node_name(&dev->vbi_out_dev));
bda24f433013d6 drivers/media/test-drivers/vivid/vivid-core.c Hans Verkuil 2020-07-13 2062 vb2_video_unregister_device(&dev->vbi_out_dev);
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2063 }
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2064 if (dev->has_sdr_cap) {
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2065 v4l2_info(&dev->v4l2_dev, "unregistering %s\n",
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2066 video_device_node_name(&dev->sdr_cap_dev));
bda24f433013d6 drivers/media/test-drivers/vivid/vivid-core.c Hans Verkuil 2020-07-13 2067 vb2_video_unregister_device(&dev->sdr_cap_dev);
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2068 }
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2069 if (dev->has_radio_rx) {
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2070 v4l2_info(&dev->v4l2_dev, "unregistering %s\n",
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2071 video_device_node_name(&dev->radio_rx_dev));
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2072 video_unregister_device(&dev->radio_rx_dev);
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2073 }
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2074 if (dev->has_radio_tx) {
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2075 v4l2_info(&dev->v4l2_dev, "unregistering %s\n",
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2076 video_device_node_name(&dev->radio_tx_dev));
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2077 video_unregister_device(&dev->radio_tx_dev);
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2078 }
d730c581d478b1 drivers/media/test-drivers/vivid/vivid-core.c Guillaume Tucker 2021-09-03 2079 #if IS_ENABLED(CONFIG_VIDEO_VIVID_FB)
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2080 if (dev->has_fb) {
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2081 v4l2_info(&dev->v4l2_dev, "unregistering fb%d\n",
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2082 dev->fb_info.node);
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 @2083 unregister_framebuffer(&dev->fb_info);
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2084 vivid_fb_release_buffers(dev);
d5797cf685a0a3 drivers/media/platform/vivid/vivid-core.c Vandana BN 2019-10-15 2085 }
d730c581d478b1 drivers/media/test-drivers/vivid/vivid-core.c Guillaume Tucker 2021-09-03 2086 #endif
d5797cf685a0a3 drivers/media/platform/vivid/vivid-core.c Vandana BN 2019-10-15 2087 if (dev->has_meta_cap) {
d5797cf685a0a3 drivers/media/platform/vivid/vivid-core.c Vandana BN 2019-10-15 2088 v4l2_info(&dev->v4l2_dev, "unregistering %s\n",
d5797cf685a0a3 drivers/media/platform/vivid/vivid-core.c Vandana BN 2019-10-15 2089 video_device_node_name(&dev->meta_cap_dev));
bda24f433013d6 drivers/media/test-drivers/vivid/vivid-core.c Hans Verkuil 2020-07-13 2090 vb2_video_unregister_device(&dev->meta_cap_dev);
746facd39370cc drivers/media/platform/vivid/vivid-core.c Vandana BN 2019-10-15 2091 }
746facd39370cc drivers/media/platform/vivid/vivid-core.c Vandana BN 2019-10-15 2092 if (dev->has_meta_out) {
746facd39370cc drivers/media/platform/vivid/vivid-core.c Vandana BN 2019-10-15 2093 v4l2_info(&dev->v4l2_dev, "unregistering %s\n",
746facd39370cc drivers/media/platform/vivid/vivid-core.c Vandana BN 2019-10-15 2094 video_device_node_name(&dev->meta_out_dev));
bda24f433013d6 drivers/media/test-drivers/vivid/vivid-core.c Hans Verkuil 2020-07-13 2095 vb2_video_unregister_device(&dev->meta_out_dev);
3d15c7643ba78b drivers/media/platform/vivid/vivid-core.c Vandana BN 2019-11-26 2096 }
3d15c7643ba78b drivers/media/platform/vivid/vivid-core.c Vandana BN 2019-11-26 2097 if (dev->has_touch_cap) {
3d15c7643ba78b drivers/media/platform/vivid/vivid-core.c Vandana BN 2019-11-26 2098 v4l2_info(&dev->v4l2_dev, "unregistering %s\n",
3d15c7643ba78b drivers/media/platform/vivid/vivid-core.c Vandana BN 2019-11-26 2099 video_device_node_name(&dev->touch_cap_dev));
bda24f433013d6 drivers/media/test-drivers/vivid/vivid-core.c Hans Verkuil 2020-07-13 2100 vb2_video_unregister_device(&dev->touch_cap_dev);
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2101 }
6f8adea2b64f7e drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2016-02-05 2102 cec_unregister_adapter(dev->cec_rx_adap);
6f8adea2b64f7e drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2016-02-05 2103 for (j = 0; j < MAX_OUTPUTS; j++)
6f8adea2b64f7e drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2016-02-05 2104 cec_unregister_adapter(dev->cec_tx_adap[j]);
6f8adea2b64f7e drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2016-02-05 2105 if (dev->cec_workqueue) {
6f8adea2b64f7e drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2016-02-05 2106 vivid_cec_bus_free_work(dev);
6f8adea2b64f7e drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2016-02-05 2107 destroy_workqueue(dev->cec_workqueue);
6f8adea2b64f7e drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2016-02-05 2108 }
87c674e24362cf drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2015-03-13 2109 v4l2_device_put(&dev->v4l2_dev);
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2110 vivid_devs[i] = NULL;
c88a96b023d823 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2014-08-25 2111 }
f46d740fb02589 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2015-03-13 2112 return 0;
f46d740fb02589 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2015-03-13 2113 }
f46d740fb02589 drivers/media/platform/vivid/vivid-core.c Hans Verkuil 2015-03-13 2114

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (11.62 kB)
.config.gz (34.29 kB)
Download all attachments

2021-09-13 10:37:06

by Hans Verkuil

[permalink] [raw]
Subject: Re: [PATCH v3] media: vivid: drop FB dependency with new VIDEO_VIVID_FB

Hi Guillaume,

On 03/09/2021 17:24, Guillaume Tucker wrote:
> Drop the vivid dependency on CONFIG_FB by introducing a new
> CONFIG_VIDEO_VIVID_FB option which depends on CONFIG_FB instead and
> selects the generic CFB options when enabled. Compile out parts of
> the code that make use of the framebuffer API when not enabled. This
> is particularly useful as CONFIG_FB is not selected by
> CONFIG_DRM_FBDEV_EMULATION any more.

As reported by the kernel test robot, this will fail if CONFIG_FB=m but
CONFIG_VIDEO_VIVID=y.

So this needs a bit more work.

Regards,

Hans

>
> Suggested-by: Hans Verkuil <[email protected]>
> Signed-off-by: Guillaume Tucker <[email protected]>
> ---
>
> Notes:
> Changes in v3:
> * use CONFIG_VIDEO_VIVID_FB instead of CONFIG_FB
> * select CFB options to fix linkage issue
>
> Changes in v2:
> * fix Makefile conditional for when CONFIG_FB=m
> * compile-out bit 16 (framebuffer) when no CONFIG_FB
>
> drivers/media/test-drivers/vivid/Kconfig | 16 ++++++++++++----
> drivers/media/test-drivers/vivid/Makefile | 5 ++++-
> drivers/media/test-drivers/vivid/vivid-core.c | 9 +++++++++
> drivers/media/test-drivers/vivid/vivid-ctrls.c | 4 ++++
> 4 files changed, 29 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/media/test-drivers/vivid/Kconfig b/drivers/media/test-drivers/vivid/Kconfig
> index c3abde2986b2..7cadaefea010 100644
> --- a/drivers/media/test-drivers/vivid/Kconfig
> +++ b/drivers/media/test-drivers/vivid/Kconfig
> @@ -1,13 +1,10 @@
> # SPDX-License-Identifier: GPL-2.0-only
> config VIDEO_VIVID
> tristate "Virtual Video Test Driver"
> - depends on VIDEO_DEV && VIDEO_V4L2 && !SPARC32 && !SPARC64 && FB
> + depends on VIDEO_DEV && VIDEO_V4L2 && !SPARC32 && !SPARC64
> depends on HAS_DMA
> select FONT_SUPPORT
> select FONT_8x16
> - select FB_CFB_FILLRECT
> - select FB_CFB_COPYAREA
> - select FB_CFB_IMAGEBLIT
> select VIDEOBUF2_VMALLOC
> select VIDEOBUF2_DMA_CONTIG
> select VIDEO_V4L2_TPG
> @@ -41,3 +38,14 @@ config VIDEO_VIVID_MAX_DEVS
> help
> This allows you to specify the maximum number of devices supported
> by the vivid driver.
> +
> +config VIDEO_VIVID_FB
> + bool "Enable framebuffer for testing overlays"
> + depends on VIDEO_VIVID
> + depends on FB
> + select FB_CFB_FILLRECT
> + select FB_CFB_COPYAREA
> + select FB_CFB_IMAGEBLIT
> + default y
> + help
> + Enable vivid framebuffer support for testing overlays.
> diff --git a/drivers/media/test-drivers/vivid/Makefile b/drivers/media/test-drivers/vivid/Makefile
> index b12ad0152a3e..b48bd13239f5 100644
> --- a/drivers/media/test-drivers/vivid/Makefile
> +++ b/drivers/media/test-drivers/vivid/Makefile
> @@ -3,10 +3,13 @@ vivid-objs := vivid-core.o vivid-ctrls.o vivid-vid-common.o vivid-vbi-gen.o \
> vivid-vid-cap.o vivid-vid-out.o vivid-kthread-cap.o vivid-kthread-out.o \
> vivid-radio-rx.o vivid-radio-tx.o vivid-radio-common.o \
> vivid-rds-gen.o vivid-sdr-cap.o vivid-vbi-cap.o vivid-vbi-out.o \
> - vivid-osd.o vivid-meta-cap.o vivid-meta-out.o \
> + vivid-meta-cap.o vivid-meta-out.o \
> vivid-kthread-touch.o vivid-touch-cap.o
> ifeq ($(CONFIG_VIDEO_VIVID_CEC),y)
> vivid-objs += vivid-cec.o
> endif
> +ifeq ($(CONFIG_VIDEO_VIVID_FB),y)
> + vivid-objs += vivid-osd.o
> +endif
>
> obj-$(CONFIG_VIDEO_VIVID) += vivid.o
> diff --git a/drivers/media/test-drivers/vivid/vivid-core.c b/drivers/media/test-drivers/vivid/vivid-core.c
> index 87f27c7524ec..3e785c6ce5dd 100644
> --- a/drivers/media/test-drivers/vivid/vivid-core.c
> +++ b/drivers/media/test-drivers/vivid/vivid-core.c
> @@ -126,7 +126,9 @@ MODULE_PARM_DESC(node_types, " node types, default is 0xe1d3d. Bitmask with the
> "\t\t bit 8: Video Output node\n"
> "\t\t bit 10-11: VBI Output node: 0 = none, 1 = raw vbi, 2 = sliced vbi, 3 = both\n"
> "\t\t bit 12: Radio Transmitter node\n"
> +#if IS_ENABLED(CONFIG_VIDEO_VIVID_FB)
> "\t\t bit 16: Framebuffer for testing overlays\n"
> +#endif
> "\t\t bit 17: Metadata Capture node\n"
> "\t\t bit 18: Metadata Output node\n"
> "\t\t bit 19: Touch Capture node\n");
> @@ -1031,9 +1033,11 @@ static int vivid_detect_feature_set(struct vivid_dev *dev, int inst,
> /* do we have a modulator? */
> *has_modulator = dev->has_radio_tx;
>
> +#if IS_ENABLED(CONFIG_VIDEO_VIVID_FB)
> if (dev->has_vid_cap)
> /* do we have a framebuffer for overlay testing? */
> dev->has_fb = node_type & 0x10000;
> +#endif
>
> /* can we do crop/compose/scaling while capturing? */
> if (no_error_inj && *ccs_cap == -1)
> @@ -1365,6 +1369,7 @@ static int vivid_create_queues(struct vivid_dev *dev)
> return ret;
> }
>
> +#if IS_ENABLED(CONFIG_VIDEO_VIVID_FB)
> if (dev->has_fb) {
> /* Create framebuffer for testing capture/output overlay */
> ret = vivid_fb_init(dev);
> @@ -1373,6 +1378,8 @@ static int vivid_create_queues(struct vivid_dev *dev)
> v4l2_info(&dev->v4l2_dev, "Framebuffer device registered as fb%d\n",
> dev->fb_info.node);
> }
> +#endif
> +
> return 0;
> }
>
> @@ -2079,12 +2086,14 @@ static int vivid_remove(struct platform_device *pdev)
> video_device_node_name(&dev->radio_tx_dev));
> video_unregister_device(&dev->radio_tx_dev);
> }
> +#if IS_ENABLED(CONFIG_VIDEO_VIVID_FB)
> if (dev->has_fb) {
> v4l2_info(&dev->v4l2_dev, "unregistering fb%d\n",
> dev->fb_info.node);
> unregister_framebuffer(&dev->fb_info);
> vivid_fb_release_buffers(dev);
> }
> +#endif
> if (dev->has_meta_cap) {
> v4l2_info(&dev->v4l2_dev, "unregistering %s\n",
> video_device_node_name(&dev->meta_cap_dev));
> diff --git a/drivers/media/test-drivers/vivid/vivid-ctrls.c b/drivers/media/test-drivers/vivid/vivid-ctrls.c
> index 8dc50fe22972..6cfd4808b38c 100644
> --- a/drivers/media/test-drivers/vivid/vivid-ctrls.c
> +++ b/drivers/media/test-drivers/vivid/vivid-ctrls.c
> @@ -305,6 +305,7 @@ static const struct v4l2_ctrl_config vivid_ctrl_ro_int32 = {
>
> /* Framebuffer Controls */
>
> +#if IS_ENABLED(CONFIG_VIDEO_VIVID_FB)
> static int vivid_fb_s_ctrl(struct v4l2_ctrl *ctrl)
> {
> struct vivid_dev *dev = container_of(ctrl->handler,
> @@ -328,6 +329,7 @@ static const struct v4l2_ctrl_config vivid_ctrl_clear_fb = {
> .name = "Clear Framebuffer",
> .type = V4L2_CTRL_TYPE_BUTTON,
> };
> +#endif /* IS_ENABLED(CONFIG_VIDEO_VIVID_FB) */
>
>
> /* Video User Controls */
> @@ -1761,8 +1763,10 @@ int vivid_create_controls(struct vivid_dev *dev, bool show_ccs_cap,
> (dev->has_vbi_cap && dev->has_vbi_out))
> v4l2_ctrl_new_custom(hdl_loop_cap, &vivid_ctrl_loop_video, NULL);
>
> +#if IS_ENABLED(CONFIG_VIDEO_VIVID_FB)
> if (dev->has_fb)
> v4l2_ctrl_new_custom(hdl_fb, &vivid_ctrl_clear_fb, NULL);
> +#endif
>
> if (dev->has_radio_rx) {
> v4l2_ctrl_new_custom(hdl_radio_rx, &vivid_ctrl_radio_hw_seek_mode, NULL);
>