Thread: DAC size with vesafb?

  1. #1
    Registered User
    Join Date
    Sep 2009
    Posts
    12

    DAC size with vesafb?

    Hi there,

    I am programming with Linux vesafb and below is my code which works for mobility radeon 7500 but does NOT work for GT 330M:

    Code:
    unsigned short R = (Pixel.R << 8);
    unsigned short G = (Pixel.G << 8);
    unsigned short B = (Pixel.B << 8);
    
    fb_cmap Palette = {Index, 1, &R, &G, &B, NULL};
    
    ioctl(Device, FBIOPUTCMAP, &Palette);
    while below code works for GT 330M:

    Code:
    unsigned short R = (Pixel.R << 6);
    unsigned short G = (Pixel.G << 6);
    unsigned short B = (Pixel.B << 6);
    
    fb_cmap Palette = {Index, 1, &R, &G, &B, NULL};
    
    ioctl(Device, FBIOPUTCMAP, &Palette);
    So my question is, how should I write my code to get the 6 or 8 during initialization? I have searched much on google but seems no luck.

    Thanks in advance!

  2. #2
    Registered User
    Join Date
    Sep 2009
    Posts
    12

    Talking

    I suspect the issue is related to the video card's RAMDAC size (for standard VGA it's 6 bits for each color component, for some super VGA it's 8), but I could not have this size during code initialization.

    It is possible to call interrupt 10h (AX = 4F00h) to query super VGA info and have the size, but this is not acceptable to me as my code is running in user space without root privilege.

    I have also checked the info returned by FBIOGET_VSCREENINFO and FBIOGET_FSCREENINFO, but still no help.

    Is it possible to make use of what's in /sys or some other (non-root) methods? Thanks for your help!

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Is there anything in /usr/include/linux/fb.h which looks like it might be the thing?
    It might help figure out which ioctl() returns the info you want.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Sep 2009
    Posts
    12
    Quote Originally Posted by Salem View Post
    Is there anything in /usr/include/linux/fb.h which looks like it might be the thing?
    It might help figure out which ioctl() returns the info you want.
    Thanks for the reply, but I did not find anything interesting in /usr/include/linux/fb.h. Do you have some hints?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Code review
    By Elysia in forum C++ Programming
    Replies: 71
    Last Post: 05-13-2008, 09:42 PM
  2. Pointer Size Relative To Integers?
    By SMurf in forum C Programming
    Replies: 1
    Last Post: 04-18-2006, 06:58 AM
  3. Invalid conversion from 'void*' to 'BYTE' help
    By bikr692002 in forum C++ Programming
    Replies: 9
    Last Post: 02-22-2006, 11:27 AM
  4. An exercise in optimization
    By Prelude in forum Contests Board
    Replies: 10
    Last Post: 04-29-2005, 03:06 PM