mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Juergen Beisert <jbe@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 03/12] Bring in dynamic videomode selection at runtime
Date: Mon, 15 Nov 2010 11:04:52 +0100	[thread overview]
Message-ID: <201011151104.52552.jbe@pengutronix.de> (raw)
In-Reply-To: <20101101134714.GX6017@pengutronix.de>

Sascha Hauer wrote:
> [...]
> > +	fb_dev->priv = cdev;	/* pointer forward */
> > +	cdev->dev = fb_dev;	/* pointer backward */
> > +
> > +	cdev->ops = &fb_ops;
> > +	cdev->name = asprintf("fb%d", id);
> > +
> > +	cdev->size = fb_dev->size;	/* use the default if any */
> > +	cdev->priv = info;
> > +
> > +	info->host = host;
> > +	info->fb_dev = fb_dev;
> > +
> > +	/* setup defaults */
> > +	if (host->bits_per_pixel != 0)
> > +		info->bits_per_pixel = host->bits_per_pixel;
> > +	else
> > +		info->bits_per_pixel = 16;	/* means RGB565 */
>
> No, this does not mean RGB565. It could also mean BGR or even something
> else.

You are right. But currently it means exactly what I wrote. All drivers 
currently using RGB565 for 16 bpp. To make it as you stated, we need more 
information about the bits per colour and their layout. Currently the 
graphics drivers do it in their own way. No way to intervent from the 
platform file.

> > +
> > +	/* add params on demand */
>
> There is no information in this comment.

Yes and no ;-) But when "CONFIG_VIDEO_DELAY_INIT" is gone also this feature is 
gone.

