Re: [PATCH 2.6.19-rc1 full] drivers: add LCD support

Miguel Ojeda
2006-10-27T20:25:08Z

On 10/27/06, Franck Bui-Huu <vagabon.xyz@gmail.com> wrote:
> On 10/26/06, Miguel Ojeda <maxextreme@gmail.com> wrote:
> > To be clearer. And you are wrong: you can write other modules which
> > want to know what the LCD is showing, or use it; without worrying
> > about framebuffer things. They can read / write "cfag12864b_buffer" as
> > well as cfag12864bfb do. Why not?
> >
>
> Suppose I'm writing a user space application which uses your frame
> buffer driver. I would naturaly mmap your device since it's the
> easiest way to use a frame buffer. Now I want to display as fast as
> possible a set of images. How am I sure that each image is sent to the
> lcd ? For example, suppose the application just finished to copy image
> A into the buffer, and now it starts to copy image B into the buffer
> but the work queue has not been scheduled yet...
>

Refresh rate is fixed in this driver (the user can change it to other
value at Kconfig or at loading time as a module parameter).

An application should not refresh images so fast (the LCD controller
can handle it, but the readability is pretty bad). Having a refresh
rate like 10 Hz for example, the application can be sure all images
are displayed. Anyway, an animation of 10 Hz wouldn't be fine at this
kind of LCDs, so it is pointless which the refresh rate of the driver
is, as it is not useful to display images as fast as the driver
refresh the LCD.

(I don't know if I'm explaining myself...)

>
> Futhermore I'm not sure it's a common use case for such device, is it
> ? I would say that the usual case for such LCD is to display an image
> every now and then. If so do we really need to give the possibility to
> mmap the device ? Is a simple synchrone write() enough ?
>

Well, you can show a set of images, animations... althought it's not
so useful. Usual cases:
1. Display a static image / info.
2. Display refreshed info every X seconds (like % usage of CPU and so
on, the music you are listening to...)
3. Display, maybe, a animated graph (like the wave created by your
music), althought this one is not so usual, as it changes much more
quickly than [2]. Still, there are apps in other SOs that show such
kind of info.

Well, mmaping is the best option, as it is the easiest and the
fastest. Any use will be better using mmaping than doing synchrone
write(). Yes, many uses just need a write() call, but other uses would
need mmap.

> BTW how can the application retrieve the refresh rate from the driver ?
>

Hum, right now one way is:

$ cat /sys/module/cfag12864b/parameters/cfag12864b_rate

Yes, a more generic option would be better. Do the fbdevices have some
standard way to retrieve such kind of info (like the bits per pixel,
width, height...)? If not, which would be a good to retrieve the
refresh rate?

Anyway, a application which would like to use this LCD should know its
specs and the user knows he shouldn't change the refresh rate without
a good reason. If a user changes it to other value, he knows he can be
breaking the apps, the same way you can break your kernel adding
things you shouldn't; also the driver could stop working properly at
higher rates.

>
> Franck
>