Re: [PATCH] solo6x10: Approximate frame intervals with non-standard denominator
Hi Ismael! A quick review below: On Wed April 10 2013 23:28:05 Ismael Luceno wrote: Instead of falling back to 1/25 (PAL) or 1/30 (NTSC). Signed-off-by: Ismael Luceno ismael.luc...@corp.bluecherry.net # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # On branch media # Changes to be committed: # (use git reset HEAD file... to unstage) # # modified: drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c # # Untracked files: # (use git add file... to include in what will be committed) # # buildtest/ --- drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c | 38 +- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c b/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c index 6c7d20f..6965307 100644 --- a/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c +++ b/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c @@ -975,12 +975,11 @@ static int solo_g_parm(struct file *file, void *priv, struct v4l2_streamparm *sp) { struct solo_enc_dev *solo_enc = video_drvdata(file); - struct solo_dev *solo_dev = solo_enc-solo_dev; struct v4l2_captureparm *cp = sp-parm.capture; cp-capability = V4L2_CAP_TIMEPERFRAME; cp-timeperframe.numerator = solo_enc-interval; - cp-timeperframe.denominator = solo_dev-fps; + cp-timeperframe.denominator = solo_enc-solo_dev-fps; cp-capturemode = 0; /* XXX: Shouldn't we be able to get/set this from videobuf? */ cp-readbuffers = 2; @@ -988,36 +987,29 @@ static int solo_g_parm(struct file *file, void *priv, return 0; } +static inline int calc_interval(u8 fps, u32 n, u32 d) +{ + if (unlikely(!n || !d)) + return 1; + if (likely(d == fps)) + return n; Don't use likely/unlikely in code that is rarely executed. It just makes it harder to read. These optimizations are only useful in tight loops. + n *= fps; + return min(15U, n / d + (n % d = (fps 1))); +} + static int solo_s_parm(struct file *file, void *priv, struct v4l2_streamparm *sp) { struct solo_enc_dev *solo_enc = video_drvdata(file); - struct solo_dev *solo_dev = solo_enc-solo_dev; - struct v4l2_captureparm *cp = sp-parm.capture; + struct v4l2_fract *t = sp-parm.capture.timeperframe; + u8 fps = solo_enc-solo_dev-fps; if (vb2_is_streaming(solo_enc-vidq)) return -EBUSY; - if ((cp-timeperframe.numerator == 0) || - (cp-timeperframe.denominator == 0)) { - /* reset framerate */ - cp-timeperframe.numerator = 1; - cp-timeperframe.denominator = solo_dev-fps; - } - - if (cp-timeperframe.denominator != solo_dev-fps) - cp-timeperframe.denominator = solo_dev-fps; - - if (cp-timeperframe.numerator 15) - cp-timeperframe.numerator = 15; - - solo_enc-interval = cp-timeperframe.numerator; - - cp-capability = V4L2_CAP_TIMEPERFRAME; - cp-readbuffers = 2; - + solo_enc-interval = calc_interval(fps, t-numerator, t-denominator); solo_update_mode(solo_enc); - return 0; + return solo_g_parm(file, priv, sp); } static long solo_enc_default(struct file *file, void *fh, If you post a new version today with that small fix, then I can still merge it for 3.10 tomorrow. Regards, Hans -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [REVIEWv2 PATCH 12/12] hdpvr: allow g/s_std when in legacy mode.
Hans, The current HEAD is working for both MythTV and gstreamer! Will you be doing more work on hdpvr? Should I start looking into error handling and kmallocs? Thank you, -Leo. Original Message Subject: Re: [REVIEWv2 PATCH 12/12] hdpvr: allow g/s_std when in legacy mode. From: Hans Verkuil hansv...@cisco.com Date: Wed, April 10, 2013 10:25 am To: linux-media@vger.kernel.org Cc: l...@lumanate.com, Janne Grunau j...@jannau.net, Hans Verkuil hans.verk...@cisco.com On Wed April 10 2013 18:27:43 Hans Verkuil wrote: Leo, can you verify that this works for you as well? I tested it without problems with MythTV and gstreamer. Thanks! Hans Both MythTV and gstreamer expect that they can set/get/query/enumerate the standards, even if the input is the component input for which standards really do not apply. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/usb/hdpvr/hdpvr-video.c | 40 - 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/drivers/media/usb/hdpvr/hdpvr-video.c b/drivers/media/usb/hdpvr/hdpvr-video.c index 4376309..38724d7 100644 --- a/drivers/media/usb/hdpvr/hdpvr-video.c +++ b/drivers/media/usb/hdpvr/hdpvr-video.c -static int vidioc_enum_input(struct file *file, void *priv, - struct v4l2_input *i) +static int vidioc_enum_input(struct file *file, void *_fh, struct v4l2_input *i) { + struct hdpvr_fh *fh = _fh; unsigned int n; n = i-index; @@ -758,13 +761,15 @@ static int vidioc_enum_input(struct file *file, void *priv, i-audioset = 1HDPVR_RCA_FRONT | 1HDPVR_RCA_BACK | 1HDPVR_SPDIF; + if (fh-legacy_mode) + n = 1; Oops, these two lines should be removed. Otherwise non-legacy apps like qv4l2 will break as they rely on accurate capability reporting. i-capabilities = n ? V4L2_IN_CAP_STD : V4L2_IN_CAP_DV_TIMINGS; i-std = n ? V4L2_STD_ALL : 0; return 0; } Regards, Hans -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v8 1/7] media: V4L2: add temporary clock helpers
Hi Barry On Thu, 11 Apr 2013, Barry Song wrote: Hi Guennadi, Typical video devices like camera sensors require an external clock source. Many such devices cannot even access their hardware registers without a running clock. These clock sources should be controlled by their consumers. This should be performed, using the generic clock framework. Unfortunately so far only very few systems have been ported to that framework. This patch adds a set of temporary helpers, mimicking the generic clock API, to V4L2. Platforms, adopting the clock API, should switch to using it. Eventually this temporary API should be removed. Signed-off-by: Guennadi Liakhovetski g.liakhovetski@xx --- for your patch 1/8 and 3/8, i think it makes a lot of senses to let the object manages its own clock by itself. is it possible for us to implement v4l2-clk.c directly as an instance of standard clk driver for those systems which don't have generic clock, and remove the V4L2 clock APIs like v4l2_clk_get, v4l2_clk_enable from the first day? i mean v4l2-clk.c becomes a temp and fake clock controller driver. finally, after people have generically clk, remove it. I don't think you can force-enable the CFF on systems, that don't support it, e.g. PXA. Thanks Guennadi v8: Updated both (C) dates drivers/media/v4l2-core/Makefile |2 +- drivers/media/v4l2-core/v4l2-clk.c | 177 include/media/v4l2-clk.h | 54 +++ 3 files changed, 232 insertions(+), 1 deletions(-) create mode 100644 drivers/media/v4l2-core/v4l2-clk.c create mode 100644 include/media/v4l2-clk.h diff --git a/drivers/media/v4l2-core/Makefile b/drivers/media/v4l2-core/Makefile index aa50c46..628c630 100644 --- a/drivers/media/v4l2-core/Makefile +++ b/drivers/media/v4l2-core/Makefile @@ -5,7 +5,7 @@ tuner-objs := tuner-core.o videodev-objs := v4l2-dev.o v4l2-ioctl.o v4l2-device.o v4l2-fh.o \ - v4l2-event.o v4l2-ctrls.o v4l2-subdev.o + v4l2-event.o v4l2-ctrls.o v4l2-subdev.o v4l2-clk.o ifeq ($(CONFIG_COMPAT),y) videodev-objs += v4l2-compat-ioctl32.o endif diff --git a/drivers/media/v4l2-core/v4l2-clk.c b/drivers/media/v4l2-core/v4l2-clk.c new file mode 100644 index 000..d7cc13e --- /dev/null +++ b/drivers/media/v4l2-core/v4l2-clk.c @@ -0,0 +1,177 @@ -barry --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [REVIEWv2 PATCH 12/12] hdpvr: allow g/s_std when in legacy mode.
On Thu 11 April 2013 09:21:45 l...@lumanate.com wrote: Hans, The current HEAD is working for both MythTV and gstreamer! Will you be doing more work on hdpvr? Should I start looking into error handling and kmallocs? No, that's it. I'll post a pull request with all this tomorrow. Feel free to work on improvements, but they'll be queued for kernel 3.11 since tomorrow is the last chance for patches for 3.10. Thanks for your help testing this! Much appreciated. Regards, Hans Thank you, -Leo. Original Message Subject: Re: [REVIEWv2 PATCH 12/12] hdpvr: allow g/s_std when in legacy mode. From: Hans Verkuil hansv...@cisco.com Date: Wed, April 10, 2013 10:25 am To: linux-media@vger.kernel.org Cc: l...@lumanate.com, Janne Grunau j...@jannau.net, Hans Verkuil hans.verk...@cisco.com On Wed April 10 2013 18:27:43 Hans Verkuil wrote: Leo, can you verify that this works for you as well? I tested it without problems with MythTV and gstreamer. Thanks! Hans Both MythTV and gstreamer expect that they can set/get/query/enumerate the standards, even if the input is the component input for which standards really do not apply. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/usb/hdpvr/hdpvr-video.c | 40 - 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/drivers/media/usb/hdpvr/hdpvr-video.c b/drivers/media/usb/hdpvr/hdpvr-video.c index 4376309..38724d7 100644 --- a/drivers/media/usb/hdpvr/hdpvr-video.c +++ b/drivers/media/usb/hdpvr/hdpvr-video.c -static int vidioc_enum_input(struct file *file, void *priv, - struct v4l2_input *i) +static int vidioc_enum_input(struct file *file, void *_fh, struct v4l2_input *i) { + struct hdpvr_fh *fh = _fh; unsigned int n; n = i-index; @@ -758,13 +761,15 @@ static int vidioc_enum_input(struct file *file, void *priv, i-audioset = 1HDPVR_RCA_FRONT | 1HDPVR_RCA_BACK | 1HDPVR_SPDIF; + if (fh-legacy_mode) + n = 1; Oops, these two lines should be removed. Otherwise non-legacy apps like qv4l2 will break as they rely on accurate capability reporting. i-capabilities = n ? V4L2_IN_CAP_STD : V4L2_IN_CAP_DV_TIMINGS; i-std = n ? V4L2_STD_ALL : 0; return 0; } Regards, Hans -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: uvcvideo: Dropping payload (out of sync)
On 10.04.2013 08:05, André Weidemann wrote: Hi, I ran into a problem while trying to get a Microsoft LifeCam Studio(TM) (045e:0772) to work with uvccapture on a Raspberry PI running Kernel 3.6.11 under Debian Wheezy. I started grabbing a picture with: /usr/bin/uvccapture -x1920 -y1080 -o/media/ramdisk/webcam.jpg -q80 [1] http://ftp.de.debian.org/debian/pool/main/u/uvccapture/uvccapture_0.5.orig.tar.gz [2] http://ftp.de.debian.org/debian/pool/main/u/uvccapture/uvccapture_0.5-2.debian.tar.gz Grabbing a picture takes between 20 seconds and 1-2 minutes. Unfortuantely the captured image is heavily distorted. For anyone who may also run into this problem here is a solution... It seems the problem is hardware related to the Raspberry Pi. The solution can be found here: https://github.com/raspberrypi/linux/issues/238 https://github.com/P33M/linux André -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v8 1/7] media: V4L2: add temporary clock helpers
2013/4/11 Guennadi Liakhovetski g.liakhovet...@gmx.de: Hi Barry On Thu, 11 Apr 2013, Barry Song wrote: Hi Guennadi, Typical video devices like camera sensors require an external clock source. Many such devices cannot even access their hardware registers without a running clock. These clock sources should be controlled by their consumers. This should be performed, using the generic clock framework. Unfortunately so far only very few systems have been ported to that framework. This patch adds a set of temporary helpers, mimicking the generic clock API, to V4L2. Platforms, adopting the clock API, should switch to using it. Eventually this temporary API should be removed. Signed-off-by: Guennadi Liakhovetski g.liakhovetski@xx --- for your patch 1/8 and 3/8, i think it makes a lot of senses to let the object manages its own clock by itself. is it possible for us to implement v4l2-clk.c directly as an instance of standard clk driver for those systems which don't have generic clock, and remove the V4L2 clock APIs like v4l2_clk_get, v4l2_clk_enable from the first day? i mean v4l2-clk.c becomes a temp and fake clock controller driver. finally, after people have generically clk, remove it. I don't think you can force-enable the CFF on systems, that don't support it, e.g. PXA. yes. we can. clock is only a framework, has it any limitation to implement a driver instance on any platform? people have tried to move to common clk and generic framework for a long time, now you still try to provide a v4l2 specific clock APIs, it just makes v4l2 unacceptable and much complex. Thanks Guennadi v8: Updated both (C) dates drivers/media/v4l2-core/Makefile |2 +- drivers/media/v4l2-core/v4l2-clk.c | 177 include/media/v4l2-clk.h | 54 +++ 3 files changed, 232 insertions(+), 1 deletions(-) create mode 100644 drivers/media/v4l2-core/v4l2-clk.c create mode 100644 include/media/v4l2-clk.h diff --git a/drivers/media/v4l2-core/Makefile b/drivers/media/v4l2-core/Makefile index aa50c46..628c630 100644 --- a/drivers/media/v4l2-core/Makefile +++ b/drivers/media/v4l2-core/Makefile @@ -5,7 +5,7 @@ tuner-objs := tuner-core.o videodev-objs := v4l2-dev.o v4l2-ioctl.o v4l2-device.o v4l2-fh.o \ - v4l2-event.o v4l2-ctrls.o v4l2-subdev.o + v4l2-event.o v4l2-ctrls.o v4l2-subdev.o v4l2-clk.o ifeq ($(CONFIG_COMPAT),y) videodev-objs += v4l2-compat-ioctl32.o endif diff --git a/drivers/media/v4l2-core/v4l2-clk.c b/drivers/media/v4l2-core/v4l2-clk.c new file mode 100644 index 000..d7cc13e --- /dev/null +++ b/drivers/media/v4l2-core/v4l2-clk.c @@ -0,0 +1,177 @@ -barry -barry -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v8 1/7] media: V4L2: add temporary clock helpers
On Thu, 11 Apr 2013, Barry Song wrote: 2013/4/11 Guennadi Liakhovetski g.liakhovet...@gmx.de: Hi Barry On Thu, 11 Apr 2013, Barry Song wrote: Hi Guennadi, Typical video devices like camera sensors require an external clock source. Many such devices cannot even access their hardware registers without a running clock. These clock sources should be controlled by their consumers. This should be performed, using the generic clock framework. Unfortunately so far only very few systems have been ported to that framework. This patch adds a set of temporary helpers, mimicking the generic clock API, to V4L2. Platforms, adopting the clock API, should switch to using it. Eventually this temporary API should be removed. Signed-off-by: Guennadi Liakhovetski g.liakhovetski@xx --- for your patch 1/8 and 3/8, i think it makes a lot of senses to let the object manages its own clock by itself. is it possible for us to implement v4l2-clk.c directly as an instance of standard clk driver for those systems which don't have generic clock, and remove the V4L2 clock APIs like v4l2_clk_get, v4l2_clk_enable from the first day? i mean v4l2-clk.c becomes a temp and fake clock controller driver. finally, after people have generically clk, remove it. I don't think you can force-enable the CFF on systems, that don't support it, e.g. PXA. yes. we can. clock is only a framework, has it any limitation to implement a driver instance on any platform? So, you enable CFF, it provides its own clk_* implementation like clk_get_rate() etc. Now, PXA already has it defined in arch/arm/mach-pxa/clock.c. Don't think this is going to fly. Thanks Guennadi people have tried to move to common clk and generic framework for a long time, now you still try to provide a v4l2 specific clock APIs, it just makes v4l2 unacceptable and much complex. Thanks Guennadi v8: Updated both (C) dates drivers/media/v4l2-core/Makefile |2 +- drivers/media/v4l2-core/v4l2-clk.c | 177 include/media/v4l2-clk.h | 54 +++ 3 files changed, 232 insertions(+), 1 deletions(-) create mode 100644 drivers/media/v4l2-core/v4l2-clk.c create mode 100644 include/media/v4l2-clk.h diff --git a/drivers/media/v4l2-core/Makefile b/drivers/media/v4l2-core/Makefile index aa50c46..628c630 100644 --- a/drivers/media/v4l2-core/Makefile +++ b/drivers/media/v4l2-core/Makefile @@ -5,7 +5,7 @@ tuner-objs := tuner-core.o videodev-objs := v4l2-dev.o v4l2-ioctl.o v4l2-device.o v4l2-fh.o \ - v4l2-event.o v4l2-ctrls.o v4l2-subdev.o + v4l2-event.o v4l2-ctrls.o v4l2-subdev.o v4l2-clk.o ifeq ($(CONFIG_COMPAT),y) videodev-objs += v4l2-compat-ioctl32.o endif diff --git a/drivers/media/v4l2-core/v4l2-clk.c b/drivers/media/v4l2-core/v4l2-clk.c new file mode 100644 index 000..d7cc13e --- /dev/null +++ b/drivers/media/v4l2-core/v4l2-clk.c @@ -0,0 +1,177 @@ -barry -barry --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v8 1/7] media: V4L2: add temporary clock helpers
2013/4/11 Guennadi Liakhovetski g.liakhovet...@gmx.de: On Thu, 11 Apr 2013, Barry Song wrote: 2013/4/11 Guennadi Liakhovetski g.liakhovet...@gmx.de: Hi Barry On Thu, 11 Apr 2013, Barry Song wrote: Hi Guennadi, Typical video devices like camera sensors require an external clock source. Many such devices cannot even access their hardware registers without a running clock. These clock sources should be controlled by their consumers. This should be performed, using the generic clock framework. Unfortunately so far only very few systems have been ported to that framework. This patch adds a set of temporary helpers, mimicking the generic clock API, to V4L2. Platforms, adopting the clock API, should switch to using it. Eventually this temporary API should be removed. Signed-off-by: Guennadi Liakhovetski g.liakhovetski@xx --- for your patch 1/8 and 3/8, i think it makes a lot of senses to let the object manages its own clock by itself. is it possible for us to implement v4l2-clk.c directly as an instance of standard clk driver for those systems which don't have generic clock, and remove the V4L2 clock APIs like v4l2_clk_get, v4l2_clk_enable from the first day? i mean v4l2-clk.c becomes a temp and fake clock controller driver. finally, after people have generically clk, remove it. I don't think you can force-enable the CFF on systems, that don't support it, e.g. PXA. yes. we can. clock is only a framework, has it any limitation to implement a driver instance on any platform? So, you enable CFF, it provides its own clk_* implementation like clk_get_rate() etc. Now, PXA already has it defined in arch/arm/mach-pxa/clock.c. Don't think this is going to fly. agree. Thanks Guennadi people have tried to move to common clk and generic framework for a long time, now you still try to provide a v4l2 specific clock APIs, it just makes v4l2 unacceptable and much complex. Thanks Guennadi v8: Updated both (C) dates drivers/media/v4l2-core/Makefile |2 +- drivers/media/v4l2-core/v4l2-clk.c | 177 include/media/v4l2-clk.h | 54 +++ 3 files changed, 232 insertions(+), 1 deletions(-) create mode 100644 drivers/media/v4l2-core/v4l2-clk.c create mode 100644 include/media/v4l2-clk.h diff --git a/drivers/media/v4l2-core/Makefile b/drivers/media/v4l2-core/Makefile index aa50c46..628c630 100644 --- a/drivers/media/v4l2-core/Makefile +++ b/drivers/media/v4l2-core/Makefile @@ -5,7 +5,7 @@ tuner-objs := tuner-core.o videodev-objs := v4l2-dev.o v4l2-ioctl.o v4l2-device.o v4l2-fh.o \ - v4l2-event.o v4l2-ctrls.o v4l2-subdev.o + v4l2-event.o v4l2-ctrls.o v4l2-subdev.o v4l2-clk.o ifeq ($(CONFIG_COMPAT),y) videodev-objs += v4l2-compat-ioctl32.o endif diff --git a/drivers/media/v4l2-core/v4l2-clk.c b/drivers/media/v4l2-core/v4l2-clk.c new file mode 100644 index 000..d7cc13e --- /dev/null +++ b/drivers/media/v4l2-core/v4l2-clk.c @@ -0,0 +1,177 @@ -barry -barry -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 11/30] [media] exynos: remove unnecessary header inclusions
On 04/11/2013 02:13 AM, Mauro Carvalho Chehab wrote: Em Thu, 11 Apr 2013 02:04:53 +0200 Arnd Bergmann a...@arndb.de escreveu: In multiplatform configurations, we cannot include headers provided by only the exynos platform. Fortunately a number of drivers that include those headers do not actually need them, so we can just remove the inclusions. Signed-off-by: Arnd Bergmann a...@arndb.de Cc: linux-media@vger.kernel.org Cc: Mauro Carvalho Chehab mche...@redhat.com Acked-by: Mauro Carvalho Chehab mche...@redhat.com This patch is already queued in the media tree for 3.10, and it can be found in -next now. Thanks, Sylwester -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] v4l2-ctl: break down the streaming_set()
On Wed 10 April 2013 12:57:05 Tzu-Jung Lee wrote: This patch breaks down the streaming_set() into smaller ones, which can be resued for supporting m2m devices. Further cleanup or consolidation can be applied with separate patches, since this one tries not to modify logics. Signed-off-by: Tzu-Jung Lee tj...@ambarella.com --- utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 921 +++--- 1 file changed, 505 insertions(+), 416 deletions(-) diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp index c29565f..a180c6a 100644 --- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp Thanks! I've committed your patches to v4l-utils. I also added a bunch of other fixes (among others I broke the non-poll streaming case with my eos patch). I do have some questions about the EOS semantics, but I'll ask those in a separate mail. Regards, Hans -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Exact behavior of the EOS event?
Hi Kamil, Roy, When implementing eos support in v4l2-ctl I started wondering about the exact timings of that. There are two cases, polling and non-polling, and I'll explain how I do it now in v4l2-ctl. Polling case: I select for both read and exceptions. When the select returns I check for exceptions and call DQEVENT, which may return EOS. If there is something to read then I call DQBUF to get the frame, process it and afterwards exit the capture loop if the EOS event was seen. This procedure assumes that setting the event and making the last frame available to userspace happen atomically, otherwise you can get a race condition. Non-polling case: I select for an exception with a timeout of 0 (i.e. returns immediately), then I call DQBUF (which may block), process the frame and exit if EOS was seen. I suspect this is wrong, since when I call select the EOS may not be set yet, but it is after the DQBUF. So in the next run through the capture loop I capture one frame too many. What I think is the correct sequence is to first select for a read(), but not exceptions, then do the DQBUF, and finally do a select for exceptions with a timeout of 0. If EOS was seen, then that was the last frame. A potential problem with that might be when you want to select on other events as well. Then you would select on both read and exceptions, and we end up with a potential race condition again. The only solution I see is to open a second filehandle to the video node and subscribe to the EOS event only for that filehandle and use that to do the EOS polling. It all feels rather awkward. Kamil, Roy, any ideas/suggestions to improve this? Regards, Hans -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Exact behavior of the EOS event?
Hi Hans, On Thu, Apr 11, 2013 at 5:40 PM, Hans Verkuil hverk...@xs4all.nl wrote: Hi Kamil, Roy, When implementing eos support in v4l2-ctl I started wondering about the exact timings of that. There are two cases, polling and non-polling, and I'll explain how I do it now in v4l2-ctl. Polling case: I select for both read and exceptions. When the select returns I check for exceptions and call DQEVENT, which may return EOS. If there is something to read then I call DQBUF to get the frame, process it and afterwards exit the capture loop if the EOS event was seen. This procedure assumes that setting the event and making the last frame available to userspace happen atomically, otherwise you can get a race condition. Non-polling case: I select for an exception with a timeout of 0 (i.e. returns immediately), then I call DQBUF (which may block), process the frame and exit if EOS was seen. I suspect this is wrong, since when I call select the EOS may not be set yet, but it is after the DQBUF. So in the next run through the capture loop I capture one frame too many. What I think is the correct sequence is to first select for a read(), but not exceptions, then do the DQBUF, and finally do a select for exceptions with a timeout of 0. If EOS was seen, then that was the last frame. A potential problem with that might be when you want to select on other events as well. Then you would select on both read and exceptions, and we end up with a potential race condition again. The only solution I see is to open a second filehandle to the video node and subscribe to the EOS event only for that filehandle and use that to do the EOS polling. It all feels rather awkward. Kamil, Roy, any ideas/suggestions to improve this? I was thinking to serialize this within the driver, which means no buffers on capture side will be DQBUF once the EOS is generated. I'm not sure is this generic enough, but it should make life easier for applications Regards, Roy -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v8 0/7] V4L2 clock and async patches and soc-camera example
Hi all On Mon, 8 Apr 2013, Guennadi Liakhovetski wrote: Mostly just a re-spin of v7 with minor modifications. Guennadi Liakhovetski (7): media: V4L2: add temporary clock helpers media: V4L2: support asynchronous subdevice registration media: soc-camera: switch I2C subdevice drivers to use v4l2-clk soc-camera: add V4L2-async support sh_mobile_ceu_camera: add asynchronous subdevice probing support imx074: support asynchronous probing ARM: shmobile: convert ap4evb to asynchronously register camera subdevices So far there haven't been any comments to this, and Mauro asked to push all non-fixes to him by tomorrow. So, if at least the API is now ok, we could push this to 3.10, at least the core patches 1 and 2. Then during 3.10 we could look at porting individual drivers on top of this. Thanks Guennadi arch/arm/mach-shmobile/board-ap4evb.c | 103 ++-- arch/arm/mach-shmobile/clock-sh7372.c |1 + drivers/media/i2c/soc_camera/imx074.c | 36 +- drivers/media/i2c/soc_camera/mt9m001.c | 17 +- drivers/media/i2c/soc_camera/mt9m111.c | 20 +- drivers/media/i2c/soc_camera/mt9t031.c | 19 +- drivers/media/i2c/soc_camera/mt9t112.c | 19 +- drivers/media/i2c/soc_camera/mt9v022.c | 17 +- drivers/media/i2c/soc_camera/ov2640.c | 19 +- drivers/media/i2c/soc_camera/ov5642.c | 20 +- drivers/media/i2c/soc_camera/ov6650.c | 17 +- drivers/media/i2c/soc_camera/ov772x.c | 15 +- drivers/media/i2c/soc_camera/ov9640.c | 17 +- drivers/media/i2c/soc_camera/ov9640.h |1 + drivers/media/i2c/soc_camera/ov9740.c | 18 +- drivers/media/i2c/soc_camera/rj54n1cb0c.c | 17 +- drivers/media/i2c/soc_camera/tw9910.c | 18 +- .../platform/soc_camera/sh_mobile_ceu_camera.c | 134 +++-- drivers/media/platform/soc_camera/sh_mobile_csi2.c | 163 +++-- drivers/media/platform/soc_camera/soc_camera.c | 666 .../platform/soc_camera/soc_camera_platform.c |2 +- drivers/media/v4l2-core/Makefile |3 +- drivers/media/v4l2-core/v4l2-async.c | 262 drivers/media/v4l2-core/v4l2-clk.c | 177 ++ include/media/sh_mobile_ceu.h |2 + include/media/sh_mobile_csi2.h |2 +- include/media/soc_camera.h | 36 +- include/media/v4l2-async.h | 104 +++ include/media/v4l2-clk.h | 54 ++ 29 files changed, 1675 insertions(+), 304 deletions(-) create mode 100644 drivers/media/v4l2-core/v4l2-async.c create mode 100644 drivers/media/v4l2-core/v4l2-clk.c create mode 100644 include/media/v4l2-async.h create mode 100644 include/media/v4l2-clk.h -- 1.7.2.5 Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 11/30] [media] exynos: remove unnecessary header inclusions
On Thursday 11 April 2013, Sylwester Nawrocki wrote: On 04/11/2013 02:13 AM, Mauro Carvalho Chehab wrote: Em Thu, 11 Apr 2013 02:04:53 +0200 Arnd Bergmann a...@arndb.de escreveu: In multiplatform configurations, we cannot include headers provided by only the exynos platform. Fortunately a number of drivers that include those headers do not actually need them, so we can just remove the inclusions. Signed-off-by: Arnd Bergmann a...@arndb.de Cc: linux-media@vger.kernel.org Cc: Mauro Carvalho Chehab mche...@redhat.com Acked-by: Mauro Carvalho Chehab mche...@redhat.com This patch is already queued in the media tree for 3.10, and it can be found in -next now. Ok, thanks! I'll drop it from my series then. Arnd -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC][PATCH 1/2] media: vb2: return for polling if a buffer is available
Hello, On 4/1/2013 8:40 AM, Seung-Woo Kim wrote: The vb2_poll() does not need to wait next vb_buffer_done() if there is already a buffer in done_list of queue, but current vb2_poll() always waits. So done_list is checked before calling poll_wait(). Signed-off-by: Seung-Woo Kim sw0312@samsung.com Acked-by: Marek Szyprowski m.szyprow...@samsung.com --- drivers/media/v4l2-core/videobuf2-core.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index db1235d..e941d2b 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -1996,7 +1996,8 @@ unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait) if (list_empty(q-queued_list)) return res | POLLERR; - poll_wait(file, q-done_wq, wait); + if (list_empty(q-done_list)) + poll_wait(file, q-done_wq, wait); /* * Take first buffer available for dequeuing. Best regards -- Marek Szyprowski Samsung Poland RD Center -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: Exact behavior of the EOS event?
Hi Hans, -Original Message- From: Hans Verkuil [mailto:hverk...@xs4all.nl] Sent: Thursday, April 11, 2013 11:41 AM To: k.deb...@samsung.com Cc: linux-media@vger.kernel.org; Tzu-Jung Lee Subject: Exact behavior of the EOS event? Hi Kamil, Roy, When implementing eos support in v4l2-ctl I started wondering about the exact timings of that. There are two cases, polling and non-polling, and I'll explain how I do it now in v4l2-ctl. Polling case: I select for both read and exceptions. When the select returns I check for exceptions and call DQEVENT, which may return EOS. If there is something to read then I call DQBUF to get the frame, process it and afterwards exit the capture loop if the EOS event was seen. This procedure assumes that setting the event and making the last frame available to userspace happen atomically, otherwise you can get a race condition. Non-polling case: I select for an exception with a timeout of 0 (i.e. returns immediately), then I call DQBUF (which may block), process the frame and exit if EOS was seen. I suspect this is wrong, since when I call select the EOS may not be set yet, but it is after the DQBUF. So in the next run through the capture loop I capture one frame too many. What I think is the correct sequence is to first select for a read(), but not exceptions, then do the DQBUF, and finally do a select for exceptions with a timeout of 0. If EOS was seen, then that was the last frame. A potential problem with that might be when you want to select on other events as well. Then you would select on both read and exceptions, and we end up with a potential race condition again. The only solution I see is to open a second filehandle to the video node and subscribe to the EOS event only for that filehandle and use that to do the EOS polling. This would work if we have a single context only. In case of mem2mem devices, where there is a separate context for each file this would not work. It all feels rather awkward. Kamil, Roy, any ideas/suggestions to improve this? Regards, Hans -- Kamil Debski Linux Platform Group Samsung Poland RD Center -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Exact behavior of the EOS event?
On Thu 11 April 2013 14:39:44 Kamil Debski wrote: Hi Hans, -Original Message- From: Hans Verkuil [mailto:hverk...@xs4all.nl] Sent: Thursday, April 11, 2013 11:41 AM To: k.deb...@samsung.com Cc: linux-media@vger.kernel.org; Tzu-Jung Lee Subject: Exact behavior of the EOS event? Hi Kamil, Roy, When implementing eos support in v4l2-ctl I started wondering about the exact timings of that. There are two cases, polling and non-polling, and I'll explain how I do it now in v4l2-ctl. Polling case: I select for both read and exceptions. When the select returns I check for exceptions and call DQEVENT, which may return EOS. If there is something to read then I call DQBUF to get the frame, process it and afterwards exit the capture loop if the EOS event was seen. This procedure assumes that setting the event and making the last frame available to userspace happen atomically, otherwise you can get a race condition. Non-polling case: I select for an exception with a timeout of 0 (i.e. returns immediately), then I call DQBUF (which may block), process the frame and exit if EOS was seen. I suspect this is wrong, since when I call select the EOS may not be set yet, but it is after the DQBUF. So in the next run through the capture loop I capture one frame too many. What I think is the correct sequence is to first select for a read(), but not exceptions, then do the DQBUF, and finally do a select for exceptions with a timeout of 0. If EOS was seen, then that was the last frame. A potential problem with that might be when you want to select on other events as well. Then you would select on both read and exceptions, and we end up with a potential race condition again. The only solution I see is to open a second filehandle to the video node and subscribe to the EOS event only for that filehandle and use that to do the EOS polling. This would work if we have a single context only. In case of mem2mem devices, where there is a separate context for each file this would not work. True. Another idea was to set an EOS buffer flag for the last buffer, but I think I remember that your driver won't know it is the last one until later, right? Perhaps we should implement the EOS buffer flag idea after all. If that flag is set, then if the buffer is empty, then that buffer should be discarded, if it is not, then that was the last buffer. The EOS event was originally designed for a decoder where you want to know when the decoder finished decoding your last frame. It's now being used for capture streams were it is not a good fit, IMHO. Regards, Hans -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Exact behavior of the EOS event?
Hi Hans, Kamil and Roy, On 11.04.2013 14:51, Hans Verkuil wrote: On Thu 11 April 2013 14:39:44 Kamil Debski wrote: Hi Hans, -Original Message- From: Hans Verkuil [mailto:hverk...@xs4all.nl] Sent: Thursday, April 11, 2013 11:41 AM To: k.deb...@samsung.com Cc: linux-media@vger.kernel.org; Tzu-Jung Lee Subject: Exact behavior of the EOS event? Hi Kamil, Roy, When implementing eos support in v4l2-ctl I started wondering about the exact timings of that. There are two cases, polling and non-polling, and I'll explain how I do it now in v4l2-ctl. Polling case: I select for both read and exceptions. When the select returns I check for exceptions and call DQEVENT, which may return EOS. If there is something to read then I call DQBUF to get the frame, process it and afterwards exit the capture loop if the EOS event was seen. This procedure assumes that setting the event and making the last frame available to userspace happen atomically, otherwise you can get a race condition. Non-polling case: I select for an exception with a timeout of 0 (i.e. returns immediately), then I call DQBUF (which may block), process the frame and exit if EOS was seen. I suspect this is wrong, since when I call select the EOS may not be set yet, but it is after the DQBUF. So in the next run through the capture loop I capture one frame too many. What I think is the correct sequence is to first select for a read(), but not exceptions, then do the DQBUF, and finally do a select for exceptions with a timeout of 0. If EOS was seen, then that was the last frame. A potential problem with that might be when you want to select on other events as well. Then you would select on both read and exceptions, and we end up with a potential race condition again. The only solution I see is to open a second filehandle to the video node and subscribe to the EOS event only for that filehandle and use that to do the EOS polling. This would work if we have a single context only. In case of mem2mem devices, where there is a separate context for each file this would not work. True. Another idea was to set an EOS buffer flag for the last buffer, but I think I remember that your driver won't know it is the last one until later, right? Perhaps we should implement the EOS buffer flag idea after all. If that flag is set, then if the buffer is empty, then that buffer should be discarded, if it is not, then that was the last buffer. The EOS event was originally designed for a decoder where you want to know when the decoder finished decoding your last frame. It's now being used for capture streams were it is not a good fit, IMHO. After rejecting my RFC with EOS flag on buffers about year ago I have implemented EOS in MFC encoder using v4l2 events. In my implementation EOS event is sent always AFTER the last buffer of the stream was dequeued to the application. Additionally if there is a buffer in DQBUF, driver marks it done with payload 0. This way apps are able to work in both polling and non-polling mode. Anyway EOS using events seems to be more difficult/error prone to both drivers and apps. Thinking about it on higher level of abstraction end-of-stream as a concept IMO better fits to stream/queue than to asynchronous events. Regards, Hans Regards Andrzej -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: uvcvideo: Dropping payload (out of sync)
On Thu, Apr 11, 2013 at 3:56 AM, André Weidemann andre.weidem...@web.de wrote: For anyone who may also run into this problem here is a solution... It seems the problem is hardware related to the Raspberry Pi. The solution can be found here: https://github.com/raspberrypi/linux/issues/238 https://github.com/P33M/linux Yup, it's been known for a while that the USB host controller on the Raspberry Pi is absolute crap. For all the great things about the Pi, I would probably consider this it's biggest weakness (it's actually prompted me to *not* use the Pi for several projects where I needed a low-cost Linux platform)... No easy answers here. It just won't be a very good platform for capturing uncompressed video over its USB port. Devin -- Devin J. Heitmueller - Kernel Labs http://www.kernellabs.com -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC v2013-04-11] SDR API REQUIREMENT SPECIFICATION
I added some new parameters as described. Comments are welcome - I haven't got almost any up to date. I will keep latest version of that document same old address: http://palosaari.fi/linux/kernel_sdr_api_requirement_specification.txt regards Antti LINUX KERNEL SDR API REQUIREMENT SPECIFICATION = Ideal SDR specific requirements (basics SDR settings) * operation mode * values: ADC (Rx) or DAC (Tx) * operations GET, inquire what HW supports GET, get current value SET, set desired value sampling resolution * values: 1 - 32 (unit: bit) 16 bit could be enough, but better to leave some room for future * operations GET, inquire what HW supports GET, get current value SET, set desired value sampling rate * values: 1 - infinity (unit: Hz, symbols per second) currently 500 MHz is more than enough * operations GET, inquire what HW supports GET, get current value SET, set desired value TODO: * inversion? Practical SDR specific requirements (SDR settings for RF tuner) * RF frequency * values: 1 - infinity (unit: Hz) currently 100 GHz is more than enough * operations GET, inquire what HW supports there could be unsupported ranges between lower and upper freq GET, get current value SET, set desired value IF frequency (intermediate frequency) * values: 0 - infinity (unit: Hz) currently 500 MHz is more than enough * operations GET, get current value tuner lock (frequency synthesizer / PLL) * values: yes/no * operations GET, get current value tuner gains * gain and attenuation * there could be multiple places to adjust gain on tuner signal path * is single overall gain enough or do we want more manual fine tuning? tuner filters * there could be multiple filters on tuner signal path (RF/IF) * do we need to control filters at all? * calculate from sampling rate? TODO: * pass RF standard to tuner? Passing standard is clearly against idea, but some RF tuners does black magic according to standard. That magic is usually setting filters and and gains, but it could be more... * inversion? Hardware specific requirements (board settings) * antenna switch * values: 0 - 32 (unit: piece) * operations GET, inquire what HW supports GET, get current value SET, set desired value external LNA * values: -20 - 20 (unit: dB/1000) * operations GET, inquire what HW supports GET, get current value SET, set desired value * range from -200dB to 200dB should be enough multiple ADCs / DACs on single device * there could be multiple ADCs and DACs on single device * resources could be shared which limits concurrent usage * eg. device has 2 ADC + 2 DAC = 4 total, but only 2 could be used at the time Kernel specific requirements * device locking between multiple APIs * same device could support multiple APIs which could not be used at same time * for example DVB API and V4L2 API * locking needed DOCUMENT VERSION HISTORY = 2012-10-15 Antti Palosaari cr...@iki.fi * Initial version 2013-04-11 Antti Palosaari cr...@iki.fi * add version history * order requirements per sections * add IF frequency (intermediate frequency) * add tuner lock (frequency synthesizer / PLL) * add external LNA * add TODOs -- http://palosaari.fi/ -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] v4l2-ctl: add is_compressed_format() helper
It is used to: bypass precalculate_bars() for OUTPUT device that takes encoded bitstreams. handle the last chunk of input file that has non-buffer-aligned size. Signed-off-by: Tzu-Jung Lee tj...@ambarella.com --- utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 101 +++--- 1 file changed, 82 insertions(+), 19 deletions(-) diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp index 9e361af..b3ba32e 100644 --- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp @@ -115,6 +115,29 @@ static const flag_def tc_flags_def[] = { { 0, NULL } }; +static bool is_compressed_format(__u32 pixfmt) +{ + switch (pixfmt) { + case V4L2_PIX_FMT_MJPEG: + case V4L2_PIX_FMT_JPEG: + case V4L2_PIX_FMT_DV: + case V4L2_PIX_FMT_MPEG: + case V4L2_PIX_FMT_H264: + case V4L2_PIX_FMT_H264_NO_SC: + case V4L2_PIX_FMT_H263: + case V4L2_PIX_FMT_MPEG1: + case V4L2_PIX_FMT_MPEG2: + case V4L2_PIX_FMT_MPEG4: + case V4L2_PIX_FMT_XVID: + case V4L2_PIX_FMT_VC1_ANNEX_G: + return true; + default: + return false; + } + + return false; +} + static void print_buffer(FILE *f, struct v4l2_buffer buf) { fprintf(f, \tIndex: %d\n, buf.index); @@ -223,23 +246,29 @@ void streaming_cmd(int ch, char *optarg) } static bool fill_buffer_from_file(void *buffers[], unsigned buffer_lengths[], - unsigned buf_index, unsigned num_planes, FILE *fin) + unsigned buffer_bytesused[], unsigned buf_index, + unsigned num_planes, bool is_compressed, FILE *fin) { for (unsigned j = 0; j num_planes; j++) { unsigned p = buf_index * num_planes + j; unsigned sz = fread(buffers[p], 1, buffer_lengths[p], fin); + buffer_bytesused[p] = sz; if (j == 0 sz == 0 stream_loop) { fseek(fin, 0, SEEK_SET); sz = fread(buffers[p], 1, buffer_lengths[p], fin); + + buffer_bytesused[p] = sz; } if (sz == buffer_lengths[p]) continue; - if (sz) + + // Bail out if we get weird buffer sizes or non-compressed format. + if (sz !is_compressed) fprintf(stderr, %u != %u\n, sz, buffer_lengths[p]); - // Bail out if we get weird buffer sizes. + return false; } return true; @@ -312,16 +341,22 @@ static void do_setup_out_buffers(int fd, struct v4l2_requestbuffers *reqbufs, bool is_mplane, unsigned num_planes, bool is_mmap, void *buffers[], unsigned buffer_lengths[], FILE *fin) { + bool is_compressed; + struct v4l2_format fmt; memset(fmt, 0, sizeof(fmt)); fmt.type = reqbufs-type; doioctl(fd, VIDIOC_G_FMT, fmt); - if (!precalculate_bars(fmt.fmt.pix.pixelformat, stream_pat)) { + is_compressed = is_compressed_format(fmt.fmt.pix.pixelformat); + if (!is_compressed + !precalculate_bars(fmt.fmt.pix.pixelformat, stream_pat)) { fprintf(stderr, unsupported pixelformat\n); return; } + unsigned buffer_bytesused[reqbufs-count * VIDEO_MAX_PLANES]; + for (unsigned i = 0; i reqbufs-count; i++) { struct v4l2_plane planes[VIDEO_MAX_PLANES]; struct v4l2_buffer buf; @@ -363,11 +398,11 @@ static void do_setup_out_buffers(int fd, struct v4l2_requestbuffers *reqbufs, // TODO fill_buffer_mp(buffers[i], fmt.fmt.pix_mp); if (fin) fill_buffer_from_file(buffers, buffer_lengths, - buf.index, num_planes, fin); + buffer_bytesused, buf.index, + num_planes, is_compressed, fin); } else { buffer_lengths[i] = buf.length; - buf.bytesused = buf.length; if (is_mmap) { buffers[i] = mmap(NULL, buf.length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, buf.m.offset); @@ -381,9 +416,16 @@ static void do_setup_out_buffers(int fd, struct v4l2_requestbuffers *reqbufs, buffers[i] = calloc(1, buf.length); buf.m.userptr = (unsigned long)buffers[i]; } - if (!fin || !fill_buffer_from_file(buffers, buffer_lengths, -
[PATCH] v4l2-ctl: add is_compressed_format() helper
It is used to: bypass precalculate_bars() for OUTPUT device that takes encoded bitstreams. handle the last chunk of input file that has non-buffer-aligned size. Signed-off-by: Tzu-Jung Lee tj...@ambarella.com --- utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 101 +++--- 1 file changed, 82 insertions(+), 19 deletions(-) diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp index 9e361af..2bcf950 100644 --- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp @@ -115,6 +115,29 @@ static const flag_def tc_flags_def[] = { { 0, NULL } }; +static bool is_compressed_format(__u32 pixfmt) +{ + switch (pixfmt) { + case V4L2_PIX_FMT_MJPEG: + case V4L2_PIX_FMT_JPEG: + case V4L2_PIX_FMT_DV: + case V4L2_PIX_FMT_MPEG: + case V4L2_PIX_FMT_H264: + case V4L2_PIX_FMT_H264_NO_SC: + case V4L2_PIX_FMT_H263: + case V4L2_PIX_FMT_MPEG1: + case V4L2_PIX_FMT_MPEG2: + case V4L2_PIX_FMT_MPEG4: + case V4L2_PIX_FMT_XVID: + case V4L2_PIX_FMT_VC1_ANNEX_G: + return true; + default: + return false; + } + + return false; +} + static void print_buffer(FILE *f, struct v4l2_buffer buf) { fprintf(f, \tIndex: %d\n, buf.index); @@ -223,23 +246,29 @@ void streaming_cmd(int ch, char *optarg) } static bool fill_buffer_from_file(void *buffers[], unsigned buffer_lengths[], - unsigned buf_index, unsigned num_planes, FILE *fin) + unsigned buffer_bytesused[], unsigned buf_index, + unsigned num_planes, bool is_compressed, FILE *fin) { for (unsigned j = 0; j num_planes; j++) { unsigned p = buf_index * num_planes + j; unsigned sz = fread(buffers[p], 1, buffer_lengths[p], fin); + buffer_bytesused[j] = sz; if (j == 0 sz == 0 stream_loop) { fseek(fin, 0, SEEK_SET); sz = fread(buffers[p], 1, buffer_lengths[p], fin); + + buffer_bytesused[j] = sz; } if (sz == buffer_lengths[p]) continue; - if (sz) + + // Bail out if we get weird buffer sizes or non-compressed format. + if (sz !is_compressed) fprintf(stderr, %u != %u\n, sz, buffer_lengths[p]); - // Bail out if we get weird buffer sizes. + return false; } return true; @@ -312,16 +341,22 @@ static void do_setup_out_buffers(int fd, struct v4l2_requestbuffers *reqbufs, bool is_mplane, unsigned num_planes, bool is_mmap, void *buffers[], unsigned buffer_lengths[], FILE *fin) { + bool is_compressed; + struct v4l2_format fmt; memset(fmt, 0, sizeof(fmt)); fmt.type = reqbufs-type; doioctl(fd, VIDIOC_G_FMT, fmt); - if (!precalculate_bars(fmt.fmt.pix.pixelformat, stream_pat)) { + is_compressed = is_compressed_format(fmt.fmt.pix.pixelformat); + if (!is_compressed + !precalculate_bars(fmt.fmt.pix.pixelformat, stream_pat)) { fprintf(stderr, unsupported pixelformat\n); return; } + unsigned buffer_bytesused[reqbufs-count * VIDEO_MAX_PLANES]; + for (unsigned i = 0; i reqbufs-count; i++) { struct v4l2_plane planes[VIDEO_MAX_PLANES]; struct v4l2_buffer buf; @@ -363,11 +398,11 @@ static void do_setup_out_buffers(int fd, struct v4l2_requestbuffers *reqbufs, // TODO fill_buffer_mp(buffers[i], fmt.fmt.pix_mp); if (fin) fill_buffer_from_file(buffers, buffer_lengths, - buf.index, num_planes, fin); + buffer_bytesused, buf.index, + num_planes, is_compressed, fin); } else { buffer_lengths[i] = buf.length; - buf.bytesused = buf.length; if (is_mmap) { buffers[i] = mmap(NULL, buf.length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, buf.m.offset); @@ -381,9 +416,16 @@ static void do_setup_out_buffers(int fd, struct v4l2_requestbuffers *reqbufs, buffers[i] = calloc(1, buf.length); buf.m.userptr = (unsigned long)buffers[i]; } - if (!fin || !fill_buffer_from_file(buffers, buffer_lengths, -
[GIT PULL] s5p-mfc/exynos4-is clean up
Hi Mauro, This change set includes mostly some cleanup/refactoring of the Exynos4 FIMC-IS driver and refactoring to make some modules from exynos4-is easier to re-use in the future Exynos5 FIMC-IS driver. The following changes since commit 81e096c8ac6a064854c2157e0bf802dc4906678c: [media] budget: Add support for Philips Semi Sylt PCI ref. design (2013-04-08 07:28:01 -0300) are available in the git repository at: git://linuxtv.org/snawrocki/samsung.git for_v3.10_2 for you to fetch changes up to 163a357478f3da49db43afd0352efcc754017a16: exynos4-is: Disable debug trace by default in fimc-isp.c (2013-04-10 14:04:29 +0200) Sylwester Nawrocki (8): s5p-mfc: Remove potential uninitialized variable usage exynos4-is: Move the subdev group ID definitions to public header exynos4-is: Make fimc-lite independent of the pipeline-subdevs array exynos4-is: Make fimc-lite independent of struct fimc_sensor_info exynos4-is: Improve the ISP chain parameter count calculation exynos4-is: Rename the ISP chain configuration data structure exynos4-is: Remove meaningless test before bit setting exynos4-is: Disable debug trace by default in fimc-isp.c drivers/media/platform/exynos4-is/fimc-capture.c |7 +- drivers/media/platform/exynos4-is/fimc-is-param.c | 277 + drivers/media/platform/exynos4-is/fimc-is-param.h |4 +- drivers/media/platform/exynos4-is/fimc-is-regs.c | 17 +- drivers/media/platform/exynos4-is/fimc-is.c | 24 +- drivers/media/platform/exynos4-is/fimc-is.h | 10 +- drivers/media/platform/exynos4-is/fimc-isp.c | 15 +- drivers/media/platform/exynos4-is/fimc-lite.c | 67 ++--- drivers/media/platform/exynos4-is/media-dev.c | 74 +++--- drivers/media/platform/exynos4-is/media-dev.h | 15 +- drivers/media/platform/s5p-mfc/s5p_mfc.c |2 +- include/media/s5p_fimc.h | 11 + 12 files changed, 239 insertions(+), 284 deletions(-) Regards, Sylwester -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] v4l2-ctl: add is_compressed_format() helper
It is used to: bypass precalculate_bars() for OUTPUT device that takes encoded bitstreams. handle the last chunk of input file that has non-buffer-aligned size. Signed-off-by: Tzu-Jung Lee tj...@ambarella.com --- utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 132 -- 1 file changed, 112 insertions(+), 20 deletions(-) diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp index 9e361af..44643e8 100644 --- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp @@ -115,6 +115,29 @@ static const flag_def tc_flags_def[] = { { 0, NULL } }; +static bool is_compressed_format(__u32 pixfmt) +{ + switch (pixfmt) { + case V4L2_PIX_FMT_MJPEG: + case V4L2_PIX_FMT_JPEG: + case V4L2_PIX_FMT_DV: + case V4L2_PIX_FMT_MPEG: + case V4L2_PIX_FMT_H264: + case V4L2_PIX_FMT_H264_NO_SC: + case V4L2_PIX_FMT_H263: + case V4L2_PIX_FMT_MPEG1: + case V4L2_PIX_FMT_MPEG2: + case V4L2_PIX_FMT_MPEG4: + case V4L2_PIX_FMT_XVID: + case V4L2_PIX_FMT_VC1_ANNEX_G: + return true; + default: + return false; + } + + return false; +} + static void print_buffer(FILE *f, struct v4l2_buffer buf) { fprintf(f, \tIndex: %d\n, buf.index); @@ -223,25 +246,60 @@ void streaming_cmd(int ch, char *optarg) } static bool fill_buffer_from_file(void *buffers[], unsigned buffer_lengths[], - unsigned buf_index, unsigned num_planes, FILE *fin) + unsigned buffer_bytesused[], unsigned buf_index, + unsigned num_planes, bool is_compressed, FILE *fin) { + if (num_planes == 1) { + unsigned i = buf_index; + unsigned sz = fread(buffers[i], 1, + buffer_lengths[i], fin); + + buffer_bytesused[i] = sz; + if (sz == 0 stream_loop) { + fseek(fin, 0, SEEK_SET); + sz = fread(buffers[i], 1, + buffer_lengths[i], fin); + + buffer_bytesused[i] = sz; + } + + if (!sz) + return false; + + if (sz == buffer_lengths[i]) + return true; + + if (is_compressed) + return true; + + fprintf(stderr, %u != %u\n, sz, buffer_lengths[i]); + + return false; + } + for (unsigned j = 0; j num_planes; j++) { unsigned p = buf_index * num_planes + j; unsigned sz = fread(buffers[p], 1, - buffer_lengths[p], fin); + buffer_lengths[p], fin); + buffer_bytesused[j] = sz; if (j == 0 sz == 0 stream_loop) { fseek(fin, 0, SEEK_SET); sz = fread(buffers[p], 1, - buffer_lengths[p], fin); + buffer_lengths[p], fin); + + buffer_bytesused[j] = sz; } if (sz == buffer_lengths[p]) continue; + + // Bail out if we get weird buffer sizes. if (sz) fprintf(stderr, %u != %u\n, sz, buffer_lengths[p]); - // Bail out if we get weird buffer sizes. + return false; } + return true; } @@ -312,16 +370,22 @@ static void do_setup_out_buffers(int fd, struct v4l2_requestbuffers *reqbufs, bool is_mplane, unsigned num_planes, bool is_mmap, void *buffers[], unsigned buffer_lengths[], FILE *fin) { + bool is_compressed; + struct v4l2_format fmt; memset(fmt, 0, sizeof(fmt)); fmt.type = reqbufs-type; doioctl(fd, VIDIOC_G_FMT, fmt); - if (!precalculate_bars(fmt.fmt.pix.pixelformat, stream_pat)) { + is_compressed = is_compressed_format(fmt.fmt.pix.pixelformat); + if (!is_compressed + !precalculate_bars(fmt.fmt.pix.pixelformat, stream_pat)) { fprintf(stderr, unsupported pixelformat\n); return; } + unsigned buffer_bytesused[reqbufs-count * VIDEO_MAX_PLANES]; + for (unsigned i = 0; i reqbufs-count; i++) { struct v4l2_plane planes[VIDEO_MAX_PLANES]; struct v4l2_buffer buf; @@ -363,11 +427,11 @@ static void do_setup_out_buffers(int fd, struct v4l2_requestbuffers *reqbufs, // TODO fill_buffer_mp(buffers[i], fmt.fmt.pix_mp); if (fin) fill_buffer_from_file(buffers, buffer_lengths, - buf.index, num_planes,
Re: [PATCH] v4l2-ctl: add is_compressed_format() helper
On Thu April 11 2013 18:54:07 Tzu-Jung Lee wrote: It is used to: bypass precalculate_bars() for OUTPUT device that takes encoded bitstreams. handle the last chunk of input file that has non-buffer-aligned size. Signed-off-by: Tzu-Jung Lee tj...@ambarella.com --- utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 101 +++--- 1 file changed, 82 insertions(+), 19 deletions(-) diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp index 9e361af..2bcf950 100644 --- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp @@ -115,6 +115,29 @@ static const flag_def tc_flags_def[] = { { 0, NULL } }; +static bool is_compressed_format(__u32 pixfmt) +{ + switch (pixfmt) { + case V4L2_PIX_FMT_MJPEG: + case V4L2_PIX_FMT_JPEG: + case V4L2_PIX_FMT_DV: + case V4L2_PIX_FMT_MPEG: + case V4L2_PIX_FMT_H264: + case V4L2_PIX_FMT_H264_NO_SC: + case V4L2_PIX_FMT_H263: + case V4L2_PIX_FMT_MPEG1: + case V4L2_PIX_FMT_MPEG2: + case V4L2_PIX_FMT_MPEG4: + case V4L2_PIX_FMT_XVID: + case V4L2_PIX_FMT_VC1_ANNEX_G: You should use VIDIOC_ENUM_FMT: that sets a 'COMPRESSED' flag for compressed formats. You can never keep a list like the above up to date, so using ENUM_FMT is a much more generic solution. I will review the rest of the code tomorrow, but this jumped out to me, and you probably didn't know this flag existed :-) Regards, Hans -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] v4l2-ctl: add is_compressed_format() helper
On Thu April 11 2013 20:07:01 Tzu-Jung Lee wrote: It is used to: bypass precalculate_bars() for OUTPUT device that takes encoded bitstreams. handle the last chunk of input file that has non-buffer-aligned size. This seems to be the third version of this patch. When you post a new version, can you 1) add a version number after 'PATCH' (e.g. [PATCHv3]) and 2) mention the differences since the previous version. That makes a reviewer's life a lot easier. Thanks! Hans Signed-off-by: Tzu-Jung Lee tj...@ambarella.com --- utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 132 -- 1 file changed, 112 insertions(+), 20 deletions(-) diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp index 9e361af..44643e8 100644 --- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp @@ -115,6 +115,29 @@ static const flag_def tc_flags_def[] = { { 0, NULL } }; +static bool is_compressed_format(__u32 pixfmt) +{ + switch (pixfmt) { + case V4L2_PIX_FMT_MJPEG: + case V4L2_PIX_FMT_JPEG: + case V4L2_PIX_FMT_DV: + case V4L2_PIX_FMT_MPEG: + case V4L2_PIX_FMT_H264: + case V4L2_PIX_FMT_H264_NO_SC: + case V4L2_PIX_FMT_H263: + case V4L2_PIX_FMT_MPEG1: + case V4L2_PIX_FMT_MPEG2: + case V4L2_PIX_FMT_MPEG4: + case V4L2_PIX_FMT_XVID: + case V4L2_PIX_FMT_VC1_ANNEX_G: + return true; + default: + return false; + } + + return false; +} + static void print_buffer(FILE *f, struct v4l2_buffer buf) { fprintf(f, \tIndex: %d\n, buf.index); @@ -223,25 +246,60 @@ void streaming_cmd(int ch, char *optarg) } static bool fill_buffer_from_file(void *buffers[], unsigned buffer_lengths[], - unsigned buf_index, unsigned num_planes, FILE *fin) + unsigned buffer_bytesused[], unsigned buf_index, + unsigned num_planes, bool is_compressed, FILE *fin) { + if (num_planes == 1) { + unsigned i = buf_index; + unsigned sz = fread(buffers[i], 1, + buffer_lengths[i], fin); + + buffer_bytesused[i] = sz; + if (sz == 0 stream_loop) { + fseek(fin, 0, SEEK_SET); + sz = fread(buffers[i], 1, +buffer_lengths[i], fin); + + buffer_bytesused[i] = sz; + } + + if (!sz) + return false; + + if (sz == buffer_lengths[i]) + return true; + + if (is_compressed) + return true; + + fprintf(stderr, %u != %u\n, sz, buffer_lengths[i]); + + return false; + } + for (unsigned j = 0; j num_planes; j++) { unsigned p = buf_index * num_planes + j; unsigned sz = fread(buffers[p], 1, - buffer_lengths[p], fin); + buffer_lengths[p], fin); + buffer_bytesused[j] = sz; if (j == 0 sz == 0 stream_loop) { fseek(fin, 0, SEEK_SET); sz = fread(buffers[p], 1, - buffer_lengths[p], fin); +buffer_lengths[p], fin); + + buffer_bytesused[j] = sz; } if (sz == buffer_lengths[p]) continue; + + // Bail out if we get weird buffer sizes. if (sz) fprintf(stderr, %u != %u\n, sz, buffer_lengths[p]); - // Bail out if we get weird buffer sizes. + return false; } + return true; } @@ -312,16 +370,22 @@ static void do_setup_out_buffers(int fd, struct v4l2_requestbuffers *reqbufs, bool is_mplane, unsigned num_planes, bool is_mmap, void *buffers[], unsigned buffer_lengths[], FILE *fin) { + bool is_compressed; + struct v4l2_format fmt; memset(fmt, 0, sizeof(fmt)); fmt.type = reqbufs-type; doioctl(fd, VIDIOC_G_FMT, fmt); - if (!precalculate_bars(fmt.fmt.pix.pixelformat, stream_pat)) { + is_compressed = is_compressed_format(fmt.fmt.pix.pixelformat); + if (!is_compressed + !precalculate_bars(fmt.fmt.pix.pixelformat, stream_pat)) { fprintf(stderr, unsupported pixelformat\n); return; } + unsigned buffer_bytesused[reqbufs-count * VIDEO_MAX_PLANES]; + for (unsigned i = 0; i reqbufs-count; i++) { struct v4l2_plane planes[VIDEO_MAX_PLANES]; struct v4l2_buffer buf; @@ -363,11 +427,11 @@ static void do_setup_out_buffers(int fd,
cron job: media_tree daily build: WARNINGS
This message is generated daily by a cron job that builds media_tree for the kernels and architectures in the list below. Results of the daily build of media_tree: date: Thu Apr 11 19:00:19 CEST 2013 git branch: test git hash: 81e096c8ac6a064854c2157e0bf802dc4906678c gcc version:i686-linux-gcc (GCC) 4.7.2 host hardware: x86_64 host os:3.8-3.slh.2-amd64 linux-git-arm-davinci: OK linux-git-arm-exynos: WARNINGS linux-git-arm-omap: WARNINGS linux-git-blackfin: WARNINGS linux-git-i686: OK linux-git-m32r: OK linux-git-mips: OK linux-git-powerpc64: OK linux-git-sh: OK linux-git-x86_64: OK linux-2.6.31.14-i686: WARNINGS linux-2.6.32.27-i686: WARNINGS linux-2.6.33.7-i686: WARNINGS linux-2.6.34.7-i686: WARNINGS linux-2.6.35.9-i686: WARNINGS linux-2.6.36.4-i686: WARNINGS linux-2.6.37.6-i686: WARNINGS linux-2.6.38.8-i686: WARNINGS linux-2.6.39.4-i686: WARNINGS linux-3.0.60-i686: WARNINGS linux-3.1.10-i686: WARNINGS linux-3.2.37-i686: WARNINGS linux-3.3.8-i686: WARNINGS linux-3.4.27-i686: WARNINGS linux-3.5.7-i686: WARNINGS linux-3.6.11-i686: WARNINGS linux-3.7.4-i686: WARNINGS linux-3.8-i686: OK linux-3.9-rc1-i686: OK linux-2.6.31.14-x86_64: WARNINGS linux-2.6.32.27-x86_64: WARNINGS linux-2.6.33.7-x86_64: WARNINGS linux-2.6.34.7-x86_64: WARNINGS linux-2.6.35.9-x86_64: WARNINGS linux-2.6.36.4-x86_64: WARNINGS linux-2.6.37.6-x86_64: WARNINGS linux-2.6.38.8-x86_64: WARNINGS linux-2.6.39.4-x86_64: WARNINGS linux-3.0.60-x86_64: WARNINGS linux-3.1.10-x86_64: WARNINGS linux-3.2.37-x86_64: WARNINGS linux-3.3.8-x86_64: WARNINGS linux-3.4.27-x86_64: WARNINGS linux-3.5.7-x86_64: WARNINGS linux-3.6.11-x86_64: WARNINGS linux-3.7.4-x86_64: WARNINGS linux-3.8-x86_64: WARNINGS linux-3.9-rc1-x86_64: WARNINGS apps: WARNINGS spec-git: OK sparse: ERRORS Detailed results are available here: http://www.xs4all.nl/~hverkuil/logs/Thursday.log Full logs are available here: http://www.xs4all.nl/~hverkuil/logs/Thursday.tar.bz2 The Media Infrastructure API from this daily build is here: http://www.xs4all.nl/~hverkuil/spec/media.html -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch] [media] radio-si476x: check different function pointers
On Wed April 10 2013 13:40:51 Dan Carpenter wrote: This is a static checker where it complains if we check for one function pointer and then call a different function on the next line. In most cases, the code does the same thing before and after this patch. For example, when -phase_diversity is non-NULL then -phase_div_status is also non-NULL. The one place where that's not true is when we check -rds_blckcnt instead of -rsq_status. In those cases, we would want to call -rsq_status but we instead return -ENOENT. Signed-off-by: Dan Carpenter dan.carpen...@oracle.com --- Please review this carefully. I don't have the hardware to test it. Andrey, can you review this? I think the first two chunks are correct, but the last two chunks are probably not what you want. In the case of an AM receiver there is no RDS data, so an error is probably correct. Regards, Hans diff --git a/drivers/media/radio/radio-si476x.c b/drivers/media/radio/radio-si476x.c index 9430c6a..817fc0c 100644 --- a/drivers/media/radio/radio-si476x.c +++ b/drivers/media/radio/radio-si476x.c @@ -854,7 +854,7 @@ static int si476x_radio_g_volatile_ctrl(struct v4l2_ctrl *ctrl) switch (ctrl-id) { case V4L2_CID_SI476X_INTERCHIP_LINK: if (si476x_core_has_diversity(radio-core)) { - if (radio-ops-phase_diversity) { + if (radio-ops-phase_div_status) { retval = radio-ops-phase_div_status(radio-core); if (retval 0) break; @@ -1285,7 +1285,7 @@ static ssize_t si476x_radio_read_agc_blob(struct file *file, struct si476x_agc_status_report report; si476x_core_lock(radio-core); - if (radio-ops-rds_blckcnt) + if (radio-ops-agc_status) err = radio-ops-agc_status(ZZradio-core, report); else err = -ENOENT; @@ -1320,7 +1320,7 @@ static ssize_t si476x_radio_read_rsq_blob(struct file *file, }; si476x_core_lock(radio-core); - if (radio-ops-rds_blckcnt) + if (radio-ops-rsq_status) err = radio-ops-rsq_status(radio-core, args, report); else err = -ENOENT; @@ -1355,7 +1355,7 @@ static ssize_t si476x_radio_read_rsq_primary_blob(struct file *file, }; si476x_core_lock(radio-core); - if (radio-ops-rds_blckcnt) + if (radio-ops-rsq_status) err = radio-ops-rsq_status(radio-core, args, report); else err = -ENOENT; -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch] [media] radio-si476x: check different function pointers
On Thu, Apr 11, 2013 at 11:24 AM, Hans Verkuil hverk...@xs4all.nl wrote: On Wed April 10 2013 13:40:51 Dan Carpenter wrote: This is a static checker where it complains if we check for one function pointer and then call a different function on the next line. In most cases, the code does the same thing before and after this patch. For example, when -phase_diversity is non-NULL then -phase_div_status is also non-NULL. The one place where that's not true is when we check -rds_blckcnt instead of -rsq_status. In those cases, we would want to call -rsq_status but we instead return -ENOENT. Signed-off-by: Dan Carpenter dan.carpen...@oracle.com --- Please review this carefully. I don't have the hardware to test it. Andrey, can you review this? I think the first two chunks are correct, but the last two chunks are probably not what you want. In the case of an AM receiver there is no RDS data, so an error is probably correct. Sorry, I suck at gmail-ing and my response to this letter was bounced for having HTML in it and I guess you didn't receive it either, I'll just copy it below: On Wed, Apr 10, 2013 at 4:40 AM, Dan Carpenter dan.carpen...@oracle.com wrote: This is a static checker where it complains if we check for one function pointer and then call a different function on the next line. In most cases, the code does the same thing before and after this patch. For example, when -phase_diversity is non-NULL then -phase_div_status is also non-NULL. The one place where that's not true is when we check -rds_blckcnt instead of -rsq_status. In those cases, we would want to call -rsq_status but we instead return -ENOENT. Signed-off-by: Dan Carpenter dan.carpen...@oracle.com --- Please review this carefully. I don't have the hardware to test it. diff --git a/drivers/media/radio/radio-si476x.c b/drivers/media/radio/radio-si476x.c index 9430c6a..817fc0c 100644 --- a/drivers/media/radio/radio-si476x.c +++ b/drivers/media/radio/radio-si476x.c @@ -854,7 +854,7 @@ static int si476x_radio_g_volatile_ctrl(struct v4l2_ctrl *ctrl) switch (ctrl-id) { case V4L2_CID_SI476X_INTERCHIP_LINK: if (si476x_core_has_diversity(radio-core)) { - if (radio-ops-phase_diversity) { + if (radio-ops-phase_div_status) { retval = radio-ops-phase_div_status(radio-core); if (retval 0) break; I think I would prefer to use si476x_core_is_in_am_receiver_mode in the case above and then have additional BUG_ON(radio-ops-phase_div_status) for cases where it should not be NULL(tuner in FM mode, diversity feature present) also I probably should return -EINVAL in all the cases for this control. @@ -1285,7 +1285,7 @@ static ssize_t si476x_radio_read_agc_blob(struct file *file, struct si476x_agc_status_report report; si476x_core_lock(radio-core); - if (radio-ops-rds_blckcnt) + if (radio-ops-agc_status) err = radio-ops-agc_status(radio-core, report); else err = -ENOENT; @@ -1320,7 +1320,7 @@ static ssize_t si476x_radio_read_rsq_blob(struct file *file, }; si476x_core_lock(radio-core); - if (radio-ops-rds_blckcnt) + if (radio-ops-rsq_status) err = radio-ops-rsq_status(radio-core, args, report); else err = -ENOENT; @@ -1355,7 +1355,7 @@ static ssize_t si476x_radio_read_rsq_primary_blob(struct file *file, }; si476x_core_lock(radio-core); - if (radio-ops-rds_blckcnt) + if (radio-ops-rsq_status) err = radio-ops-rsq_status(radio-core, args, report); else err = -ENOENT; This all looks like a dumb copy-paste screw up on my part. I think I copied the body of si476x_radio_read_rds_blckcnt_blob and used it to implement all the other functions and I guess forgot to change this bit of the code. Thank you for catching this, mistakes like this are just embarrassing. I'll make a patch based on this one and send it alongside the patches for MFD subsystem -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] v4l2-ctl: add is_compressed_format() helper
On Fri, Apr 12, 2013 at 2:09 AM, Hans Verkuil hverk...@xs4all.nl wrote: On Thu April 11 2013 20:07:01 Tzu-Jung Lee wrote: It is used to: bypass precalculate_bars() for OUTPUT device that takes encoded bitstreams. handle the last chunk of input file that has non-buffer-aligned size. This seems to be the third version of this patch. When you post a new version, can you 1) add a version number after 'PATCH' (e.g. [PATCHv3]) and 2) mention the differences since the previous version. That makes a reviewer's life a lot easier. Sorry about that, I tried to use the in-reply-to with git-send-email. But it didn't work as intended. Next time I'll try it with my own email first. The difference is the logic of fill_buffer_from_file(). In v3, I realized that compressed formats are not for multiplane anyway. So I split the logic to only handle single plane case, and leave multiplane untouched. I'll break the patch into two. One for is_compressed(). And the other one for handling the input file that has the non-buffer aligned size. Thanks. Roy Thanks! Hans Signed-off-by: Tzu-Jung Lee tj...@ambarella.com --- utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 132 -- 1 file changed, 112 insertions(+), 20 deletions(-) diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp index 9e361af..44643e8 100644 --- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp @@ -115,6 +115,29 @@ static const flag_def tc_flags_def[] = { { 0, NULL } }; +static bool is_compressed_format(__u32 pixfmt) +{ + switch (pixfmt) { + case V4L2_PIX_FMT_MJPEG: + case V4L2_PIX_FMT_JPEG: + case V4L2_PIX_FMT_DV: + case V4L2_PIX_FMT_MPEG: + case V4L2_PIX_FMT_H264: + case V4L2_PIX_FMT_H264_NO_SC: + case V4L2_PIX_FMT_H263: + case V4L2_PIX_FMT_MPEG1: + case V4L2_PIX_FMT_MPEG2: + case V4L2_PIX_FMT_MPEG4: + case V4L2_PIX_FMT_XVID: + case V4L2_PIX_FMT_VC1_ANNEX_G: + return true; + default: + return false; + } + + return false; +} + static void print_buffer(FILE *f, struct v4l2_buffer buf) { fprintf(f, \tIndex: %d\n, buf.index); @@ -223,25 +246,60 @@ void streaming_cmd(int ch, char *optarg) } static bool fill_buffer_from_file(void *buffers[], unsigned buffer_lengths[], - unsigned buf_index, unsigned num_planes, FILE *fin) + unsigned buffer_bytesused[], unsigned buf_index, + unsigned num_planes, bool is_compressed, FILE *fin) { + if (num_planes == 1) { + unsigned i = buf_index; + unsigned sz = fread(buffers[i], 1, + buffer_lengths[i], fin); + + buffer_bytesused[i] = sz; + if (sz == 0 stream_loop) { + fseek(fin, 0, SEEK_SET); + sz = fread(buffers[i], 1, +buffer_lengths[i], fin); + + buffer_bytesused[i] = sz; + } + + if (!sz) + return false; + + if (sz == buffer_lengths[i]) + return true; + + if (is_compressed) + return true; + + fprintf(stderr, %u != %u\n, sz, buffer_lengths[i]); + + return false; + } + for (unsigned j = 0; j num_planes; j++) { unsigned p = buf_index * num_planes + j; unsigned sz = fread(buffers[p], 1, - buffer_lengths[p], fin); + buffer_lengths[p], fin); + buffer_bytesused[j] = sz; if (j == 0 sz == 0 stream_loop) { fseek(fin, 0, SEEK_SET); sz = fread(buffers[p], 1, - buffer_lengths[p], fin); +buffer_lengths[p], fin); + + buffer_bytesused[j] = sz; } if (sz == buffer_lengths[p]) continue; + + // Bail out if we get weird buffer sizes. if (sz) fprintf(stderr, %u != %u\n, sz, buffer_lengths[p]); - // Bail out if we get weird buffer sizes. + return false; } + return true; } @@ -312,16 +370,22 @@ static void do_setup_out_buffers(int fd, struct v4l2_requestbuffers *reqbufs, bool is_mplane, unsigned num_planes, bool is_mmap, void *buffers[], unsigned buffer_lengths[], FILE *fin) { + bool is_compressed; + struct v4l2_format fmt; memset(fmt, 0, sizeof(fmt)); fmt.type = reqbufs-type; doioctl(fd, VIDIOC_G_FMT, fmt); - if
Re: [PATCH v8 1/7] media: V4L2: add temporary clock helpers
Quoting Barry Song (2013-04-11 01:59:28) 2013/4/11 Guennadi Liakhovetski g.liakhovet...@gmx.de: On Thu, 11 Apr 2013, Barry Song wrote: 2013/4/11 Guennadi Liakhovetski g.liakhovet...@gmx.de: Hi Barry On Thu, 11 Apr 2013, Barry Song wrote: Hi Guennadi, Typical video devices like camera sensors require an external clock source. Many such devices cannot even access their hardware registers without a running clock. These clock sources should be controlled by their consumers. This should be performed, using the generic clock framework. Unfortunately so far only very few systems have been ported to that framework. This patch adds a set of temporary helpers, mimicking the generic clock API, to V4L2. Platforms, adopting the clock API, should switch to using it. Eventually this temporary API should be removed. Signed-off-by: Guennadi Liakhovetski g.liakhovetski@xx --- for your patch 1/8 and 3/8, i think it makes a lot of senses to let the object manages its own clock by itself. is it possible for us to implement v4l2-clk.c directly as an instance of standard clk driver for those systems which don't have generic clock, and remove the V4L2 clock APIs like v4l2_clk_get, v4l2_clk_enable from the first day? i mean v4l2-clk.c becomes a temp and fake clock controller driver. finally, after people have generically clk, remove it. I don't think you can force-enable the CFF on systems, that don't support it, e.g. PXA. yes. we can. clock is only a framework, has it any limitation to implement a driver instance on any platform? So, you enable CFF, it provides its own clk_* implementation like clk_get_rate() etc. Now, PXA already has it defined in arch/arm/mach-pxa/clock.c. Don't think this is going to fly. agree. Hi, I came into this thread late and don't have the actual patches in my inbox for review. That said, I don't understand why V4L2 cares about the clk framework *implementation*? The clk.h api is the same for platforms using the common struct clk and those still using the legacy method of defining their own struct clk. If drivers are only consumers of the clk.h api then the implementation underneath should not matter. Regards, Mike Thanks Guennadi people have tried to move to common clk and generic framework for a long time, now you still try to provide a v4l2 specific clock APIs, it just makes v4l2 unacceptable and much complex. Thanks Guennadi v8: Updated both (C) dates drivers/media/v4l2-core/Makefile |2 +- drivers/media/v4l2-core/v4l2-clk.c | 177 include/media/v4l2-clk.h | 54 +++ 3 files changed, 232 insertions(+), 1 deletions(-) create mode 100644 drivers/media/v4l2-core/v4l2-clk.c create mode 100644 include/media/v4l2-clk.h diff --git a/drivers/media/v4l2-core/Makefile b/drivers/media/v4l2-core/Makefile index aa50c46..628c630 100644 --- a/drivers/media/v4l2-core/Makefile +++ b/drivers/media/v4l2-core/Makefile @@ -5,7 +5,7 @@ tuner-objs := tuner-core.o videodev-objs := v4l2-dev.o v4l2-ioctl.o v4l2-device.o v4l2-fh.o \ - v4l2-event.o v4l2-ctrls.o v4l2-subdev.o + v4l2-event.o v4l2-ctrls.o v4l2-subdev.o v4l2-clk.o ifeq ($(CONFIG_COMPAT),y) videodev-objs += v4l2-compat-ioctl32.o endif diff --git a/drivers/media/v4l2-core/v4l2-clk.c b/drivers/media/v4l2-core/v4l2-clk.c new file mode 100644 index 000..d7cc13e --- /dev/null +++ b/drivers/media/v4l2-core/v4l2-clk.c @@ -0,0 +1,177 @@ -barry -barry ___ linux-arm-kernel mailing list linux-arm-ker...@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 1/2] v4l2-ctl: add is_compressed_format() helper
To bypass precalculate_bars() for OUTPUT device that takes encoded bitstreams. Signed-off-by: Tzu-Jung Lee tj...@ambarella.com --- utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 40 ++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp index 9e361af..035c3c7 100644 --- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp @@ -115,6 +115,23 @@ static const flag_def tc_flags_def[] = { { 0, NULL } }; +static bool is_compressed_format(int fd, struct v4l2_format *f) +{ + struct v4l2_fmtdesc fmt; + + memset(fmt, 0, sizeof(fmt)); + fmt.type = f-type; + + while (test_ioctl(fd, VIDIOC_ENUM_FMT, fmt) = 0) { + if (fmt.pixelformat == f-fmt.pix.pixelformat) + return fmt.flags V4L2_FMT_FLAG_COMPRESSED; + + fmt.index++; + } + + return false; +} + static void print_buffer(FILE *f, struct v4l2_buffer buf) { fprintf(f, \tIndex: %d\n, buf.index); @@ -312,12 +329,16 @@ static void do_setup_out_buffers(int fd, struct v4l2_requestbuffers *reqbufs, bool is_mplane, unsigned num_planes, bool is_mmap, void *buffers[], unsigned buffer_lengths[], FILE *fin) { + bool is_compressed; + struct v4l2_format fmt; memset(fmt, 0, sizeof(fmt)); fmt.type = reqbufs-type; doioctl(fd, VIDIOC_G_FMT, fmt); - if (!precalculate_bars(fmt.fmt.pix.pixelformat, stream_pat)) { + is_compressed = is_compressed_format(fd, fmt); + if (!is_compressed + !precalculate_bars(fmt.fmt.pix.pixelformat, stream_pat)) { fprintf(stderr, unsupported pixelformat\n); return; } @@ -688,7 +709,9 @@ static void streaming_set_cap(int fd) static void streaming_set_out(int fd) { struct v4l2_requestbuffers reqbufs; + struct v4l2_format fmt; int fd_flags = fcntl(fd, F_GETFL); + bool is_compressed; bool is_mplane = capabilities (V4L2_CAP_VIDEO_OUTPUT_MPLANE | V4L2_CAP_VIDEO_M2M_MPLANE); @@ -710,6 +733,12 @@ static void streaming_set_out(int fd) reqbufs.type = type; reqbufs.memory = is_mmap ? V4L2_MEMORY_MMAP : V4L2_MEMORY_USERPTR; + memset(fmt, 0, sizeof(fmt)); + fmt.type = reqbufs.type; + doioctl(fd, VIDIOC_G_FMT, fmt); + + is_compressed = is_compressed_format(fd, fmt); + if (file_out) { if (!strcmp(file_out, -)) fin = stdin; @@ -795,6 +824,9 @@ enum stream_type { static void streaming_set_m2m(int fd) { + struct v4l2_format fmt; + bool is_compressed; + int fd_flags = fcntl(fd, F_GETFL); bool use_poll = options[OptStreamPoll]; @@ -864,6 +896,12 @@ static void streaming_set_m2m(int fd) is_mmap, buffers_out, buffer_lengths_out, file[OUT]); + memset(fmt, 0, sizeof(fmt)); + fmt.type = reqbufs[OUT].type; + doioctl(fd, VIDIOC_G_FMT, fmt); + + is_compressed = is_compressed_format(fd, fmt); + if (doioctl(fd, VIDIOC_STREAMON, type[CAP]) || doioctl(fd, VIDIOC_STREAMON, type[OUT])) return; -- 1.8.1.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 2/2] v4l2-ctl: handle the last chunk of input file
For bitstream input file, it could be non-aligned to the buffer size. In this case, we still need to QBUF it to the driver. Signed-off-by: Tzu-Jung Lee tj...@ambarella.com --- utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 72 +++ 1 file changed, 57 insertions(+), 15 deletions(-) diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp index 035c3c7..d9b9146 100644 --- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp @@ -240,8 +240,37 @@ void streaming_cmd(int ch, char *optarg) } static bool fill_buffer_from_file(void *buffers[], unsigned buffer_lengths[], - unsigned buf_index, unsigned num_planes, FILE *fin) + unsigned buffer_bytesused[], unsigned buf_index, + unsigned num_planes, bool is_compressed, FILE *fin) { + if (num_planes == 1) { + unsigned i = buf_index; + unsigned sz = fread(buffers[i], 1, + buffer_lengths[i], fin); + + buffer_bytesused[i] = sz; + if (sz == 0 stream_loop) { + fseek(fin, 0, SEEK_SET); + sz = fread(buffers[i], 1, + buffer_lengths[i], fin); + + buffer_bytesused[i] = sz; + } + + if (!sz) + return false; + + if (sz == buffer_lengths[i]) + return true; + + if (is_compressed) + return true; + + fprintf(stderr, %u != %u\n, sz, buffer_lengths[i]); + + return false; + } + for (unsigned j = 0; j num_planes; j++) { unsigned p = buf_index * num_planes + j; unsigned sz = fread(buffers[p], 1, @@ -343,6 +372,8 @@ static void do_setup_out_buffers(int fd, struct v4l2_requestbuffers *reqbufs, return; } + unsigned buffer_bytesused[reqbufs-count * VIDEO_MAX_PLANES]; + for (unsigned i = 0; i reqbufs-count; i++) { struct v4l2_plane planes[VIDEO_MAX_PLANES]; struct v4l2_buffer buf; @@ -384,11 +415,11 @@ static void do_setup_out_buffers(int fd, struct v4l2_requestbuffers *reqbufs, // TODO fill_buffer_mp(buffers[i], fmt.fmt.pix_mp); if (fin) fill_buffer_from_file(buffers, buffer_lengths, - buf.index, num_planes, fin); + buffer_bytesused, buf.index, + num_planes, is_compressed, fin); } else { buffer_lengths[i] = buf.length; - buf.bytesused = buf.length; if (is_mmap) { buffers[i] = mmap(NULL, buf.length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, buf.m.offset); @@ -402,9 +433,16 @@ static void do_setup_out_buffers(int fd, struct v4l2_requestbuffers *reqbufs, buffers[i] = calloc(1, buf.length); buf.m.userptr = (unsigned long)buffers[i]; } - if (!fin || !fill_buffer_from_file(buffers, buffer_lengths, - buf.index, num_planes, fin)) + + if (fin fill_buffer_from_file(buffers, buffer_lengths, +buffer_bytesused, buf.index, +num_planes, is_compressed, +fin)) { + buf.bytesused = buffer_bytesused[buf.index]; + } + else { fill_buffer(buffers[i], fmt.fmt.pix); + } } if (doioctl(fd, VIDIOC_QBUF, buf)) return; @@ -532,12 +570,13 @@ static int do_handle_cap(int fd, struct v4l2_requestbuffers *reqbufs, } static int do_handle_out(int fd, struct v4l2_requestbuffers *reqbufs, -bool is_mplane, unsigned num_planes, +bool is_compressed, bool is_mplane, unsigned num_planes, void *buffers[], unsigned buffer_lengths[], FILE *fin, unsigned count, unsigned last, struct timeval tv_last) { struct v4l2_plane planes[VIDEO_MAX_PLANES]; struct v4l2_buffer buf; + unsigned buffer_bytesused[reqbufs-count * VIDEO_MAX_PLANES]; int ret; memset(buf, 0, sizeof(buf)); @@ -556,14 +595,17 @@ static int
[PATCH] em28xx: fix snapshot button support
The snapshot button support is currently broken, because module em28xx-rc is loaded only if the device has remote control support. Fix it by also loading this module if the device has a snapshot button. Signed-off-by: Frank Schäfer fschaefer@googlemail.com --- drivers/media/usb/em28xx/em28xx-cards.c |3 ++- 1 Datei geändert, 2 Zeilen hinzugefügt(+), 1 Zeile entfernt(-) diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c index 085b8fc..2da17af 100644 --- a/drivers/media/usb/em28xx/em28xx-cards.c +++ b/drivers/media/usb/em28xx/em28xx-cards.c @@ -2810,7 +2810,8 @@ static void request_module_async(struct work_struct *work) if (dev-board.has_dvb) request_module(em28xx-dvb); - if ((dev-board.ir_codes || dev-board.has_ir_i2c) !disable_ir) + if (dev-board.has_snapshot_button || + ((dev-board.ir_codes || dev-board.has_ir_i2c) !disable_ir)) request_module(em28xx-rc); #endif /* CONFIG_MODULES */ } -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] em28xx: improve em2710/em2820 distinction
Chip id 18 is used by the em2710 and em2820. The current code assumes that if the device is a camera, the chip is an em2710 and an em2820 otherwise. But it turned out that the em2820 is also used in camera devices. Silvercrest 1.3 MPix webcams for example are available with both chips. Fortunately both variants are using different generic USD IDs which give us a hint about the used chip. Signed-off-by: Frank Schäfer fschaefer@googlemail.com --- drivers/media/usb/em28xx/em28xx-cards.c | 16 1 Datei geändert, 8 Zeilen hinzugefügt(+), 8 Zeilen entfernt(-) diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c index 2da17af..bec604f 100644 --- a/drivers/media/usb/em28xx/em28xx-cards.c +++ b/drivers/media/usb/em28xx/em28xx-cards.c @@ -2909,6 +2909,14 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev, break; case CHIP_ID_EM2820: chip_name = em2710/2820; + if (dev-udev-descriptor.idVendor == 0xeb1a) { + __le16 idProd = dev-udev-descriptor.idProduct; + if (le16_to_cpu(idProd) == 0x2710) + chip_name = em2710; + else if (le16_to_cpu(idProd) == 0x2820) + chip_name = em2820; + } + /* NOTE: the em2820 is used in webcams, too ! */ break; case CHIP_ID_EM2840: chip_name = em2840; @@ -2974,14 +2982,6 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev, em28xx_pre_card_setup(dev); - if (dev-chip_id == CHIP_ID_EM2820) { - if (dev-board.is_webcam) - chip_name = em2710; - else - chip_name = em2820; - snprintf(dev-name, sizeof(dev-name), %s #%d, chip_name, dev-devno); - } - if (!dev-board.is_em2800) { /* Resets I2C speed */ retval = em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, dev-board.i2c_speed); -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v8 0/7] V4L2 clock and async patches and soc-camera example
Hi Guennadi, On 04/11/2013 11:59 AM, Guennadi Liakhovetski wrote: Hi all On Mon, 8 Apr 2013, Guennadi Liakhovetski wrote: Mostly just a re-spin of v7 with minor modifications. Guennadi Liakhovetski (7): media: V4L2: add temporary clock helpers media: V4L2: support asynchronous subdevice registration media: soc-camera: switch I2C subdevice drivers to use v4l2-clk soc-camera: add V4L2-async support sh_mobile_ceu_camera: add asynchronous subdevice probing support imx074: support asynchronous probing ARM: shmobile: convert ap4evb to asynchronously register camera subdevices So far there haven't been any comments to this, and Mauro asked to push all non-fixes to him by tomorrow. So, if at least the API is now ok, we could push this to 3.10, at least the core patches 1 and 2. Then during 3.10 we could look at porting individual drivers on top of this. This patch series has significantly improved over time but I'm not sure it is all ready to merge it at this moment. At least it doesn't make sense to me to merge it without any users. The purpose of an introduction of this whole asynchronous probing concept was to add support for the device tree based systems. However there is no patch in this series that would be adding device tree support to some V4L2 driver. That's a minor issue though I think. A significant blocking point IMHO is that this API is bound to the circular dependency issue between a sub-device and the host driver. I think we should have at least some specific ideas on how to resolve it before pushing the API upstream. Or are there any already ? One of the ideas I had was to make a sub-device driver drop the reference it has to the clock provider module (the host) as soon as it gets registered to it. But it doesn't seem straightforward with the common clock API. Other option is a sysfs attribute at a host driver that would allow to release its sub-device(s). But it sounds a bit strange to me to require userspace to touch some sysfs attributes before being able to remove some modules. Something probably needs to be changed at the high level design to avoid this circular dependency. Thanks, Sylwester -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v8 1/7] media: V4L2: add temporary clock helpers
Hi, On 04/11/2013 08:52 PM, Mike Turquette wrote: [...] So, you enable CFF, it provides its own clk_* implementation like clk_get_rate() etc. Now, PXA already has it defined in arch/arm/mach-pxa/clock.c. Don't think this is going to fly. agree. Hi, I came into this thread late and don't have the actual patches in my inbox for review. That said, I don't understand why V4L2 cares about the clk framework *implementation*? The clk.h api is the same for platforms using the common struct clk and those still using the legacy method of defining their own struct clk. If drivers are only consumers of the clk.h api then the implementation underneath should not matter. I came to similar conclusions previously, but in case when one of the two drivers is the clock provider I think there is still an issue there. The drivers are supposed to be platform agnostic, but the clock provider would have to include mach specific declarations of struct clk, wouldn't it ? Regards, Sylwester -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] adv8170: fix querystd() method for no input signal
From: Vladimir Barinov vladimir.bari...@cogentembedded.com When the input signal is not detected querystd() method should return V4L2_STD_UNKNOWN instead of previously latched analog video standard. Signed-off-by: Vladimir Barinov vladimir.bari...@cogentembedded.com Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com --- drivers/media/i2c/adv7180.c |4 1 file changed, 4 insertions(+) Index: linux/drivers/media/i2c/adv7180.c === --- linux.orig/drivers/media/i2c/adv7180.c +++ linux/drivers/media/i2c/adv7180.c @@ -135,6 +135,10 @@ struct adv7180_state { static v4l2_std_id adv7180_std_to_v4l2(u8 status1) { + /* in case V4L2_IN_ST_NO_SIGNAL */ + if (!(status1 ADV7180_STATUS1_IN_LOCK)) + return V4L2_STD_UNKNOWN; + switch (status1 ADV7180_STATUS1_AUTOD_MASK) { case ADV7180_STATUS1_AUTOD_NTSM_M_J: return V4L2_STD_NTSC; -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 1/2] adv7180: fix querystd() method for no input signal
From: Vladimir Barinov vladimir.bari...@cogentembedded.com When the input signal is not detected querystd() method should return V4L2_STD_UNKNOWN instead of previously latched analog video standard. Signed-off-by: Vladimir Barinov vladimir.bari...@cogentembedded.com Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com --- Changes since original posting: - fixed the driver name in the subject. drivers/media/i2c/adv7180.c |4 1 file changed, 4 insertions(+) Index: linux/drivers/media/i2c/adv7180.c === --- linux.orig/drivers/media/i2c/adv7180.c +++ linux/drivers/media/i2c/adv7180.c @@ -135,6 +135,10 @@ struct adv7180_state { static v4l2_std_id adv7180_std_to_v4l2(u8 status1) { + /* in case V4L2_IN_ST_NO_SIGNAL */ + if (!(status1 ADV7180_STATUS1_IN_LOCK)) + return V4L2_STD_UNKNOWN; + switch (status1 ADV7180_STATUS1_AUTOD_MASK) { case ADV7180_STATUS1_AUTOD_NTSM_M_J: return V4L2_STD_NTSC; -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 2/2] adv7180: add more subdev video ops
From: Vladimir Barinov vladimir.bari...@cogentembedded.com Add subdev video ops for ADV7180 video decoder. This makes decoder usable on the soc-camera drivers. Signed-off-by: Vladimir Barinov vladimir.bari...@cogentembedded.com Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com --- drivers/media/i2c/adv7180.c | 105 1 file changed, 105 insertions(+) Index: linux/drivers/media/i2c/adv7180.c === --- linux.orig/drivers/media/i2c/adv7180.c +++ linux/drivers/media/i2c/adv7180.c @@ -1,6 +1,8 @@ /* * adv7180.c Analog Devices ADV7180 video decoder driver * Copyright (c) 2009 Intel Corporation + * Copyright (C) 2013 Cogent Embedded, Inc. + * Copyright (C) 2013 Renesas Solutions Corp. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -128,6 +130,7 @@ struct adv7180_state { v4l2_std_id curr_norm; boolautodetect; u8 input; + struct v4l2_mbus_framefmt fmt; }; #define to_adv7180_sd(_ctrl) (container_of(_ctrl-handler,\ struct adv7180_state, \ @@ -397,10 +400,112 @@ static void adv7180_exit_controls(struct v4l2_ctrl_handler_free(state-ctrl_hdl); } +static int adv7180_enum_mbus_fmt(struct v4l2_subdev *sd, unsigned int index, +enum v4l2_mbus_pixelcode *code) +{ + if (index 0) + return -EINVAL; + + *code = V4L2_MBUS_FMT_YUYV8_2X8; + + return 0; +} + +static int adv7180_try_mbus_fmt(struct v4l2_subdev *sd, + struct v4l2_mbus_framefmt *fmt) +{ + struct adv7180_state *state = to_state(sd); + + adv7180_querystd(sd, state-curr_norm); + + fmt-code = V4L2_MBUS_FMT_YUYV8_2X8; + fmt-colorspace = V4L2_COLORSPACE_SMPTE170M; + fmt-field = V4L2_FIELD_INTERLACED; + fmt-width = 720; + fmt-height = state-curr_norm V4L2_STD_525_60 ? 480 : 576; + + return 0; +} + +static int adv7180_g_mbus_fmt(struct v4l2_subdev *sd, + struct v4l2_mbus_framefmt *fmt) +{ + struct adv7180_state *state = to_state(sd); + + *fmt = state-fmt; + + return 0; +} + +static int adv7180_s_mbus_fmt(struct v4l2_subdev *sd, + struct v4l2_mbus_framefmt *fmt) +{ + struct adv7180_state *state = to_state(sd); + + adv7180_try_mbus_fmt(sd, fmt); + state-fmt = *fmt; + + return 0; +} + +static int adv7180_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) +{ + struct adv7180_state *state = to_state(sd); + + adv7180_querystd(sd, state-curr_norm); + + a-bounds.left = 0; + a-bounds.top = 0; + a-bounds.width = 720; + a-bounds.height = state-curr_norm V4L2_STD_525_60 ? 480 : 576; + a-defrect = a-bounds; + a-type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + a-pixelaspect.numerator = 1; + a-pixelaspect.denominator = 1; + + return 0; +} + +static int adv7180_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) +{ + struct adv7180_state *state = to_state(sd); + + adv7180_querystd(sd, state-curr_norm); + + a-c.left = 0; + a-c.top = 0; + a-c.width = 720; + a-c.height = state-curr_norm V4L2_STD_525_60 ? 480 : 576; + a-type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + + return 0; +} + +static int adv7180_g_mbus_config(struct v4l2_subdev *sd, +struct v4l2_mbus_config *cfg) +{ + /* +* The ADV7180 sensor supports BT.601/656 output modes. +* The BT.656 is default and not yet configurable by s/w. +*/ + cfg-flags = V4L2_MBUS_MASTER | V4L2_MBUS_PCLK_SAMPLE_RISING | +V4L2_MBUS_DATA_ACTIVE_HIGH; + cfg-type = V4L2_MBUS_BT656; + + return 0; +} + static const struct v4l2_subdev_video_ops adv7180_video_ops = { .querystd = adv7180_querystd, .g_input_status = adv7180_g_input_status, .s_routing = adv7180_s_routing, + .enum_mbus_fmt = adv7180_enum_mbus_fmt, + .try_mbus_fmt = adv7180_try_mbus_fmt, + .g_mbus_fmt = adv7180_g_mbus_fmt, + .s_mbus_fmt = adv7180_s_mbus_fmt, + .cropcap = adv7180_cropcap, + .g_crop = adv7180_g_crop, + .g_mbus_config = adv7180_g_mbus_config, }; static const struct v4l2_subdev_core_ops adv7180_core_ops = { -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v8 1/7] media: V4L2: add temporary clock helpers
Hi Mike, On Thursday 11 April 2013 11:52:58 Mike Turquette wrote: Quoting Barry Song (2013-04-11 01:59:28) 2013/4/11 Guennadi Liakhovetski g.liakhovet...@gmx.de: On Thu, 11 Apr 2013, Barry Song wrote: 2013/4/11 Guennadi Liakhovetski g.liakhovet...@gmx.de: On Thu, 11 Apr 2013, Barry Song wrote: Hi Guennadi, Typical video devices like camera sensors require an external clock source. Many such devices cannot even access their hardware registers without a running clock. These clock sources should be controlled by their consumers. This should be performed, using the generic clock framework. Unfortunately so far only very few systems have been ported to that framework. This patch adds a set of temporary helpers, mimicking the generic clock API, to V4L2. Platforms, adopting the clock API, should switch to using it. Eventually this temporary API should be removed. Signed-off-by: Guennadi Liakhovetski g.liakhovetski@xx --- for your patch 1/8 and 3/8, i think it makes a lot of senses to let the object manages its own clock by itself. is it possible for us to implement v4l2-clk.c directly as an instance of standard clk driver for those systems which don't have generic clock, and remove the V4L2 clock APIs like v4l2_clk_get, v4l2_clk_enable from the first day? i mean v4l2-clk.c becomes a temp and fake clock controller driver. finally, after people have generically clk, remove it. I don't think you can force-enable the CFF on systems, that don't support it, e.g. PXA. yes. we can. clock is only a framework, has it any limitation to implement a driver instance on any platform? So, you enable CFF, it provides its own clk_* implementation like clk_get_rate() etc. Now, PXA already has it defined in arch/arm/mach-pxa/clock.c. Don't think this is going to fly. agree. I came into this thread late and don't have the actual patches in my inbox for review. That said, I don't understand why V4L2 cares about the clk framework *implementation*? The clk.h api is the same for platforms using the common struct clk and those still using the legacy method of defining their own struct clk. If drivers are only consumers of the clk.h api then the implementation underneath should not matter. The issue on non-CCF systems is that devices usually can't register clocks dynamically. (Most of) those systems provide system clocks only through their clock API, without a way for the camera IP core to hook up the clock(s) it can provide to the camera sensor. On the consumer side we don't care much about the clock framework implementation, but on the provider side we need a framework that allows registering non-system clocks at runtime. -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Keene
Hello Hans, That device is working very, thank you for it. Anyhow, I noticed two things. 1) it does not start transmitting just after I plug it - I have to retune it! Output says it is tuned to 95.16 MHz by default, but it is not. After I issue retune, just to same channel it starts working. $ v4l2-ctl -d /dev/radio0 --set-freq=95.16 2) What is that log printing? ALSA sound/usb/mixer.c:932 13:0: cannot get min/max values for control 2 (id 13) usb 5-2: new full-speed USB device number 3 using ohci_hcd usb 5-2: New USB device found, idVendor=046d, idProduct=0a0e usb 5-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0 usb 5-2: Product: B-LINK USB Audio usb 5-2: Manufacturer: HOLTEK ALSA sound/usb/mixer.c:932 13:0: cannot get min/max values for control 2 (id 13) radio-keene 5-2:1.2: V4L2 device registered as radio0 $ v4l2-ctl -d /dev/radio0 --all -L Driver Info (not using libv4l2): Driver name : radio-keene Card type : Keene FM Transmitter Bus info : usb-:00:13.0-2 Driver version: 3.9.0 Capabilities : 0x800C Modulator Radio Frequency: 1522560 (95.16 MHz) Modulator: Name : FM Capabilities : 62.5 Hz stereo Frequency range : 76.0 MHz - 108.0 MHz Subchannel modulation: stereo Priority: 2 User Controls mute (bool) : default=0 value=0 FM Radio Modulator Controls audio_compression_gain (int): min=-15 max=18 step=3 default=0 value=0 flags=slider pre_emphasis (menu) : min=0 max=2 default=1 value=1 1: 50 Microseconds 2: 75 Microseconds tune_power_level (int): min=84 max=118 step=1 default=118 value=118 flags=slider regards Antti -- http://palosaari.fi/ -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] media: vb2: add length check for mmap
The length of mmap() can be bigger than length of vb2 buffer, so it should be checked. Signed-off-by: Seung-Woo Kim sw0312@samsung.com --- drivers/media/v4l2-core/videobuf2-core.c |5 + 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index db1235d..2c6ff2d 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -1886,6 +1886,11 @@ int vb2_mmap(struct vb2_queue *q, struct vm_area_struct *vma) vb = q-bufs[buffer]; + if (vb-v4l2_planes[plane].length (vma-vm_end - vma-vm_start)) { + dprintk(1, Invalid length\n); + return -EINVAL; + } + ret = call_memop(q, mmap, vb-planes[plane].mem_priv, vma); if (ret) return ret; -- 1.7.4.1 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH Resend 1/1] Revert of/exynos_g2d: Add Bindings for exynos G2D driver
This reverts commit 09495dda6a62c74b13412a63528093910ef80edd. The description is incomplete and the location of this file is incorrect. Based on discussion with the Samsung media and DRM subsystem maintainers, the documentaion of Samsung G2D bindings has been placed at: Documentation/devicetree/bindings/gpu/samsung-g2d.txt Signed-off-by: Sachin Kamat sachin.ka...@linaro.org Cc: Inki Dae inki@samsung.com Cc: Sylwester Nawrocki s.nawro...@samsung.com Cc: Ajay Kumar ajaykumar...@samsung.com --- The right documentation for G2D bindings has already been merged for 3.10-rc and hence we need this patch for 3.10-rc too, to avoid confusions due to multiple documents. --- .../devicetree/bindings/drm/exynos/g2d.txt | 22 1 file changed, 22 deletions(-) delete mode 100644 Documentation/devicetree/bindings/drm/exynos/g2d.txt diff --git a/Documentation/devicetree/bindings/drm/exynos/g2d.txt b/Documentation/devicetree/bindings/drm/exynos/g2d.txt deleted file mode 100644 index 1eb124d..000 --- a/Documentation/devicetree/bindings/drm/exynos/g2d.txt +++ /dev/null @@ -1,22 +0,0 @@ -Samsung 2D Graphic Accelerator using DRM frame work - -Samsung FIMG2D is a graphics 2D accelerator which supports Bit Block Transfer. -We set the drawing-context registers for configuring rendering parameters and -then start rendering. -This driver is for SOCs which contain G2D IPs with version 4.1. - -Required properties: - -compatible: - should be samsung,exynos-g2d-41. - -reg: - physical base address of the controller and length - of memory mapped region. - -interrupts: - interrupt combiner values. - -Example: - g2d { - compatible = samsung,exynos-g2d-41; - reg = 0x1085 0x1000; - interrupts = 0 91 0; - }; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html