From: Bui Sy P. <bui...@gm...> - 2006-08-22 09:29:05
|
Hi everybody, I'm a newbie on Framebuffer programmation and newbie also on this mailing list. Actually, i'm writing a little program witch will display a full-screen windows in bleu. But when i execute this program, my windows is always hiden by the console or X11's windows. I dont understant how X11 communicates with Framebuffer so i cannot do the same thing to display my windows in first plane. This is my program in C and on Linux : #include <errno.h> #include <unistd.h> #include <stdio.h> #include <fcntl.h> #include <linux/fb.h> #include <sys/mman.h> #include <stropts.h> #include <sys/ioctl.h> #include <stdlib.h> #include <string.h> int main() { unsigned short int pcolor = 0x2858; int fbfd = 0; struct fb_var_screeninfo vinfo; struct fb_fix_screeninfo finfo; long int screensize = 0; char *fbp = 0; int x = 0, y = 0; long int location = 0; // Open the file for reading and writing fbfd = open("/dev/fb0", O_RDWR); if (!fbfd) { printf("Error: cannot open framebuffer device.\n"); exit(1); } printf("The framebuffer device was opened successfully.\n"); // Get fixed screen information if (ioctl(fbfd, FBIOGET_FSCREENINFO, &finfo)) { printf("Error reading fixed information.\n"); exit(2); } // Get variable screen information if (ioctl(fbfd, FBIOGET_VSCREENINFO, &vinfo)) { printf("Error reading variable information.\n"); exit(3); } printf("%dx%d, %dbpp\n", vinfo.xres, vinfo.yres, vinfo.bits_per_pixel); // Figure out the size of the screen in bytes screensize = vinfo.xres * vinfo.yres * vinfo.bits_per_pixel / 8; // Map the device to memory fbp = (char *)mmap(0, finfo.smem_len, PROT_READ | PROT_WRITE , MAP_SHARED, fbfd, 0); if ((int)fbp == -1) { printf("Error: failed to map framebuffer device to memory.\n"); exit(4); } printf("The framebuffer device was mapped to memory successfully.\n"); x = 0; y = 0; // Where we are going to put the pixel // Figure out where in memory to put the pixel for (y = 0; y < vinfo.yres; y++) for (x = 0; x < vinfo.xres; x++) { location = (x+vinfo.xoffset) * (vinfo.bits_per_pixel/8) + (y+vinfo.yoffset) * finfo.line_length; // Color conversion for 16 bit and 32 bit if ( vinfo.bits_per_pixel == 16 ) { *((unsigned short int *)(fbp + location)) = pcolor; } else // 32 bit { *(fbp + location) = (pcolor & 0x001F)<<3; // Blue *(fbp + location + 1) = (pcolor & 0x07E0)>>3; // Green *(fbp + location + 2) = (pcolor & 0xF800)>>8; // Red *(fbp + location + 3) = 0; // No transparency } } munmap(fbp, screensize); close(fbfd); return 0; } If someone can help me to fix this problem (means display my windows at the first plane), it will be wanderful for me. Thanks for yours helpful and sorry for my bad english. Bui Sy Phong. |
From: Geert U. <ge...@li...> - 2006-08-22 09:31:37
|
On Tue, 22 Aug 2006, Bui Sy Phong wrote: > I'm a newbie on Framebuffer programmation and newbie also on this mailing > list. > > Actually, i'm writing a little program witch will display a full-screen > windows in bleu. > But when i execute this program, my windows is always hiden by the console > or X11's windows. I dont understant how X11 communicates with Framebuffer so > i cannot do the same thing to display my windows in first plane. You should not touch the frame buffer device while X is active. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@li... 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 |
From: Bui Sy P. <bui...@gm...> - 2006-08-22 09:45:43
|
Thanks for your very fast answer. I've tried to turn off Windows Manager (X11 or something else like that on Zarus Sharp SL-C3200 - because my projet is based on) by booting in text mode. I try to execute my program in this mode and my window is one more time broken by the console, exactly, by the text on console. So, i think that i'm wrong somewhere in my program or my solution is bad. I'm waiting always for your helpful. Thanks so much. Bui Sy Phong 2006/8/22, Geert Uytterhoeven <ge...@li...>: > > On Tue, 22 Aug 2006, Bui Sy Phong wrote: > > I'm a newbie on Framebuffer programmation and newbie also on this > mailing > > list. > > > > Actually, i'm writing a little program witch will display a full-screen > > windows in bleu. > > But when i execute this program, my windows is always hiden by the > console > > or X11's windows. I dont understant how X11 communicates with > Framebuffer so > > i cannot do the same thing to display my windows in first plane. > > You should not touch the frame buffer device while X is active. > > Gr{oetje,eeting}s, > > Geert > > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- > ge...@li... > > 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 > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Linux-fbdev-users mailing list > Lin...@li... > https://lists.sourceforge.net/lists/listinfo/linux-fbdev-users > |
From: Geert U. <ge...@li...> - 2006-08-22 09:50:29
|
On Tue, 22 Aug 2006, Bui Sy Phong wrote: > I've tried to turn off Windows Manager (X11 or something else like that on > Zarus Sharp SL-C3200 - because my projet is based on) by booting in text > mode. > I try to execute my program in this mode and my window is one more time > broken by the console, exactly, by the text on console. > > So, i think that i'm wrong somewhere in my program or my solution is bad. There's an ioctl to switch the console to KD_GRAPHICS mode. If you do that, no more text will be printed by the console driver. > I'm waiting always for your helpful. > Thanks so much. > > Bui Sy Phong > > 2006/8/22, Geert Uytterhoeven <ge...@li...>: > > > > On Tue, 22 Aug 2006, Bui Sy Phong wrote: > > > I'm a newbie on Framebuffer programmation and newbie also on this > > mailing > > > list. > > > > > > Actually, i'm writing a little program witch will display a full-screen > > > windows in bleu. > > > But when i execute this program, my windows is always hiden by the > > console > > > or X11's windows. I dont understant how X11 communicates with > > Framebuffer so > > > i cannot do the same thing to display my windows in first plane. > > > > You should not touch the frame buffer device while X is active. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@li... 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 |
From: Bui Sy P. <bui...@gm...> - 2006-08-22 10:02:15
|
Yes, understood. But let me explain my project to you : My project consits to write a program witch will work like a Linux graphic application but it must be cross-platform (Linux, Zaurus and Linux based mobile phone). It's a Linux graphic application so it must work when Window Manager turned on :( It's cross-platform, so it must based on Framebuffer. And this is a big problem to me. Can i have your suggestion about it ? Thanks so much, Bui Sy Phong 2006/8/22, Geert Uytterhoeven <ge...@li...>: > > On Tue, 22 Aug 2006, Bui Sy Phong wrote: > > I've tried to turn off Windows Manager (X11 or something else like that > on > > Zarus Sharp SL-C3200 - because my projet is based on) by booting in text > > mode. > > I try to execute my program in this mode and my window is one more time > > broken by the console, exactly, by the text on console. > > > > So, i think that i'm wrong somewhere in my program or my solution is > bad. > > There's an ioctl to switch the console to KD_GRAPHICS mode. If you do > that, no > more text will be printed by the console driver. > > > I'm waiting always for your helpful. > > Thanks so much. > > > > Bui Sy Phong > > > > 2006/8/22, Geert Uytterhoeven <ge...@li...>: > > > > > > On Tue, 22 Aug 2006, Bui Sy Phong wrote: > > > > I'm a newbie on Framebuffer programmation and newbie also on this > > > mailing > > > > list. > > > > > > > > Actually, i'm writing a little program witch will display a > full-screen > > > > windows in bleu. > > > > But when i execute this program, my windows is always hiden by the > > > console > > > > or X11's windows. I dont understant how X11 communicates with > > > Framebuffer so > > > > i cannot do the same thing to display my windows in first plane. > > > > > > You should not touch the frame buffer device while X is active. > > Gr{oetje,eeting}s, > > Geert > > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- > ge...@li... > > 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 > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Linux-fbdev-users mailing list > Lin...@li... > https://lists.sourceforge.net/lists/listinfo/linux-fbdev-users > |
From: Unger R. <ric...@te...> - 2006-08-22 10:49:49
|
Hi! In general, access to the FrameBuffer device is exclusive under Linux. Thus one process can open /dev/fbX, and use the framebuffer, but another = program cannot really do so at the same time. This is almost a necessity, since the processes could otherwise set = different bit-depths or resolutions, or otherwise interfere with the = settings of the other process! There's also the memory to consider! Access to the framebuffer memory = would have to be synchronized between the different processes. There are solutions for your problem: For example, X11 is one such solution. It will access the GFX Hardware = (either through framebuffer or directly) and provides an API allowing = the programmer to handle multiple windows. DirectFB (www.directfb.org) is another interesting solution allowing = multiple applications to share a linux framebuffer. Richard Unger =20 > -----Urspr=FCngliche Nachricht----- > Von: lin...@li...=20 > [mailto:lin...@li...] Im=20 > Auftrag von Bui Sy Phong > Gesendet: Dienstag, 22. August 2006 12:02 > An: lin...@li... > Betreff: Re: [Linux-fbdev-users] Problem of programmation >=20 > Yes, understood. But let me explain my project to you : >=20 > My project consits to write a program witch will work like a=20 > Linux graphic application but it must be cross-platform=20 > (Linux, Zaurus and Linux based mobile phone).=20 > It's a Linux graphic application so it must work when Window=20 > Manager turned on :( It's cross-platform, so it must based on=20 > Framebuffer. >=20 > And this is a big problem to me. >=20 > Can i have your suggestion about it ?=20 >=20 > Thanks so much, >=20 > Bui Sy Phong >=20 >=20 >=20 >=20 >=20 > 2006/8/22, Geert Uytterhoeven <ge...@li...>: >=20 > On Tue, 22 Aug 2006, Bui Sy Phong wrote: > > I've tried to turn off Windows Manager (X11 or=20 > something else like that on > > Zarus Sharp SL-C3200 - because my projet is based on)=20 > by booting in text > > mode. > > I try to execute my program in this mode and my=20 > window is one more time > > broken by the console, exactly, by the text on console. > > > > So, i think that i'm wrong somewhere in my program or=20 > my solution is bad.=20 > =09 > There's an ioctl to switch the console to KD_GRAPHICS=20 > mode. If you do that, no > more text will be printed by the console driver. > =09 > > I'm waiting always for your helpful. > > Thanks so much. > > > > Bui Sy Phong > > > > 2006/8/22, Geert Uytterhoeven <ge...@li...>: > > > > > > On Tue, 22 Aug 2006, Bui Sy Phong wrote: > > > > I'm a newbie on Framebuffer programmation and=20 > newbie also on this=20 > > > mailing > > > > list. > > > > > > > > Actually, i'm writing a little program witch will=20 > display a full-screen > > > > windows in bleu. > > > > But when i execute this program, my windows is=20 > always hiden by the=20 > > > console > > > > or X11's windows. I dont understant how X11=20 > communicates with > > > Framebuffer so > > > > i cannot do the same thing to display my windows=20 > in first plane. > > >=20 > > > You should not touch the frame buffer device while=20 > X is active. > =09 > Gr{oetje,eeting}s, > =09 > Geert > =09 > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32=20 > -- ge...@li... > =09 > In personal conversations with technical people, I call=20 > myself a hacker. But > when I'm talking to journalists I just say "programmer"=20 > or something like that.=20 > =20 > -- Linus Torvalds > =09 > =09 > -------------------------------------------------------------- > ----------- > Using Tomcat but need to do more? Need to support web=20 > services, security?=20 > Get stuff done quickly with pre-integrated technology=20 > to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based=20 > on Apache Geronimo > =09 > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057& > dat=3D121642=20 > <http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057 > &dat=3D121642>=20 > _______________________________________________ > Linux-fbdev-users mailing list > Lin...@li...=20 > <mailto:Lin...@li...>=20 > https://lists.sourceforge.net/lists/listinfo/linux-fbdev-users > =09 >=20 >=20 >=20 |
From: Bui Sy P. <bui...@gm...> - 2006-08-22 10:59:36
|
Thanks for your helpful. I will read the documentation and work hard. I'll tell you the resultat. Thanks so much for your help Bui Sy Phong 2006/8/22, Unger Richard <ric...@te...>: > > Hi! > > In general, access to the FrameBuffer device is exclusive under Linux. > > Thus one process can open /dev/fbX, and use the framebuffer, but another > program cannot really do so at the same time. > This is almost a necessity, since the processes could otherwise set > different bit-depths or resolutions, or otherwise interfere with the > settings of the other process! > There's also the memory to consider! Access to the framebuffer memory > would have to be synchronized between the different processes. > > There are solutions for your problem: > > For example, X11 is one such solution. It will access the GFX Hardware > (either through framebuffer or directly) and provides an API allowing the > programmer to handle multiple windows. > > DirectFB (www.directfb.org) is another interesting solution allowing > multiple applications to share a linux framebuffer. > > Richard Unger > > > > -----Urspr=FCngliche Nachricht----- > > Von: lin...@li... > > [mailto:lin...@li...] Im > > Auftrag von Bui Sy Phong > > Gesendet: Dienstag, 22. August 2006 12:02 > > An: lin...@li... > > Betreff: Re: [Linux-fbdev-users] Problem of programmation > > > > Yes, understood. But let me explain my project to you : > > > > My project consits to write a program witch will work like a > > Linux graphic application but it must be cross-platform > > (Linux, Zaurus and Linux based mobile phone). > > It's a Linux graphic application so it must work when Window > > Manager turned on :( It's cross-platform, so it must based on > > Framebuffer. > > > > And this is a big problem to me. > > > > Can i have your suggestion about it ? > > > > Thanks so much, > > > > Bui Sy Phong > > > > > > > > > > > > 2006/8/22, Geert Uytterhoeven <ge...@li...>: > > > > On Tue, 22 Aug 2006, Bui Sy Phong wrote: > > > I've tried to turn off Windows Manager (X11 or > > something else like that on > > > Zarus Sharp SL-C3200 - because my projet is based on) > > by booting in text > > > mode. > > > I try to execute my program in this mode and my > > window is one more time > > > broken by the console, exactly, by the text on console. > > > > > > So, i think that i'm wrong somewhere in my program or > > my solution is bad. > > > > There's an ioctl to switch the console to KD_GRAPHICS > > mode. If you do that, no > > more text will be printed by the console driver. > > > > > I'm waiting always for your helpful. > > > Thanks so much. > > > > > > Bui Sy Phong > > > > > > 2006/8/22, Geert Uytterhoeven <ge...@li...>: > > > > > > > > On Tue, 22 Aug 2006, Bui Sy Phong wrote: > > > > > I'm a newbie on Framebuffer programmation and > > newbie also on this > > > > mailing > > > > > list. > > > > > > > > > > Actually, i'm writing a little program witch will > > display a full-screen > > > > > windows in bleu. > > > > > But when i execute this program, my windows is > > always hiden by the > > > > console > > > > > or X11's windows. I dont understant how X11 > > communicates with > > > > Framebuffer so > > > > > i cannot do the same thing to display my windows > > in first plane. > > > > > > > > You should not touch the frame buffer device while > > X is active. > > > > Gr{oetje,eeting}s, > > > > Geert > > > > -- > > Geert Uytterhoeven -- There's lots of Linux beyond ia32 > > -- ge...@li... > > > > 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 > > > > > > -------------------------------------------------------------- > > ----------- > > Using Tomcat but need to do more? Need to support web > > services, security? > > Get stuff done quickly with pre-integrated technology > > to make your job easier > > Download IBM WebSphere Application Server v.1.0.1 based > > on Apache Geronimo > > > > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057& > > dat=3D121642 > > <http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057 > > &dat=3D121642> > > _______________________________________________ > > Linux-fbdev-users mailing list > > Lin...@li... > > <mailto:Lin...@li...> > > https://lists.sourceforge.net/lists/listinfo/linux-fbdev-users > > > > > > > > > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronim= o > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat= =3D121642 > _______________________________________________ > Linux-fbdev-users mailing list > Lin...@li... > https://lists.sourceforge.net/lists/listinfo/linux-fbdev-users > |