From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: davinci-linux-open-source@linux.davincidsp.com
Cc: Manjunath Hadli <manjunath.hadli@ti.com>,
LMML <linux-media@vger.kernel.org>,
Hans Verkuil <hverkuil@xs4all.nl>
Subject: Re: [PATCH v3 08/13] davinci: vpif: add support for clipping on output data
Date: Mon, 25 Jun 2012 14:54:39 +0200 [thread overview]
Message-ID: <2408615.OIAyvZB6Tt@avalon> (raw)
In-Reply-To: <1340622455-10419-9-git-send-email-manjunath.hadli@ti.com>
Hi Manjunath,
Thank you for the patch.
On Monday 25 June 2012 16:37:30 Manjunath Hadli wrote:
> add hardware clipping support for VPIF output data. This
> is needed as it is possible that the external encoder
> might get confused between the FF or 00 which are a part
> of the data and that of the SAV or EAV codes.
>
> Signed-off-by: Manjunath Hadli <manjunath.hadli@ti.com>
> Signed-off-by: Lad, Prabhakar <prabhakar.lad@ti.com>
> ---
> drivers/media/video/davinci/vpif.h | 30 +++++++++++++++++++++++++
> drivers/media/video/davinci/vpif_display.c | 10 +++++++++
> include/media/davinci/vpif_types.h | 2 +
> 3 files changed, 42 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/media/video/davinci/vpif.h
> b/drivers/media/video/davinci/vpif.h index a4d2141..c2ce4d9 100644
> --- a/drivers/media/video/davinci/vpif.h
> +++ b/drivers/media/video/davinci/vpif.h
> @@ -211,6 +211,12 @@ static inline void vpif_clr_bit(u32 reg, u32 bit)
> #define VPIF_CH3_INT_CTRL_SHIFT (6)
> #define VPIF_CH_INT_CTRL_SHIFT (6)
>
> +#define VPIF_CH2_CLIP_ANC_EN 14
> +#define VPIF_CH2_CLIP_ACTIVE_EN 13
> +
> +#define VPIF_CH3_CLIP_ANC_EN 14
> +#define VPIF_CH3_CLIP_ACTIVE_EN 13
> +
> /* enabled interrupt on both the fields on vpid_ch0_ctrl register */
> #define channel0_intr_assert() (regw((regr(VPIF_CH0_CTRL)|\
> (VPIF_INT_BOTH << VPIF_CH0_INT_CTRL_SHIFT)), VPIF_CH0_CTRL))
> @@ -515,6 +521,30 @@ static inline void channel3_raw_enable(int enable, u8
> index) vpif_clr_bit(VPIF_CH3_CTRL, mask);
> }
>
> +/* function to enable clipping (for both active and blanking regions) on ch
> 2 */ +static inline void channel2_clipping_enable(int enable)
> +{
> + if (enable) {
> + vpif_set_bit(VPIF_CH2_CTRL, VPIF_CH2_CLIP_ANC_EN);
> + vpif_set_bit(VPIF_CH2_CTRL, VPIF_CH2_CLIP_ACTIVE_EN);
> + } else {
> + vpif_clr_bit(VPIF_CH2_CTRL, VPIF_CH2_CLIP_ANC_EN);
> + vpif_clr_bit(VPIF_CH2_CTRL, VPIF_CH2_CLIP_ACTIVE_EN);
> + }
> +}
> +
> +/* function to enable clipping (for both active and blanking regions) on ch
> 2 */ +static inline void channel3_clipping_enable(int enable)
> +{
> + if (enable) {
> + vpif_set_bit(VPIF_CH3_CTRL, VPIF_CH3_CLIP_ANC_EN);
> + vpif_set_bit(VPIF_CH3_CTRL, VPIF_CH3_CLIP_ACTIVE_EN);
> + } else {
> + vpif_clr_bit(VPIF_CH3_CTRL, VPIF_CH3_CLIP_ANC_EN);
> + vpif_clr_bit(VPIF_CH3_CTRL, VPIF_CH3_CLIP_ACTIVE_EN);
> + }
> +}
> +
> /* inline function to set buffer addresses in case of Y/C non mux mode */
> static inline void ch2_set_videobuf_addr_yc_nmux(unsigned long
> top_strt_luma, unsigned long btm_strt_luma,
> diff --git a/drivers/media/video/davinci/vpif_display.c
> b/drivers/media/video/davinci/vpif_display.c index 61ea8bc..4436ef6 100644
> --- a/drivers/media/video/davinci/vpif_display.c
> +++ b/drivers/media/video/davinci/vpif_display.c
> @@ -1046,6 +1046,8 @@ static int vpif_streamon(struct file *file, void
> *priv, channel2_intr_assert();
> channel2_intr_enable(1);
> enable_channel2(1);
> + if (vpif_config_data->ch2_clip_en)
> + channel2_clipping_enable(1);
> }
>
> if ((VPIF_CHANNEL3_VIDEO == ch->channel_id)
> @@ -1053,6 +1055,8 @@ static int vpif_streamon(struct file *file, void
> *priv, channel3_intr_assert();
> channel3_intr_enable(1);
> enable_channel3(1);
> + if (vpif_config_data->ch3_clip_en)
> + channel3_clipping_enable(1);
> }
> channel_first_int[VPIF_VIDEO_INDEX][ch->channel_id] = 1;
> }
> @@ -1065,6 +1069,8 @@ static int vpif_streamoff(struct file *file, void
> *priv, struct vpif_fh *fh = priv;
> struct channel_obj *ch = fh->channel;
> struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
> + struct vpif_display_config *vpif_config_data =
> + vpif_dev->platform_data;
>
> if (buftype != V4L2_BUF_TYPE_VIDEO_OUTPUT) {
> vpif_err("buffer type not supported\n");
> @@ -1084,11 +1090,15 @@ static int vpif_streamoff(struct file *file, void
> *priv, if (buftype == V4L2_BUF_TYPE_VIDEO_OUTPUT) {
> /* disable channel */
> if (VPIF_CHANNEL2_VIDEO == ch->channel_id) {
> + if (vpif_config_data->ch2_clip_en)
> + channel2_clipping_enable(0);
> enable_channel2(0);
> channel2_intr_enable(0);
> }
> if ((VPIF_CHANNEL3_VIDEO == ch->channel_id) ||
> (2 == common->started)) {
> + if (vpif_config_data->ch3_clip_en)
> + channel3_clipping_enable(0);
> enable_channel3(0);
> channel3_intr_enable(0);
> }
> diff --git a/include/media/davinci/vpif_types.h
> b/include/media/davinci/vpif_types.h index bd8217c..d8f6ab1 100644
> --- a/include/media/davinci/vpif_types.h
> +++ b/include/media/davinci/vpif_types.h
> @@ -50,6 +50,8 @@ struct vpif_display_config {
> const char **output;
> int output_count;
> const char *card_name;
> + bool ch2_clip_en;
> + bool ch3_clip_en;
Instead of hardcoding this in platform data, I think it would be better to
make this runtime-configurable. One option is to use the value of the
v4l2_pix_format::colorspace field configured by userspace. We already have
V4L2_COLORSPACE_JPEG which maps to the full 0-255 range, but we're missing a
colorspace for the clipped 1-254 range used by the VPIF and I'm not sure
whether it would really make sense to add one. Another option is to use a V4L2
control.
> };
>
> struct vpif_input {
--
Regards,
Laurent Pinchart
next parent reply other threads:[~2012-06-25 12:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1340622455-10419-1-git-send-email-manjunath.hadli@ti.com>
[not found] ` <1340622455-10419-9-git-send-email-manjunath.hadli@ti.com>
2012-06-25 12:54 ` Laurent Pinchart [this message]
2012-06-25 13:08 ` [PATCH v3 08/13] davinci: vpif: add support for clipping on output data Hans Verkuil
2012-06-25 13:18 ` Laurent Pinchart
2012-06-25 13:23 ` Hans Verkuil
2012-06-28 9:50 ` Hadli, Manjunath
[not found] ` <1340622455-10419-10-git-send-email-manjunath.hadli@ti.com>
2012-06-25 12:56 ` [PATCH v3 09/13] davinci: vpif display: Add power management support Laurent Pinchart
2012-06-28 9:56 ` Hadli, Manjunath
[not found] ` <1340622455-10419-11-git-send-email-manjunath.hadli@ti.com>
2012-06-25 12:57 ` [PATCH v3 10/13] davinci: vpif capture:Add " Laurent Pinchart
2012-06-28 9:54 ` Hadli, Manjunath
[not found] ` <1340622455-10419-5-git-send-email-manjunath.hadli@ti.com>
2012-06-26 10:36 ` [PATCH v3 04/13] davinci: vpif: fix setting of data width in config_vpif_params() function Sergei Shtylyov
2012-06-28 9:52 ` Hadli, Manjunath
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2408615.OIAyvZB6Tt@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=davinci-linux-open-source@linux.davincidsp.com \
--cc=hverkuil@xs4all.nl \
--cc=linux-media@vger.kernel.org \
--cc=manjunath.hadli@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox