Discussion:
[uClinux-dev] framebuffer/console question
angelo
2012-09-17 12:29:51 UTC
Permalink
Hi all,

i have a working coldfire board, running uClinux. I connected a 128x64
monochrome lcd on gpio, and written a framebuffer driver.
From userspace i can now write on "/dev/fb0" and see some images properly.

My question now is about console. Just for playing, i am trying to see
the console output on the LCD. Even if very small, this should be
possible, as i enabled the "console framebuffer" driver and some fonts.

Once i booted linux, i try an echo "test" > /dev/console, something
seems to happen on the screen, some pixels are cleared, but i don't see
nothing similar to font chars.

I read fb and fbcon docs, but i couldn't find any document that explain
if console fb driver (fbcon) can be used with some fb drivers only (like
vesfb), or with any fb driver. So my question is: is it possible or i
should add/create some additional driver ?


many thanks
angelo
--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.uclinux.org/pipermail/uclinux-dev/attachments/20120917/ef23e72f/attachment.html>
Geert Uytterhoeven
2012-09-20 19:19:06 UTC
Permalink
Hi Angelo,
Post by angelo
i have a working coldfire board, running uClinux. I connected a 128x64
monochrome lcd on gpio, and written a framebuffer driver.
On gpio, so it's not memory mapped?
Post by angelo
From userspace i can now write on "/dev/fb0" and see some images properly.
Good.
Post by angelo
My question now is about console. Just for playing, i am trying to see the
console output on the LCD. Even if very small, this should be possible, as i
enabled the "console framebuffer" driver and some fonts.
OK.
Post by angelo
Once i booted linux, i try an echo "test" > /dev/console, something seems to
happen on the screen, some pixels are cleared, but i don't see nothing
similar to font chars.
Strange.
Post by angelo
I read fb and fbcon docs, but i couldn't find any document that explain if
console fb driver (fbcon) can be used with some fb drivers only (like
vesfb), or with any fb driver. So my question is: is it possible or i should
add/create some additional driver ?
The console should work, assumed you provided the proper drawing operations
in your struct fb_ops. E.g. for simple packed monochrome:

.fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea,
.fb_imageblit = cfb_imageblit,

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Angelo Dureghello
2012-09-21 22:47:27 UTC
Permalink
Hi Geert,

thanks for your help.

For now the LCD is mapped on the parallel port PP0/PP16.

Yes, everytime i draw from userspace using "write" on /dev/fb i correctly see the image.
Same if i "echo somegarbage > /dev/fb" i can see some pixel drawn correctly.

The three functions in fb_opts are there, mapped and implemented.

Still, nothing on the lcd on boot.
If i "echo something > /dev/console" i see part of the first line of pixels cleared.

This is my boot line
CONFIG_BOOTPARAM_STRING="root=/dev/mtdblock3 rootfstype=romfs init=/bin/init video=amcorefb console=tty0"

Some related configs

#
# Frame buffer hardware drivers
#
CONFIG_FB_AMCORE=y

#
# Graphics support
#
# CONFIG_VGASTATE is not set
CONFIG_VIDEO_OUTPUT_CONTROL=y
CONFIG_FB=y
# CONFIG_FIRMWARE_EDID is not set
# CONFIG_FB_DDC is not set
# CONFIG_FB_BOOT_VESA_SUPPORT is not set
# CONFIG_FB_CFB_FILLRECT is not set
# CONFIG_FB_CFB_COPYAREA is not set
# CONFIG_FB_CFB_IMAGEBLIT is not set
# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
CONFIG_FB_SYS_FILLRECT=y
CONFIG_FB_SYS_COPYAREA=y
CONFIG_FB_SYS_IMAGEBLIT=y
# CONFIG_FB_FOREIGN_ENDIAN is not set
# CONFIG_FB_SYS_FOPS is not set
# CONFIG_FB_SVGALIB is not set
# CONFIG_FB_MACMODES is not set
# CONFIG_FB_BACKLIGHT is not set
# CONFIG_FB_MODE_HELPERS is not set
# CONFIG_FB_TILEBLITTING is not set