> > +	add_fb_parameter(fb_dev);
> > +
> > +	devfs_create(cdev);
> > +#ifndef CONFIG_VIDEO_DELAY_INIT
> > +	/* initialize video mode immediately (the first one) */
> > +	fb_activate_mode(fb_dev, &host->mode[0]);
> > +#endif
> > +	return 0;
> > +}
> > +
> > +static struct driver_d fb_driver = {
> > +	.name	= "framebuffer",
> > +	.probe	= fb_probe,
> > +};
> > +
> > +static int framebuffer_init(void)
> > +{
> > +	return register_driver(&fb_driver);
> > +}
> > +
> > +device_initcall(framebuffer_init);
> > +
> > +struct device_d *register_framebuffer(struct fb_host *host, void *base,
> > unsigned size) +{
> > +	struct device_d *fb_dev;
> > +	int rc;
> > +
> > +	fb_dev = xzalloc(sizeof(struct device_d));
> > +
> > +	strcpy(fb_dev->name, fb_driver.name);
> > +	fb_dev->platform_data = (void*)host;
> > +
> > +	/* setup the defaults for this framebuffer if given */
> > +	fb_dev->size = size;
> > +	fb_dev->map_base = (unsigned long)base;
> > +
> > +	rc = register_device(fb_dev);
> > +	if (rc != 0) {
> > +		pr_debug("Cannot register framebuffer device\n");
> > +		free(fb_dev);
> > +		return NULL;
> > +	}
> > +
> > +	return fb_dev;
> > +}
> > +#endif
> > +
> >  int register_framebuffer(struct fb_info *info)
> >  {
> >  	int id = get_free_deviceid("fb");
> > diff --git a/include/fb.h b/include/fb.h
> > index 218b244..96edc24 100644
> > --- a/include/fb.h
> > +++ b/include/fb.h
> > @@ -85,6 +85,46 @@ struct fb_ops {
> >  	void (*fb_disable)(struct fb_info *info);
> >  };
> >
> > +#if 0
> > +struct fb_host {
> > +	const struct fb_videomode *mode;
> > +	unsigned mode_cnt;
> > +
> > +	struct device_d *hw_dev;
> > +
> > +	/* callbacks into the video hardware driver */
> > +	int (*fb_setcolreg)(struct fb_info*, unsigned, unsigned, unsigned,
> > unsigned, unsigned); +	int (*fb_mode)(struct fb_info*, const struct
> > fb_videomode*);
> > +	void (*fb_enable)(struct fb_info*);
> > +	void (*fb_disable)(struct fb_info*);
> > +
> > +	unsigned bits_per_pixel;
> > +};
> > +
> > +struct fb_info {
> > +	struct fb_host *host;
> > +	struct device_d *fb_dev;
> > +	const struct fb_videomode *active_mode;
> > +
> > +	u32 xres;			/* visible resolution		*/
> > +	u32 yres;
> > +	u32 bits_per_pixel;		/* guess what			*/
> > +
> > +	u32 grayscale;			/* != 0 Graylevels instead of colors */
> > +
> > +	struct fb_bitfield red;		/* bitfield in fb mem if true color, */
> > +	struct fb_bitfield green;	/* else only length is significant */
> > +	struct fb_bitfield blue;
> > +	struct fb_bitfield transp;	/* transparency			*/
>
> If you go the way of duplicating the code and removing the old code
> afterwards I would assume that you add the code in the right way and
> start to add doxygen from the beginning instead of fixing it later.

I tried. But it makes the patch unreadable due to the fact it touches more 
lines than required for the code itself. And I know you don't like patches 
with too many '+' and '-' lines in...

jbe

-- 
Pengutronix e.K.                              | Juergen Beisert             |
Linux Solutions for Science and Industry      | Phone: +49-8766-939 228     |
Vertretung Sued/Muenchen, Germany             | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686              | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2010-11-15 10:10 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-26 11:31 [PATCHv2] Add dynamic video initialization to barebox Juergen Beisert
2010-10-26 11:31 ` [PATCH 01/12] Separate framebuffer platformdata and the videomode Juergen Beisert
2010-10-26 11:31 ` [PATCH 02/12] Add more flags for sync control Juergen Beisert
2010-10-26 11:31 ` [PATCH 03/12] Bring in dynamic videomode selection at runtime Juergen Beisert
2010-11-01 13:47   ` Sascha Hauer
2010-11-15 10:04     ` Juergen Beisert [this message]
2010-11-17  8:27       ` Sascha Hauer
2010-11-01 14:16   ` Sascha Hauer
2010-11-15 10:08     ` Juergen Beisert
2010-10-26 11:31 ` [PATCH 04/12] Remove the old videomode functions Juergen Beisert
2010-10-26 11:31 ` [PATCH 05/12] Add verbose framebuffer device info Juergen Beisert
2010-10-26 11:31 ` [PATCH 06/12] Adapt the existing imx fb driver to support runtime videomode selection Juergen Beisert
2010-10-26 11:31 ` [PATCH 07/12] Adapt the existing imx-ipu " Juergen Beisert
2010-10-26 11:31 ` [PATCH 08/12] Add a video driver for S3C2440 bases platforms Juergen Beisert
2010-11-01 14:41   ` Sascha Hauer
2010-11-15 11:35     ` Juergen Beisert
2010-11-17  8:36       ` Sascha Hauer
2010-10-26 11:31 ` [PATCH 09/12] STM378x: Add video driver for this platform Juergen Beisert
2010-10-26 11:31 ` [PATCH 10/12] Remove variable size restrictions Juergen Beisert
2010-10-26 11:31 ` [PATCH 11/12] Add doxygen documentation to the framebfuffer code Juergen Beisert
2010-10-26 11:31 ` [PATCH 12/12] Provide more driver specific data in a videomode Juergen Beisert
2010-11-01 13:19 ` [PATCHv2] Add dynamic video initialization to barebox Sascha Hauer
2010-11-01 13:29   ` Eric Bénard
2010-11-01 14:18     ` Sascha Hauer
2010-11-15  9:57   ` Juergen Beisert
2010-11-15 10:25     ` Belisko Marek
2010-11-17  8:44       ` Sascha Hauer
2010-11-18  8:18         ` Belisko Marek
2010-11-18 10:09           ` Sascha Hauer
2010-11-17  8:43     ` Sascha Hauer

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=201011151104.52552.jbe@pengutronix.de \
    --to=jbe@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /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