dvbscan output Channel Number into final stdout?
Can we get dvbscan to output the Channel Number into the final stdout somehow? A likely format would be something such as the following. Current output: KATN-DT:497028615:8VSB:49:52:3 KWFA-DT:497028615:8VSB:65:68:4 ... Suggested output: 2.1:497028615:8VSB:49:52:3 2.2:497028615:8VSB:65:68:4 ... The reason for this, the local ATSC broadcast over the air channels are not assigning unique channel names. However, channel numbers seem to be consistent between the published TV Guide/TV Listings and are unique! This seems to be the norm for the past several years now. There have been some minor changes with channel numbers within the past years, but if channel numbers are used such as in the above example, mplayer should be able to recognize mplayer dvb://2.1 or mplayer dvb://2.2, etc? One should also be able to do something like 'dvbscan | sort' instead of trying to test each channel to see which channel is really 2.1 or 2.2! Currently, dvbscan outputs the channel number only when the channel is first found and with a colon. (ie. 2:1, 2:2, ...) 1) Get/Keep Channel Number found 2) Convert/reassign the colon to a period (ie. 2:1 == 2.1, 2:2 == 2.2) 3) Print Channel Number instead of Channel Name on final stdout. In the meantime, I should test whether mplayer has any issues with using "mplayer dvb://2.1" instead of the channel name. It would be really nice to be able to schedule a cron job here with "dvbscan > .mplayer/channels.conf" to keep channels updated and have a decent channels.conf I can use within mplayer/mencoder scripts for playback/recording. Currently, I have to go through and manually run mplayer on each station frequency to figure out which is 2.1 and which is 2.2, and so on. Or am I barking up the wrong tree? -- Roger http://rogerx.freeshell.org/ -- 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] stb0899: Fix slow and not locking DVB-S transponder(s)
Another version of http://patchwork.linuxtv.org/patch/6307 http://patchwork.linuxtv.org/patch/6510 which was superseded or rejected, but I don't know why. In stb0899_status stb0899_check_data the first read of STB0899_VSTATUS could read old (from previous search) status bits and the search fails on a good frequency. With the patch more transponder could be locked and locks about 2* faster. Signed-off-by: Lutz Sammer --- drivers/media/dvb/frontends/stb0899_algo.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/drivers/media/dvb/frontends/stb0899_algo.c b/drivers/media/dvb/frontends/stb0899_algo.c index d70eee0..8eca419 100644 --- a/drivers/media/dvb/frontends/stb0899_algo.c +++ b/drivers/media/dvb/frontends/stb0899_algo.c @@ -358,6 +358,7 @@ static enum stb0899_status stb0899_check_data(struct stb0899_state *state) else dataTime = 500; + stb0899_read_reg(state, STB0899_VSTATUS); /* clear old status bits */ stb0899_write_reg(state, STB0899_DSTATUS2, 0x00); /* force search loop */ while (1) { /* WARNING! VIT LOCKED has to be tested before VIT_END_LOOOP */ -- 1.7.6.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] stb0899: Fix slow and not locking DVB-S transponder(s)
Another version of http://patchwork.linuxtv.org/patch/6307 http://patchwork.linuxtv.org/patch/6510 which was superseded or rejected, but it don't know why. In stb0899_status stb0899_check_data the first read of STB0899_VSTATUS could read old (from previous search) status bits and the search fails on a good frequency. With the patch more transponder could be locked and locks about 2* faster. Signed-off-by: Lutz Sammer --- drivers/media/dvb/frontends/stb0899_algo.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/drivers/media/dvb/frontends/stb0899_algo.c b/drivers/media/dvb/fron tends/stb0899_algo.c index d70eee0..8eca419 100644 --- a/drivers/media/dvb/frontends/stb0899_algo.c +++ b/drivers/media/dvb/frontends/stb0899_algo.c @@ -358,6 +358,7 @@ static enum stb0899_status stb0899_check_data(struct stb0899 _state *state) else dataTime = 500; + stb0899_read_reg(state, STB0899_VSTATUS); /* clear old status bits */ stb0899_write_reg(state, STB0899_DSTATUS2, 0x00); /* force search loop * / while (1) { /* WARNING! VIT LOCKED has to be tested before VIT_END_LOOOP * / -- 1.7.6.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
Re: YCbCr 422 on s3c2440
Forwarding to the suitable list, although, I don't think s3c24xx SoCs are currently supported by V4L. Thanks Guennadi On Thu, 29 Sep 2011, GIGIN JOSE wrote: > Hi, > > I am working on s3c2440 ARM linux platform. I am connecting > an image sensor device to the camera controller of the s3c2440 > ARM processor. The image sensor outputs YCbCr 4:2:2 output. > Can I pass the output of this format to the preview path of > the camera controller to get proper image ? > > The image sensor also outputs RGB565 format, which I can > comfortably view using the preview path. But I would like > to get the YCbCr 4:2:2 format from the image sensor device. > > Is this possible with the preview path ? Any other register > settings are required for YCbCr 4:2:2 mode on the preview > path, other than that done for the RGB565 format. ? > > Thank You > GIGIN > > > ___ > linux-arm-kernel mailing list > linux-arm-ker...@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel > --- 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
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 Sep 29 19:00:15 CEST 2011 git hash:446b792c6bd87de4565ba200b75a708b4c575a06 gcc version: i686-linux-gcc (GCC) 4.6.1 host hardware:x86_64 host os: 3.0-4.slh.3-amd64 linux-git-armv5: WARNINGS linux-git-armv5-davinci: WARNINGS linux-git-armv5-ixp: WARNINGS linux-git-armv5-omap2: WARNINGS linux-git-i686: WARNINGS linux-git-m32r: OK linux-git-mips: WARNINGS linux-git-powerpc64: WARNINGS linux-git-x86_64: WARNINGS linux-2.6.31.12-i686: WARNINGS linux-2.6.32.6-i686: WARNINGS linux-2.6.33-i686: WARNINGS linux-2.6.34-i686: WARNINGS linux-2.6.35.3-i686: WARNINGS linux-2.6.36-i686: WARNINGS linux-2.6.37-i686: WARNINGS linux-2.6.38.2-i686: WARNINGS linux-2.6.39.1-i686: WARNINGS linux-3.0-i686: WARNINGS linux-3.1-rc1-i686: WARNINGS linux-2.6.31.12-x86_64: WARNINGS linux-2.6.32.6-x86_64: WARNINGS linux-2.6.33-x86_64: WARNINGS linux-2.6.34-x86_64: WARNINGS linux-2.6.35.3-x86_64: WARNINGS linux-2.6.36-x86_64: WARNINGS linux-2.6.37-x86_64: WARNINGS linux-2.6.38.2-x86_64: WARNINGS linux-2.6.39.1-x86_64: WARNINGS linux-3.0-x86_64: WARNINGS linux-3.1-rc1-x86_64: WARNINGS spec-git: WARNINGS 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 V4L-DVB specification 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 v2 3/5] omap3evm: Add Camera board init/hookup file
Hi, Few comments below. * Deepthy Ravi [110927 06:07]: > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include You can leave out mach/gpio.h as you already have linux/gpio.h included. > +static int __init omap3evm_cam_init(void) > +{ > + int ret; > + > + ret = gpio_request_array(omap3evm_gpios, > + ARRAY_SIZE(omap3evm_gpios)); > + if (ret < 0) { > + printk(KERN_ERR "Unable to get GPIO pins\n"); > + return ret; > + } > + > + omap3_init_camera(&omap3evm_isp_platform_data); > + > + printk(KERN_INFO "omap3evm camera init done successfully...\n"); > + return 0; > +} > + > +static void __exit omap3evm_cam_exit(void) > +{ > + gpio_free_array(omap3evm_gpios, > + ARRAY_SIZE(omap3evm_gpios)); > +} > + > +module_init(omap3evm_cam_init); > +module_exit(omap3evm_cam_exit); Looks like most of this file should be under drivers/media. For initializing the module you should pass some platform_data (until we have DT doing it) so you know that the camera is available on the booted board or not. Now the init tries to wrongly initialize things on other boards too. > --- a/arch/arm/mach-omap2/board-omap3evm.c > +++ b/arch/arm/mach-omap2/board-omap3evm.c > @@ -573,6 +573,8 @@ static struct omap_board_mux omap35x_board_mux[] > __initdata = { > OMAP_PIN_OFF_NONE), > OMAP3_MUX(GPMC_WAIT2, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP | > OMAP_PIN_OFF_NONE), > + OMAP3_MUX(MCBSP1_FSR, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP | > + OMAP_PIN_OFF_NONE), > #ifdef CONFIG_WL12XX_PLATFORM_DATA > /* WLAN IRQ - GPIO 149 */ > OMAP3_MUX(UART1_RTS, OMAP_MUX_MODE4 | OMAP_PIN_INPUT), > @@ -598,6 +600,8 @@ static struct omap_board_mux omap36x_board_mux[] > __initdata = { > OMAP3_MUX(MCSPI1_CS1, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP | > OMAP_PIN_OFF_INPUT_PULLUP | > OMAP_PIN_OFF_OUTPUT_LOW | > OMAP_PIN_OFF_WAKEUPENABLE), > + OMAP3_MUX(MCBSP1_FSR, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP | > + OMAP_PIN_OFF_NONE), > /* AM/DM37x EVM: DSS data bus muxed with sys_boot */ > OMAP3_MUX(DSS_DATA18, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE), > OMAP3_MUX(DSS_DATA19, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE), Is this safe to do on all boards, or only if you have the camera board attached? Regards, Tony -- 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 7/9] V4L: soc-camera: add a Media Controller wrapper
This wrapper adds a Media Controller implementation to soc-camera drivers. To really benefit from it individual host drivers should implement support for values of enum soc_camera_target other than SOCAM_TARGET_PIPELINE in their .set_fmt() and .try_fmt() methods. Signed-off-by: Guennadi Liakhovetski --- drivers/media/video/Makefile |6 +- drivers/media/video/soc_camera.c | 46 -- drivers/media/video/soc_entity.c | 284 drivers/media/video/soc_mediabus.c | 16 -- include/media/soc_camera.h |1 + include/media/soc_entity.h | 12 ++ 6 files changed, 334 insertions(+), 31 deletions(-) create mode 100644 drivers/media/video/soc_entity.c diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index 11fff97..f4e3d52 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile @@ -162,7 +162,11 @@ obj-$(CONFIG_VIDEO_CX23885) += cx23885/ obj-$(CONFIG_VIDEO_AK881X) += ak881x.o obj-$(CONFIG_VIDEO_OMAP2) += omap2cam.o -obj-$(CONFIG_SOC_CAMERA) += soc_camera.o soc_mediabus.o +obj-$(CONFIG_SOC_CAMERA) += soc_camera_core.o +soc_camera_core-objs := soc_camera.o soc_mediabus.o +ifeq ($(CONFIG_MEDIA_CONTROLLER),y) +soc_camera_core-objs += soc_entity.o +endif obj-$(CONFIG_SOC_CAMERA_PLATFORM) += soc_camera_platform.o # soc-camera host drivers have to be linked after camera drivers obj-$(CONFIG_VIDEO_MX1)+= mx1_camera.o diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c index 790c14c..9b4c3c0 100644 --- a/drivers/media/video/soc_camera.c +++ b/drivers/media/video/soc_camera.c @@ -515,17 +515,17 @@ int soc_camera_set_fmt(struct soc_camera_device *icd, struct v4l2_format *f, case SOCAM_TARGET_HOST_OUT: icd->user_width = pix->width; icd->user_height= pix->height; + icd->bytesperline = pix->bytesperline; + icd->sizeimage = pix->sizeimage; + icd->colorspace = pix->colorspace; + icd->field = pix->field; + if (ici->ops->init_videobuf) + icd->vb_vidq.field = pix->field; break; case SOCAM_TARGET_HOST_IN: icd->host_input_width = pix->width; icd->host_input_height = pix->height; } - icd->bytesperline = pix->bytesperline; - icd->sizeimage = pix->sizeimage; - icd->colorspace = pix->colorspace; - icd->field = pix->field; - if (ici->ops->init_videobuf) - icd->vb_vidq.field = pix->field; dev_dbg(icd->pdev, "set width: %d height: %d\n", icd->user_width, icd->user_height); @@ -835,10 +835,14 @@ static int soc_camera_streamon(struct file *file, void *priv, if (icd->streamer != file) return -EBUSY; + ret = soc_camera_mc_streamon(icd); + if (ret < 0) + return ret; + /* set physical bus parameters */ ret = ici->ops->set_bus_param(icd); if (ret < 0) - return ret; + goto ebusp; /* This calls buf_queue from host driver's videobuf_queue_ops */ if (ici->ops->init_videobuf) @@ -846,9 +850,23 @@ static int soc_camera_streamon(struct file *file, void *priv, else ret = vb2_streamon(&icd->vb2_vidq, i); - if (!ret) - v4l2_subdev_call(sd, video, s_stream, 1); + if (ret < 0) + goto estreamon; + + ret = v4l2_subdev_call(sd, video, s_stream, 1); + if (ret < 0 && ret != -ENOIOCTLCMD) + goto esdstream; + + return ret; +esdstream: + if (ici->ops->init_videobuf) + videobuf_streamoff(&icd->vb_vidq); + else + vb2_streamoff(&icd->vb2_vidq, i); +estreamon: +ebusp: + soc_camera_mc_streamoff(icd); return ret; } @@ -877,6 +895,7 @@ static int soc_camera_streamoff(struct file *file, void *priv, vb2_streamoff(&icd->vb2_vidq, i); v4l2_subdev_call(sd, video, s_stream, 0); + soc_camera_mc_streamoff(icd); return 0; } @@ -1250,12 +1269,11 @@ static int soc_camera_remove(struct soc_camera_device *icd) BUG_ON(!icd->parent); v4l2_ctrl_handler_free(&icd->ctrl_handler); - if (vdev) { + soc_camera_mc_free(icd); + if (vdev) video_unregister_device(vdev); - icd->vdev = NULL; - } - soc_camera_mc_free(icd); + icd->vdev = NULL; if (icl->board_info) { soc_camera_free_i2c(icd); @@ -1484,7 +1502,7 @@ static int video_dev_create(struct soc_camera_device *icd) if (!vdev) return -ENOMEM; - strlcpy(vdev->name, ici->
[PATCH 8/9] V4L: mt9t112: add pad level operations
On Media Controller enabled systems this patch allows the user to communicate with the driver directly over /dev/v4l-subdev* device nodes using VIDIOC_SUBDEV_* ioctl()s. Signed-off-by: Guennadi Liakhovetski --- drivers/media/video/mt9t112.c | 97 ++--- 1 files changed, 81 insertions(+), 16 deletions(-) diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c index 32114a3..bb95ad1 100644 --- a/drivers/media/video/mt9t112.c +++ b/drivers/media/video/mt9t112.c @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -87,6 +88,7 @@ struct mt9t112_format { struct mt9t112_priv { struct v4l2_subdev subdev; + struct media_pad pad; struct mt9t112_camera_info *info; struct i2c_client *client; struct v4l2_rect frame; @@ -739,8 +741,7 @@ static int mt9t112_init_camera(const struct i2c_client *client) static int mt9t112_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *id) { - struct i2c_client *client = v4l2_get_subdevdata(sd); - struct mt9t112_priv *priv = to_mt9t112(client); + struct mt9t112_priv *priv = container_of(sd, struct mt9t112_priv, subdev); id->ident= priv->model; id->revision = 0; @@ -790,7 +791,7 @@ static struct v4l2_subdev_core_ops mt9t112_subdev_core_ops = { static int mt9t112_s_stream(struct v4l2_subdev *sd, int enable) { struct i2c_client *client = v4l2_get_subdevdata(sd); - struct mt9t112_priv *priv = to_mt9t112(client); + struct mt9t112_priv *priv = container_of(sd, struct mt9t112_priv, subdev); int ret = 0; if (!enable) { @@ -888,8 +889,7 @@ static int mt9t112_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) static int mt9t112_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) { - struct i2c_client *client = v4l2_get_subdevdata(sd); - struct mt9t112_priv *priv = to_mt9t112(client); + struct mt9t112_priv *priv = container_of(sd, struct mt9t112_priv, subdev); a->c= priv->frame; a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; @@ -899,8 +899,7 @@ static int mt9t112_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) static int mt9t112_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) { - struct i2c_client *client = v4l2_get_subdevdata(sd); - struct mt9t112_priv *priv = to_mt9t112(client); + struct mt9t112_priv *priv = container_of(sd, struct mt9t112_priv, subdev); struct v4l2_rect *rect = &a->c; return mt9t112_set_params(priv, rect, priv->format->code); @@ -909,8 +908,7 @@ static int mt9t112_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) static int mt9t112_g_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) { - struct i2c_client *client = v4l2_get_subdevdata(sd); - struct mt9t112_priv *priv = to_mt9t112(client); + struct mt9t112_priv *priv = container_of(sd, struct mt9t112_priv, subdev); mf->width = priv->frame.width; mf->height = priv->frame.height; @@ -924,8 +922,7 @@ static int mt9t112_g_fmt(struct v4l2_subdev *sd, static int mt9t112_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) { - struct i2c_client *client = v4l2_get_subdevdata(sd); - struct mt9t112_priv *priv = to_mt9t112(client); + struct mt9t112_priv *priv = container_of(sd, struct mt9t112_priv, subdev); struct v4l2_rect rect = { .width = mf->width, .height = mf->height, @@ -996,8 +993,8 @@ static int mt9t112_s_mbus_config(struct v4l2_subdev *sd, const struct v4l2_mbus_config *cfg) { struct i2c_client *client = v4l2_get_subdevdata(sd); + struct mt9t112_priv *priv = container_of(sd, struct mt9t112_priv, subdev); struct soc_camera_link *icl = soc_camera_i2c_to_link(client); - struct mt9t112_priv *priv = to_mt9t112(client); if (soc_camera_apply_board_flags(icl, cfg) & V4L2_MBUS_PCLK_SAMPLE_RISING) priv->flags |= PCLK_RISING; @@ -1018,14 +1015,67 @@ static struct v4l2_subdev_video_ops mt9t112_subdev_video_ops = { .s_mbus_config = mt9t112_s_mbus_config, }; -/ - i2c driver -/ +static int mt9t112_enum_mbus_code(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, + struct v4l2_subdev_mbus_code_enum *ce) +{ + if (ce->index >= ARRAY_SIZE(mt9t112_cfmts)) + return -EINVAL; + + ce->code = mt9t112_cfmts[ce->index].code; + return 0; +} + +static int mt9t112_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, +
[PATCH 9/9] V4L: imx074: add pad level operations
On Media Controller enabled systems this patch allows the user to communicate with the driver directly over /dev/v4l-subdev* device nodes using VIDIOC_SUBDEV_* ioctl()s. Signed-off-by: Guennadi Liakhovetski --- drivers/media/video/imx074.c | 85 +- 1 files changed, 75 insertions(+), 10 deletions(-) diff --git a/drivers/media/video/imx074.c b/drivers/media/video/imx074.c index 8775e26..9745887 100644 --- a/drivers/media/video/imx074.c +++ b/drivers/media/video/imx074.c @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -75,6 +76,7 @@ struct imx074_datafmt { struct imx074 { struct v4l2_subdev subdev; + struct media_padpad; const struct imx074_datafmt *fmt; }; @@ -172,8 +174,7 @@ static int imx074_try_fmt(struct v4l2_subdev *sd, static int imx074_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) { - struct i2c_client *client = v4l2_get_subdevdata(sd); - struct imx074 *priv = to_imx074(client); + struct imx074 *priv = container_of(sd, struct imx074, subdev); dev_dbg(sd->v4l2_dev->dev, "%s(%u)\n", __func__, mf->code); @@ -191,9 +192,7 @@ static int imx074_s_fmt(struct v4l2_subdev *sd, static int imx074_g_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) { - struct i2c_client *client = v4l2_get_subdevdata(sd); - struct imx074 *priv = to_imx074(client); - + struct imx074 *priv = container_of(sd, struct imx074, subdev); const struct imx074_datafmt *fmt = priv->fmt; mf->code= fmt->code; @@ -293,9 +292,62 @@ static struct v4l2_subdev_core_ops imx074_subdev_core_ops = { .g_chip_ident = imx074_g_chip_ident, }; +static int imx074_enum_mbus_code(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, +struct v4l2_subdev_mbus_code_enum *ce) +{ + if (ce->index >= ARRAY_SIZE(imx074_colour_fmts)) + return -EINVAL; + + ce->code = imx074_colour_fmts[ce->index].code; + return 0; +} + +static int imx074_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, + struct v4l2_subdev_format *sd_fmt) +{ + struct v4l2_mbus_framefmt *mf; + + if (sd_fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) + return imx074_g_fmt(sd, &sd_fmt->format); + + mf = v4l2_subdev_get_try_format(fh, sd_fmt->pad); + sd_fmt->format = *mf; + return 0; +} + +static int imx074_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, + struct v4l2_subdev_format *sd_fmt) +{ + struct v4l2_mbus_framefmt *mf; + + if (sd_fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) + return imx074_s_fmt(sd, &sd_fmt->format); + + mf = v4l2_subdev_get_try_format(fh, sd_fmt->pad); + *mf = sd_fmt->format; + return imx074_try_fmt(sd, mf); +} + +struct v4l2_subdev_pad_ops imx074_subdev_pad_ops = { + .enum_mbus_code = imx074_enum_mbus_code, + .get_fmt= imx074_get_fmt, + .set_fmt= imx074_set_fmt, +}; + static struct v4l2_subdev_ops imx074_subdev_ops = { .core = &imx074_subdev_core_ops, .video = &imx074_subdev_video_ops, + .pad= &imx074_subdev_pad_ops, +}; + +static int imx074_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) +{ + struct v4l2_mbus_framefmt *mf = v4l2_subdev_get_try_format(fh, 0); + return mf ? imx074_try_fmt(sd, mf) : 0; +} + +static const struct v4l2_subdev_internal_ops imx074_subdev_internal_ops = { + .open = imx074_open, }; static int imx074_video_probe(struct i2c_client *client) @@ -427,16 +479,27 @@ static int imx074_probe(struct i2c_client *client, if (!priv) return -ENOMEM; + priv->fmt = &imx074_colour_fmts[0]; + v4l2_i2c_subdev_init(&priv->subdev, client, &imx074_subdev_ops); + priv->subdev.internal_ops = &imx074_subdev_internal_ops; + priv->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; - priv->fmt = &imx074_colour_fmts[0]; + priv->pad.flags = MEDIA_PAD_FL_SOURCE; + ret = subdev_media_entity_init(&priv->subdev, 1, &priv->pad, 0); + if (ret < 0) + goto emeinit; ret = imx074_video_probe(client); - if (ret < 0) { - kfree(priv); - return ret; - } + if (ret < 0) + goto evprobe; + + return ret; +evprobe: + subdev_media_entity_cleanup(&priv->subdev); +emeinit: + kfree(priv); return ret; } @@ -447,6 +510,8 @@ static int imx074_remove(struct i2c_client *client) if (icl->free_bus) icl->free_bus(icl); + v4l2_device_unregister_subdev(&priv->subdev); + subdev_media_entity_cleanup(&priv->subdev); kfree(priv); return 0; -- 1.7.2.5 -- To unsubscribe from this
[PATCH 6/9] V4L: soc-camera: prepare hooks for Media Controller wrapper
Extend soc-camera host operations with a target parameter to specify, whether the operation should be propagated to subdevices or only applied to the host itself. Signed-off-by: Guennadi Liakhovetski --- drivers/media/video/atmel-isi.c| 10 +++- drivers/media/video/mx1_camera.c | 10 +++- drivers/media/video/mx2_camera.c | 10 +++- drivers/media/video/mx3_camera.c | 10 +++- drivers/media/video/omap1_camera.c | 12 +++- drivers/media/video/pxa_camera.c | 10 +++- drivers/media/video/sh_mobile_ceu_camera.c | 12 +++- drivers/media/video/soc_camera.c | 82 +--- include/media/soc_camera.h | 25 - include/media/soc_entity.h | 19 +++ 10 files changed, 163 insertions(+), 37 deletions(-) create mode 100644 include/media/soc_entity.h diff --git a/drivers/media/video/atmel-isi.c b/drivers/media/video/atmel-isi.c index 84d7a85..6db8d43 100644 --- a/drivers/media/video/atmel-isi.c +++ b/drivers/media/video/atmel-isi.c @@ -527,7 +527,7 @@ static int isi_camera_init_videobuf(struct vb2_queue *q, } static int isi_camera_set_fmt(struct soc_camera_device *icd, - struct v4l2_format *f) + struct v4l2_format *f, enum soc_camera_target tgt) { struct soc_camera_host *ici = to_soc_camera_host(icd->parent); struct atmel_isi *isi = ici->priv; @@ -537,6 +537,9 @@ static int isi_camera_set_fmt(struct soc_camera_device *icd, struct v4l2_mbus_framefmt mf; int ret; + if (tgt != SOCAM_TARGET_PIPELINE) + return -EINVAL; + xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); if (!xlate) { dev_warn(icd->parent, "Format %x not found\n", @@ -577,7 +580,7 @@ static int isi_camera_set_fmt(struct soc_camera_device *icd, } static int isi_camera_try_fmt(struct soc_camera_device *icd, - struct v4l2_format *f) + struct v4l2_format *f, enum soc_camera_target tgt) { struct v4l2_subdev *sd = soc_camera_to_subdev(icd); const struct soc_camera_format_xlate *xlate; @@ -586,6 +589,9 @@ static int isi_camera_try_fmt(struct soc_camera_device *icd, u32 pixfmt = pix->pixelformat; int ret; + if (tgt != SOCAM_TARGET_PIPELINE) + return -EINVAL; + xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); if (pixfmt && !xlate) { dev_warn(icd->parent, "Format %x not found\n", pixfmt); diff --git a/drivers/media/video/mx1_camera.c b/drivers/media/video/mx1_camera.c index 055d11d..b63a163 100644 --- a/drivers/media/video/mx1_camera.c +++ b/drivers/media/video/mx1_camera.c @@ -564,7 +564,7 @@ static int mx1_camera_set_bus_param(struct soc_camera_device *icd) } static int mx1_camera_set_fmt(struct soc_camera_device *icd, - struct v4l2_format *f) + struct v4l2_format *f, enum soc_camera_target tgt) { struct v4l2_subdev *sd = soc_camera_to_subdev(icd); const struct soc_camera_format_xlate *xlate; @@ -572,6 +572,9 @@ static int mx1_camera_set_fmt(struct soc_camera_device *icd, struct v4l2_mbus_framefmt mf; int ret, buswidth; + if (tgt != SOCAM_TARGET_PIPELINE) + return -EINVAL; + xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); if (!xlate) { dev_warn(icd->parent, "Format %x not found\n", @@ -610,7 +613,7 @@ static int mx1_camera_set_fmt(struct soc_camera_device *icd, } static int mx1_camera_try_fmt(struct soc_camera_device *icd, - struct v4l2_format *f) + struct v4l2_format *f, enum soc_camera_target tgt) { struct v4l2_subdev *sd = soc_camera_to_subdev(icd); const struct soc_camera_format_xlate *xlate; @@ -619,6 +622,9 @@ static int mx1_camera_try_fmt(struct soc_camera_device *icd, int ret; /* TODO: limit to mx1 hardware capabilities */ + if (tgt != SOCAM_TARGET_PIPELINE) + return -EINVAL; + xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); if (!xlate) { dev_warn(icd->parent, "Format %x not found\n", diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c index ffbfbfe..614dd0a 100644 --- a/drivers/media/video/mx2_camera.c +++ b/drivers/media/video/mx2_camera.c @@ -911,7 +911,7 @@ static int mx2_camera_set_crop(struct soc_camera_device *icd, } static int mx2_camera_set_fmt(struct soc_camera_device *icd, - struct v4l2_format *f) + struct v4l2_format *f, enum soc_camera_target tgt) { struct v4l2_subdev *sd = soc_camera_to_subdev(icd); const struct soc_camera_format_xlate *xlate; @@ -919,6 +919,9 @@ static int mx2_cam
[PATCH 3/9] V4L: soc-camera: remove redundant parameter from the .set_bus_param() method
The "pixfmt" parameter of the struct soc_camera_host_ops::set_bus_param() method is redundant, because at the time, when this method is called, pixfmt is guaranteed to be equal to icd->current_fmt->host_fmt->fourcc. Remove this parameter and update all drivers accordingly. Signed-off-by: Guennadi Liakhovetski --- drivers/media/video/atmel-isi.c|2 +- drivers/media/video/mx1_camera.c |2 +- drivers/media/video/mx2_camera.c |3 +-- drivers/media/video/mx3_camera.c |3 ++- drivers/media/video/omap1_camera.c |4 ++-- drivers/media/video/pxa_camera.c |3 ++- drivers/media/video/sh_mobile_ceu_camera.c | 11 ++- drivers/media/video/soc_camera.c |2 +- include/media/soc_camera.h |2 +- 9 files changed, 13 insertions(+), 19 deletions(-) diff --git a/drivers/media/video/atmel-isi.c b/drivers/media/video/atmel-isi.c index 8c775c5..84d7a85 100644 --- a/drivers/media/video/atmel-isi.c +++ b/drivers/media/video/atmel-isi.c @@ -803,7 +803,7 @@ static int isi_camera_querycap(struct soc_camera_host *ici, return 0; } -static int isi_camera_set_bus_param(struct soc_camera_device *icd, u32 pixfmt) +static int isi_camera_set_bus_param(struct soc_camera_device *icd) { struct v4l2_subdev *sd = soc_camera_to_subdev(icd); struct soc_camera_host *ici = to_soc_camera_host(icd->parent); diff --git a/drivers/media/video/mx1_camera.c b/drivers/media/video/mx1_camera.c index 18e94c7..055d11d 100644 --- a/drivers/media/video/mx1_camera.c +++ b/drivers/media/video/mx1_camera.c @@ -487,7 +487,7 @@ static int mx1_camera_set_crop(struct soc_camera_device *icd, return v4l2_subdev_call(sd, video, s_crop, a); } -static int mx1_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt) +static int mx1_camera_set_bus_param(struct soc_camera_device *icd) { struct v4l2_subdev *sd = soc_camera_to_subdev(icd); struct soc_camera_host *ici = to_soc_camera_host(icd->parent); diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c index a803d9e..ffbfbfe 100644 --- a/drivers/media/video/mx2_camera.c +++ b/drivers/media/video/mx2_camera.c @@ -766,8 +766,7 @@ static void mx27_camera_emma_buf_init(struct soc_camera_device *icd, pcdev->base_emma + PRP_INTR_CNTL); } -static int mx2_camera_set_bus_param(struct soc_camera_device *icd, - __u32 pixfmt) +static int mx2_camera_set_bus_param(struct soc_camera_device *icd) { struct v4l2_subdev *sd = soc_camera_to_subdev(icd); struct soc_camera_host *ici = to_soc_camera_host(icd->parent); diff --git a/drivers/media/video/mx3_camera.c b/drivers/media/video/mx3_camera.c index fb38e22..6020061 100644 --- a/drivers/media/video/mx3_camera.c +++ b/drivers/media/video/mx3_camera.c @@ -980,12 +980,13 @@ static int mx3_camera_querycap(struct soc_camera_host *ici, return 0; } -static int mx3_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt) +static int mx3_camera_set_bus_param(struct soc_camera_device *icd) { struct v4l2_subdev *sd = soc_camera_to_subdev(icd); struct soc_camera_host *ici = to_soc_camera_host(icd->parent); struct mx3_camera_dev *mx3_cam = ici->priv; struct v4l2_mbus_config cfg = {.type = V4L2_MBUS_PARALLEL,}; + u32 pixfmt = icd->current_fmt->host_fmt->fourcc; unsigned long bus_flags, common_flags; u32 dw, sens_conf; const struct soc_mbus_pixelfmt *fmt; diff --git a/drivers/media/video/omap1_camera.c b/drivers/media/video/omap1_camera.c index e87ae2f..e73a23e 100644 --- a/drivers/media/video/omap1_camera.c +++ b/drivers/media/video/omap1_camera.c @@ -1435,13 +1435,13 @@ static int omap1_cam_querycap(struct soc_camera_host *ici, return 0; } -static int omap1_cam_set_bus_param(struct soc_camera_device *icd, - __u32 pixfmt) +static int omap1_cam_set_bus_param(struct soc_camera_device *icd) { struct v4l2_subdev *sd = soc_camera_to_subdev(icd); struct device *dev = icd->parent; struct soc_camera_host *ici = to_soc_camera_host(dev); struct omap1_cam_dev *pcdev = ici->priv; + u32 pixfmt = icd->current_fmt->host_fmt->fourcc; const struct soc_camera_format_xlate *xlate; const struct soc_mbus_pixelfmt *fmt; struct v4l2_mbus_config cfg = {.type = V4L2_MBUS_PARALLEL,}; diff --git a/drivers/media/video/pxa_camera.c b/drivers/media/video/pxa_camera.c index 79fb22c..2f9ae63 100644 --- a/drivers/media/video/pxa_camera.c +++ b/drivers/media/video/pxa_camera.c @@ -1133,12 +1133,13 @@ static void pxa_camera_setup_cicr(struct soc_camera_device *icd, __raw_writel(cicr0, pcdev->base + CICR0); } -static int pxa_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt) +static int pxa_camera_set_bus_param(struct soc_camera_device *icd) { struct v4l2_subd
[PATCH 1/9] V4L: soc-camera: add a function to lookup xlate by mediabus code
In addition to a helper function, performing a format translation table lookup by a fourcc value, a similar function is now needed to lookup translation table entries by mediabus codes. Signed-off-by: Guennadi Liakhovetski --- drivers/media/video/soc_camera.c | 25 - include/media/soc_camera.h |6 +- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c index b72580c..ba409ac 100644 --- a/drivers/media/video/soc_camera.c +++ b/drivers/media/video/soc_camera.c @@ -112,7 +112,7 @@ static int soc_camera_power_off(struct soc_camera_device *icd, } const struct soc_camera_format_xlate *soc_camera_xlate_by_fourcc( - struct soc_camera_device *icd, unsigned int fourcc) + const struct soc_camera_device *icd, u32 fourcc) { unsigned int i; @@ -123,6 +123,29 @@ const struct soc_camera_format_xlate *soc_camera_xlate_by_fourcc( } EXPORT_SYMBOL(soc_camera_xlate_by_fourcc); +/* + * Warning: the mediabus code -> fourcc mapping is not unique, this is why we + * need a hint of a preferred fourcc value. Use 0 if unknown. + */ +const struct soc_camera_format_xlate *soc_camera_xlate_by_mcode( + const struct soc_camera_device *icd, enum v4l2_mbus_pixelcode code, + u32 fourcc) +{ + unsigned int i; + struct soc_camera_format_xlate *xlate = NULL; + + for (i = 0; i < icd->num_user_formats; i++) + if (icd->user_formats[i].code == code) { + if (icd->user_formats[i].host_fmt->fourcc == fourcc) + return icd->user_formats + i; + /* Prefer the first one */ + if (!xlate) + xlate = icd->user_formats + i; + } + return xlate; +} +EXPORT_SYMBOL(soc_camera_xlate_by_mcode); + /** * soc_camera_apply_board_flags() - apply platform SOCAM_SENSOR_INVERT_* flags * @icl: camera platform parameters diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h index b1377b9..22e4bee 100644 --- a/include/media/soc_camera.h +++ b/include/media/soc_camera.h @@ -174,7 +174,11 @@ int soc_camera_host_register(struct soc_camera_host *ici); void soc_camera_host_unregister(struct soc_camera_host *ici); const struct soc_camera_format_xlate *soc_camera_xlate_by_fourcc( - struct soc_camera_device *icd, unsigned int fourcc); + const struct soc_camera_device *icd, u32 fourcc); + +const struct soc_camera_format_xlate *soc_camera_xlate_by_mcode( + const struct soc_camera_device *icd, enum v4l2_mbus_pixelcode code, + u32 fourcc); /** * struct soc_camera_format_xlate - match between host and sensor formats -- 1.7.2.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 5/9] V4L: soc-camera: move bus parameter configuration to .vidioc_streamon()
With the Media Controller API various pipeline entities can be configured independently and in unpredictable order. The only location, where we know for sure, that the pipeline should be ready, is .vidioc_streamon(). This makes it the only suitable location for the bus parameter configuration. Signed-off-by: Guennadi Liakhovetski --- drivers/media/video/soc_camera.c |8 ++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c index 5596688..2905a88 100644 --- a/drivers/media/video/soc_camera.c +++ b/drivers/media/video/soc_camera.c @@ -509,8 +509,7 @@ static int soc_camera_set_fmt(struct soc_camera_device *icd, dev_dbg(icd->pdev, "set width: %d height: %d\n", icd->user_width, icd->user_height); - /* set physical bus parameters */ - return ici->ops->set_bus_param(icd); + return 0; } static int soc_camera_open(struct file *file) @@ -814,6 +813,11 @@ static int soc_camera_streamon(struct file *file, void *priv, if (icd->streamer != file) return -EBUSY; + /* set physical bus parameters */ + ret = ici->ops->set_bus_param(icd); + if (ret < 0) + return ret; + /* This calls buf_queue from host driver's videobuf_queue_ops */ if (ici->ops->init_videobuf) ret = videobuf_streamon(&icd->vb_vidq); -- 1.7.2.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 4/9] V4L: add convenience macros to the subdevice / Media Controller API
Drivers, that can be built and work with and without CONFIG_VIDEO_V4L2_SUBDEV_API, need the v4l2_subdev_get_try_format() and v4l2_subdev_get_try_crop() functions, even though their return value should never be dereferenced. Also add convenience macros to init and clean up subdevice internal media entities. Signed-off-by: Guennadi Liakhovetski --- include/media/v4l2-subdev.h | 11 +++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index f0f3358..4670506 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -569,6 +569,9 @@ v4l2_subdev_get_try_crop(struct v4l2_subdev_fh *fh, unsigned int pad) { return &fh->try_crop[pad]; } +#else +#define v4l2_subdev_get_try_format(arg...) NULL +#define v4l2_subdev_get_try_crop(arg...) NULL #endif extern const struct v4l2_file_operations v4l2_subdev_fops; @@ -610,4 +613,12 @@ void v4l2_subdev_init(struct v4l2_subdev *sd, ((!(sd) || !(sd)->v4l2_dev || !(sd)->v4l2_dev->notify) ? -ENODEV : \ (sd)->v4l2_dev->notify((sd), (notification), (arg))) +#if defined(CONFIG_MEDIA_CONTROLLER) +#define subdev_media_entity_init(sd, n, p, e) media_entity_init(&(sd)->entity, n, p, e) +#define subdev_media_entity_cleanup(sd) media_entity_cleanup(&(sd)->entity) +#else +#define subdev_media_entity_init(sd, n, p, e) 0 +#define subdev_media_entity_cleanup(sd)do {} while (0) +#endif + #endif -- 1.7.2.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 0/9] Media Controller for soc-camera
This is the first attempt at extending soc-camera with Media Controller / pad-level APIs. Yes, I know, that Laurent wasn't quite happy with "V4L: add convenience macros to the subdevice / Media Controller API," maybe we'll remove it eventually, but so far my patches use it, so, I kept it for now. The general idea has been described in http://article.gmane.org/gmane.linux.drivers.video-input-infrastructure/38083 In short: soc-camera implements a media controller device and two entities per camera host (bridge) instance, linked statically to each other and to the client. The host driver gets a chance to implement "local" only configuration, as opposed to the standard soc-camera way of propagating the configuration up the pipeline to the client (sensor / decoder) driver. An example implementation is provided for sh_mobile_ceu_camera and two sensor drivers. The whole machinery gets activated if the soc-camera core finds a client driver, that implements pad operations. In that case both the "standard" (V4L2) and the "new" (MC) ways of addressing the driver become available. I.e., it is possible to run both standard V4L2 applications and MC-aware ones. Of course, applies on top of git://linuxtv.org/gliakhovetski/v4l-dvb.git for-3.2 Deepthy: this is what I told you about in http://article.gmane.org/gmane.linux.ports.arm.omap/64847 it just took me a bit longer, than I thought. Guennadi Liakhovetski (9): V4L: soc-camera: add a function to lookup xlate by mediabus code sh_mobile_ceu_camera: simplify scaling and cropping algorithms V4L: soc-camera: remove redundant parameter from the .set_bus_param() method V4L: add convenience macros to the subdevice / Media Controller API V4L: soc-camera: move bus parameter configuration to .vidioc_streamon() V4L: soc-camera: prepare hooks for Media Controller wrapper V4L: soc-camera: add a Media Controller wrapper V4L: mt9t112: add pad level operations V4L: imx074: add pad level operations drivers/media/video/Makefile |6 +- drivers/media/video/atmel-isi.c| 12 +- drivers/media/video/imx074.c | 85 +++- drivers/media/video/mt9t112.c | 97 +++- drivers/media/video/mx1_camera.c | 12 +- drivers/media/video/mx2_camera.c | 13 +- drivers/media/video/mx3_camera.c | 13 +- drivers/media/video/omap1_camera.c | 16 +- drivers/media/video/pxa_camera.c | 13 +- drivers/media/video/sh_mobile_ceu_camera.c | 904 +++- drivers/media/video/soc_camera.c | 157 - drivers/media/video/soc_entity.c | 284 + drivers/media/video/soc_mediabus.c | 16 - include/media/soc_camera.h | 34 +- include/media/soc_entity.h | 31 + include/media/v4l2-subdev.h| 11 + 16 files changed, 1064 insertions(+), 640 deletions(-) create mode 100644 drivers/media/video/soc_entity.c create mode 100644 include/media/soc_entity.h -- 1.7.2.5 Thanks Guennadi --- 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
[PATCH 2/9] sh_mobile_ceu_camera: simplify scaling and cropping algorithms
With the pad-level API scaling and cropping will be configured on each entity separately. To prepare for the conversion remove all attempts to optimise scaling and cropping on the host and clients, as has previously been done by the sh_mobile_ceu_camera driver. Signed-off-by: Guennadi Liakhovetski --- drivers/media/video/sh_mobile_ceu_camera.c | 881 +++- 1 files changed, 355 insertions(+), 526 deletions(-) diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c index 955947a..33ffc35 100644 --- a/drivers/media/video/sh_mobile_ceu_camera.c +++ b/drivers/media/video/sh_mobile_ceu_camera.c @@ -112,7 +112,6 @@ struct sh_mobile_ceu_dev { u32 cflcr; - enum v4l2_field field; int sequence; unsigned int image_mode:1; @@ -121,20 +120,16 @@ struct sh_mobile_ceu_dev { }; struct sh_mobile_ceu_cam { - /* CEU offsets within the camera output, before the CEU scaler */ - unsigned int ceu_left; - unsigned int ceu_top; + /* Client cropping rectangle */ + struct v4l2_rect rect; /* Client output, as seen by the CEU */ unsigned int width; unsigned int height; /* -* User window from S_CROP / G_CROP, produced by client cropping and -* scaling, CEU scaling and CEU cropping, mapped back onto the client -* input window +* CEU offsets and sizes within the camera output, before the CEU +* scaling filter */ - struct v4l2_rect subrect; - /* Camera cropping rectangle */ - struct v4l2_rect rect; + struct v4l2_rect ceu_rect; const struct soc_mbus_pixelfmt *extra_fmt; enum v4l2_mbus_pixelcode code; }; @@ -303,7 +298,7 @@ static int sh_mobile_ceu_capture(struct sh_mobile_ceu_dev *pcdev) if (!pcdev->active) return ret; - if (V4L2_FIELD_INTERLACED_BT == pcdev->field) { + if (V4L2_FIELD_INTERLACED_BT == icd->field) { top1= CDBYR; top2= CDBCR; bottom1 = CDAYR; @@ -329,7 +324,7 @@ static int sh_mobile_ceu_capture(struct sh_mobile_ceu_dev *pcdev) } ceu_write(pcdev, top1, phys_addr_top); - if (V4L2_FIELD_NONE != pcdev->field) { + if (V4L2_FIELD_NONE != icd->field) { if (planar) phys_addr_bottom = phys_addr_top + icd->user_width; else @@ -343,7 +338,7 @@ static int sh_mobile_ceu_capture(struct sh_mobile_ceu_dev *pcdev) phys_addr_top += icd->user_width * icd->user_height; ceu_write(pcdev, top2, phys_addr_top); - if (V4L2_FIELD_NONE != pcdev->field) { + if (V4L2_FIELD_NONE != icd->field) { phys_addr_bottom = phys_addr_top + icd->user_width; ceu_write(pcdev, bottom2, phys_addr_bottom); } @@ -517,7 +512,7 @@ static irqreturn_t sh_mobile_ceu_irq(int irq, void *data) ret = sh_mobile_ceu_capture(pcdev); do_gettimeofday(&vb->v4l2_buf.timestamp); if (!ret) { - vb->v4l2_buf.field = pcdev->field; + vb->v4l2_buf.field = pcdev->icd->field; vb->v4l2_buf.sequence = pcdev->sequence++; } vb2_buffer_done(vb, ret < 0 ? VB2_BUF_STATE_ERROR : VB2_BUF_STATE_DONE); @@ -659,17 +654,18 @@ static void sh_mobile_ceu_set_rect(struct soc_camera_device *icd) u32 camor; dev_geo(icd->parent, "Crop %ux%u@%u:%u\n", - icd->user_width, icd->user_height, cam->ceu_left, cam->ceu_top); + icd->user_width, icd->user_height, cam->ceu_rect.left, cam->ceu_rect.top); - left_offset = cam->ceu_left; - top_offset = cam->ceu_top; + left_offset = cam->ceu_rect.left; + top_offset = cam->ceu_rect.top; WARN_ON(icd->user_width & 3 || icd->user_height & 3); width = icd->user_width; + in_width = min(2560U, cam->width); + if (pcdev->image_mode) { - in_width = cam->width; if (!pcdev->is_16bit) { in_width *= 2; left_offset *= 2; @@ -688,7 +684,7 @@ static void sh_mobile_ceu_set_rect(struct soc_camera_device *icd) w_factor = 1; } - in_width = cam->width * w_factor; + in_width *= w_factor; left_offset *= w_factor; if (bytes_per_line < 0) @@ -698,8 +694,8 @@ static void sh_mobile_ceu_set_rect(struct soc_camera_device *icd) } height = icd->user_height; - in_height = cam->height; - if (V4L2_FIELD_NONE != pcdev->field) { + in_height = min(1920U, cam->height); + if (V4L2_FIELD_NONE != icd->field) { height = (height / 2) & ~3; in_height /= 2; top_offs
[PULL] soc-camera, v4l for 3.2
Hi Mauro I'm finally ready to push my soc-camera and generic v4l collection for 3.2. The absolute highlight is, of course, the addition of the two new IOCTLs, which, I think, are now in a good shape to go. A huge pile of soc-camera patches, largely releasing subdevice drivers into the wild for all subdevice API compatible bridge drivers, the addition of the control framework to soc-camera - thanks to Hans Verkuil. A few patches outside of the V4L / media area are supplied with respective acks. I think, this is going to be my largest push so far. The following changes since commit 446b792c6bd87de4565ba200b75a708b4c575a06: [media] media: DocBook: Fix trivial typo in Sub-device Interface (2011-09-27 09:14:58 -0300) are available in the git repository at: git://linuxtv.org/gliakhovetski/v4l-dvb.git for-3.2 Bastian Hecht (1): media: ov5642: Add support for arbitrary resolution Guennadi Liakhovetski (86): V4L: mt9p031 and mt9t001 drivers depend on VIDEO_V4L2_SUBDEV_API V4L: sh_mobile_ceu_camera: output image sizes must be a multiple of 4 V4L: sh_mobile_ceu_camera: don't try to improve client scaling, if perfect V4L: sh_mobile_ceu_camera: fix field addresses in interleaved mode V4L: sh_mobile_ceu_camera: remove duplicated code V4L: imx074: support the new mbus-config subdev ops V4L: soc-camera: add helper functions for new bus configuration type V4L: mt9m001: support the new mbus-config subdev ops V4L: mt9m111: support the new mbus-config subdev ops V4L: mt9t031: support the new mbus-config subdev ops V4L: mt9t112: support the new mbus-config subdev ops V4L: mt9v022: support the new mbus-config subdev ops V4L: ov2640: support the new mbus-config subdev ops V4L: ov5642: support the new mbus-config subdev ops V4L: ov6650: support the new mbus-config subdev ops V4L: ov772x: rename macros to not pollute the global namespace V4L: ov772x: support the new mbus-config subdev ops V4L: ov9640: support the new mbus-config subdev ops V4L: ov9740: support the new mbus-config subdev ops V4L: rj54n1cb0c: support the new mbus-config subdev ops ARM: ap4evb: switch imx074 configuration to default number of lanes V4L: sh_mobile_csi2: verify client compatibility V4L: sh_mobile_csi2: support the new mbus-config subdev ops V4L: tw9910: remove a not really implemented cropping support V4L: tw9910: support the new mbus-config subdev ops V4L: soc_camera_platform: support the new mbus-config subdev ops V4L: soc-camera: compatible bus-width flags ARM: mach-shmobile: convert mackerel to mediabus flags sh: convert ap325rxa to mediabus flags ARM: PXA: use gpio_set_value_cansleep() on pcm990 V4L: atmel-isi: convert to the new mbus-config subdev operations V4L: mx1_camera: convert to the new mbus-config subdev operations V4L: mx2_camera: convert to the new mbus-config subdev operations V4L: ov2640: remove undefined struct V4L: mx3_camera: convert to the new mbus-config subdev operations V4L: mt9m001, mt9v022: add a clarifying comment V4L: omap1_camera: convert to the new mbus-config subdev operations V4L: pxa_camera: convert to the new mbus-config subdev operations V4L: sh_mobile_ceu_camera: convert to the new mbus-config subdev operations V4L: soc-camera: camera client operations no longer compulsory V4L: mt9m001: remove superfluous soc-camera client operations V4L: mt9m111: remove superfluous soc-camera client operations V4L: imx074: remove superfluous soc-camera client operations V4L: mt9t031: remove superfluous soc-camera client operations V4L: mt9t112: remove superfluous soc-camera client operations V4L: mt9v022: remove superfluous soc-camera client operations V4L: ov2640: remove superfluous soc-camera client operations V4L: ov5642: remove superfluous soc-camera client operations V4L: ov6650: remove superfluous soc-camera client operations sh: ap3rxa: remove redundant soc-camera platform data fields sh: migor: remove unused ov772x buswidth flag V4L: ov772x: remove superfluous soc-camera client operations V4L: ov9640: remove superfluous soc-camera client operations V4L: ov9740: remove superfluous soc-camera client operations V4L: rj54n1cb0c: remove superfluous soc-camera client operations V4L: sh_mobile_csi2: remove superfluous soc-camera client operations ARM: mach-shmobile: mackerel doesn't need legacy SOCAM_* flags anymore V4L: soc_camera_platform: remove superfluous soc-camera client operations V4L: tw9910: remove superfluous soc-camera client operations V4L: soc-camera: remove soc-camera client bus-param operations and supporting code V4L: mt9t112: fix broken cropping and scaling V4L: sh-mobile-ceu-camera: fix mixed CSI2 & parallel camera case
[PATCH 3/5] doc: v4l: add documentation for selection API
This patch adds a documentation for VIDIOC_{G/S}_SELECTION ioctl. Moreover, the patch adds the description of modeling of composing, cropping and scaling features in V4L2. Finally, some examples are presented. Signed-off-by: Tomasz Stanislawski Signed-off-by: Kyungmin Park --- Documentation/DocBook/media/v4l/common.xml |2 + Documentation/DocBook/media/v4l/compat.xml |9 + Documentation/DocBook/media/v4l/selection-api.xml | 327 Documentation/DocBook/media/v4l/v4l2.xml |1 + .../DocBook/media/v4l/vidioc-g-selection.xml | 303 ++ 5 files changed, 642 insertions(+), 0 deletions(-) create mode 100644 Documentation/DocBook/media/v4l/selection-api.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-g-selection.xml diff --git a/Documentation/DocBook/media/v4l/common.xml b/Documentation/DocBook/media/v4l/common.xml index a86f7a0..9c8db86 100644 --- a/Documentation/DocBook/media/v4l/common.xml +++ b/Documentation/DocBook/media/v4l/common.xml @@ -1168,6 +1168,8 @@ dheight = format.fmt.pix.height; + &sub-selection-api; + Streaming Parameters diff --git a/Documentation/DocBook/media/v4l/compat.xml b/Documentation/DocBook/media/v4l/compat.xml index 91410b6..7c430ca 100644 --- a/Documentation/DocBook/media/v4l/compat.xml +++ b/Documentation/DocBook/media/v4l/compat.xml @@ -2376,6 +2376,12 @@ that used it. It was originally scheduled for removal in 2.6.35. V4L2_CTRL_FLAG_VOLATILE was added to signal volatile controls to userspace. + + Add selection API for extended control over cropping and +composing. Does not affect the compatibility of current drivers and +applications. See selection API for +details. + @@ -2486,6 +2492,9 @@ ioctls. Flash API. + + Selection API. + diff --git a/Documentation/DocBook/media/v4l/selection-api.xml b/Documentation/DocBook/media/v4l/selection-api.xml new file mode 100644 index 000..3b6dfe0 --- /dev/null +++ b/Documentation/DocBook/media/v4l/selection-api.xml @@ -0,0 +1,327 @@ + + + Experimental API for cropping, composing and scaling + + + Experimental + + This is an experimental +interface and may change in the future. + + + +Introduction + +Some video capture devices can sample a subsection of a picture and +shrink or enlarge it to an image of arbitrary size. Next, the devices can +insert the image into larger one. Some video output devices can crop part of an +input image, scale it up or down and insert it at an arbitrary scan line and +horizontal offset into a video signal. We call these abilities cropping, +scaling and composing. + +On a video capture device the source is a video +signal, and the cropping target determine the area actually sampled. The sink +is an image stored in a memory buffer. The composing area specifies which part +of the buffer is actually written to by the hardware. + +On a video output device the source is an image in a +memory buffer, and the cropping target is a part of an image to be shown on a +display. The sink is the display or the graphics screen. The application may +select the part of display where the image should be displayed. The size and +position of such a window is controlled by the compose target. + +Rectangles for all cropping and composing targets are defined even if the +device does supports neither cropping nor composing. Their size and position +will be fixed in such a case. If the device does not support scaling then the +cropping and composing rectangles have the same size. + + + + + Selection targets + + + Cropping and composing targets + + + + + + Targets used by a cropping, composing and scaling +process + + + + + + + + Configuration + +Applications can use the selection +API to select an area in a video signal or a buffer, and to query for +default settings and hardware limits. + +Video hardware can have various cropping, composing and scaling +limitations. It may only scale up or down, support only discrete scaling +factors, or have different scaling abilities in the horizontal and vertical +directions. Also it may not support scaling at all. At the same time the +cropping/composing rectangles may have to be aligned, and both the source and +the sink may have arbitrary upper and lower size limits. Therefore, as usual, +drivers are expected to adjust the requested parameters and return the actual +values selected. An application can control the rounding behaviour using constraint flags . + + + + Configuration of video capture + +See figure for examples of the +selection targets available for a video capture device. It is recommended to +configure the cropping targets before to the composing targets. + +T
[PATCH 4/5] v4l: emulate old crop API using extended crop/compose API
This patch allows new video drivers to work correctly with applications that use the old-style crop API. The old crop ioctl is emulated by using selection callbacks. Signed-off-by: Tomasz Stanislawski Signed-off-by: Kyungmin Park --- drivers/media/video/v4l2-ioctl.c | 86 - 1 files changed, 74 insertions(+), 12 deletions(-) diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index 4cbb695e..e4831e9 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c @@ -1539,11 +1539,29 @@ static long __video_do_ioctl(struct file *file, { struct v4l2_crop *p = arg; - if (!ops->vidioc_g_crop) - break; - dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names)); - ret = ops->vidioc_g_crop(file, fh, p); + + if (ops->vidioc_g_crop) { + ret = ops->vidioc_g_crop(file, fh, p); + } else if (ops->vidioc_g_selection) { + /* simulate capture crop using selection api */ + struct v4l2_selection s = { + .type = p->type, + }; + + /* crop means compose for output devices */ + if (p->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) + s.target = V4L2_SEL_COMPOSE_ACTIVE; + else + s.target = V4L2_SEL_CROP_ACTIVE; + + ret = ops->vidioc_g_selection(file, fh, &s); + + /* copying results to old structure on success */ + if (!ret) + p->c = s.r; + } + if (!ret) dbgrect(vfd, "", &p->c); break; @@ -1552,15 +1570,30 @@ static long __video_do_ioctl(struct file *file, { struct v4l2_crop *p = arg; - if (!ops->vidioc_s_crop) - break; if (ret_prio) { ret = ret_prio; break; } dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names)); dbgrect(vfd, "", &p->c); - ret = ops->vidioc_s_crop(file, fh, p); + + if (ops->vidioc_s_crop) { + ret = ops->vidioc_s_crop(file, fh, p); + } else if (ops->vidioc_s_selection) { + /* simulate capture crop using selection api */ + struct v4l2_selection s = { + .type = p->type, + .r = p->c, + }; + + /* crop means compose for output devices */ + if (p->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) + s.target = V4L2_SEL_COMPOSE_ACTIVE; + else + s.target = V4L2_SEL_CROP_ACTIVE; + + ret = ops->vidioc_s_selection(file, fh, &s); + } break; } case VIDIOC_G_SELECTION: @@ -1599,12 +1632,41 @@ static long __video_do_ioctl(struct file *file, { struct v4l2_cropcap *p = arg; - /*FIXME: Should also show v4l2_fract pixelaspect */ - if (!ops->vidioc_cropcap) - break; - dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names)); - ret = ops->vidioc_cropcap(file, fh, p); + if (ops->vidioc_cropcap) { + ret = ops->vidioc_cropcap(file, fh, p); + } else + if (ops->vidioc_g_selection) { + struct v4l2_selection s = { .type = p->type }; + + /* obtaining bounds */ + if (p->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) + s.target = V4L2_SEL_COMPOSE_BOUNDS; + else + s.target = V4L2_SEL_CROP_BOUNDS; + + ret = ops->vidioc_g_selection(file, fh, &s); + if (ret) + break; + p->bounds = s.r; + + /* obtaining defrect */ + if (p->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) + s.target = V4L2_SEL_COMPOSE_DEFAULT; + else + s.target = V4L2_SEL_CROP_DEFAULT; + + ret = ops->vidioc_g_selection(file, fh, &s); + if (ret) + break; + p->defrect = s.r; + + /* setting trivial pixelaspect */ + p->pixelaspect.numerator = 1; + p->pixelaspect.denominator
[PATCH 5/5] v4l: s5p-tv: mixer: add support for selection API
This patch add support for V4L2 selection API to s5p-tv driver. Moreover it removes old API for cropping. Old applications would still work because the crop ioctls are emulated using the selection API. Signed-off-by: Tomasz Stanislawski Signed-off-by: Kyungmin Park --- drivers/media/video/s5p-tv/mixer.h | 14 +- drivers/media/video/s5p-tv/mixer_grp_layer.c | 157 +--- drivers/media/video/s5p-tv/mixer_video.c | 339 +- drivers/media/video/s5p-tv/mixer_vp_layer.c | 108 ++--- 4 files changed, 422 insertions(+), 196 deletions(-) diff --git a/drivers/media/video/s5p-tv/mixer.h b/drivers/media/video/s5p-tv/mixer.h index 51ad59b..1597078 100644 --- a/drivers/media/video/s5p-tv/mixer.h +++ b/drivers/media/video/s5p-tv/mixer.h @@ -86,6 +86,17 @@ struct mxr_crop { unsigned int field; }; +/** stages of geometry operations */ +enum mxr_geometry_stage { + MXR_GEOMETRY_SINK, + MXR_GEOMETRY_COMPOSE, + MXR_GEOMETRY_CROP, + MXR_GEOMETRY_SOURCE, +}; + +/* flag indicating that offset should be 0 */ +#define MXR_NO_OFFSET 0x8000 + /** description of transformation from source to destination image */ struct mxr_geometry { /** cropping for source image */ @@ -133,7 +144,8 @@ struct mxr_layer_ops { /** streaming stop/start */ void (*stream_set)(struct mxr_layer *, int); /** adjusting geometry */ - void (*fix_geometry)(struct mxr_layer *); + void (*fix_geometry)(struct mxr_layer *, + enum mxr_geometry_stage, unsigned long); }; /** layer instance, a single window and content displayed on output */ diff --git a/drivers/media/video/s5p-tv/mixer_grp_layer.c b/drivers/media/video/s5p-tv/mixer_grp_layer.c index de8270c..1ed10f8 100644 --- a/drivers/media/video/s5p-tv/mixer_grp_layer.c +++ b/drivers/media/video/s5p-tv/mixer_grp_layer.c @@ -101,47 +101,132 @@ static void mxr_graph_format_set(struct mxr_layer *layer) layer->fmt, &layer->geo); } -static void mxr_graph_fix_geometry(struct mxr_layer *layer) +static inline unsigned int closest(unsigned int x, unsigned int a, + unsigned int b, unsigned long flags) +{ + unsigned int mid = (a + b) / 2; + + /* choosing closest value with constraints according to table: +* -+-+-+-+---+ +* flags| 0 | LE | GE | LE|GE | +* -+-+-+-+---+ +* x <= a | a | a | a | a | +* a < x <= mid | a | a | b | a | +* mid < x < b | b | a | b | b | +* b <= x | b | b | b | b | +* -+-+-+-+---+ +*/ + + /* remove all non-constraint flags */ + flags &= V4L2_SEL_SIZE_LE | V4L2_SEL_SIZE_GE; + + if (x <= a) + return a; + if (x >= b) + return b; + if (flags == V4L2_SEL_SIZE_LE) + return a; + if (flags == V4L2_SEL_SIZE_GE) + return b; + if (x <= mid) + return a; + return b; +} + +static inline unsigned int do_center(unsigned int center, + unsigned int size, unsigned int upper, unsigned int flags) +{ + unsigned int lower; + + if (flags & MXR_NO_OFFSET) + return 0; + + lower = center - min(center, size / 2); + return min(lower, upper - size); +} + +static void mxr_graph_fix_geometry(struct mxr_layer *layer, + enum mxr_geometry_stage stage, unsigned long flags) { struct mxr_geometry *geo = &layer->geo; + struct mxr_crop *src = &geo->src; + struct mxr_crop *dst = &geo->dst; + unsigned int x_center, y_center; - /* limit to boundary size */ - geo->src.full_width = clamp_val(geo->src.full_width, 1, 32767); - geo->src.full_height = clamp_val(geo->src.full_height, 1, 2047); - geo->src.width = clamp_val(geo->src.width, 1, geo->src.full_width); - geo->src.width = min(geo->src.width, 2047U); - /* not possible to crop of Y axis */ - geo->src.y_offset = min(geo->src.y_offset, geo->src.full_height - 1); - geo->src.height = geo->src.full_height - geo->src.y_offset; - /* limitting offset */ - geo->src.x_offset = min(geo->src.x_offset, - geo->src.full_width - geo->src.width); - - /* setting position in output */ - geo->dst.width = min(geo->dst.width, geo->dst.full_width); - geo->dst.height = min(geo->dst.height, geo->dst.full_height); - - /* Mixer supports only 1x and 2x scaling */ - if (geo->dst.width >= 2 * geo->src.width) { - geo->x_ratio = 1; - geo->dst.width = 2 * geo->src.width; - } else { - geo->x_ratio = 0; - geo->dst.width = geo->src.width; - } + switch (stage) { - if (geo->dst.height >= 2 * geo->src.height) { - geo->y_ratio = 1
[PATCH 1/5] v4l: add support for selection api
This patch introduces new api for a precise control of cropping and composing features for video devices. The new ioctls are VIDIOC_S_SELECTION and VIDIOC_G_SELECTION. Signed-off-by: Tomasz Stanislawski Signed-off-by: Kyungmin Park --- drivers/media/video/v4l2-compat-ioctl32.c |2 + drivers/media/video/v4l2-ioctl.c | 34 + include/linux/videodev2.h | 46 + include/media/v4l2-ioctl.h|4 ++ 4 files changed, 86 insertions(+), 0 deletions(-) diff --git a/drivers/media/video/v4l2-compat-ioctl32.c b/drivers/media/video/v4l2-compat-ioctl32.c index 61979b7..f3b9d15 100644 --- a/drivers/media/video/v4l2-compat-ioctl32.c +++ b/drivers/media/video/v4l2-compat-ioctl32.c @@ -927,6 +927,8 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg) case VIDIOC_CROPCAP: case VIDIOC_G_CROP: case VIDIOC_S_CROP: + case VIDIOC_G_SELECTION: + case VIDIOC_S_SELECTION: case VIDIOC_G_JPEGCOMP: case VIDIOC_S_JPEGCOMP: case VIDIOC_QUERYSTD: diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index 21c49dc..4cbb695e 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c @@ -238,6 +238,8 @@ static const char *v4l2_ioctls[] = { [_IOC_NR(VIDIOC_CROPCAP)] = "VIDIOC_CROPCAP", [_IOC_NR(VIDIOC_G_CROP)] = "VIDIOC_G_CROP", [_IOC_NR(VIDIOC_S_CROP)] = "VIDIOC_S_CROP", + [_IOC_NR(VIDIOC_G_SELECTION)] = "VIDIOC_G_SELECTION", + [_IOC_NR(VIDIOC_S_SELECTION)] = "VIDIOC_S_SELECTION", [_IOC_NR(VIDIOC_G_JPEGCOMP)] = "VIDIOC_G_JPEGCOMP", [_IOC_NR(VIDIOC_S_JPEGCOMP)] = "VIDIOC_S_JPEGCOMP", [_IOC_NR(VIDIOC_QUERYSTD)] = "VIDIOC_QUERYSTD", @@ -1561,6 +1563,38 @@ static long __video_do_ioctl(struct file *file, ret = ops->vidioc_s_crop(file, fh, p); break; } + case VIDIOC_G_SELECTION: + { + struct v4l2_selection *p = arg; + + if (!ops->vidioc_g_selection) + break; + + dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names)); + + ret = ops->vidioc_g_selection(file, fh, p); + if (!ret) + dbgrect(vfd, "", &p->r); + break; + } + case VIDIOC_S_SELECTION: + { + struct v4l2_selection *p = arg; + + if (!ops->vidioc_s_selection) + break; + + if (ret_prio) { + ret = ret_prio; + break; + } + + dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names)); + dbgrect(vfd, "", &p->r); + + ret = ops->vidioc_s_selection(file, fh, p); + break; + } case VIDIOC_CROPCAP: { struct v4l2_cropcap *p = arg; diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 9d14523..bdb2b49 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -738,6 +738,48 @@ struct v4l2_crop { struct v4l2_rectc; }; +/* Hints for adjustments of selection rectangle */ +#define V4L2_SEL_SIZE_GE 0x0001 +#define V4L2_SEL_SIZE_LE 0x0002 + +/* Selection targets */ + +/* current cropping area */ +#define V4L2_SEL_CROP_ACTIVE 0 +/* default cropping area */ +#define V4L2_SEL_CROP_DEFAULT 1 +/* cropping bounds */ +#define V4L2_SEL_CROP_BOUNDS 2 +/* current composing area */ +#define V4L2_SEL_COMPOSE_ACTIVE256 +/* default composing area */ +#define V4L2_SEL_COMPOSE_DEFAULT 257 +/* composing bounds */ +#define V4L2_SEL_COMPOSE_BOUNDS258 +/* current composing area plus all padding pixels */ +#define V4L2_SEL_COMPOSE_PADDED259 + +/** + * struct v4l2_selection - selection info + * @type: buffer type (do not use *_MPLANE types) + * @target:selection target, used to choose one of possible rectangles + * @flags: constraints flags + * @r: coordinates of selection window + * @reserved: for future use, rounds structure size to 64 bytes, set to zero + * + * Hardware may use multiple helper window to process a video stream. + * The structure is used to exchange this selection areas between + * an application and a driver. + */ +struct v4l2_selection { + __u32 type; + __u32 target; + __u32 flags; + struct v4l2_rectr; + __u32 reserved[9]; +}; + + /* * A N A L O G V I D E O S T A N D A R D */ @@ -2189,6 +2231,10 @@ struct v4l2_dbg_chip_ident { #defineVIDIOC_SUBSCRIBE_EVENT _IOW('V', 90, struct v4l2_event_subscription) #defineVIDIOC_UNSUBSCRI
[PATCH v5 0/5] v4l: extended crop/compose api
Hello Everyone, This is the fifth version of extended crop/compose RFC. The patch-set introduces new ioctls to V4L2 API for the configuration of the selection rectangles like crop and compose areas. Please refer to the link below for more details about the API development. http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/32152 Changelog: v4: - typos, style fixes - added piorority support to VIDIOC_S_SELECTION - removed deprecation of current crop API - marked selection as experimental API - removed references to pipeline configuration rules - added subsection about deficiencies of current cropping API - moved patches to binaries to separate patch - updated V4L2 changelog v3: - added target for padded buffer - reduced number of constraint flags to SIZE_LE and SIZE_GE - removed try flag - added documentation for selection ioctls - added documentation for new model of cropping, composing and scaling - support of selection api for s5p-tv - fixed returning ioctl's structures on failure v2: - reduced number of hints and its semantics to be more practical and less restrictive - combined EXTCROP and COMPOSE ioctls into VIDIOC_{S/G}_SELECTION - introduced crop and compose targets - introduced try flag that prevents passing configuration to a hardware - added usage examples Tomasz Stanislawski (5): v4l: add support for selection api doc: v4l: add binary images for selection API doc: v4l: add documentation for selection API v4l: emulate old crop API using extended crop/compose API v4l: s5p-tv: mixer: add support for selection API Documentation/DocBook/media/constraints.png.b64| 134 + Documentation/DocBook/media/selection.png.b64 | 2937 Documentation/DocBook/media/v4l/common.xml |2 + Documentation/DocBook/media/v4l/compat.xml |9 + Documentation/DocBook/media/v4l/selection-api.xml | 327 +++ Documentation/DocBook/media/v4l/v4l2.xml |1 + .../DocBook/media/v4l/vidioc-g-selection.xml | 303 ++ drivers/media/video/s5p-tv/mixer.h | 14 +- drivers/media/video/s5p-tv/mixer_grp_layer.c | 157 +- drivers/media/video/s5p-tv/mixer_video.c | 339 ++- drivers/media/video/s5p-tv/mixer_vp_layer.c| 108 +- drivers/media/video/v4l2-compat-ioctl32.c |2 + drivers/media/video/v4l2-ioctl.c | 120 +- include/linux/videodev2.h | 46 + include/media/v4l2-ioctl.h |4 + 15 files changed, 4295 insertions(+), 208 deletions(-) create mode 100644 Documentation/DocBook/media/constraints.png.b64 create mode 100644 Documentation/DocBook/media/selection.png.b64 create mode 100644 Documentation/DocBook/media/v4l/selection-api.xml create mode 100644 Documentation/DocBook/media/v4l/vidioc-g-selection.xml -- 1.7.6 -- 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/4] v4l: add support for selection api
Hi Hans, On 09/27/2011 10:28 AM, Hans Verkuil wrote: Here is my 'better late than never' review :-) On Wednesday, August 31, 2011 14:28:20 Tomasz Stanislawski wrote: This patch introduces new api for a precise control of cropping and composing features for video devices. The new ioctls are VIDIOC_S_SELECTION and VIDIOC_G_SELECTION. Signed-off-by: Tomasz Stanislawski Signed-off-by: Kyungmin Park --- drivers/media/video/v4l2-compat-ioctl32.c |2 + drivers/media/video/v4l2-ioctl.c | 28 + include/linux/videodev2.h | 46 + include/media/v4l2-ioctl.h|4 ++ 4 files changed, 80 insertions(+), 0 deletions(-) diff --git a/drivers/media/video/v4l2-compat-ioctl32.c b/drivers/media/video/v4l2-compat-ioctl32.c index 61979b7..f3b9d15 100644 --- a/drivers/media/video/v4l2-compat-ioctl32.c +++ b/drivers/media/video/v4l2-compat-ioctl32.c @@ -927,6 +927,8 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg) case VIDIOC_CROPCAP: case VIDIOC_G_CROP: case VIDIOC_S_CROP: + case VIDIOC_G_SELECTION: + case VIDIOC_S_SELECTION: case VIDIOC_G_JPEGCOMP: case VIDIOC_S_JPEGCOMP: case VIDIOC_QUERYSTD: diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index 002ce13..6e02b45 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c @@ -225,6 +225,8 @@ static const char *v4l2_ioctls[] = { [_IOC_NR(VIDIOC_CROPCAP)] = "VIDIOC_CROPCAP", [_IOC_NR(VIDIOC_G_CROP)] = "VIDIOC_G_CROP", [_IOC_NR(VIDIOC_S_CROP)] = "VIDIOC_S_CROP", + [_IOC_NR(VIDIOC_G_SELECTION)] = "VIDIOC_G_SELECTION", + [_IOC_NR(VIDIOC_S_SELECTION)] = "VIDIOC_S_SELECTION", [_IOC_NR(VIDIOC_G_JPEGCOMP)] = "VIDIOC_G_JPEGCOMP", [_IOC_NR(VIDIOC_S_JPEGCOMP)] = "VIDIOC_S_JPEGCOMP", [_IOC_NR(VIDIOC_QUERYSTD)] = "VIDIOC_QUERYSTD", @@ -1714,6 +1716,32 @@ static long __video_do_ioctl(struct file *file, ret = ops->vidioc_s_crop(file, fh, p); break; } + case VIDIOC_G_SELECTION: + { + struct v4l2_selection *p = arg; + + if (!ops->vidioc_g_selection) + break; + + dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names)); + + ret = ops->vidioc_g_selection(file, fh, p); + if (!ret) + dbgrect(vfd, "",&p->r); + break; + } + case VIDIOC_S_SELECTION: + { + struct v4l2_selection *p = arg; + + if (!ops->vidioc_s_selection) + break; Here you should insert this code so that this ioctl handles the priority check correctly: if (ret_prio) { ret = ret_prio; break; } OK + dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names)); + dbgrect(vfd, "",&p->r); + + ret = ops->vidioc_s_selection(file, fh, p); + break; + } case VIDIOC_CROPCAP: { struct v4l2_cropcap *p = arg; diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index fca24cc..b7471fe 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -738,6 +738,48 @@ struct v4l2_crop { struct v4l2_rectc; }; +/* Hints for adjustments of selection rectangle */ +#define V4L2_SEL_SIZE_GE 0x0001 +#define V4L2_SEL_SIZE_LE 0x0002 + +/* Selection targets */ + +/* current cropping area */ +#define V4L2_SEL_CROP_ACTIVE 0 +/* default cropping area */ +#define V4L2_SEL_CROP_DEFAULT 1 +/* cropping bounds */ +#define V4L2_SEL_CROP_BOUNDS 2 +/* current composing area */ +#define V4L2_SEL_COMPOSE_ACTIVE256 +/* default composing area */ +#define V4L2_SEL_COMPOSE_DEFAULT 257 +/* composing bounds */ +#define V4L2_SEL_COMPOSE_BOUNDS258 +/* current composing area plus all padding pixels */ +#define V4L2_SEL_COMPOSE_PADDED259 + +/** + * struct v4l2_selection - selection info + * @type: buffer type (do not use *_MPLANE types) Why can't I use MPLANE types? Because the selection has nothing to do with "multiplanar" stuff. The VIDIOC_{S/G}_CROP does not use it. Therefore the selection should not use it either. Only memory referring ioctl should use *_MPLANE types. I would really like to avoid forcing developers to implement this non-intuitive and confusing business logic like it happened to VIDIOC_S_FMT, and VIDIOC_STREAM{ON/OFF} ioctls. + * @target:selection target, used to choose one of possible rectangles + * @flags: constraints flags + * @r: coordinates of selection window + * @reserved: for future
RE: [PATCH v4 5/5] OMAP_VOUT: Increase MAX_DISPLAYS to a larger value
> -Original Message- > From: Taneja, Archit > Sent: Wednesday, September 28, 2011 8:19 PM > To: Hiremath, Vaibhav > Cc: Valkeinen, Tomi; linux-o...@vger.kernel.org; Semwal, Sumit; linux- > me...@vger.kernel.org; Taneja, Archit > Subject: [PATCH v4 5/5] OMAP_VOUT: Increase MAX_DISPLAYS to a larger value > > There is no limit to the number of displays that can registered with DSS2. > The > current value of MAX_DISPLAYS is 3, set this to 10 so that the 'displays' > member of omap2video_device struct can store more omap_dss_device pointers. > > This fixes a crash seen in omap_vout_probe when DSS2 registers for more > than 3 > displays. > > Signed-off-by: Archit Taneja > --- > drivers/media/video/omap/omap_voutdef.h |2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/drivers/media/video/omap/omap_voutdef.h > b/drivers/media/video/omap/omap_voutdef.h > index d793501..27a95d2 100644 > --- a/drivers/media/video/omap/omap_voutdef.h > +++ b/drivers/media/video/omap/omap_voutdef.h > @@ -25,7 +25,7 @@ > #define MAC_VRFB_CTXS4 > #define MAX_VOUT_DEV 2 > #define MAX_OVLS 3 > -#define MAX_DISPLAYS 3 > +#define MAX_DISPLAYS 10 > #define MAX_MANAGERS 3 > > #define QQVGA_WIDTH 160 Acked-by: Vaibhav Hiremath Thanks, Vaibhav > -- > 1.7.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
RE: [PATCH v4 4/5] OMAP_VOUT: Add support for DSI panels
> -Original Message- > From: Taneja, Archit > Sent: Wednesday, September 28, 2011 8:19 PM > To: Hiremath, Vaibhav > Cc: Valkeinen, Tomi; linux-o...@vger.kernel.org; Semwal, Sumit; linux- > me...@vger.kernel.org; Taneja, Archit > Subject: [PATCH v4 4/5] OMAP_VOUT: Add support for DSI panels > > Add support for DSI panels. DSI video mode panels will work directly. For > command mode panels, we will need to trigger updates regularly. This isn't > done > by the omap_vout driver currently. It can still be supported if we connect > a > framebuffer device to the panel and configure it in auto update mode. > > Signed-off-by: Archit Taneja > --- > drivers/media/video/omap/omap_vout.c |1 + > 1 files changed, 1 insertions(+), 0 deletions(-) > > diff --git a/drivers/media/video/omap/omap_vout.c > b/drivers/media/video/omap/omap_vout.c > index 6bc2620..65374b5 100644 > --- a/drivers/media/video/omap/omap_vout.c > +++ b/drivers/media/video/omap/omap_vout.c > @@ -590,6 +590,7 @@ static void omap_vout_isr(void *arg, unsigned int > irqstatus) > do_gettimeofday(&timevalue); > > switch (cur_display->type) { > + case OMAP_DISPLAY_TYPE_DSI: > case OMAP_DISPLAY_TYPE_DPI: > if (mgr_id == OMAP_DSS_CHANNEL_LCD) > irq = DISPC_IRQ_VSYNC; Acked-by: Vaibhav Hiremath Thanks, Vaibhav > -- > 1.7.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
RE: [PATCH v4 3/5] OMAP_VOUT: Fix VSYNC IRQ handling in omap_vout_isr
> -Original Message- > From: Taneja, Archit > Sent: Wednesday, September 28, 2011 8:19 PM > To: Hiremath, Vaibhav > Cc: Valkeinen, Tomi; linux-o...@vger.kernel.org; Semwal, Sumit; linux- > me...@vger.kernel.org; Taneja, Archit > Subject: [PATCH v4 3/5] OMAP_VOUT: Fix VSYNC IRQ handling in omap_vout_isr > > Currently, in omap_vout_isr(), if the panel type is DPI, and if we > get either VSYNC or VSYNC2 interrupts, we proceed ahead to set the > current buffers state to VIDEOBUF_DONE and prepare to display the > next frame in the queue. > > On OMAP4, because we have 2 LCD managers, the panel type itself is not > sufficient to tell if we have received the correct irq, i.e, we shouldn't > proceed ahead if we get a VSYNC interrupt for LCD2 manager, or a VSYNC2 > interrupt for LCD manager. > > Fix this by correlating LCD manager to VSYNC interrupt and LCD2 manager > to VSYNC2 interrupt. > > Signed-off-by: Archit Taneja > --- > drivers/media/video/omap/omap_vout.c | 14 +++--- > 1 files changed, 11 insertions(+), 3 deletions(-) > > diff --git a/drivers/media/video/omap/omap_vout.c > b/drivers/media/video/omap/omap_vout.c > index 247ea31..6bc2620 100644 > --- a/drivers/media/video/omap/omap_vout.c > +++ b/drivers/media/video/omap/omap_vout.c > @@ -566,8 +566,8 @@ err: > > static void omap_vout_isr(void *arg, unsigned int irqstatus) > { > - int ret, fid; > - u32 addr; > + int ret, fid, mgr_id; > + u32 addr, irq; > struct omap_overlay *ovl; > struct timeval timevalue; > struct omapvideo_info *ovid; > @@ -583,6 +583,7 @@ static void omap_vout_isr(void *arg, unsigned int > irqstatus) > if (!ovl->manager || !ovl->manager->device) > return; > > + mgr_id = ovl->manager->id; > cur_display = ovl->manager->device; > > spin_lock(&vout->vbq_lock); > @@ -590,7 +591,14 @@ static void omap_vout_isr(void *arg, unsigned int > irqstatus) > > switch (cur_display->type) { > case OMAP_DISPLAY_TYPE_DPI: > - if (!(irqstatus & (DISPC_IRQ_VSYNC | DISPC_IRQ_VSYNC2))) > + if (mgr_id == OMAP_DSS_CHANNEL_LCD) > + irq = DISPC_IRQ_VSYNC; > + else if (mgr_id == OMAP_DSS_CHANNEL_LCD2) > + irq = DISPC_IRQ_VSYNC2; > + else > + goto vout_isr_err; > + > + if (!(irqstatus & irq)) > goto vout_isr_err; > break; > case OMAP_DISPLAY_TYPE_VENC: Acked-by: Vaibhav Hiremath Thanks, Vaibhav > -- > 1.7.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
RE: [PATCH v4 2/5] OMAP_VOUT: CLEANUP: Remove redundant code from omap_vout_isr
> -Original Message- > From: Taneja, Archit > Sent: Wednesday, September 28, 2011 8:19 PM > To: Hiremath, Vaibhav > Cc: Valkeinen, Tomi; linux-o...@vger.kernel.org; Semwal, Sumit; linux- > me...@vger.kernel.org; Taneja, Archit > Subject: [PATCH v4 2/5] OMAP_VOUT: CLEANUP: Remove redundant code from > omap_vout_isr > > Currently, there is a lot of redundant code is between DPI and VENC panels, > this > can be made common by moving out field/interlace specific code to a > separate > function called omapvid_handle_interlace_display(). There is no functional > change made. > > Signed-off-by: Archit Taneja > --- > drivers/media/video/omap/omap_vout.c | 172 - > - > 1 files changed, 82 insertions(+), 90 deletions(-) > > diff --git a/drivers/media/video/omap/omap_vout.c > b/drivers/media/video/omap/omap_vout.c > index e64a83c..247ea31 100644 > --- a/drivers/media/video/omap/omap_vout.c > +++ b/drivers/media/video/omap/omap_vout.c > @@ -524,10 +524,50 @@ static int omapvid_apply_changes(struct > omap_vout_device *vout) > return 0; > } > > +static int omapvid_handle_interlace_display(struct omap_vout_device *vout, > + unsigned int irqstatus, struct timeval timevalue) > +{ > + u32 fid; > + > + if (vout->first_int) { > + vout->first_int = 0; > + goto err; > + } > + > + if (irqstatus & DISPC_IRQ_EVSYNC_ODD) > + fid = 1; > + else if (irqstatus & DISPC_IRQ_EVSYNC_EVEN) > + fid = 0; > + else > + goto err; > + > + vout->field_id ^= 1; > + if (fid != vout->field_id) { > + if (fid == 0) > + vout->field_id = fid; > + } else if (0 == fid) { > + if (vout->cur_frm == vout->next_frm) > + goto err; > + > + vout->cur_frm->ts = timevalue; > + vout->cur_frm->state = VIDEOBUF_DONE; > + wake_up_interruptible(&vout->cur_frm->done); > + vout->cur_frm = vout->next_frm; > + } else { > + if (list_empty(&vout->dma_queue) || > + (vout->cur_frm != vout->next_frm)) > + goto err; > + } > + > + return vout->field_id; > +err: > + return 0; > +} > + > static void omap_vout_isr(void *arg, unsigned int irqstatus) > { > - int ret; > - u32 addr, fid; > + int ret, fid; > + u32 addr; > struct omap_overlay *ovl; > struct timeval timevalue; > struct omapvideo_info *ovid; > @@ -548,107 +588,59 @@ static void omap_vout_isr(void *arg, unsigned int > irqstatus) > spin_lock(&vout->vbq_lock); > do_gettimeofday(&timevalue); > > - if (cur_display->type != OMAP_DISPLAY_TYPE_VENC) { > - switch (cur_display->type) { > - case OMAP_DISPLAY_TYPE_DPI: > - if (!(irqstatus & (DISPC_IRQ_VSYNC | DISPC_IRQ_VSYNC2))) > - goto vout_isr_err; > - break; > - case OMAP_DISPLAY_TYPE_HDMI: > - if (!(irqstatus & DISPC_IRQ_EVSYNC_EVEN)) > - goto vout_isr_err; > - break; > - default: > + switch (cur_display->type) { > + case OMAP_DISPLAY_TYPE_DPI: > + if (!(irqstatus & (DISPC_IRQ_VSYNC | DISPC_IRQ_VSYNC2))) > goto vout_isr_err; > - } > - if (!vout->first_int && (vout->cur_frm != vout->next_frm)) { > - vout->cur_frm->ts = timevalue; > - vout->cur_frm->state = VIDEOBUF_DONE; > - wake_up_interruptible(&vout->cur_frm->done); > - vout->cur_frm = vout->next_frm; > - } > - vout->first_int = 0; > - if (list_empty(&vout->dma_queue)) > + break; > + case OMAP_DISPLAY_TYPE_VENC: > + fid = omapvid_handle_interlace_display(vout, irqstatus, > + timevalue); > + if (!fid) > goto vout_isr_err; > + break; > + case OMAP_DISPLAY_TYPE_HDMI: > + if (!(irqstatus & DISPC_IRQ_EVSYNC_EVEN)) > + goto vout_isr_err; > + break; > + default: > + goto vout_isr_err; > + } > > - vout->next_frm = list_entry(vout->dma_queue.next, > - struct videobuf_buffer, queue); > - list_del(&vout->next_frm->queue); > - > - vout->next_frm->state = VIDEOBUF_ACTIVE; > - > - addr = (unsigned long) vout->queued_buf_addr[vout->next_frm- > >i] > - + vout->cropped_offset; > + if (!vout->first_int && (vout->cur_frm != vout->next_frm)) { > + vout->cur_frm->ts = timevalue; > + vout->cur_frm->state = VIDEOBUF_DONE; > + wake_up_interruptible(&vout->cur_frm->done); > + vout->cur_f
Re: [PATCH] V4L: add convenience macros to the subdevice / Media Controller API
Hi Guennadi, On Thursday 29 September 2011 10:44:14 Guennadi Liakhovetski wrote: > On Thu, 29 Sep 2011, Laurent Pinchart wrote: > > On Thursday 29 September 2011 10:18:31 Guennadi Liakhovetski wrote: > > > Drivers, that can be built and work with and without > > > CONFIG_VIDEO_V4L2_SUBDEV_API, need the v4l2_subdev_get_try_format() and > > > v4l2_subdev_get_try_crop() functions, even though their return value > > > should never be dereferenced. Also add convenience macros to init and > > > clean up subdevice internal media entities. > > > > Why don't you just make the drivers depend on > > CONFIG_VIDEO_V4L2_SUBDEV_API ? They don't need to actually export a > > device node to userspace, but they require the in-kernel API. > > Why? Why should the user build and load all the media controller stuff, > buy all the in-kernel objects and code to never actually use it? Where > OTOH all is needed to avoid that is a couple of NOP macros? Because the automatic compatibility layer that will translate video operations to pad operations will need to access pads, so subdevs that implement a pad- level API need to export it to the bridge, even if the bridge is not MC-aware. -- 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
[RFC PATCH] Introduce a strict tuner type check for VIDIOC_S_FREQUENCY
As per feature-removal-schedule. If there are no comments, then I'll make a pull request in a few days. Regards, Hans For tuners the tuner type as passed by VIDIOC_S_FREQUENCY must match the type of the device node. So setting the radio frequency through a video node instead of the radio node is no longer allowed. This is now implemented as per the feature removal schedule. Signed-off-by: Hans Verkuil --- .../DocBook/media/v4l/vidioc-g-frequency.xml |5 - Documentation/feature-removal-schedule.txt | 11 --- drivers/media/video/v4l2-ioctl.c |9 - 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/Documentation/DocBook/media/v4l/vidioc-g-frequency.xml b/Documentation/DocBook/media/v4l/vidioc-g-frequency.xml index 062d720..d18645c 100644 --- a/Documentation/DocBook/media/v4l/vidioc-g-frequency.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-frequency.xml @@ -99,7 +99,10 @@ the &v4l2-output; modulator field and the type The tuner type. This is the same value as in the &v4l2-tuner; type field. The field is not -applicable to modulators, &ie; ignored by drivers. +applicable to modulators, &ie; ignored by drivers. The tuner type must +match the type of the device node, &ie; you cannot specify V4L2_TUNER_RADIO +for a video/vbi device node or V4L2_TUNER_ANALOG_TV for a radio device node. +EINVAL will be returned in case of a mismatch. __u32 diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index ead08f1..b0ed38c 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt @@ -530,17 +530,6 @@ Who: Hans de Goede -What: For VIDIOC_S_FREQUENCY the type field must match the device node's type. - If not, return -EINVAL. -When: 3.2 -Why: It makes no sense to switch the tuner to radio mode by calling - VIDIOC_S_FREQUENCY on a video node, or to switch the tuner to tv mode by - calling VIDIOC_S_FREQUENCY on a radio node. This is the first step of a - move to more consistent handling of tv and radio tuners. -Who: Hans Verkuil - - - What: Opening a radio device node will no longer automatically switch the tuner mode from tv to radio. When: 3.3 diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index 21c49dc..4004b77 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c @@ -1757,6 +1757,8 @@ static long __video_do_ioctl(struct file *file, case VIDIOC_S_FREQUENCY: { struct v4l2_frequency *p = arg; + enum v4l2_tuner_type type = (vfd->vfl_type == VFL_TYPE_RADIO) ? + V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; if (!ops->vidioc_s_frequency) break; @@ -1766,7 +1768,12 @@ static long __video_do_ioctl(struct file *file, } dbgarg(cmd, "tuner=%d, type=%d, frequency=%d\n", p->tuner, p->type, p->frequency); - ret = ops->vidioc_s_frequency(file, fh, p); + /* type is ignored for modulators, so only do this check + if there is no modulator support. */ + if (ops->vidioc_s_modulator == NULL && type != p->type) + ret = -EINVAL; + else + ret = ops->vidioc_s_frequency(file, fh, p); break; } case VIDIOC_G_SLICED_VBI_CAP: -- 1.7.5.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] V4L: omap3isp: remove redundant operation
Trivial arithmetics clean up. Signed-off-by: Guennadi Liakhovetski --- drivers/media/video/omap3isp/ispccdc.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/media/video/omap3isp/ispccdc.c b/drivers/media/video/omap3isp/ispccdc.c index 40b141c..65ae267 100644 --- a/drivers/media/video/omap3isp/ispccdc.c +++ b/drivers/media/video/omap3isp/ispccdc.c @@ -1834,7 +1834,7 @@ ccdc_try_format(struct isp_ccdc_device *ccdc, struct v4l2_subdev_fh *fh, * callers to request an output size bigger than the input size * up to the nearest multiple of 16. */ - fmt->width = clamp_t(u32, width, 32, (fmt->width + 15) & ~15); + fmt->width = clamp_t(u32, width, 32, fmt->width + 15); fmt->width &= ~15; fmt->height = clamp_t(u32, height, 32, fmt->height); break; -- 1.7.2.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
Re: [PATCH] V4L: add convenience macros to the subdevice / Media Controller API
On Thu, 29 Sep 2011, Laurent Pinchart wrote: > Hi Guennadi, > > Thanks for the patch. > > On Thursday 29 September 2011 10:18:31 Guennadi Liakhovetski wrote: > > Drivers, that can be built and work with and without > > CONFIG_VIDEO_V4L2_SUBDEV_API, need the v4l2_subdev_get_try_format() and > > v4l2_subdev_get_try_crop() functions, even though their return value > > should never be dereferenced. Also add convenience macros to init and > > clean up subdevice internal media entities. > > Why don't you just make the drivers depend on CONFIG_VIDEO_V4L2_SUBDEV_API ? > They don't need to actually export a device node to userspace, but they > require the in-kernel API. Why? Why should the user build and load all the media controller stuff, buy all the in-kernel objects and code to never actually use it? Where OTOH all is needed to avoid that is a couple of NOP macros? Thanks Guennadi > > > Signed-off-by: Guennadi Liakhovetski > > --- > > include/media/v4l2-subdev.h | 11 +++ > > 1 files changed, 11 insertions(+), 0 deletions(-) > > > > diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h > > index f0f3358..4670506 100644 > > --- a/include/media/v4l2-subdev.h > > +++ b/include/media/v4l2-subdev.h > > @@ -569,6 +569,9 @@ v4l2_subdev_get_try_crop(struct v4l2_subdev_fh *fh, > > unsigned int pad) { > > return &fh->try_crop[pad]; > > } > > +#else > > +#define v4l2_subdev_get_try_format(arg...) NULL > > +#define v4l2_subdev_get_try_crop(arg...) NULL > > #endif > > > > extern const struct v4l2_file_operations v4l2_subdev_fops; > > @@ -610,4 +613,12 @@ void v4l2_subdev_init(struct v4l2_subdev *sd, > > ((!(sd) || !(sd)->v4l2_dev || !(sd)->v4l2_dev->notify) ? -ENODEV : \ > > (sd)->v4l2_dev->notify((sd), (notification), (arg))) > > > > +#if defined(CONFIG_MEDIA_CONTROLLER) > > +#define subdev_media_entity_init(sd, n, p, > > e) media_entity_init(&(sd)->entity, n, p, e) +#define > > subdev_media_entity_cleanup(sd) > > media_entity_cleanup(&(sd)->entity) > > +#else > > +#define subdev_media_entity_init(sd, n, p, e) 0 > > +#define subdev_media_entity_cleanup(sd)do {} while (0) > > +#endif > > + > > #endif > > -- > Regards, > > Laurent Pinchart > --- 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] V4L: add convenience macros to the subdevice / Media Controller API
Hi Guennadi, Thanks for the patch. On Thursday 29 September 2011 10:18:31 Guennadi Liakhovetski wrote: > Drivers, that can be built and work with and without > CONFIG_VIDEO_V4L2_SUBDEV_API, need the v4l2_subdev_get_try_format() and > v4l2_subdev_get_try_crop() functions, even though their return value > should never be dereferenced. Also add convenience macros to init and > clean up subdevice internal media entities. Why don't you just make the drivers depend on CONFIG_VIDEO_V4L2_SUBDEV_API ? They don't need to actually export a device node to userspace, but they require the in-kernel API. > Signed-off-by: Guennadi Liakhovetski > --- > include/media/v4l2-subdev.h | 11 +++ > 1 files changed, 11 insertions(+), 0 deletions(-) > > diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h > index f0f3358..4670506 100644 > --- a/include/media/v4l2-subdev.h > +++ b/include/media/v4l2-subdev.h > @@ -569,6 +569,9 @@ v4l2_subdev_get_try_crop(struct v4l2_subdev_fh *fh, > unsigned int pad) { > return &fh->try_crop[pad]; > } > +#else > +#define v4l2_subdev_get_try_format(arg...) NULL > +#define v4l2_subdev_get_try_crop(arg...) NULL > #endif > > extern const struct v4l2_file_operations v4l2_subdev_fops; > @@ -610,4 +613,12 @@ void v4l2_subdev_init(struct v4l2_subdev *sd, > ((!(sd) || !(sd)->v4l2_dev || !(sd)->v4l2_dev->notify) ? -ENODEV : \ >(sd)->v4l2_dev->notify((sd), (notification), (arg))) > > +#if defined(CONFIG_MEDIA_CONTROLLER) > +#define subdev_media_entity_init(sd, n, p, > e)media_entity_init(&(sd)->entity, n, p, e) +#define > subdev_media_entity_cleanup(sd) > media_entity_cleanup(&(sd)->entity) > +#else > +#define subdev_media_entity_init(sd, n, p, e)0 > +#define subdev_media_entity_cleanup(sd) do {} while (0) > +#endif > + > #endif -- 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
[PATCH] V4L: add convenience macros to the subdevice / Media Controller API
Drivers, that can be built and work with and without CONFIG_VIDEO_V4L2_SUBDEV_API, need the v4l2_subdev_get_try_format() and v4l2_subdev_get_try_crop() functions, even though their return value should never be dereferenced. Also add convenience macros to init and clean up subdevice internal media entities. Signed-off-by: Guennadi Liakhovetski --- include/media/v4l2-subdev.h | 11 +++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index f0f3358..4670506 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -569,6 +569,9 @@ v4l2_subdev_get_try_crop(struct v4l2_subdev_fh *fh, unsigned int pad) { return &fh->try_crop[pad]; } +#else +#define v4l2_subdev_get_try_format(arg...) NULL +#define v4l2_subdev_get_try_crop(arg...) NULL #endif extern const struct v4l2_file_operations v4l2_subdev_fops; @@ -610,4 +613,12 @@ void v4l2_subdev_init(struct v4l2_subdev *sd, ((!(sd) || !(sd)->v4l2_dev || !(sd)->v4l2_dev->notify) ? -ENODEV : \ (sd)->v4l2_dev->notify((sd), (notification), (arg))) +#if defined(CONFIG_MEDIA_CONTROLLER) +#define subdev_media_entity_init(sd, n, p, e) media_entity_init(&(sd)->entity, n, p, e) +#define subdev_media_entity_cleanup(sd) media_entity_cleanup(&(sd)->entity) +#else +#define subdev_media_entity_init(sd, n, p, e) 0 +#define subdev_media_entity_cleanup(sd)do {} while (0) +#endif + #endif -- 1.7.2.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
Re: [PATCH 2/9 v10] V4L: add two new ioctl()s for multi-size videobuffer management
On Thu, 29 Sep 2011, Sakari Ailus wrote: > Guennadi Liakhovetski wrote: > > On Wed, 28 Sep 2011, Sakari Ailus wrote: > > > > > Hi Guennadi, > > > > > > On Wed, Sep 28, 2011 at 04:56:11PM +0200, Guennadi Liakhovetski wrote: > > > > @@ -2099,6 +2103,15 @@ struct v4l2_dbg_chip_ident { > > > > __u32 revision;/* chip revision, chip specific */ > > > > } __attribute__ ((packed)); > > > > > > > > +/* VIDIOC_CREATE_BUFS */ > > > > +struct v4l2_create_buffers { > > > > + __u32 index; /* output: buffers > > > > index...index + count - 1 have been created */ > > > > + __u32 count; > > > > + enum v4l2_memorymemory; > > > > + struct v4l2_format format; /* "type" is used > > > > always, the > > > > rest if sizeimage == 0 */ > > > > + __u32 reserved[8]; > > > > +}; > > > > > > What about the kerneldoc comments you wrote right after v6 on 1st > > > September > > > for v4l2_create_buffers and the same for the compat32 version? > > > > Looks like someone is trying very hard to cause me a heart failure;-) They > > are in a separate patch: > > No, I don't! :-) I'm just interested all the appropriate changes are in the > patchset. My understanding was you intended to add these changes to the > original patches. > > Are you planning to put them to the same patchset still, or a different one? The same. Thanks Guennadi --- 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
[RFCv4 PATCH 1/6] poll: add poll_requested_events() function
In some cases the poll() implementation in a driver has to do different things depending on the events the caller wants to poll for. An example is when a driver needs to start a DMA engine if the caller polls for POLLIN, but doesn't want to do that if POLLIN is not requested but instead only POLLOUT or POLLPRI is requested. This is something that can happen in the video4linux subsystem. Unfortunately, the current epoll/poll/select implementation doesn't provide that information reliably. The poll_table_struct does have it: it has a key field with the event mask. But once a poll() call matches one or more bits of that mask any following poll() calls are passed a NULL poll_table_struct pointer. The solution is to set the qproc field to NULL in poll_table_struct once poll() matches the events, not the poll_table_struct pointer itself. That way drivers can obtain the mask through a new poll_requested_events inline. The poll_table_struct can still be NULL since some kernel code calls it internally (netfs_state_poll() in ./drivers/staging/pohmelfs/netfs.h). In that case poll_requested_events() returns ~0 (i.e. all events). Since eventpoll always leaves the key field at ~0 instead of using the requested events mask, that source was changed as well to properly fill in the key field. Signed-off-by: Hans Verkuil Reviewed-by: Jonathan Corbet --- fs/eventpoll.c | 18 +++--- fs/select.c | 38 +- include/linux/poll.h | 13 - 3 files changed, 44 insertions(+), 25 deletions(-) diff --git a/fs/eventpoll.c b/fs/eventpoll.c index fe047d96..fc32717 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -650,9 +650,12 @@ static int ep_read_events_proc(struct eventpoll *ep, struct list_head *head, void *priv) { struct epitem *epi, *tmp; + poll_table pt; + init_poll_funcptr(&pt, NULL); list_for_each_entry_safe(epi, tmp, head, rdllink) { - if (epi->ffd.file->f_op->poll(epi->ffd.file, NULL) & + pt.key = epi->event.events; + if (epi->ffd.file->f_op->poll(epi->ffd.file, &pt) & epi->event.events) return POLLIN | POLLRDNORM; else { @@ -946,6 +949,7 @@ static int ep_insert(struct eventpoll *ep, struct epoll_event *event, /* Initialize the poll table using the queue callback */ epq.epi = epi; init_poll_funcptr(&epq.pt, ep_ptable_queue_proc); + epq.pt.key = event->events; /* * Attach the item to the poll hooks and get current event bits. @@ -1027,6 +1031,9 @@ static int ep_modify(struct eventpoll *ep, struct epitem *epi, struct epoll_even { int pwake = 0; unsigned int revents; + poll_table pt; + + init_poll_funcptr(&pt, NULL); /* * Set the new event interest mask before calling f_op->poll(); @@ -1034,13 +1041,14 @@ static int ep_modify(struct eventpoll *ep, struct epitem *epi, struct epoll_even * f_op->poll() call and the new event set registering. */ epi->event.events = event->events; + pt.key = event->events; epi->event.data = event->data; /* protected by mtx */ /* * Get current event bits. We can safely use the file* here because * its usage count has been increased by the caller of this function. */ - revents = epi->ffd.file->f_op->poll(epi->ffd.file, NULL); + revents = epi->ffd.file->f_op->poll(epi->ffd.file, &pt); /* * If the item is "hot" and it is not registered inside the ready @@ -1075,6 +1083,9 @@ static int ep_send_events_proc(struct eventpoll *ep, struct list_head *head, unsigned int revents; struct epitem *epi; struct epoll_event __user *uevent; + poll_table pt; + + init_poll_funcptr(&pt, NULL); /* * We can loop without lock because we are passed a task private list. @@ -1087,7 +1098,8 @@ static int ep_send_events_proc(struct eventpoll *ep, struct list_head *head, list_del_init(&epi->rdllink); - revents = epi->ffd.file->f_op->poll(epi->ffd.file, NULL) & + pt.key = epi->event.events; + revents = epi->ffd.file->f_op->poll(epi->ffd.file, &pt) & epi->event.events; /* diff --git a/fs/select.c b/fs/select.c index d33418f..b6765cf 100644 --- a/fs/select.c +++ b/fs/select.c @@ -386,13 +386,11 @@ get_max: static inline void wait_key_set(poll_table *wait, unsigned long in, unsigned long out, unsigned long bit) { - if (wait) { - wait->key = POLLEX_SET; - if (in & bit) - wait->key |= POLLIN_SET; - if (out & bit) - wait->key |= POLLOUT_SET; - } + wait->key = POLLEX_SET; + if (in & bit)
[RFCv4 PATCH 6/6] vivi: let vb2_poll handle events.
From: Hans Verkuil The vb2_poll function now tests for events and sets POLLPRI accordingly. So there it is no longer necessary to test for it in the vivi driver. Signed-off-by: Hans Verkuil --- drivers/media/video/vivi.c |9 + 1 files changed, 1 insertions(+), 8 deletions(-) diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c index 7cf94c0..c25787d 100644 --- a/drivers/media/video/vivi.c +++ b/drivers/media/video/vivi.c @@ -1057,17 +1057,10 @@ static unsigned int vivi_poll(struct file *file, struct poll_table_struct *wait) { struct vivi_dev *dev = video_drvdata(file); - struct v4l2_fh *fh = file->private_data; struct vb2_queue *q = &dev->vb_vidq; - unsigned int res; dprintk(dev, 1, "%s\n", __func__); - res = vb2_poll(q, file, wait); - if (v4l2_event_pending(fh)) - res |= POLLPRI; - else - poll_wait(file, &fh->wait, wait); - return res; + return vb2_poll(q, file, wait); } static int vivi_close(struct file *file) -- 1.7.5.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
[RFCv4 PATCH 4/6] videobuf: only start streaming in poll() if so requested by the poll mask.
From: Hans Verkuil Signed-off-by: Hans Verkuil --- drivers/media/video/videobuf-core.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c index de4fa4e..ffdf59c 100644 --- a/drivers/media/video/videobuf-core.c +++ b/drivers/media/video/videobuf-core.c @@ -1129,6 +1129,7 @@ unsigned int videobuf_poll_stream(struct file *file, struct videobuf_queue *q, poll_table *wait) { + unsigned long req_events = poll_requested_events(wait); struct videobuf_buffer *buf = NULL; unsigned int rc = 0; @@ -1137,7 +1138,7 @@ unsigned int videobuf_poll_stream(struct file *file, if (!list_empty(&q->stream)) buf = list_entry(q->stream.next, struct videobuf_buffer, stream); - } else { + } else if (req_events & (POLLIN | POLLRDNORM)) { if (!q->reading) __videobuf_read_start(q); if (!q->reading) { -- 1.7.5.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
[RFCv4 PATCH 5/6] videobuf2-core: also test for pending events.
From: Hans Verkuil Signed-off-by: Hans Verkuil --- drivers/media/video/videobuf2-core.c | 41 +++-- 1 files changed, 28 insertions(+), 13 deletions(-) diff --git a/drivers/media/video/videobuf2-core.c b/drivers/media/video/videobuf2-core.c index a921638..7674220 100644 --- a/drivers/media/video/videobuf2-core.c +++ b/drivers/media/video/videobuf2-core.c @@ -19,6 +19,9 @@ #include #include +#include +#include +#include #include static int debug; @@ -1363,15 +1366,28 @@ static int __vb2_cleanup_fileio(struct vb2_queue *q); * For OUTPUT queues, if a buffer is ready to be dequeued, the file descriptor * will be reported as available for writing. * + * If the driver uses struct v4l2_fh, then vb2_poll() will also check for any + * pending events. + * * The return values from this function are intended to be directly returned * from poll handler in driver. */ unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait) { + struct video_device *vfd = video_devdata(file); unsigned long req_events = poll_requested_events(wait); - unsigned long flags; - unsigned int ret; struct vb2_buffer *vb = NULL; + unsigned int res = 0; + unsigned long flags; + + if (test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags)) { + struct v4l2_fh *fh = file->private_data; + + if (v4l2_event_pending(fh)) + res = POLLPRI; + else if (req_events & POLLPRI) + poll_wait(file, &fh->wait, wait); + } /* * Start file I/O emulator only if streaming API has not been used yet. @@ -1379,19 +1395,17 @@ unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait) if (q->num_buffers == 0 && q->fileio == NULL) { if (!V4L2_TYPE_IS_OUTPUT(q->type) && (q->io_modes & VB2_READ) && (req_events & (POLLIN | POLLRDNORM))) { - ret = __vb2_init_fileio(q, 1); - if (ret) - return POLLERR; + if (__vb2_init_fileio(q, 1)) + return res | POLLERR; } if (V4L2_TYPE_IS_OUTPUT(q->type) && (q->io_modes & VB2_WRITE) && (req_events & (POLLOUT | POLLWRNORM))) { - ret = __vb2_init_fileio(q, 0); - if (ret) - return POLLERR; + if (__vb2_init_fileio(q, 0)) + return res | POLLERR; /* * Write to OUTPUT queue can be done immediately. */ - return POLLOUT | POLLWRNORM; + return res | POLLOUT | POLLWRNORM; } } @@ -1399,7 +1413,7 @@ unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait) * There is nothing to wait for if no buffers have already been queued. */ if (list_empty(&q->queued_list)) - return POLLERR; + return res | POLLERR; poll_wait(file, &q->done_wq, wait); @@ -1414,10 +1428,11 @@ unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait) if (vb && (vb->state == VB2_BUF_STATE_DONE || vb->state == VB2_BUF_STATE_ERROR)) { - return (V4L2_TYPE_IS_OUTPUT(q->type)) ? POLLOUT | POLLWRNORM : - POLLIN | POLLRDNORM; + return (V4L2_TYPE_IS_OUTPUT(q->type)) ? + res | POLLOUT | POLLWRNORM : + res | POLLIN | POLLRDNORM; } - return 0; + return res; } EXPORT_SYMBOL_GPL(vb2_poll); -- 1.7.5.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
[RFCv4 PATCH 2/6] ivtv: only start streaming in poll() if polling for input.
From: Hans Verkuil Signed-off-by: Hans Verkuil --- drivers/media/video/ivtv/ivtv-fileops.c |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/ivtv/ivtv-fileops.c b/drivers/media/video/ivtv/ivtv-fileops.c index 38f0522..a931ecf 100644 --- a/drivers/media/video/ivtv/ivtv-fileops.c +++ b/drivers/media/video/ivtv/ivtv-fileops.c @@ -744,8 +744,9 @@ unsigned int ivtv_v4l2_dec_poll(struct file *filp, poll_table *wait) return res; } -unsigned int ivtv_v4l2_enc_poll(struct file *filp, poll_table * wait) +unsigned int ivtv_v4l2_enc_poll(struct file *filp, poll_table *wait) { + unsigned long req_events = poll_requested_events(wait); struct ivtv_open_id *id = fh2id(filp->private_data); struct ivtv *itv = id->itv; struct ivtv_stream *s = &itv->streams[id->type]; @@ -753,7 +754,8 @@ unsigned int ivtv_v4l2_enc_poll(struct file *filp, poll_table * wait) unsigned res = 0; /* Start a capture if there is none */ - if (!eof && !test_bit(IVTV_F_S_STREAMING, &s->s_flags)) { + if (!eof && !test_bit(IVTV_F_S_STREAMING, &s->s_flags) && + (req_events & (POLLIN | POLLRDNORM))) { int rc; mutex_lock(&itv->serialize_lock); -- 1.7.5.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
[RFCv4 PATCH 0/6]: add poll_requested_events() function
This is the fourth version of this patch series, incorporating the comments from Andrew Morton: I've split up the multiple-assignment line and added a comment explaining the purpose of the new function in poll.h. It's also rebased to the current staging/for_v3.2 branch of the linux-media tree. There are no other changes compared to the RFCv3 patches. I'd very much like to get an Acked-by (or additional comments) from Al or Andrew! This patch series really should go into v3.2 which is getting close. Normally I would have posted this v4 3 weeks ago, but due to Real Life interference in the past few weeks I was unable to. But I'm back, and this is currently the highest priority for me. 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
[RFCv4 PATCH 3/6] videobuf2: only start streaming in poll() if so requested by the poll mask.
From: Hans Verkuil Signed-off-by: Hans Verkuil --- drivers/media/video/videobuf2-core.c |7 +-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/videobuf2-core.c b/drivers/media/video/videobuf2-core.c index 6687ac3..a921638 100644 --- a/drivers/media/video/videobuf2-core.c +++ b/drivers/media/video/videobuf2-core.c @@ -1368,6 +1368,7 @@ static int __vb2_cleanup_fileio(struct vb2_queue *q); */ unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait) { + unsigned long req_events = poll_requested_events(wait); unsigned long flags; unsigned int ret; struct vb2_buffer *vb = NULL; @@ -1376,12 +1377,14 @@ unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait) * Start file I/O emulator only if streaming API has not been used yet. */ if (q->num_buffers == 0 && q->fileio == NULL) { - if (!V4L2_TYPE_IS_OUTPUT(q->type) && (q->io_modes & VB2_READ)) { + if (!V4L2_TYPE_IS_OUTPUT(q->type) && (q->io_modes & VB2_READ) && + (req_events & (POLLIN | POLLRDNORM))) { ret = __vb2_init_fileio(q, 1); if (ret) return POLLERR; } - if (V4L2_TYPE_IS_OUTPUT(q->type) && (q->io_modes & VB2_WRITE)) { + if (V4L2_TYPE_IS_OUTPUT(q->type) && (q->io_modes & VB2_WRITE) && + (req_events & (POLLOUT | POLLWRNORM))) { ret = __vb2_init_fileio(q, 0); if (ret) return POLLERR; -- 1.7.5.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 2/9 v10] V4L: add two new ioctl()s for multi-size videobuffer management
Guennadi Liakhovetski wrote: On Wed, 28 Sep 2011, Sakari Ailus wrote: Hi Guennadi, On Wed, Sep 28, 2011 at 04:56:11PM +0200, Guennadi Liakhovetski wrote: @@ -2099,6 +2103,15 @@ struct v4l2_dbg_chip_ident { __u32 revision;/* chip revision, chip specific */ } __attribute__ ((packed)); +/* VIDIOC_CREATE_BUFS */ +struct v4l2_create_buffers { + __u32 index; /* output: buffers index...index + count - 1 have been created */ + __u32 count; + enum v4l2_memorymemory; + struct v4l2_format format; /* "type" is used always, the rest if sizeimage == 0 */ + __u32 reserved[8]; +}; What about the kerneldoc comments you wrote right after v6 on 1st September for v4l2_create_buffers and the same for the compat32 version? Looks like someone is trying very hard to cause me a heart failure;-) They are in a separate patch: No, I don't! :-) I'm just interested all the appropriate changes are in the patchset. My understanding was you intended to add these changes to the original patches. Are you planning to put them to the same patchset still, or a different one? Cheers, -- Sakari Ailus sakari.ai...@iki.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