linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Frame buffer / mmap() weirdness
@ 1999-11-30 22:06 Stephen Edie
  1999-11-30 21:19 ` Geert Uytterhoeven
  0 siblings, 1 reply; 12+ messages in thread
From: Stephen Edie @ 1999-11-30 22:06 UTC (permalink / raw)
  To: linuxppc-dev, yellowdog-devel


Hello,

I have been noticing some strange behavior while working with Linux frame
buffer devices on PPC.  Perhaps I am just doing something stupid.  I open
the frame buffer using:

fbdev_handle = open("/dev/fb0", O_RDWR);

I can draw to the frame buffer using:

lseek(fbdev_handle, 0, SEEK_SET);
write(fbdev_handle, pixmap, size);

This part works fine.  What causes problems is attempting to memory map
the frame buffer using:

address = mmap(0, screen.height * screen.stride * screen.bpp / 8,
               PROT_READ | PROT_WRITE, MAP_SHARED, fbdev_handle, 0);

When doing this, address[0] points outside of the video memory and
strangely enough, address[512] points to the first pixel in memory!  So if
I do the following, everything works as expected:

address = (char *)(mmap(0, screen.height * screen.stride * screen.bpp / 8
                        + 512, PROT_READ | PROT_WRITE, MAP_SHARED,
                        fbdev_handle, 0)) + 512;

I don't think this is right!  Is this a kernel bug in the frame buffer
driver code?  (This is being tested using OFFB by the way)  Is there
something weird going on here with page alignment or something?

Thanks,
Stephen

Terra Soft Solutions, Inc.
   Yellow Dog Linux
   "The Ultimate Companion for a Dedicated Server"
   http://www.yellowdoglinux.com/


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

end of thread, other threads:[~1999-12-01 15:06 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-11-30 22:06 Frame buffer / mmap() weirdness Stephen Edie
1999-11-30 21:19 ` Geert Uytterhoeven
1999-11-30 22:43   ` Stephen Edie
1999-12-01  7:28     ` Geert Uytterhoeven
1999-12-01  8:16       ` Momchil Velikov
1999-12-01  9:13         ` Geert Uytterhoeven
1999-12-01  9:54           ` Gabriel Paubert
1999-12-01 11:02             ` Momchil Velikov
1999-12-01 13:02               ` Gabriel Paubert
1999-12-01 15:06                 ` Momchil Velikov
1999-12-01 11:12           ` Michael Schmitz
1999-12-01  9:26       ` Michael Schmitz

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).