Accelerant.h

Go to the documentation of this file.
00001 #if !defined(_ACCELERANT_H_)
00002 #define _ACCELERANT_H_
00003 
00004 #include <OS.h>
00005 
00006 #if defined(__cplusplus)
00007 extern "C" {
00008 #endif
00009 
00010 #define B_ACCELERANT_ENTRY_POINT    "get_accelerant_hook"
00011 #define B_ACCELERANT_VERSION        1
00012 
00013 typedef void * (*GetAccelerantHook)(uint32, void *);
00014 
00015 _EXPORT void *  get_accelerant_hook(uint32 feature, void *data);    
00016 
00017 enum {
00018     /* initialization */
00019     B_INIT_ACCELERANT = 0,          /* required */
00020     B_ACCELERANT_CLONE_INFO_SIZE,   /* required */
00021     B_GET_ACCELERANT_CLONE_INFO,    /* required */
00022     B_CLONE_ACCELERANT,             /* required */
00023     B_UNINIT_ACCELERANT,            /* required */
00024     B_GET_ACCELERANT_DEVICE_INFO,   /* required */
00025     B_ACCELERANT_RETRACE_SEMAPHORE, /* optional */
00026 
00027     /* mode configuration */
00028     B_ACCELERANT_MODE_COUNT = 0x100,    /* required */
00029     B_GET_MODE_LIST,            /* required */
00030     B_PROPOSE_DISPLAY_MODE,     /* optional */
00031     B_SET_DISPLAY_MODE,         /* required */  
00032     B_GET_DISPLAY_MODE,         /* required */
00033     B_GET_FRAME_BUFFER_CONFIG,  /* required */
00034     B_GET_PIXEL_CLOCK_LIMITS,   /* required */
00035     B_GET_TIMING_CONSTRAINTS,   /* optional */
00036     B_MOVE_DISPLAY,             /* optional */
00037     B_SET_INDEXED_COLORS,       /* required if driver supports 8bit indexed modes */
00038     B_DPMS_CAPABILITIES,        /* required if driver supports DPMS */
00039     B_DPMS_MODE,                /* required if driver supports DPMS */
00040     B_SET_DPMS_MODE,            /* required if driver supports DPMS */
00041 
00042     /* cursor managment */
00043     B_MOVE_CURSOR = 0x200,      /* optional */
00044     B_SET_CURSOR_SHAPE,         /* optional */
00045     B_SHOW_CURSOR,              /* optional */
00046     B_SET_CURSOR_COLORS,        /* optional */
00047 
00048     /* synchronization */
00049     B_ACCELERANT_ENGINE_COUNT = 0x300,  /* required */
00050     B_ACQUIRE_ENGINE,           /* required */
00051     B_RELEASE_ENGINE,           /* required */
00052     B_WAIT_ENGINE_IDLE,         /* required */
00053     B_GET_SYNC_TOKEN,           /* required */
00054     B_SYNC_TO_TOKEN,            /* required */
00055 
00056     /* 2D acceleration */
00057     B_SCREEN_TO_SCREEN_BLIT = 0x400,    /* optional */
00058     B_FILL_RECTANGLE,           /* optional */
00059     B_INVERT_RECTANGLE,         /* optional */
00060     B_FILL_SPAN,                /* optional */
00061     B_SCREEN_TO_SCREEN_TRANSPARENT_BLIT,    /* optional */
00062     B_SCREEN_TO_SCREEN_SCALED_FILTERED_BLIT,    /* optional.  NOTE: source and dest may NOT overlap */
00063     
00064     /* 3D acceleration */
00065     B_3D_INIT_ACCELERANT,
00066     B_3D_SHUTDOWN,
00067     B_3D_GET_DEVICE_INFO,
00068     B_3D_GET_MODES,
00069     B_3D_GET_BUILD_ID,
00070     
00071     
00072     B_ACCELERANT_PRIVATE_START = (int)0x80000000
00073 };
00074 
00075 typedef struct {
00076     uint32  version;            /* structure version number */
00077     char    name[32];           /* a name the user will recognize the device by */
00078     char    chipset[32];        /* the chipset used by the device */
00079     char    serial_no[32];      /* serial number for the device */
00080     uint32  memory;             /* amount of memory on the device, in bytes */
00081     uint32  dac_speed;          /* nominal DAC speed, in MHz */
00082 } accelerant_device_info;
00083 
00084 typedef struct {
00085     uint32  pixel_clock;    /* kHz */
00086     uint16  h_display;      /* in pixels (not character clocks) */
00087     uint16  h_sync_start;
00088     uint16  h_sync_end;
00089     uint16  h_total;
00090     uint16  v_display;      /* in lines */
00091     uint16  v_sync_start;
00092     uint16  v_sync_end;
00093     uint16  v_total;
00094     uint32  flags;          /* sync polarity, etc. */
00095 } display_timing;
00096 
00097 typedef struct {
00098     display_timing  timing;         /* CTRC info */
00099     uint32      space;              /* pixel configuration */
00100     uint16      virtual_width;      /* in pixels */
00101     uint16      virtual_height;     /* in lines */
00102     uint16      h_display_start;    /* first displayed pixel in line */
00103     uint16      v_display_start;    /* first displayed line */
00104     uint32      flags;              /* mode flags */
00105 } display_mode;
00106 
00107 typedef struct {
00108     void    *frame_buffer;      /* pointer to first byte of frame buffer in virtual memory */
00109     void    *frame_buffer_dma;  /* pointer to first byte of frame buffer in physical memory for DMA */
00110     uint32  bytes_per_row;      /* number of bytes in one virtual_width line */
00111                                 /* not neccesarily the same as virtual_width * byte_per_pixel */
00112 } frame_buffer_config;
00113 
00114 typedef struct {
00115     uint16  h_res;          /* minimum effective change in horizontal pixels, usually 8 */
00116     uint16  h_sync_min;     /* min/max horizontal sync pulse width in pixels, a multiple of h_res */
00117     uint16  h_sync_max;
00118     uint16  h_blank_min;    /* min/max horizontal blank pulse width in pixels, a multiple of h_res */
00119     uint16  h_blank_max;
00120     uint16  v_res;          /* minimum effective change in vertical lines, usually 1 */
00121     uint16  v_sync_min;     /* min/max vertical sync pulse width in lines, a multiple of v_res */
00122     uint16  v_sync_max;
00123     uint16  v_blank_min;    /* min/max vertical blank pulse width in linex, a multiple of v_res */
00124     uint16  v_blank_max;
00125 } display_timing_constraints;
00126 
00127 enum { /* mode flags */
00128     B_SCROLL = 1 << 0,
00129     B_8_BIT_DAC = 1 << 1,
00130     B_HARDWARE_CURSOR = 1 << 2,
00131     B_PARALLEL_ACCESS = 1 << 3,
00132     B_DPMS = 1 << 4,
00133     B_IO_FB_NA = 1 << 5
00134 };
00135 
00136 enum {  /* power saver flags */
00137     B_DPMS_ON = 1 << 0,
00138     B_DPMS_STAND_BY = 1 << 1,
00139     B_DPMS_SUSPEND = 1 << 2,
00140     B_DPMS_OFF = 1 << 3
00141 };
00142 
00143 enum {  /* timing flags */
00144     B_BLANK_PEDESTAL = 1 << 27,
00145     B_TIMING_INTERLACED = 1 << 28,
00146     B_POSITIVE_HSYNC = 1 << 29,
00147     B_POSITIVE_VSYNC = 1 << 30,
00148     B_SYNC_ON_GREEN = 1 << 31
00149 };
00150 
00151 typedef struct {
00152     uint16  src_left;   /* guaranteed constrained to virtual width and height */
00153     uint16  src_top;
00154     uint16  dest_left;
00155     uint16  dest_top;
00156     uint16  width;  /* 0 to N, where zero means one pixel, one means two pixels, etc. */
00157     uint16  height; /* 0 to M, where zero means one line, one means two lines, etc. */
00158 } blit_params;
00159 
00160 typedef struct {
00161     uint16  src_left;   /* guaranteed constrained to virtual width and height */
00162     uint16  src_top;
00163     uint16  src_width;  /* 0 to N, where zero means one pixel, one means two pixels, etc. */
00164     uint16  src_height; /* 0 to M, where zero means one line, one means two lines, etc. */
00165     uint16  dest_left;
00166     uint16  dest_top;
00167     uint16  dest_width; /* 0 to N, where zero means one pixel, one means two pixels, etc. */
00168     uint16  dest_height;    /* 0 to M, where zero means one line, one means two lines, etc. */
00169 } scaled_blit_params;
00170 
00171 typedef struct {
00172     uint16  left;   /* guaranteed constrained to virtual width and height */
00173     uint16  top;
00174     uint16  right;
00175     uint16  bottom;
00176 } fill_rect_params;
00177 
00178 typedef struct {
00179     uint32  engine_id;          /* 0 == no engine, 1,2,3 etc individual engines */
00180     uint32  capability_mask;    /* features this engine supports */
00181     void    *opaque;            /* optional pointer to engine private storage */
00182 } engine_token;
00183 
00184 enum {  /* engine capabilities */
00185     B_2D_ACCELERATION = 1 << 0,
00186     B_3D_ACCELERATION = 1 << 1
00187 };
00188 
00189 typedef struct {
00190     uint64  counter;        /* counts issued primatives */
00191     uint32  engine_id;      /* what engine the counter is for */
00192     char    opaque[12];     /* 12 bytes of private storage */
00193 } sync_token;
00194 
00195 typedef struct
00196 {
00197     int width;
00198     int height;
00199     int refresh;
00200     int color;
00201     int depth;
00202     int stencil;
00203     int accum;
00204 } video_mode;
00205 
00206 /* Masks for color info */
00207 /* B_CMAP8    - 0x000000ff */
00208 /* B_RGB15/16 - 0x0000ffff */
00209 /* B_RGB24    - 0x00ffffff */
00210 /* B_RGB32    - 0xffffffff */
00211 
00212 typedef status_t (*init_accelerant)(int fd);
00213 typedef ssize_t (*accelerant_clone_info_size)(void);
00214 typedef void (*get_accelerant_clone_info)(void *data);
00215 typedef status_t (*clone_accelerant)(void *data);
00216 typedef void (*uninit_accelerant)(void);
00217 typedef status_t (*get_accelerant_device_info)(accelerant_device_info *adi);
00218 
00219 typedef uint32 (*accelerant_mode_count)(void);
00220 typedef status_t (*get_mode_list)(display_mode *);
00221 typedef status_t (*propose_display_mode)(display_mode *target, display_mode *low, display_mode *high);
00222 typedef status_t (*set_display_mode)(display_mode *mode_to_set);
00223 typedef status_t (*get_display_mode)(display_mode *current_mode);
00224 typedef status_t (*get_frame_buffer_config)(frame_buffer_config *a_frame_buffer);
00225 typedef status_t (*get_pixel_clock_limits)(display_mode *dm, uint32 *low, uint32 *high);
00226 typedef status_t (*move_display_area)(uint16 h_display_start, uint16 v_display_start);
00227 typedef status_t (*get_timing_constraints)(display_timing_constraints *dtc);
00228 typedef void (*set_indexed_colors)(uint count, uint8 first, uint8 *color_data, uint32 flags);
00229 typedef uint32 (*dpms_capabilities)(void);
00230 typedef uint32 (*dpms_mode)(void);
00231 typedef status_t (*set_dpms_mode)(uint32 dpms_flags);
00232 typedef sem_id (*accelerant_retrace_semaphore)(void);
00233 
00234 typedef status_t (*set_cursor_shape)(uint16 width, uint16 height, uint16 hot_x, uint16 hot_y, uint8 *andMask, uint8 *xorMask);
00235 typedef void (*move_cursor)(uint16 x, uint16 y);
00236 typedef void (*show_cursor)(bool is_visible);
00237 
00238 typedef uint32 (*accelerant_engine_count)(void);
00239 typedef status_t (*acquire_engine)(uint32 capabilities, uint32 max_wait, sync_token *st, engine_token **et);
00240 typedef status_t (*release_engine)(engine_token *et, sync_token *st);
00241 typedef void (*wait_engine_idle)(void);
00242 typedef status_t (*get_sync_token)(engine_token *et, sync_token *st);
00243 typedef status_t (*sync_to_token)(sync_token *st);
00244 
00245 typedef void (*screen_to_screen_blit)(engine_token *et, blit_params *list, uint32 count);
00246 typedef void (*fill_rectangle)(engine_token *et, uint32 color, fill_rect_params *list, uint32 count);
00247 typedef void (*invert_rectangle)(engine_token *et, fill_rect_params *list, uint32 count);
00248 typedef void (*screen_to_screen_transparent_blit)(engine_token *et, uint32 transparent_color, blit_params *list, uint32 count);
00249 typedef void (*screen_to_screen_scaled_filtered_blit)(engine_token *et, scaled_blit_params *list, uint32 count);
00250 
00251 typedef void (*fill_span)(engine_token *et, uint32 color, uint16 *list, uint32 count);
00252 /*
00253     The uint16 *list points to a list of tripples:
00254         list[N+0]  Y co-ordinate of span
00255         list[N+1]  Left x co-ordinate of span
00256         list[N+2]  Right x co-ordinate of span
00257     where N is in the range 0 to count-1.
00258 */
00259 
00260 
00261 typedef status_t (*_3D_init)( char *device_path, void *glContext );
00262 typedef status_t (*_3D_shutdown)( char *device_path, void *glContext );
00263 typedef void (*_3D_get_device_info)( char *device_path, const char **name, uint8 *depth, uint8 *stencil, uint8 *accum );
00264 typedef void (*_3D_get_modes)( char *device_path, void (* callback)(video_mode *modes), uint32 min_color, uint32 min_depth, uint32 min_stencil, uint32 min_accum );
00265 typedef uint32 (*_3D_get_build_id)( char *device_path );
00266 
00267 
00268 #if defined(__cplusplus)
00269 }
00270 #endif
00271 
00272 #endif

Copyright 2005 by yellowTAB GmbH, Be Inc., Palm Source Inc. and their respective legal successors
All rights reserved.