frame buffer control

I want to do some very simple manipulation of the framebuffer on a pixel by pixel basis and I am
doing something like this at the moment:

main(){

int fbdev;
unsigned int fb;
int x,y,px;
fbdev=open("/dev/fb0", O_RDWR);
fb=(unsigned int )mmap(0, 640480
sizeof(unsigned int), PROT_WRITE, MAP_SHARED, fbdev, 0);

for(y=0;y<480;y++){
for(x=0;x<640;x++){
px=x<<8;
fb[x+y*640]=px;
}
}
printf(“Done\n”);
}

Which works fine provided I stop X and the display was present / turn on at the start. If the display
is turned off and back on again the code executes fine but the display doesn’t change. The only
way I have of bringing back to life is to start and stop X again. There must be a better way to do this could
someone point me in the right direction*.

Cheers,

SA

  • I have strace Xorg to see what it does and it OMAPFB_QUERY_PLANE and OMAPFB_SETUP_PLANE presumably
    fixing the structure inbetween but I cannot find documentation for this and so far my attempts haven’t produced
    the right results.

Ok - I fixed an unrelated bug and it now seems to work as wanted - I don’t quite
understand how it is now working as wanted but the original code, as posted, works
fine.

Thanks,

SA

Ok it isn’t fixed - it just depends on how long the display have been switched off - if
it has been a long time then the display remains inactive until I start / stop X.

I need failsafe way to get the display going from C,

Any suggestions?

Cheers,

SA

Is this perhaps nothing to do with disconnecting display and more to do with the screensaving?

I think I have been fooled slightly by the DLP which doesn’t sleep but just holds the last frame while
the beagle display sleeps.

Also I have the cursor appearing across my graphic is there a way to turn off the text cursor?

Cheers,

SA