All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Sakari Ailus <sakari.ailus@iki.fi>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH v3 9/9] omap3isp: preview: Shorten shadow update delay
Date: Tue, 17 Apr 2012 18:09:27 +0200	[thread overview]
Message-ID: <2049798.AIViuaqhSZ@avalon> (raw)
In-Reply-To: <20120417142600.GD5356@valkosipuli.localdomain>

Hi Sakari,

On Tuesday 17 April 2012 17:26:00 Sakari Ailus wrote:
> Hi Laurent,
> 
> Many thanks for the patch!!

And thank you for the review.

> On Mon, Apr 16, 2012 at 03:29:54PM +0200, Laurent Pinchart wrote:
> > When applications modify preview engine parameters, the new values are
> > applied to the hardware by the preview engine interrupt handler during
> > vertical blanking. If the parameters are being changed when the
> > interrupt handler is called, it just delays applying the parameters
> > until the next frame.
> > 
> > If an application modifies the parameters for every frame, and the
> > preview engine interrupt is triggerred synchronously, the parameters are
> > never applied to the hardware.
> > 
> > Fix this by storing new parameters in a shadow copy, and switch the
> > active parameters with the shadow values atomically.
> > 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> > 
> >  drivers/media/video/omap3isp/isppreview.c |  298 +++++++++++++++---------
> >  drivers/media/video/omap3isp/isppreview.h |   21 ++-
> >  2 files changed, 212 insertions(+), 107 deletions(-)
> > 
> > diff --git a/drivers/media/video/omap3isp/isppreview.c
> > b/drivers/media/video/omap3isp/isppreview.c index e12df2c..5ccfe46 100644
> > --- a/drivers/media/video/omap3isp/isppreview.c
> > +++ b/drivers/media/video/omap3isp/isppreview.c
> > @@ -649,12 +649,18 @@ preview_config_rgb_to_ycbcr(struct isp_prev_device
> > *prev, const void *prev_csc)
>
> Not related to this patch, but shouldn't the above function be called
> preview_config_csc()?

That would make sense, yes. I'll add a patch for that.

> >  static void
> >  preview_update_contrast(struct isp_prev_device *prev, u8 contrast)
> >  {
> > -	struct prev_params *params = &prev->params;
> > +	struct prev_params *params;
> > +	unsigned long flags;
> > +
> > +	spin_lock_irqsave(&prev->params.lock, flags);
> > +	params = (prev->params.active & OMAP3ISP_PREV_CONTRAST)
> > +	       ? &prev->params.params[0] : &prev->params.params[1];
> > 
> >  	if (params->contrast != (contrast * ISPPRV_CONTRAST_UNITS)) {
> >  		params->contrast = contrast * ISPPRV_CONTRAST_UNITS;
> > -		prev->update |= OMAP3ISP_PREV_CONTRAST;
> > +		params->update |= OMAP3ISP_PREV_CONTRAST;
> >  	}
> > +	spin_unlock_irqrestore(&prev->params.lock, flags);
> >  }
> >  
> >  /*
> > @@ -681,12 +687,18 @@ preview_config_contrast(struct isp_prev_device
> > *prev, const void *params)
> >  static void
> >  preview_update_brightness(struct isp_prev_device *prev, u8 brightness)
> >  {
> > -	struct prev_params *params = &prev->params;
> > +	struct prev_params *params;
> > +	unsigned long flags;
> > +
> > +	spin_lock_irqsave(&prev->params.lock, flags);
> > +	params = (prev->params.active & OMAP3ISP_PREV_CONTRAST)
> > +	       ? &prev->params.params[0] : &prev->params.params[1];
> 
> params = prev->params.params[!(prev->params.active &
> OMAP3ISP_PREV_CONTRAST)];

I've thought about that, but it doesn't fit on a single line. After being 
split in two lines the result is less readable in my opinion. Do you think I 
should change it nonetheless ?

> Same in contrast.
> 
> And shouldn't this be brightness here btw.?

Good point. Fixed.

> >  	if (params->brightness != (brightness * ISPPRV_BRIGHT_UNITS)) {
> >  		params->brightness = brightness * ISPPRV_BRIGHT_UNITS;
> > -		prev->update |= OMAP3ISP_PREV_BRIGHTNESS;
> > +		params->update |= OMAP3ISP_PREV_BRIGHTNESS;
> >  	}
> > +	spin_unlock_irqrestore(&prev->params.lock, flags);
> >  }

-- 
Regards,

Laurent Pinchart


  reply	other threads:[~2012-04-17 16:09 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-16 13:29 [PATCH v3 0/9] OMAP3 ISP preview engine configuration improvement Laurent Pinchart
2012-04-16 13:29 ` [PATCH v3 1/9] omap3isp: preview: Skip brightness and contrast in configuration ioctl Laurent Pinchart
2012-04-16 13:29 ` [PATCH v3 2/9] omap3isp: preview: Optimize parameters setup for the common case Laurent Pinchart
2012-04-16 17:03   ` Sakari Ailus
2012-04-16 13:29 ` [PATCH v3 3/9] omap3isp: preview: Remove averager parameter update flag Laurent Pinchart
2012-04-16 13:29 ` [PATCH v3 4/9] omap3isp: preview: Remove unused isptables_update structure definition Laurent Pinchart
2012-04-16 13:29 ` [PATCH v3 5/9] omap3isp: preview: Merge configuration and feature bits Laurent Pinchart
2012-04-16 17:08   ` Sakari Ailus
2012-04-16 13:29 ` [PATCH v3 6/9] omap3isp: preview: Remove update_attrs feature_bit field Laurent Pinchart
2012-04-16 18:00   ` Sakari Ailus
2012-04-16 13:29 ` [PATCH v3 7/9] omap3isp: preview: Rename prev_params fields to match userspace API Laurent Pinchart
2012-04-16 18:46   ` Sakari Ailus
2012-04-16 13:29 ` [PATCH v3 8/9] omap3isp: preview: Simplify configuration parameters access Laurent Pinchart
2012-04-16 20:01   ` Sakari Ailus
2012-04-16 13:29 ` [PATCH v3 9/9] omap3isp: preview: Shorten shadow update delay Laurent Pinchart
2012-04-17 14:26   ` Sakari Ailus
2012-04-17 16:09     ` Laurent Pinchart [this message]
2012-04-17 18:41       ` Sakari Ailus

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=2049798.AIViuaqhSZ@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@iki.fi \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.