2021-07-29 11:18:16

by Guillaume Tucker

[permalink] [raw]
Subject: [PATCH] media: vivid: drop CONFIG_FB dependency

Drop the vivid dependency on CONFIG_FB by compiling 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 any more by
DRM_FBDEV_EMULATION.

Suggested-by: Hans Verkuil <[email protected]>
Signed-off-by: Guillaume Tucker <[email protected]>
---
drivers/media/test-drivers/vivid/Kconfig | 5 +----
drivers/media/test-drivers/vivid/Makefile | 5 ++++-
drivers/media/test-drivers/vivid/vivid-core.c | 7 +++++++
drivers/media/test-drivers/vivid/vivid-ctrls.c | 4 ++++
4 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/media/test-drivers/vivid/Kconfig b/drivers/media/test-drivers/vivid/Kconfig
index c3abde2986b2..06ad350f1903 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
diff --git a/drivers/media/test-drivers/vivid/Makefile b/drivers/media/test-drivers/vivid/Makefile
index b12ad0152a3e..a9e4bc8dc599 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_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 d2bd2653cf54..71f3b9af4ffc 100644
--- a/drivers/media/test-drivers/vivid/vivid-core.c
+++ b/drivers/media/test-drivers/vivid/vivid-core.c
@@ -1021,9 +1021,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_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)
@@ -1355,6 +1357,7 @@ static int vivid_create_queues(struct vivid_dev *dev)
return ret;
}

+#if IS_ENABLED(CONFIG_FB)
if (dev->has_fb) {
/* Create framebuffer for testing capture/output overlay */
ret = vivid_fb_init(dev);
@@ -1363,6 +1366,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;
}

@@ -2069,12 +2074,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_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..081470a1d88a 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_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_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_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-07-29 11:34:34

by Guillaume Tucker

[permalink] [raw]
Subject: Re: [PATCH] media: vivid: drop CONFIG_FB dependency

On 29/07/2021 12:16, Guillaume Tucker wrote:
> +ifeq ($(CONFIG_FB),y)
> + vivid-objs += vivid-osd.o
> +endif

Just realised CONFIG_FB is tristate, so I guess it should be:

ifneq ($(CONFIG_FB),)
vivid-objs += vivid-osd.o
endif


Best wishes,
Guillaume

2021-07-29 18:55:28

by Guillaume Tucker

[permalink] [raw]
Subject: Re: [PATCH] media: vivid: drop CONFIG_FB dependency

On 29/07/2021 12:32, Guillaume Tucker wrote:
> On 29/07/2021 12:16, Guillaume Tucker wrote:
>> +ifeq ($(CONFIG_FB),y)
>> + vivid-objs += vivid-osd.o
>> +endif
>
> Just realised CONFIG_FB is tristate, so I guess it should be:
>
> ifneq ($(CONFIG_FB),)
> vivid-objs += vivid-osd.o
> endif

Tested-by: "kernelci.org bot" <[email protected]>

https://staging.kernelci.org/test/job/gtucker/branch/for-kernelci/kernel/v5.14-rc3-4412-g964fed94b566/plan/v4l2-compliance-vivid/

with the change mentioned above, on top of next-20210729.

Best wishes,
Guillaume

