Hello
The main change of this serie is to fusion all zoran related modules in
one.
This fixes the load order problem when everything is built-in.
Regards
Corentin Labbe (8):
staging: media: zoran: move module parameter checks to zoran_probe
staging: media: zoran: use module_pci_driver
staging: media: zoran: rename debug module parameter
staging: media: zoran: add debugfs
staging: media: zoran: videocode: remove procfs
staging: media: zoran: fusion all modules
staging: media: zoran: remove vidmem
staging: media: zoran: move videodev alloc
drivers/staging/media/zoran/Kconfig | 24 +-
drivers/staging/media/zoran/Makefile | 8 +-
drivers/staging/media/zoran/videocodec.c | 60 +----
drivers/staging/media/zoran/videocodec.h | 5 +
drivers/staging/media/zoran/zoran.h | 7 +-
drivers/staging/media/zoran/zoran_card.c | 259 +++++++++++++--------
drivers/staging/media/zoran/zoran_driver.c | 5 +-
drivers/staging/media/zoran/zr36016.c | 23 +-
drivers/staging/media/zoran/zr36016.h | 2 +
drivers/staging/media/zoran/zr36050.c | 20 +-
drivers/staging/media/zoran/zr36050.h | 2 +
drivers/staging/media/zoran/zr36060.c | 20 +-
drivers/staging/media/zoran/zr36060.h | 2 +
13 files changed, 229 insertions(+), 208 deletions(-)
--
2.32.0
We need to empty zoran_init() for removing it later.
Furthermore, this permit to use pci_xxx instead of pr_xxx for prettier
printing.
Signed-off-by: Corentin Labbe <[email protected]>
---
drivers/staging/media/zoran/zoran_card.c | 64 ++++++++++++------------
1 file changed, 33 insertions(+), 31 deletions(-)
diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c
index f259585b0689..3bc0e64f1007 100644
--- a/drivers/staging/media/zoran/zoran_card.c
+++ b/drivers/staging/media/zoran/zoran_card.c
@@ -1067,6 +1067,39 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
unsigned int nr;
int err;
+ pci_info(pdev, "Zoran MJPEG board driver version %s\n", ZORAN_VERSION);
+
+ /* check the parameters we have been given, adjust if necessary */
+ if (v4l_nbufs < 2)
+ v4l_nbufs = 2;
+ if (v4l_nbufs > VIDEO_MAX_FRAME)
+ v4l_nbufs = VIDEO_MAX_FRAME;
+ /* The user specifies the in KB, we want them in byte (and page aligned) */
+ v4l_bufsize = PAGE_ALIGN(v4l_bufsize * 1024);
+ if (v4l_bufsize < 32768)
+ v4l_bufsize = 32768;
+ /* 2 MB is arbitrary but sufficient for the maximum possible images */
+ if (v4l_bufsize > 2048 * 1024)
+ v4l_bufsize = 2048 * 1024;
+ if (jpg_nbufs < 4)
+ jpg_nbufs = 4;
+ if (jpg_nbufs > BUZ_MAX_FRAME)
+ jpg_nbufs = BUZ_MAX_FRAME;
+ jpg_bufsize = PAGE_ALIGN(jpg_bufsize * 1024);
+ if (jpg_bufsize < 8192)
+ jpg_bufsize = 8192;
+ if (jpg_bufsize > (512 * 1024))
+ jpg_bufsize = 512 * 1024;
+ /* Use parameter for vidmem or try to find a video card */
+ if (vidmem)
+ pci_info(pdev, "%s: Using supplied video memory base address @ 0x%lx\n",
+ ZORAN_NAME, vidmem);
+
+ /* some mainboards might not do PCI-PCI data transfer well */
+ if (pci_pci_problems & (PCIPCI_FAIL | PCIAGP_FAIL | PCIPCI_ALIMAGIK))
+ pci_warn(pdev, "%s: chipset does not support reliable PCI-PCI DMA\n",
+ ZORAN_NAME);
+
err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
if (err)
return -ENODEV;
@@ -1285,37 +1318,6 @@ static int __init zoran_init(void)
{
int res;
- pr_info("Zoran MJPEG board driver version %s\n", ZORAN_VERSION);
-
- /* check the parameters we have been given, adjust if necessary */
- if (v4l_nbufs < 2)
- v4l_nbufs = 2;
- if (v4l_nbufs > VIDEO_MAX_FRAME)
- v4l_nbufs = VIDEO_MAX_FRAME;
- /* The user specifies the in KB, we want them in byte (and page aligned) */
- v4l_bufsize = PAGE_ALIGN(v4l_bufsize * 1024);
- if (v4l_bufsize < 32768)
- v4l_bufsize = 32768;
- /* 2 MB is arbitrary but sufficient for the maximum possible images */
- if (v4l_bufsize > 2048 * 1024)
- v4l_bufsize = 2048 * 1024;
- if (jpg_nbufs < 4)
- jpg_nbufs = 4;
- if (jpg_nbufs > BUZ_MAX_FRAME)
- jpg_nbufs = BUZ_MAX_FRAME;
- jpg_bufsize = PAGE_ALIGN(jpg_bufsize * 1024);
- if (jpg_bufsize < 8192)
- jpg_bufsize = 8192;
- if (jpg_bufsize > (512 * 1024))
- jpg_bufsize = 512 * 1024;
- /* Use parameter for vidmem or try to find a video card */
- if (vidmem)
- pr_info("%s: Using supplied video memory base address @ 0x%lx\n", ZORAN_NAME, vidmem);
-
- /* some mainboards might not do PCI-PCI data transfer well */
- if (pci_pci_problems & (PCIPCI_FAIL | PCIAGP_FAIL | PCIPCI_ALIMAGIK))
- pr_warn("%s: chipset does not support reliable PCI-PCI DMA\n", ZORAN_NAME);
-
res = pci_register_driver(&zoran_driver);
if (res) {
pr_err("Unable to register ZR36057 driver\n");
--
2.32.0
All zoran module will be merged, so to prevent conflict, the debug
module parameter need to be renamed
Signed-off-by: Corentin Labbe <[email protected]>
---
drivers/staging/media/zoran/videocodec.c | 8 ++++----
drivers/staging/media/zoran/zr36016.c | 12 ++++++------
drivers/staging/media/zoran/zr36050.c | 8 ++++----
drivers/staging/media/zoran/zr36060.c | 9 ++++-----
4 files changed, 18 insertions(+), 19 deletions(-)
diff --git a/drivers/staging/media/zoran/videocodec.c b/drivers/staging/media/zoran/videocodec.c
index 28031d3fd757..31019b5f377e 100644
--- a/drivers/staging/media/zoran/videocodec.c
+++ b/drivers/staging/media/zoran/videocodec.c
@@ -26,13 +26,13 @@
#include "videocodec.h"
-static int debug;
-module_param(debug, int, 0);
-MODULE_PARM_DESC(debug, "Debug level (0-4)");
+static int videocodec_debug;
+module_param(videocodec_debug, int, 0);
+MODULE_PARM_DESC(videocodec_debug, "Debug level (0-4)");
#define dprintk(num, format, args...) \
do { \
- if (debug >= num) \
+ if (videocodec_debug >= num) \
printk(format, ##args); \
} while (0)
diff --git a/drivers/staging/media/zoran/zr36016.c b/drivers/staging/media/zoran/zr36016.c
index 9b350a885879..50605460a44b 100644
--- a/drivers/staging/media/zoran/zr36016.c
+++ b/drivers/staging/media/zoran/zr36016.c
@@ -22,14 +22,14 @@
/* amount of chips attached via this driver */
static int zr36016_codecs;
-/* debugging is available via module parameter */
-static int debug;
-module_param(debug, int, 0);
-MODULE_PARM_DESC(debug, "Debug level (0-4)");
+static int zr36016_debug;
+module_param(zr36016_debug, int, 0);
+MODULE_PARM_DESC(zr36016_debug, "Debug level (0-4)");
+
#define dprintk(num, format, args...) \
do { \
- if (debug >= num) \
+ if (zr36016_debug >= num) \
printk(format, ##args); \
} while (0)
@@ -120,7 +120,7 @@ static u8 zr36016_read_version(struct zr36016 *ptr)
static int zr36016_basic_test(struct zr36016 *ptr)
{
- if (debug) {
+ if (zr36016_debug) {
int i;
zr36016_writei(ptr, ZR016I_PAX_LO, 0x55);
diff --git a/drivers/staging/media/zoran/zr36050.c b/drivers/staging/media/zoran/zr36050.c
index c62af27f2683..4dc7927fefc3 100644
--- a/drivers/staging/media/zoran/zr36050.c
+++ b/drivers/staging/media/zoran/zr36050.c
@@ -32,13 +32,13 @@
static int zr36050_codecs;
/* debugging is available via module parameter */
-static int debug;
-module_param(debug, int, 0);
-MODULE_PARM_DESC(debug, "Debug level (0-4)");
+static int zr36050_debug;
+module_param(zr36050_debug, int, 0);
+MODULE_PARM_DESC(zr36050_debug, "Debug level (0-4)");
#define dprintk(num, format, args...) \
do { \
- if (debug >= num) \
+ if (zr36050_debug >= num) \
printk(format, ##args); \
} while (0)
diff --git a/drivers/staging/media/zoran/zr36060.c b/drivers/staging/media/zoran/zr36060.c
index 1c3af11b5f24..7904d5b1f402 100644
--- a/drivers/staging/media/zoran/zr36060.c
+++ b/drivers/staging/media/zoran/zr36060.c
@@ -34,14 +34,13 @@ static bool low_bitrate;
module_param(low_bitrate, bool, 0);
MODULE_PARM_DESC(low_bitrate, "Buz compatibility option, halves bitrate");
-/* debugging is available via module parameter */
-static int debug;
-module_param(debug, int, 0);
-MODULE_PARM_DESC(debug, "Debug level (0-4)");
+static int zr36060_debug;
+module_param(zr36060_debug, int, 0);
+MODULE_PARM_DESC(zr36060_debug, "Debug level (0-4)");
#define dprintk(num, format, args...) \
do { \
- if (debug >= num) \
+ if (zr36060_debug >= num) \
printk(format, ##args); \
} while (0)
--
2.32.0
The zoran driver is split in many modules, but this lead to some
problems.
One of them is that load order is incorrect when everything is built-in.
Having more than one module is useless, so fusion all zoran modules in
one.
Signed-off-by: Corentin Labbe <[email protected]>
---
drivers/staging/media/zoran/Kconfig | 14 +++----
drivers/staging/media/zoran/Makefile | 8 ++--
drivers/staging/media/zoran/videocodec.c | 28 --------------
drivers/staging/media/zoran/zoran_card.c | 48 +++++++++++++++++++++---
drivers/staging/media/zoran/zr36016.c | 11 +-----
drivers/staging/media/zoran/zr36016.h | 2 +
drivers/staging/media/zoran/zr36050.c | 12 +-----
drivers/staging/media/zoran/zr36050.h | 2 +
drivers/staging/media/zoran/zr36060.c | 11 +-----
drivers/staging/media/zoran/zr36060.h | 2 +
10 files changed, 66 insertions(+), 72 deletions(-)
diff --git a/drivers/staging/media/zoran/Kconfig b/drivers/staging/media/zoran/Kconfig
index 7d2d3c2431b1..8eacdc00b081 100644
--- a/drivers/staging/media/zoran/Kconfig
+++ b/drivers/staging/media/zoran/Kconfig
@@ -14,7 +14,7 @@ config VIDEO_ZORAN
module will be called zr36067.
config VIDEO_ZORAN_DC30
- tristate "Pinnacle/Miro DC30(+) support"
+ bool "Pinnacle/Miro DC30(+) support"
depends on VIDEO_ZORAN
select VIDEO_ADV7175 if MEDIA_SUBDRV_AUTOSELECT
select VIDEO_VPX3220 if MEDIA_SUBDRV_AUTOSELECT
@@ -24,7 +24,7 @@ config VIDEO_ZORAN_DC30
zr36050 MJPEG codec and zr36016 VFE.
config VIDEO_ZORAN_ZR36060
- tristate "Zoran ZR36060"
+ bool "Zoran ZR36060"
depends on VIDEO_ZORAN
help
Say Y to support Zoran boards based on 36060 chips.
@@ -32,7 +32,7 @@ config VIDEO_ZORAN_ZR36060
and 33 R10 and AverMedia 6 boards.
config VIDEO_ZORAN_BUZ
- tristate "Iomega Buz support"
+ bool "Iomega Buz support"
depends on VIDEO_ZORAN_ZR36060
select VIDEO_SAA711X if MEDIA_SUBDRV_AUTOSELECT
select VIDEO_SAA7185 if MEDIA_SUBDRV_AUTOSELECT
@@ -40,7 +40,7 @@ config VIDEO_ZORAN_BUZ
Support for the Iomega Buz MJPEG capture/playback card.
config VIDEO_ZORAN_DC10
- tristate "Pinnacle/Miro DC10(+) support"
+ bool "Pinnacle/Miro DC10(+) support"
depends on VIDEO_ZORAN_ZR36060
select VIDEO_SAA7110 if MEDIA_SUBDRV_AUTOSELECT
select VIDEO_ADV7175 if MEDIA_SUBDRV_AUTOSELECT
@@ -49,7 +49,7 @@ config VIDEO_ZORAN_DC10
card.
config VIDEO_ZORAN_LML33
- tristate "Linux Media Labs LML33 support"
+ bool "Linux Media Labs LML33 support"
depends on VIDEO_ZORAN_ZR36060
select VIDEO_BT819 if MEDIA_SUBDRV_AUTOSELECT
select VIDEO_BT856 if MEDIA_SUBDRV_AUTOSELECT
@@ -58,7 +58,7 @@ config VIDEO_ZORAN_LML33
card.
config VIDEO_ZORAN_LML33R10
- tristate "Linux Media Labs LML33R10 support"
+ bool "Linux Media Labs LML33R10 support"
depends on VIDEO_ZORAN_ZR36060
select VIDEO_SAA711X if MEDIA_SUBDRV_AUTOSELECT
select VIDEO_ADV7170 if MEDIA_SUBDRV_AUTOSELECT
@@ -67,7 +67,7 @@ config VIDEO_ZORAN_LML33R10
card.
config VIDEO_ZORAN_AVS6EYES
- tristate "AverMedia 6 Eyes support"
+ bool "AverMedia 6 Eyes support"
depends on VIDEO_ZORAN_ZR36060
select VIDEO_BT856 if MEDIA_SUBDRV_AUTOSELECT
select VIDEO_BT866 if MEDIA_SUBDRV_AUTOSELECT
diff --git a/drivers/staging/media/zoran/Makefile b/drivers/staging/media/zoran/Makefile
index 7023158e3892..9603bac0195c 100644
--- a/drivers/staging/media/zoran/Makefile
+++ b/drivers/staging/media/zoran/Makefile
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
zr36067-objs := zoran_device.o \
- zoran_driver.o zoran_card.o
+ zoran_driver.o zoran_card.o videocodec.o
-obj-$(CONFIG_VIDEO_ZORAN) += zr36067.o videocodec.o
-obj-$(CONFIG_VIDEO_ZORAN_DC30) += zr36050.o zr36016.o
-obj-$(CONFIG_VIDEO_ZORAN_ZR36060) += zr36060.o
+obj-$(CONFIG_VIDEO_ZORAN) += zr36067.o
+zr36067-$(CONFIG_VIDEO_ZORAN_DC30) += zr36050.o zr36016.o
+zr36067-$(CONFIG_VIDEO_ZORAN_ZR36060) += zr36060.o
diff --git a/drivers/staging/media/zoran/videocodec.c b/drivers/staging/media/zoran/videocodec.c
index 3d5a83a07e07..7350d7747516 100644
--- a/drivers/staging/media/zoran/videocodec.c
+++ b/drivers/staging/media/zoran/videocodec.c
@@ -8,8 +8,6 @@
* (c) 2002 Wolfgang Scherr <[email protected]>
*/
-#define VIDEOCODEC_VERSION "v0.2"
-
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -119,7 +117,6 @@ struct videocodec *videocodec_attach(struct videocodec_master *master)
kfree(codec);
return NULL;
}
-EXPORT_SYMBOL(videocodec_attach);
int videocodec_detach(struct videocodec *codec)
{
@@ -175,7 +172,6 @@ int videocodec_detach(struct videocodec *codec)
pr_err("%s: given codec not found!\n", __func__);
return -EINVAL;
}
-EXPORT_SYMBOL(videocodec_detach);
int videocodec_register(const struct videocodec *codec)
{
@@ -208,7 +204,6 @@ int videocodec_register(const struct videocodec *codec)
return 0;
}
-EXPORT_SYMBOL(videocodec_register);
int videocodec_unregister(const struct videocodec *codec)
{
@@ -255,7 +250,6 @@ int videocodec_unregister(const struct videocodec *codec)
pr_err("%s: given codec not found!\n", __func__);
return -EINVAL;
}
-EXPORT_SYMBOL(videocodec_unregister);
#ifdef CONFIG_VIDEO_ZORAN_DEBUG
int videocodec_debugfs_show(struct seq_file *m)
@@ -286,25 +280,3 @@ int videocodec_debugfs_show(struct seq_file *m)
return 0;
}
#endif
-
-/* ===================== */
-/* hook in driver module */
-/* ===================== */
-static int __init videocodec_init(void)
-{
- pr_info("Linux video codec intermediate layer: %s\n", VIDEOCODEC_VERSION);
-
- return 0;
-}
-
-static void __exit videocodec_exit(void)
-{
-}
-
-module_init(videocodec_init);
-module_exit(videocodec_exit);
-
-MODULE_AUTHOR("Wolfgang Scherr <[email protected]>");
-MODULE_DESCRIPTION("Intermediate API module for video codecs "
- VIDEOCODEC_VERSION);
-MODULE_LICENSE("GPL");
diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c
index 1ed8ed2f4f7f..7b2e1d1c4622 100644
--- a/drivers/staging/media/zoran/zoran_card.c
+++ b/drivers/staging/media/zoran/zoran_card.c
@@ -29,6 +29,9 @@
#include "zoran.h"
#include "zoran_card.h"
#include "zoran_device.h"
+#include "zr36016.h"
+#include "zr36050.h"
+#include "zr36060.h"
extern const struct zoran_format zoran_formats[];
@@ -266,6 +269,39 @@ static const char *codecid_to_modulename(u16 codecid)
return name;
}
+static int load_codec(struct zoran *zr, u16 codecid)
+{
+ switch (codecid) {
+ case CODEC_TYPE_ZR36060:
+#ifdef CONFIG_VIDEO_ZORAN_ZR36060
+ return zr36060_init_module();
+#else
+ pci_err(zr->pci_dev, "ZR36060 support is not enabled\n");
+ return -EINVAL;
+#endif
+ break;
+ case CODEC_TYPE_ZR36050:
+#ifdef CONFIG_VIDEO_ZORAN_DC30
+ return zr36050_init_module();
+#else
+ pci_err(zr->pci_dev, "ZR36050 support is not enabled\n");
+ return -EINVAL;
+#endif
+ break;
+ case CODEC_TYPE_ZR36016:
+#ifdef CONFIG_VIDEO_ZORAN_DC30
+ return zr36016_init_module();
+#else
+ pci_err(zr->pci_dev, "ZR36016 support is not enabled\n");
+ return -EINVAL;
+#endif
+ break;
+ }
+
+ pci_err(zr->pci_dev, "unknown codec id %x\n", codecid);
+ return -EINVAL;
+}
+
// struct tvnorm {
// u16 wt, wa, h_start, h_sync_start, ht, ha, v_start;
// };
@@ -1078,6 +1114,8 @@ static int zoran_debugfs_show(struct seq_file *seq, void *v)
seq_printf(seq, "Prepared %u\n", zr->prepared);
seq_printf(seq, "Queued %u\n", zr->queued);
+
+ videocodec_debugfs_show(seq);
return 0;
}
@@ -1262,17 +1300,17 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
if (zr->card.video_codec) {
codec_name = codecid_to_modulename(zr->card.video_codec);
if (codec_name) {
- result = request_module(codec_name);
- if (result)
- pci_err(pdev, "failed to load modules %s: %d\n", codec_name, result);
+ result = load_codec(zr, zr->card.video_codec);
+ if (result < 0)
+ pci_err(pdev, "failed to load codec %s: %d\n", codec_name, result);
}
}
if (zr->card.video_vfe) {
vfe_name = codecid_to_modulename(zr->card.video_vfe);
if (vfe_name) {
- result = request_module(vfe_name);
+ result = load_codec(zr, zr->card.video_vfe);
if (result < 0)
- pci_err(pdev, "failed to load modules %s: %d\n", vfe_name, result);
+ pci_err(pdev, "failed to load codec %s: %d\n", vfe_name, result);
}
}
diff --git a/drivers/staging/media/zoran/zr36016.c b/drivers/staging/media/zoran/zr36016.c
index 50605460a44b..adf738b5a1d5 100644
--- a/drivers/staging/media/zoran/zr36016.c
+++ b/drivers/staging/media/zoran/zr36016.c
@@ -409,14 +409,14 @@ static const struct videocodec zr36016_codec = {
HOOK IN DRIVER AS KERNEL MODULE
========================================================================= */
-static int __init zr36016_init_module(void)
+int zr36016_init_module(void)
{
//dprintk(1, "ZR36016 driver %s\n",ZR016_VERSION);
zr36016_codecs = 0;
return videocodec_register(&zr36016_codec);
}
-static void __exit zr36016_cleanup_module(void)
+void zr36016_cleanup_module(void)
{
if (zr36016_codecs) {
dprintk(1,
@@ -425,10 +425,3 @@ static void __exit zr36016_cleanup_module(void)
}
videocodec_unregister(&zr36016_codec);
}
-
-module_init(zr36016_init_module);
-module_exit(zr36016_cleanup_module);
-
-MODULE_AUTHOR("Wolfgang Scherr <[email protected]>");
-MODULE_DESCRIPTION("Driver module for ZR36016 video frontends");
-MODULE_LICENSE("GPL");
diff --git a/drivers/staging/media/zoran/zr36016.h b/drivers/staging/media/zoran/zr36016.h
index 1475f971cc24..04afba35669d 100644
--- a/drivers/staging/media/zoran/zr36016.h
+++ b/drivers/staging/media/zoran/zr36016.h
@@ -89,4 +89,6 @@ struct zr36016 {
#define ZR016_SIGN 0x02
#define ZR016_YMCS 0x01
+int zr36016_init_module(void);
+void zr36016_cleanup_module(void);
#endif /*fndef ZR36016_H */
diff --git a/drivers/staging/media/zoran/zr36050.c b/drivers/staging/media/zoran/zr36050.c
index 4dc7927fefc3..e36eff4a798c 100644
--- a/drivers/staging/media/zoran/zr36050.c
+++ b/drivers/staging/media/zoran/zr36050.c
@@ -817,14 +817,14 @@ static const struct videocodec zr36050_codec = {
HOOK IN DRIVER AS KERNEL MODULE
========================================================================= */
-static int __init zr36050_init_module(void)
+int zr36050_init_module(void)
{
//dprintk(1, "ZR36050 driver %s\n",ZR050_VERSION);
zr36050_codecs = 0;
return videocodec_register(&zr36050_codec);
}
-static void __exit zr36050_cleanup_module(void)
+void zr36050_cleanup_module(void)
{
if (zr36050_codecs) {
dprintk(1,
@@ -833,11 +833,3 @@ static void __exit zr36050_cleanup_module(void)
}
videocodec_unregister(&zr36050_codec);
}
-
-module_init(zr36050_init_module);
-module_exit(zr36050_cleanup_module);
-
-MODULE_AUTHOR("Wolfgang Scherr <[email protected]>");
-MODULE_DESCRIPTION("Driver module for ZR36050 jpeg processors "
- ZR050_VERSION);
-MODULE_LICENSE("GPL");
diff --git a/drivers/staging/media/zoran/zr36050.h b/drivers/staging/media/zoran/zr36050.h
index 8f972d045b58..f9b58f4c77b9 100644
--- a/drivers/staging/media/zoran/zr36050.h
+++ b/drivers/staging/media/zoran/zr36050.h
@@ -160,4 +160,6 @@ struct zr36050 {
#define ZR050_U_COMPONENT 1
#define ZR050_V_COMPONENT 2
+int zr36050_init_module(void);
+void zr36050_cleanup_module(void);
#endif /*fndef ZR36050_H */
diff --git a/drivers/staging/media/zoran/zr36060.c b/drivers/staging/media/zoran/zr36060.c
index 7904d5b1f402..0a6a8c985137 100644
--- a/drivers/staging/media/zoran/zr36060.c
+++ b/drivers/staging/media/zoran/zr36060.c
@@ -846,13 +846,13 @@ static const struct videocodec zr36060_codec = {
// others are not used
};
-static int __init zr36060_init_module(void)
+int zr36060_init_module(void)
{
zr36060_codecs = 0;
return videocodec_register(&zr36060_codec);
}
-static void __exit zr36060_cleanup_module(void)
+void zr36060_cleanup_module(void)
{
if (zr36060_codecs) {
dprintk(1,
@@ -863,10 +863,3 @@ static void __exit zr36060_cleanup_module(void)
/* however, we can't just stay alive */
videocodec_unregister(&zr36060_codec);
}
-
-module_init(zr36060_init_module);
-module_exit(zr36060_cleanup_module);
-
-MODULE_AUTHOR("Laurent Pinchart <[email protected]>");
-MODULE_DESCRIPTION("Driver module for ZR36060 jpeg processors " ZR060_VERSION);
-MODULE_LICENSE("GPL");
diff --git a/drivers/staging/media/zoran/zr36060.h b/drivers/staging/media/zoran/zr36060.h
index d2cdc26bf625..fbf5429534ac 100644
--- a/drivers/staging/media/zoran/zr36060.h
+++ b/drivers/staging/media/zoran/zr36060.h
@@ -198,4 +198,6 @@ struct zr36060 {
#define ZR060_SR_H_SCALE2 BIT(0)
#define ZR060_SR_H_SCALE4 (2 << 0)
+int zr36060_init_module(void);
+void zr36060_cleanup_module(void);
#endif /*fndef ZR36060_H */
--
2.32.0
The vidmem parameter is no longer necessary since we removed framebuffer
support.
Signed-off-by: Corentin Labbe <[email protected]>
---
drivers/staging/media/zoran/zoran_card.c | 15 ---------------
1 file changed, 15 deletions(-)
diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c
index 7b2e1d1c4622..ed74f04994da 100644
--- a/drivers/staging/media/zoran/zoran_card.c
+++ b/drivers/staging/media/zoran/zoran_card.c
@@ -39,17 +39,6 @@ static int card[BUZ_MAX] = { [0 ... (BUZ_MAX - 1)] = -1 };
module_param_array(card, int, NULL, 0444);
MODULE_PARM_DESC(card, "Card type");
-/*
- * The video mem address of the video card. The driver has a little database
- * for some videocards to determine it from there. If your video card is not
- * in there you have either to give it to the driver as a parameter or set
- * in a VIDIOCSFBUF ioctl
- */
-
-static unsigned long vidmem; /* default = 0 - Video memory base address */
-module_param_hw(vidmem, ulong, iomem, 0444);
-MODULE_PARM_DESC(vidmem, "Default video memory base address");
-
/* Default input and video norm at startup of the driver. */
static unsigned int default_input; /* default 0 = Composite, 1 = S-Video */
@@ -1161,10 +1150,6 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
jpg_bufsize = 8192;
if (jpg_bufsize > (512 * 1024))
jpg_bufsize = 512 * 1024;
- /* Use parameter for vidmem or try to find a video card */
- if (vidmem)
- pci_info(pdev, "%s: Using supplied video memory base address @ 0x%lx\n",
- ZORAN_NAME, vidmem);
/* some mainboards might not do PCI-PCI data transfer well */
if (pci_pci_problems & (PCIPCI_FAIL | PCIAGP_FAIL | PCIPCI_ALIMAGIK))
--
2.32.0
On 03/09/2021 21:15, Corentin Labbe wrote:
> The zoran driver is split in many modules, but this lead to some
> problems.
> One of them is that load order is incorrect when everything is built-in.
>
> Having more than one module is useless, so fusion all zoran modules in
> one.
After applying this patch I am no longer able to rmmod the module: it will
always report that it is in use. This is with a Miro DC30.
So something is wrong with refcounting.
I do like the idea of merging all these modules, but it needs a bit more
testing.
Regards,
Hans
>
> Signed-off-by: Corentin Labbe <[email protected]>
> ---
> drivers/staging/media/zoran/Kconfig | 14 +++----
> drivers/staging/media/zoran/Makefile | 8 ++--
> drivers/staging/media/zoran/videocodec.c | 28 --------------
> drivers/staging/media/zoran/zoran_card.c | 48 +++++++++++++++++++++---
> drivers/staging/media/zoran/zr36016.c | 11 +-----
> drivers/staging/media/zoran/zr36016.h | 2 +
> drivers/staging/media/zoran/zr36050.c | 12 +-----
> drivers/staging/media/zoran/zr36050.h | 2 +
> drivers/staging/media/zoran/zr36060.c | 11 +-----
> drivers/staging/media/zoran/zr36060.h | 2 +
> 10 files changed, 66 insertions(+), 72 deletions(-)
>
> diff --git a/drivers/staging/media/zoran/Kconfig b/drivers/staging/media/zoran/Kconfig
> index 7d2d3c2431b1..8eacdc00b081 100644
> --- a/drivers/staging/media/zoran/Kconfig
> +++ b/drivers/staging/media/zoran/Kconfig
> @@ -14,7 +14,7 @@ config VIDEO_ZORAN
> module will be called zr36067.
>
> config VIDEO_ZORAN_DC30
> - tristate "Pinnacle/Miro DC30(+) support"
> + bool "Pinnacle/Miro DC30(+) support"
> depends on VIDEO_ZORAN
> select VIDEO_ADV7175 if MEDIA_SUBDRV_AUTOSELECT
> select VIDEO_VPX3220 if MEDIA_SUBDRV_AUTOSELECT
> @@ -24,7 +24,7 @@ config VIDEO_ZORAN_DC30
> zr36050 MJPEG codec and zr36016 VFE.
>
> config VIDEO_ZORAN_ZR36060
> - tristate "Zoran ZR36060"
> + bool "Zoran ZR36060"
> depends on VIDEO_ZORAN
> help
> Say Y to support Zoran boards based on 36060 chips.
> @@ -32,7 +32,7 @@ config VIDEO_ZORAN_ZR36060
> and 33 R10 and AverMedia 6 boards.
>
> config VIDEO_ZORAN_BUZ
> - tristate "Iomega Buz support"
> + bool "Iomega Buz support"
> depends on VIDEO_ZORAN_ZR36060
> select VIDEO_SAA711X if MEDIA_SUBDRV_AUTOSELECT
> select VIDEO_SAA7185 if MEDIA_SUBDRV_AUTOSELECT
> @@ -40,7 +40,7 @@ config VIDEO_ZORAN_BUZ
> Support for the Iomega Buz MJPEG capture/playback card.
>
> config VIDEO_ZORAN_DC10
> - tristate "Pinnacle/Miro DC10(+) support"
> + bool "Pinnacle/Miro DC10(+) support"
> depends on VIDEO_ZORAN_ZR36060
> select VIDEO_SAA7110 if MEDIA_SUBDRV_AUTOSELECT
> select VIDEO_ADV7175 if MEDIA_SUBDRV_AUTOSELECT
> @@ -49,7 +49,7 @@ config VIDEO_ZORAN_DC10
> card.
>
> config VIDEO_ZORAN_LML33
> - tristate "Linux Media Labs LML33 support"
> + bool "Linux Media Labs LML33 support"
> depends on VIDEO_ZORAN_ZR36060
> select VIDEO_BT819 if MEDIA_SUBDRV_AUTOSELECT
> select VIDEO_BT856 if MEDIA_SUBDRV_AUTOSELECT
> @@ -58,7 +58,7 @@ config VIDEO_ZORAN_LML33
> card.
>
> config VIDEO_ZORAN_LML33R10
> - tristate "Linux Media Labs LML33R10 support"
> + bool "Linux Media Labs LML33R10 support"
> depends on VIDEO_ZORAN_ZR36060
> select VIDEO_SAA711X if MEDIA_SUBDRV_AUTOSELECT
> select VIDEO_ADV7170 if MEDIA_SUBDRV_AUTOSELECT
> @@ -67,7 +67,7 @@ config VIDEO_ZORAN_LML33R10
> card.
>
> config VIDEO_ZORAN_AVS6EYES
> - tristate "AverMedia 6 Eyes support"
> + bool "AverMedia 6 Eyes support"
> depends on VIDEO_ZORAN_ZR36060
> select VIDEO_BT856 if MEDIA_SUBDRV_AUTOSELECT
> select VIDEO_BT866 if MEDIA_SUBDRV_AUTOSELECT
> diff --git a/drivers/staging/media/zoran/Makefile b/drivers/staging/media/zoran/Makefile
> index 7023158e3892..9603bac0195c 100644
> --- a/drivers/staging/media/zoran/Makefile
> +++ b/drivers/staging/media/zoran/Makefile
> @@ -1,7 +1,7 @@
> # SPDX-License-Identifier: GPL-2.0
> zr36067-objs := zoran_device.o \
> - zoran_driver.o zoran_card.o
> + zoran_driver.o zoran_card.o videocodec.o
>
> -obj-$(CONFIG_VIDEO_ZORAN) += zr36067.o videocodec.o
> -obj-$(CONFIG_VIDEO_ZORAN_DC30) += zr36050.o zr36016.o
> -obj-$(CONFIG_VIDEO_ZORAN_ZR36060) += zr36060.o
> +obj-$(CONFIG_VIDEO_ZORAN) += zr36067.o
> +zr36067-$(CONFIG_VIDEO_ZORAN_DC30) += zr36050.o zr36016.o
> +zr36067-$(CONFIG_VIDEO_ZORAN_ZR36060) += zr36060.o
> diff --git a/drivers/staging/media/zoran/videocodec.c b/drivers/staging/media/zoran/videocodec.c
> index 3d5a83a07e07..7350d7747516 100644
> --- a/drivers/staging/media/zoran/videocodec.c
> +++ b/drivers/staging/media/zoran/videocodec.c
> @@ -8,8 +8,6 @@
> * (c) 2002 Wolfgang Scherr <[email protected]>
> */
>
> -#define VIDEOCODEC_VERSION "v0.2"
> -
> #include <linux/kernel.h>
> #include <linux/module.h>
> #include <linux/init.h>
> @@ -119,7 +117,6 @@ struct videocodec *videocodec_attach(struct videocodec_master *master)
> kfree(codec);
> return NULL;
> }
> -EXPORT_SYMBOL(videocodec_attach);
>
> int videocodec_detach(struct videocodec *codec)
> {
> @@ -175,7 +172,6 @@ int videocodec_detach(struct videocodec *codec)
> pr_err("%s: given codec not found!\n", __func__);
> return -EINVAL;
> }
> -EXPORT_SYMBOL(videocodec_detach);
>
> int videocodec_register(const struct videocodec *codec)
> {
> @@ -208,7 +204,6 @@ int videocodec_register(const struct videocodec *codec)
>
> return 0;
> }
> -EXPORT_SYMBOL(videocodec_register);
>
> int videocodec_unregister(const struct videocodec *codec)
> {
> @@ -255,7 +250,6 @@ int videocodec_unregister(const struct videocodec *codec)
> pr_err("%s: given codec not found!\n", __func__);
> return -EINVAL;
> }
> -EXPORT_SYMBOL(videocodec_unregister);
>
> #ifdef CONFIG_VIDEO_ZORAN_DEBUG
> int videocodec_debugfs_show(struct seq_file *m)
> @@ -286,25 +280,3 @@ int videocodec_debugfs_show(struct seq_file *m)
> return 0;
> }
> #endif
> -
> -/* ===================== */
> -/* hook in driver module */
> -/* ===================== */
> -static int __init videocodec_init(void)
> -{
> - pr_info("Linux video codec intermediate layer: %s\n", VIDEOCODEC_VERSION);
> -
> - return 0;
> -}
> -
> -static void __exit videocodec_exit(void)
> -{
> -}
> -
> -module_init(videocodec_init);
> -module_exit(videocodec_exit);
> -
> -MODULE_AUTHOR("Wolfgang Scherr <[email protected]>");
> -MODULE_DESCRIPTION("Intermediate API module for video codecs "
> - VIDEOCODEC_VERSION);
> -MODULE_LICENSE("GPL");
> diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c
> index 1ed8ed2f4f7f..7b2e1d1c4622 100644
> --- a/drivers/staging/media/zoran/zoran_card.c
> +++ b/drivers/staging/media/zoran/zoran_card.c
> @@ -29,6 +29,9 @@
> #include "zoran.h"
> #include "zoran_card.h"
> #include "zoran_device.h"
> +#include "zr36016.h"
> +#include "zr36050.h"
> +#include "zr36060.h"
>
> extern const struct zoran_format zoran_formats[];
>
> @@ -266,6 +269,39 @@ static const char *codecid_to_modulename(u16 codecid)
> return name;
> }
>
> +static int load_codec(struct zoran *zr, u16 codecid)
> +{
> + switch (codecid) {
> + case CODEC_TYPE_ZR36060:
> +#ifdef CONFIG_VIDEO_ZORAN_ZR36060
> + return zr36060_init_module();
> +#else
> + pci_err(zr->pci_dev, "ZR36060 support is not enabled\n");
> + return -EINVAL;
> +#endif
> + break;
> + case CODEC_TYPE_ZR36050:
> +#ifdef CONFIG_VIDEO_ZORAN_DC30
> + return zr36050_init_module();
> +#else
> + pci_err(zr->pci_dev, "ZR36050 support is not enabled\n");
> + return -EINVAL;
> +#endif
> + break;
> + case CODEC_TYPE_ZR36016:
> +#ifdef CONFIG_VIDEO_ZORAN_DC30
> + return zr36016_init_module();
> +#else
> + pci_err(zr->pci_dev, "ZR36016 support is not enabled\n");
> + return -EINVAL;
> +#endif
> + break;
> + }
> +
> + pci_err(zr->pci_dev, "unknown codec id %x\n", codecid);
> + return -EINVAL;
> +}
> +
> // struct tvnorm {
> // u16 wt, wa, h_start, h_sync_start, ht, ha, v_start;
> // };
> @@ -1078,6 +1114,8 @@ static int zoran_debugfs_show(struct seq_file *seq, void *v)
>
> seq_printf(seq, "Prepared %u\n", zr->prepared);
> seq_printf(seq, "Queued %u\n", zr->queued);
> +
> + videocodec_debugfs_show(seq);
> return 0;
> }
>
> @@ -1262,17 +1300,17 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> if (zr->card.video_codec) {
> codec_name = codecid_to_modulename(zr->card.video_codec);
> if (codec_name) {
> - result = request_module(codec_name);
> - if (result)
> - pci_err(pdev, "failed to load modules %s: %d\n", codec_name, result);
> + result = load_codec(zr, zr->card.video_codec);
> + if (result < 0)
> + pci_err(pdev, "failed to load codec %s: %d\n", codec_name, result);
> }
> }
> if (zr->card.video_vfe) {
> vfe_name = codecid_to_modulename(zr->card.video_vfe);
> if (vfe_name) {
> - result = request_module(vfe_name);
> + result = load_codec(zr, zr->card.video_vfe);
> if (result < 0)
> - pci_err(pdev, "failed to load modules %s: %d\n", vfe_name, result);
> + pci_err(pdev, "failed to load codec %s: %d\n", vfe_name, result);
> }
> }
>
> diff --git a/drivers/staging/media/zoran/zr36016.c b/drivers/staging/media/zoran/zr36016.c
> index 50605460a44b..adf738b5a1d5 100644
> --- a/drivers/staging/media/zoran/zr36016.c
> +++ b/drivers/staging/media/zoran/zr36016.c
> @@ -409,14 +409,14 @@ static const struct videocodec zr36016_codec = {
> HOOK IN DRIVER AS KERNEL MODULE
> ========================================================================= */
>
> -static int __init zr36016_init_module(void)
> +int zr36016_init_module(void)
> {
> //dprintk(1, "ZR36016 driver %s\n",ZR016_VERSION);
> zr36016_codecs = 0;
> return videocodec_register(&zr36016_codec);
> }
>
> -static void __exit zr36016_cleanup_module(void)
> +void zr36016_cleanup_module(void)
> {
> if (zr36016_codecs) {
> dprintk(1,
> @@ -425,10 +425,3 @@ static void __exit zr36016_cleanup_module(void)
> }
> videocodec_unregister(&zr36016_codec);
> }
> -
> -module_init(zr36016_init_module);
> -module_exit(zr36016_cleanup_module);
> -
> -MODULE_AUTHOR("Wolfgang Scherr <[email protected]>");
> -MODULE_DESCRIPTION("Driver module for ZR36016 video frontends");
> -MODULE_LICENSE("GPL");
> diff --git a/drivers/staging/media/zoran/zr36016.h b/drivers/staging/media/zoran/zr36016.h
> index 1475f971cc24..04afba35669d 100644
> --- a/drivers/staging/media/zoran/zr36016.h
> +++ b/drivers/staging/media/zoran/zr36016.h
> @@ -89,4 +89,6 @@ struct zr36016 {
> #define ZR016_SIGN 0x02
> #define ZR016_YMCS 0x01
>
> +int zr36016_init_module(void);
> +void zr36016_cleanup_module(void);
> #endif /*fndef ZR36016_H */
> diff --git a/drivers/staging/media/zoran/zr36050.c b/drivers/staging/media/zoran/zr36050.c
> index 4dc7927fefc3..e36eff4a798c 100644
> --- a/drivers/staging/media/zoran/zr36050.c
> +++ b/drivers/staging/media/zoran/zr36050.c
> @@ -817,14 +817,14 @@ static const struct videocodec zr36050_codec = {
> HOOK IN DRIVER AS KERNEL MODULE
> ========================================================================= */
>
> -static int __init zr36050_init_module(void)
> +int zr36050_init_module(void)
> {
> //dprintk(1, "ZR36050 driver %s\n",ZR050_VERSION);
> zr36050_codecs = 0;
> return videocodec_register(&zr36050_codec);
> }
>
> -static void __exit zr36050_cleanup_module(void)
> +void zr36050_cleanup_module(void)
> {
> if (zr36050_codecs) {
> dprintk(1,
> @@ -833,11 +833,3 @@ static void __exit zr36050_cleanup_module(void)
> }
> videocodec_unregister(&zr36050_codec);
> }
> -
> -module_init(zr36050_init_module);
> -module_exit(zr36050_cleanup_module);
> -
> -MODULE_AUTHOR("Wolfgang Scherr <[email protected]>");
> -MODULE_DESCRIPTION("Driver module for ZR36050 jpeg processors "
> - ZR050_VERSION);
> -MODULE_LICENSE("GPL");
> diff --git a/drivers/staging/media/zoran/zr36050.h b/drivers/staging/media/zoran/zr36050.h
> index 8f972d045b58..f9b58f4c77b9 100644
> --- a/drivers/staging/media/zoran/zr36050.h
> +++ b/drivers/staging/media/zoran/zr36050.h
> @@ -160,4 +160,6 @@ struct zr36050 {
> #define ZR050_U_COMPONENT 1
> #define ZR050_V_COMPONENT 2
>
> +int zr36050_init_module(void);
> +void zr36050_cleanup_module(void);
> #endif /*fndef ZR36050_H */
> diff --git a/drivers/staging/media/zoran/zr36060.c b/drivers/staging/media/zoran/zr36060.c
> index 7904d5b1f402..0a6a8c985137 100644
> --- a/drivers/staging/media/zoran/zr36060.c
> +++ b/drivers/staging/media/zoran/zr36060.c
> @@ -846,13 +846,13 @@ static const struct videocodec zr36060_codec = {
> // others are not used
> };
>
> -static int __init zr36060_init_module(void)
> +int zr36060_init_module(void)
> {
> zr36060_codecs = 0;
> return videocodec_register(&zr36060_codec);
> }
>
> -static void __exit zr36060_cleanup_module(void)
> +void zr36060_cleanup_module(void)
> {
> if (zr36060_codecs) {
> dprintk(1,
> @@ -863,10 +863,3 @@ static void __exit zr36060_cleanup_module(void)
> /* however, we can't just stay alive */
> videocodec_unregister(&zr36060_codec);
> }
> -
> -module_init(zr36060_init_module);
> -module_exit(zr36060_cleanup_module);
> -
> -MODULE_AUTHOR("Laurent Pinchart <[email protected]>");
> -MODULE_DESCRIPTION("Driver module for ZR36060 jpeg processors " ZR060_VERSION);
> -MODULE_LICENSE("GPL");
> diff --git a/drivers/staging/media/zoran/zr36060.h b/drivers/staging/media/zoran/zr36060.h
> index d2cdc26bf625..fbf5429534ac 100644
> --- a/drivers/staging/media/zoran/zr36060.h
> +++ b/drivers/staging/media/zoran/zr36060.h
> @@ -198,4 +198,6 @@ struct zr36060 {
> #define ZR060_SR_H_SCALE2 BIT(0)
> #define ZR060_SR_H_SCALE4 (2 << 0)
>
> +int zr36060_init_module(void);
> +void zr36060_cleanup_module(void);
> #endif /*fndef ZR36060_H */
>
Hi Corentin,
I finally had the opportunity to test the staging zoran driver.
I found several issues when running v4l2-compliance -s (I posted a patch
for that), but more seriously is the fact that trying to capture MJPG
at resolutions 384x288 or less just hangs my PC. It works OK with 768x576.
I discovered this when running 'v4l2-compliance -s -a -f'.
BTW, why isn't the initial format equal to MJPG 768x576?
I would expect that for these boards that should be the default format.
Another issue is that the TODO should mention that for video output there
should be a second video device node. And that's really something that
has to be done before the zoran driver can be moved out of staging.
It shouldn't be that hard to implement, I think.
Right now it is impossible to run the compliance test for the output, since
it doesn't even see it as an output.
Regards,
Hans
On 03/09/2021 21:15, Corentin Labbe wrote:
> Hello
>
> The main change of this serie is to fusion all zoran related modules in
> one.
> This fixes the load order problem when everything is built-in.
>
> Regards
>
> Corentin Labbe (8):
> staging: media: zoran: move module parameter checks to zoran_probe
> staging: media: zoran: use module_pci_driver
> staging: media: zoran: rename debug module parameter
> staging: media: zoran: add debugfs
> staging: media: zoran: videocode: remove procfs
> staging: media: zoran: fusion all modules
> staging: media: zoran: remove vidmem
> staging: media: zoran: move videodev alloc
>
> drivers/staging/media/zoran/Kconfig | 24 +-
> drivers/staging/media/zoran/Makefile | 8 +-
> drivers/staging/media/zoran/videocodec.c | 60 +----
> drivers/staging/media/zoran/videocodec.h | 5 +
> drivers/staging/media/zoran/zoran.h | 7 +-
> drivers/staging/media/zoran/zoran_card.c | 259 +++++++++++++--------
> drivers/staging/media/zoran/zoran_driver.c | 5 +-
> drivers/staging/media/zoran/zr36016.c | 23 +-
> drivers/staging/media/zoran/zr36016.h | 2 +
> drivers/staging/media/zoran/zr36050.c | 20 +-
> drivers/staging/media/zoran/zr36050.h | 2 +
> drivers/staging/media/zoran/zr36060.c | 20 +-
> drivers/staging/media/zoran/zr36060.h | 2 +
> 13 files changed, 229 insertions(+), 208 deletions(-)
>
Le Mon, Sep 06, 2021 at 12:41:32PM +0200, Hans Verkuil a ?crit :
> On 03/09/2021 21:15, Corentin Labbe wrote:
> > The zoran driver is split in many modules, but this lead to some
> > problems.
> > One of them is that load order is incorrect when everything is built-in.
> >
> > Having more than one module is useless, so fusion all zoran modules in
> > one.
>
> After applying this patch I am no longer able to rmmod the module: it will
> always report that it is in use. This is with a Miro DC30.
>
> So something is wrong with refcounting.
>
> I do like the idea of merging all these modules, but it needs a bit more
> testing.
>
> Regards,
>
> Hans
>
Hello
I am sorry, I was sure to have successfully removed the zoran module a couple of time with my DC10.
Anyway I just acquired a DC30, so I will test it also (even if I believe that model should not change anything).
Regards
Le Mon, Sep 06, 2021 at 01:03:56PM +0200, Hans Verkuil a ?crit :
> Hi Corentin,
>
> I finally had the opportunity to test the staging zoran driver.
>
> I found several issues when running v4l2-compliance -s (I posted a patch
> for that), but more seriously is the fact that trying to capture MJPG
> at resolutions 384x288 or less just hangs my PC. It works OK with 768x576.
>
> I discovered this when running 'v4l2-compliance -s -a -f'.
>
> BTW, why isn't the initial format equal to MJPG 768x576?
> I would expect that for these boards that should be the default format.
>
> Another issue is that the TODO should mention that for video output there
> should be a second video device node. And that's really something that
> has to be done before the zoran driver can be moved out of staging.
>
> It shouldn't be that hard to implement, I think.
>
> Right now it is impossible to run the compliance test for the output, since
> it doesn't even see it as an output.
>
> Regards,
>
> Hans
I work on having a second device for output, (it is the reason of "staging: media: zoran: move videodev alloc" which will help).
But I still have the problem of non working output.
Does output is really needed for going out of staging ?
Probably nobody have it working for ages. The only way to had it was to use an old mplayer output which is broken since so many time.
Note that this plugin will never work again.
The only way to work on output is to use ffmpeg which just recently have suport for writing non-raw video to V4L.
Regards
On 06/09/2021 16:56, LABBE Corentin wrote:
> Le Mon, Sep 06, 2021 at 04:11:16PM +0200, Hans Verkuil a écrit :
>> On 06/09/2021 15:49, LABBE Corentin wrote:
>>> Le Mon, Sep 06, 2021 at 01:03:56PM +0200, Hans Verkuil a écrit :
>>>> Hi Corentin,
>>>>
>>>> I finally had the opportunity to test the staging zoran driver.
>>>>
>>>> I found several issues when running v4l2-compliance -s (I posted a patch
>>>> for that), but more seriously is the fact that trying to capture MJPG
>>>> at resolutions 384x288 or less just hangs my PC. It works OK with 768x576.
>>>>
>>>> I discovered this when running 'v4l2-compliance -s -a -f'.
>>>>
>>>> BTW, why isn't the initial format equal to MJPG 768x576?
>>>> I would expect that for these boards that should be the default format.
>>>>
>>>> Another issue is that the TODO should mention that for video output there
>>>> should be a second video device node. And that's really something that
>>>> has to be done before the zoran driver can be moved out of staging.
>>>>
>>>> It shouldn't be that hard to implement, I think.
>>>>
>>>> Right now it is impossible to run the compliance test for the output, since
>>>> it doesn't even see it as an output.
>>>>
>>>> Regards,
>>>>
>>>> Hans
>>>
>>> I work on having a second device for output, (it is the reason of "staging: media: zoran: move videodev alloc" which will help).
>>>
>>> But I still have the problem of non working output.
>>>
>>> Does output is really needed for going out of staging ?
>>> Probably nobody have it working for ages. The only way to had it was to use an old mplayer output which is broken since so many time.
>>> Note that this plugin will never work again.
>>>
>>> The only way to work on output is to use ffmpeg which just recently have suport for writing non-raw video to V4L.
>>
>> Then just remove it. The code for output remains in the git history so if someone wants to
>> resurrect that, then that's always possible.
>>
>> The point is that I don't want to have half-baked output support in mainline.
>>
>> But what exactly is the problem with getting output to work? Doesn't it just decode
>> MJPEG frames? (Sorry if you explained it before, it's so long ago that I looked at this
>> that I forgot the details)
>>
>
> The first problem is that zoran dont like comment COM/APP0 markers.
> This imply a per buffer filtering but this is already handled in my next branch.
>
> But the remaining problem is that any output is like http://kernel.montjoie.ovh/zoran_out.png.
>
> I hacked the driver to grab a working buffer when doing input and overrun output buffer later.
> And the result is a working static output.
> So the hw handling is good and the problem came from the data feeding/handling.
>
> I believe that something is wrong in what ffmpeg negociate/send.
>
> Regards
>
Why not use v4l2-ctl to capture video and then replay it? You should be able to do this:
v4l2-ctl --stream-mmap --stream-to-hdr cap.hdr --stream-count 60
then this:
v4l2-ctl --stream-out-mmap --stream-from-hdr cap.hdr
The -hdr options write the frames prefixed with a header containing the length of the frame.
That way you can capture variable-length frames and stream them out with the same payload
length.
Regards,
Hans
On 06/09/2021 15:49, LABBE Corentin wrote:
> Le Mon, Sep 06, 2021 at 01:03:56PM +0200, Hans Verkuil a écrit :
>> Hi Corentin,
>>
>> I finally had the opportunity to test the staging zoran driver.
>>
>> I found several issues when running v4l2-compliance -s (I posted a patch
>> for that), but more seriously is the fact that trying to capture MJPG
>> at resolutions 384x288 or less just hangs my PC. It works OK with 768x576.
>>
>> I discovered this when running 'v4l2-compliance -s -a -f'.
>>
>> BTW, why isn't the initial format equal to MJPG 768x576?
>> I would expect that for these boards that should be the default format.
>>
>> Another issue is that the TODO should mention that for video output there
>> should be a second video device node. And that's really something that
>> has to be done before the zoran driver can be moved out of staging.
>>
>> It shouldn't be that hard to implement, I think.
>>
>> Right now it is impossible to run the compliance test for the output, since
>> it doesn't even see it as an output.
>>
>> Regards,
>>
>> Hans
>
> I work on having a second device for output, (it is the reason of "staging: media: zoran: move videodev alloc" which will help).
>
> But I still have the problem of non working output.
>
> Does output is really needed for going out of staging ?
> Probably nobody have it working for ages. The only way to had it was to use an old mplayer output which is broken since so many time.
> Note that this plugin will never work again.
>
> The only way to work on output is to use ffmpeg which just recently have suport for writing non-raw video to V4L.
Then just remove it. The code for output remains in the git history so if someone wants to
resurrect that, then that's always possible.
The point is that I don't want to have half-baked output support in mainline.
But what exactly is the problem with getting output to work? Doesn't it just decode
MJPEG frames? (Sorry if you explained it before, it's so long ago that I looked at this
that I forgot the details)
In any case, before the driver can be moved out of staging video output should either
be working or removed. Either is fine, but not the halfway state it is in today.
Regards,
Hans
Le Mon, Sep 06, 2021 at 04:11:16PM +0200, Hans Verkuil a ?crit :
> On 06/09/2021 15:49, LABBE Corentin wrote:
> > Le Mon, Sep 06, 2021 at 01:03:56PM +0200, Hans Verkuil a ?crit :
> >> Hi Corentin,
> >>
> >> I finally had the opportunity to test the staging zoran driver.
> >>
> >> I found several issues when running v4l2-compliance -s (I posted a patch
> >> for that), but more seriously is the fact that trying to capture MJPG
> >> at resolutions 384x288 or less just hangs my PC. It works OK with 768x576.
> >>
> >> I discovered this when running 'v4l2-compliance -s -a -f'.
> >>
> >> BTW, why isn't the initial format equal to MJPG 768x576?
> >> I would expect that for these boards that should be the default format.
> >>
> >> Another issue is that the TODO should mention that for video output there
> >> should be a second video device node. And that's really something that
> >> has to be done before the zoran driver can be moved out of staging.
> >>
> >> It shouldn't be that hard to implement, I think.
> >>
> >> Right now it is impossible to run the compliance test for the output, since
> >> it doesn't even see it as an output.
> >>
> >> Regards,
> >>
> >> Hans
> >
> > I work on having a second device for output, (it is the reason of "staging: media: zoran: move videodev alloc" which will help).
> >
> > But I still have the problem of non working output.
> >
> > Does output is really needed for going out of staging ?
> > Probably nobody have it working for ages. The only way to had it was to use an old mplayer output which is broken since so many time.
> > Note that this plugin will never work again.
> >
> > The only way to work on output is to use ffmpeg which just recently have suport for writing non-raw video to V4L.
>
> Then just remove it. The code for output remains in the git history so if someone wants to
> resurrect that, then that's always possible.
>
> The point is that I don't want to have half-baked output support in mainline.
>
> But what exactly is the problem with getting output to work? Doesn't it just decode
> MJPEG frames? (Sorry if you explained it before, it's so long ago that I looked at this
> that I forgot the details)
>
The first problem is that zoran dont like comment COM/APP0 markers.
This imply a per buffer filtering but this is already handled in my next branch.
But the remaining problem is that any output is like http://kernel.montjoie.ovh/zoran_out.png.
I hacked the driver to grab a working buffer when doing input and overrun output buffer later.
And the result is a working static output.
So the hw handling is good and the problem came from the data feeding/handling.
I believe that something is wrong in what ffmpeg negociate/send.
Regards