8 bit colour palette: more information - Raspberry Pi Forums
hi,
found thread http://www.raspberrypi.org/phpbb3/viewt ... 72&t=11682 in bare metal forum - went on reply before realising more appropriate forum...
hereby try branch discussion here:
thanks,
jp
found thread http://www.raspberrypi.org/phpbb3/viewt ... 72&t=11682 in bare metal forum - went on reply before realising more appropriate forum...
hereby try branch discussion here:
question remains: way access driver? , possibly bug in driver (google 'fbiogetcmap fail' finds bug reports other drivers...)?-rst- wrote:hmm, seems driver code, not directly accessible user-mode applications? or have missed way access this...dom wrote:yes, , 16-bit format 5 bits red, 6 bits green, 5 bits blue.
8bpp default "web safe" palette, can set. see:
https://github.com/raspberrypi/linux/bl ... m2708_fb.c
framebuffer ioctl method not seem work on rpi - code:
succeeds print out resolution , bit depth, fails read palette (regardless of mode set using 'fbset -depth x').code: select all
#include <linux/fb.h> ... fbfd = open("/dev/fb0", o_rdwr); ... if (ioctl(fbfd, fbioget_vscreeninfo, &vinfo)) { printf("error reading variable information.\n"); close(fbfd); return(3); } printf("%dx%d, %dbpp\n", vinfo.xres, vinfo.yres, vinfo.bits_per_pixel ); // palette information unsigned short r[256]; unsigned short g[256]; unsigned short b[256]; unsigned short a[256]; memset(r, 0xff, 256 * sizeof(unsigned short)); memset(g, 0xff, 256 * sizeof(unsigned short)); memset(b, 0xff, 256 * sizeof(unsigned short)); memset(a, 0xff, 256 * sizeof(unsigned short)); struct fb_cmap cmap; cmap.start = 0; cmap.len = 256; cmap.red = r; cmap.green = g; cmap.blue = b; cmap.transp = a; if (ioctl(fbfd, fbiogetcmap, &cmap)) { printf("error reading palette.\n"); close(fbfd); return(4); } ...
know other ways access driver (to set palette)?
thanks,
jp
thanks,
jp
uh, ok - time carefulness seems have 'bitten me in leg'... hoping read default cmap , save restoring, did not try fbioputcmap ...which seems work!!! used 'fbset -depth 8' before running test app.
easy mangle display prompt etc. lost, 'blind typing' command 'fbset -depth 16' luckily restores default palette.
question is: if fb palette change applies 8 bit gpu/vc resources too... well, time sleep - i'll try out tomorrow!
easy mangle display prompt etc. lost, 'blind typing' command 'fbset -depth 16' luckily restores default palette.
question is: if fb palette change applies 8 bit gpu/vc resources too... well, time sleep - i'll try out tomorrow!
raspberrypi
Comments
Post a Comment