#
# Character devices
#
CONFIG_VT=y
CONFIG_CONSOLE_TRANSLATIONS=y
CONFIG_VT_CONSOLE=y
CONFIG_HW_CONSOLE=y
CONFIG_VT_HW_CONSOLE_BINDING=y
# CONFIG_DEVKMEM is not set
# CONFIG_SERIAL_NONSTANDARD is not set
# CONFIG_N_GSM is not set


While i work on it every help is appreciated.

Many thanks
angelo
Post by Geert Uytterhoeven
Hi Angelo,
Post by angelo
i have a working coldfire board, running uClinux. I connected a 128x64
monochrome lcd on gpio, and written a framebuffer driver.
On gpio, so it's not memory mapped?
Post by angelo
From userspace i can now write on "/dev/fb0" and see some images properly.
Good.
Post by angelo
My question now is about console. Just for playing, i am trying to see the
console output on the LCD. Even if very small, this should be possible, as i
enabled the "console framebuffer" driver and some fonts.
OK.
Post by angelo
Once i booted linux, i try an echo "test" > /dev/console, something seems to
happen on the screen, some pixels are cleared, but i don't see nothing
similar to font chars.
Strange.
Post by angelo
I read fb and fbcon docs, but i couldn't find any document that explain if
console fb driver (fbcon) can be used with some fb drivers only (like
vesfb), or with any fb driver. So my question is: is it possible or i should
add/create some additional driver ?
The console should work, assumed you provided the proper drawing operations
.fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea,
.fb_imageblit = cfb_imageblit,
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Angelo Dureghello
2012-09-22 21:38:38 UTC
Permalink
Hi Geert,

well, i finally have it working.

I had to set some values inside my fb driver to see the fonts:

static struct fb_fix_screeninfo amcorefb_fix __initdata = {
.id = "amcorefb",
.type = FB_TYPE_PACKED_PIXELS,
.visual = FB_VISUAL_MONO10,
.xpanstep = 0,
.ypanstep = 1,
.ywrapstep = 0,
.accel = FB_ACCEL_NONE,
.line_length = (128/8),
};

static struct fb_var_screeninfo amcorefb_var __initdata = {
.xres = 128,
.yres = 64,
.xres_virtual = 128,
.yres_virtual = 64,
.bits_per_pixel = 1,
.nonstd = 1,
};

and also

info->var.red.offset = 0;
info->var.red.length = info->var.bits_per_pixel;
info->var.green = info->var.red;
info->var.blue = info->var.red;

inside probe function. As above, RGB structs values must be initialized, otherwise nothing is displayed.


I still have a problem. Every single fonts is now displayed mirrored to left. But entire text go left to right correctly. Seems to be a "bit" endiannes issue inside a byte. This should be easy to solve.

Thanks again
angelo
Post by Geert Uytterhoeven
Hi Angelo,
Post by angelo
i have a working coldfire board, running uClinux. I connected a 128x64
monochrome lcd on gpio, and written a framebuffer driver.
On gpio, so it's not memory mapped?
Post by angelo
From userspace i can now write on "/dev/fb0" and see some images properly.
Good.
Post by angelo
My question now is about console. Just for playing, i am trying to see the
console output on the LCD. Even if very small, this should be possible, as i
enabled the "console framebuffer" driver and some fonts.
OK.
Post by angelo
Once i booted linux, i try an echo "test" > /dev/console, something seems to
happen on the screen, some pixels are cleared, but i don't see nothing
similar to font chars.
Strange.
Post by angelo
I read fb and fbcon docs, but i couldn't find any document that explain if
console fb driver (fbcon) can be used with some fb drivers only (like
vesfb), or with any fb driver. So my question is: is it possible or i should
add/create some additional driver ?
The console should work, assumed you provided the proper drawing operations
.fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea,
.fb_imageblit = cfb_imageblit,
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Continue reading on narkive:
Loading...