linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: linux-fbdev@vger.kernel.org
Subject: Re: [PATCH 33/57] fbdev: sh_mobile_lcdc: Add sh_mobile_format_info() function
Date: Wed, 14 Dec 2011 11:30:24 +0000	[thread overview]
Message-ID: <201112141230.28142.laurent.pinchart@ideasonboard.com> (raw)
In-Reply-To: <1323784972-24205-34-git-send-email-laurent.pinchart@ideasonboard.com>

Hi Damian,

On Wednesday 14 December 2011 04:04:52 Damian Hobson-Garcia wrote:
> On 2011/12/13 23:02, Laurent Pinchart wrote:
> > --- a/drivers/video/sh_mobile_lcdcfb.c
> > +++ b/drivers/video/sh_mobile_lcdcfb.c
> > @@ -447,6 +447,75 @@ static int sh_mobile_lcdc_display_notify(struct
> > sh_mobile_lcdc_chan *ch,
> > 
> >   * Format helpers
> >   */
> > 
> > +struct sh_mobile_lcdc_format_info {
> > +	u32 fourcc;
> > +	unsigned int bpp;
> > +	bool yuv;
> > +	u32 lddfr;
> > +};
> > +
> > +static const struct sh_mobile_lcdc_format_info sh_mobile_format_infos[]
> > = { +	{
> > +		.fourcc = V4L2_PIX_FMT_RGB565,
> > +		.bpp = 12,
> 
> I think that this should be 16 instead of 12.

Oops, you're right. Thanks. I'll fix that.

> > @@ -665,37 +726,20 @@ static void __sh_mobile_lcdc_start(struct
> > sh_mobile_lcdc_priv *priv)
> > 
> >  	/* Setup geometry, format, frame buffer memory and operation mode. */
> >  	for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
> > 
> > +		const struct sh_mobile_lcdc_format_info *format;
> > +		u32 fourcc;
> > +
> > 
> >  		ch = &priv->ch[k];
> >  		if (!ch->enabled)
> >  		
> >  			continue;
> >  		
> >  		sh_mobile_lcdc_geometry(ch);
> > 
> > -		switch (sh_mobile_format_fourcc(&ch->info->var)) {
> > -		case V4L2_PIX_FMT_RGB565:
> > -			tmp = LDDFR_PKF_RGB16;
> > -			break;
> > -		case V4L2_PIX_FMT_BGR24:
> > -			tmp = LDDFR_PKF_RGB24;
> > -			break;
> > -		case V4L2_PIX_FMT_BGR32:
> > -			tmp = LDDFR_PKF_ARGB32;
> > -			break;
> > -		case V4L2_PIX_FMT_NV12:
> > -		case V4L2_PIX_FMT_NV21:
> > -			tmp = LDDFR_CC | LDDFR_YF_420;
> > -			break;
> > -		case V4L2_PIX_FMT_NV16:
> > -		case V4L2_PIX_FMT_NV61:
> > -			tmp = LDDFR_CC | LDDFR_YF_422;
> > -			break;
> > -		case V4L2_PIX_FMT_NV24:
> > -		case V4L2_PIX_FMT_NV42:
> > -			tmp = LDDFR_CC | LDDFR_YF_444;
> > -			break;
> > -		}
> > +		fourcc = sh_mobile_format_fourcc(&ch->info->var);
> > +		format = sh_mobile_format_info(fourcc);
> > +		tmp = format->lddfr;
> 
> Do you need to check if format is NULL here?

The fourcc is validated in both sh_mobile_lcdc_channel_init() (for the value 
passed to the driver through platform data) and sh_mobile_check_var() (for the 
value requested by userspace). format should thus never be NULL here.

-- 
Regards,

Laurent Pinchart

  parent reply	other threads:[~2011-12-14 11:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-13 14:02 [PATCH 33/57] fbdev: sh_mobile_lcdc: Add sh_mobile_format_info() function Laurent Pinchart
2011-12-14  3:04 ` [PATCH 33/57] fbdev: sh_mobile_lcdc: Add sh_mobile_format_info() Damian Hobson-Garcia
2011-12-14 11:30 ` Laurent Pinchart [this message]
2011-12-15 22:17 ` Guennadi Liakhovetski

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=201112141230.28142.laurent.pinchart@ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=linux-fbdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).