From: Geert U. <ge...@li...> - 2001-11-14 21:04:15
|
On Wed, 14 Nov 2001, James Simmons wrote: > Hi folks. I finally hammered a newer api for framebuffer devices. I > adapted skeletonfb.c to show it off. Feedback welcomed. Good news! > /* > * If your driver supports multiple boards, you should make these > * arrays, or allocate them dynamically (using kmalloc()). > */ Perhaps make it more clear that this applies to all 3 (4?) variables below > static struct fb_info info; > /* > * This represents the default state of the hardware. > */ > static struct xxx_par __initdata current_par; > > static u32 xxxfb_pseudo_palette[17]; > static int inverse = 0; > /** > * xxxfb_check_var - REQUIRED function. Validates a var passed in. Is this function really required? Imagine a graphics card with a fixed resolution (e.g. old Sun3 bwtwo), or vesafb/offb. If it's NULL, you cannot change var, and upper layer can check that an identical var was passed (using memcmp()). > * xxxfb_setcolreg - REQUIRED function. Sets a color register. Is this function really required? Imagine static pseudocolor (fixed palette) hardware. > /* Directcolor: > * var->{color}.offset contains start of bitfield > * var->{color}.length contains length of bitfield > * {hardwarespecific} contains width of DAC > * cmap[X] is programmed to (X << red.offset) | (X << green.offset) | (X << blue.offset) > * DAC[X] is programmed to (red, green, blue) s/DAC/RAMDAC/ > * > * Pseudocolor: > * uses offset = 0 && length = DAC register width. > * var->{color}.offset is 0 > * var->{color}.length contains widht of DAC > * cmap is not used > * DAC[X] is programmed to (red, green, blue) s/DAC/RAMDAC/ > * Truecolor: > * does not use DAC. > * var->{color}.offset contains start of bitfield > * var->{color}.length contains length of bitfield > * cmap is programmed to (red << red.offset) | (green << green.offset) | > * (blue << blue.offset) | (transp << transp.offset) > * DAC does not exist s/DAC/RAMDAC/ Truecolor does have a DAC (even 3 of them :-), but no RAMDAC. > /* Truecolor has hardware independent palette */ > if (info->fix.visual == FB_VISUAL_TRUECOLOR) { > u32 v; > > if (regno >= 16) > return 1; > > v = (red << info->var.red.offset) | > (green << info->var.green.offset) | > (blue << info->var.blue.offset) | > (transp << info->var.transp.offset); > if (info->var.bits_per_pixel == 16) > ((u16*)(info->pseudo_palette))[regno] = v; > else > ((u32*)(info->pseudo_palette))[regno] = v; > return 0; What about info->var.bits_per_pixel == 8? Some handhelds are RGB332 truecolor. 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 |