All of lore.kernel.org
 help / color / mirror / Atom feed
* enquiry about 4 bpp frame buffer with nibbles swapped
@ 2007-02-20 12:11 Aitor Garcia
  2007-02-21  7:34 ` Geert Uytterhoeven
  0 siblings, 1 reply; 4+ messages in thread
From: Aitor Garcia @ 2007-02-20 12:11 UTC (permalink / raw)
  To: linux-fbdev-devel

Hi all,

I am trying to design a 4 bpp FB driver for iMX1 using
imxfb.c code as 
an starting point.
The problem that I have found is that MX1 video memory
is organised as
follows:

b7 b6 b5 b4  --> pixel 0.
b3 b2 b1 b0  --> pixel 1.

The software that I'm using to display things (Qtopia
Core) assumes a 
different scheme of memory to pixel mapping:

b7 b6 b5 b4 ---> pixel 1.
b3 b2 b1 b0 ---> pixel 0.

The solution to overcome this problem is apparently
easy:

#define SWAP_NIBBLES(in,out) (out=((in&0xf)<<4) |
((in&0xf0)>>4) |\
                                  ((in&0xf00)<<4) |
((in&0xf000)>>4) |\
		                  ((in&0xf0000)<<4) |
((in&0xf00000)>>4) |\
		                  ((in&0xf000000)<<4) |
((in&0xf0000000)>>4))

But I do not know where to do it. 
Frame Buffer has 3 functions cfb_fillrect,
cfb_copyarea and cfb_imageblit which I thought were
the key to solve my problems but Qtopia Core does not
make use
of them.  
imxfb_map_video_memory function or fb_mmap, seem to be
good candidates but I do not know how to progress
further.

I would be very grateful if I could receive some kind
of help.

Best wishes,

Aitor


 
____________________________________________________________________________________
It's here! Your new message!  
Get new email alerts with the free Yahoo! Toolbar.
http://tools.search.yahoo.com/toolbar/features/mail/

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: enquiry about 4 bpp frame buffer with nibbles swapped
  2007-02-20 12:11 enquiry about 4 bpp frame buffer with nibbles swapped Aitor Garcia
@ 2007-02-21  7:34 ` Geert Uytterhoeven
  2007-02-21 21:50   ` James Simmons
  0 siblings, 1 reply; 4+ messages in thread
From: Geert Uytterhoeven @ 2007-02-21  7:34 UTC (permalink / raw)
  To: Aitor Garcia; +Cc: Linux Frame Buffer Device Development

On Tue, 20 Feb 2007, Aitor Garcia wrote:
> I am trying to design a 4 bpp FB driver for iMX1 using
> imxfb.c code as 
> an starting point.
> The problem that I have found is that MX1 video memory
> is organised as
> follows:
> 
> b7 b6 b5 b4  --> pixel 0.
> b3 b2 b1 b0  --> pixel 1.
> 
> The software that I'm using to display things (Qtopia
> Core) assumes a 
> different scheme of memory to pixel mapping:
> 
> b7 b6 b5 b4 ---> pixel 1.
> b3 b2 b1 b0 ---> pixel 0.
> 
> The solution to overcome this problem is apparently
> easy:
> 
> #define SWAP_NIBBLES(in,out) (out=((in&0xf)<<4) |
> ((in&0xf0)>>4) |\
>                                   ((in&0xf00)<<4) |
> ((in&0xf000)>>4) |\
> 		                  ((in&0xf0000)<<4) |
> ((in&0xf00000)>>4) |\
> 		                  ((in&0xf000000)<<4) |
> ((in&0xf0000000)>>4))
> 
> But I do not know where to do it. 
> Frame Buffer has 3 functions cfb_fillrect,
> cfb_copyarea and cfb_imageblit which I thought were
> the key to solve my problems but Qtopia Core does not
> make use
> of them.  

Indeed, cfb_{fillrect,copyarea,imageblit}() are used by the kernel only.

> imxfb_map_video_memory function or fb_mmap, seem to be
> good candidates but I do not know how to progress
> further.

If the order of the nibbles can be configured in hardware, you should do that.
Else I'm afraid you will have to modify Qtopia Core.

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@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

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: enquiry about 4 bpp frame buffer with nibbles swapped
  2007-02-21  7:34 ` Geert Uytterhoeven
@ 2007-02-21 21:50   ` James Simmons
  2007-02-22  8:08     ` Geert Uytterhoeven
  0 siblings, 1 reply; 4+ messages in thread
From: James Simmons @ 2007-02-21 21:50 UTC (permalink / raw)
  To: Linux Frame Buffer Device Development; +Cc: Aitor Garcia, Geert Uytterhoeven


> > But I do not know where to do it. 
> > Frame Buffer has 3 functions cfb_fillrect,
> > cfb_copyarea and cfb_imageblit which I thought were
> > the key to solve my problems but Qtopia Core does not
> > make use
> > of them.  
> 
> Indeed, cfb_{fillrect,copyarea,imageblit}() are used by the kernel only.

Speaking of. Are you using fbcon? If that is the case then your console 
should look messed up.
 
> > imxfb_map_video_memory function or fb_mmap, seem to be
> > good candidates but I do not know how to progress
> > further.
> 
> If the order of the nibbles can be configured in hardware, you should do that.
> Else I'm afraid you will have to modify Qtopia Core.

Can fb_bitfield handle that case ?


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: enquiry about 4 bpp frame buffer with nibbles swapped
  2007-02-21 21:50   ` James Simmons
@ 2007-02-22  8:08     ` Geert Uytterhoeven
  0 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2007-02-22  8:08 UTC (permalink / raw)
  To: James Simmons; +Cc: Aitor Garcia, Linux Frame Buffer Device Development

On Wed, 21 Feb 2007, James Simmons wrote:
> > > But I do not know where to do it. 
> > > Frame Buffer has 3 functions cfb_fillrect,
> > > cfb_copyarea and cfb_imageblit which I thought were
> > > the key to solve my problems but Qtopia Core does not
> > > make use
> > > of them.  
> > 
> > Indeed, cfb_{fillrect,copyarea,imageblit}() are used by the kernel only.
> 
> Speaking of. Are you using fbcon? If that is the case then your console 
> should look messed up.
>  
> > > imxfb_map_video_memory function or fb_mmap, seem to be
> > > good candidates but I do not know how to progress
> > > further.
> > 
> > If the order of the nibbles can be configured in hardware, you should do that.
> > Else I'm afraid you will have to modify Qtopia Core.
> 
> Can fb_bitfield handle that case ?

No, it only handles bits within a pixel. It doesn't handle the order of
pixels within a byte (or word).

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@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

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-02-22  8:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-20 12:11 enquiry about 4 bpp frame buffer with nibbles swapped Aitor Garcia
2007-02-21  7:34 ` Geert Uytterhoeven
2007-02-21 21:50   ` James Simmons
2007-02-22  8:08     ` Geert Uytterhoeven

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.