2021-07-30 13:34:24

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] media: vivid: drop CONFIG_FB dependency

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-rc3 next-20210729]
[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-CONFIG_FB-dependency/20210729-191815
base: git://linuxtv.org/media_tree.git master
config: m68k-allmodconfig (attached as .config)
compiler: m68k-linux-gcc (GCC) 10.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/51defc67cada10450046e4d4e7eda1a2573371cc
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Guillaume-Tucker/media-vivid-drop-CONFIG_FB-dependency/20210729-191815
git checkout 51defc67cada10450046e4d4e7eda1a2573371cc
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=m68k

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

All errors (new ones prefixed by >>, old ones prefixed by <<):

>> ERROR: modpost: "vivid_clear_fb" [drivers/media/test-drivers/vivid/vivid.ko] undefined!
>> ERROR: modpost: "vivid_fb_release_buffers" [drivers/media/test-drivers/vivid/vivid.ko] undefined!
>> ERROR: modpost: "vivid_fb_init" [drivers/media/test-drivers/vivid/vivid.ko] undefined!

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


Attachments:
(No filename) (1.82 kB)
.config.gz (58.83 kB)
Download all attachments

2021-07-30 14:28:00

by Guillaume Tucker

[permalink] [raw]
Subject: Re: [PATCH] media: vivid: drop CONFIG_FB dependency

On 30/07/2021 14:32, kernel test robot wrote:
> 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-rc3 next-20210729]
> [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-CONFIG_FB-dependency/20210729-191815
> base: git://linuxtv.org/media_tree.git master
> config: m68k-allmodconfig (attached as .config)
> compiler: m68k-linux-gcc (GCC) 10.3.0
> reproduce (this is a W=1 build):
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # https://github.com/0day-ci/linux/commit/51defc67cada10450046e4d4e7eda1a2573371cc
> git remote add linux-review https://github.com/0day-ci/linux
> git fetch --no-tags linux-review Guillaume-Tucker/media-vivid-drop-CONFIG_FB-dependency/20210729-191815
> git checkout 51defc67cada10450046e4d4e7eda1a2573371cc
> # save the attached .config to linux build tree
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=m68k
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <[email protected]>
>
> All errors (new ones prefixed by >>, old ones prefixed by <<):
>
>>> ERROR: modpost: "vivid_clear_fb" [drivers/media/test-drivers/vivid/vivid.ko] undefined!
>>> ERROR: modpost: "vivid_fb_release_buffers" [drivers/media/test-drivers/vivid/vivid.ko] undefined!
>>> ERROR: modpost: "vivid_fb_init" [drivers/media/test-drivers/vivid/vivid.ko] undefined!

Pretty sure this is due to the conditional in the Makefile I
mentioned in an email yesterday, where it should have been
ifneq ($(CONFIG_FB),) for when CONFIG_FB=m.

Let me know if I should send a v2 now with this fix, I was
waiting for Hans' feedback first.

Thanks,
Guillaume

2021-08-04 18:33:16

by Hans Verkuil

[permalink] [raw]
Subject: Re: [PATCH] media: vivid: drop CONFIG_FB dependency

Hi Guillaume,

On 30/07/2021 16:26, Guillaume Tucker wrote:
> On 30/07/2021 14:32, kernel test robot wrote:
>> 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-rc3 next-20210729]
>> [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-CONFIG_FB-dependency/20210729-191815
>> base: git://linuxtv.org/media_tree.git master
>> config: m68k-allmodconfig (attached as .config)
>> compiler: m68k-linux-gcc (GCC) 10.3.0
>> reproduce (this is a W=1 build):
>> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>> chmod +x ~/bin/make.cross
>> # https://github.com/0day-ci/linux/commit/51defc67cada10450046e4d4e7eda1a2573371cc
>> git remote add linux-review https://github.com/0day-ci/linux
>> git fetch --no-tags linux-review Guillaume-Tucker/media-vivid-drop-CONFIG_FB-dependency/20210729-191815
>> git checkout 51defc67cada10450046e4d4e7eda1a2573371cc
>> # save the attached .config to linux build tree
>> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=m68k
>>
>> If you fix the issue, kindly add following tag as appropriate
>> Reported-by: kernel test robot <[email protected]>
>>
>> All errors (new ones prefixed by >>, old ones prefixed by <<):
>>
>>>> ERROR: modpost: "vivid_clear_fb" [drivers/media/test-drivers/vivid/vivid.ko] undefined!
>>>> ERROR: modpost: "vivid_fb_release_buffers" [drivers/media/test-drivers/vivid/vivid.ko] undefined!
>>>> ERROR: modpost: "vivid_fb_init" [drivers/media/test-drivers/vivid/vivid.ko] undefined!
>
> Pretty sure this is due to the conditional in the Makefile I
> mentioned in an email yesterday, where it should have been
> ifneq ($(CONFIG_FB),) for when CONFIG_FB=m.
>
> Let me know if I should send a v2 now with this fix, I was
> waiting for Hans' feedback first.

Go ahead and send a v2.

I have just one comment: in vivid-core.c, please change this in the node_types
MODULE_PARM_DESC:

"\t\t bit 12: Radio Transmitter node\n"
"\t\t bit 16: Framebuffer for testing overlays\n"
"\t\t bit 17: Metadata Capture node\n"

to:

"\t\t bit 12: Radio Transmitter node\n"
#ifdef CONFIG_FB
"\t\t bit 16: Framebuffer for testing overlays\n"
#endif
"\t\t bit 17: Metadata Capture node\n"

That way it is visible with modinfo whether or not framebuffer support is
compiled in or not.

Regards,

Hans

>
> Thanks,
> Guillaume
>