2009-08-27 16:35:43 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2009, Haiku, Inc. All rights reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2002-10-23 17:54:44 +04:00
|
|
|
#ifndef _GRAPHICS_CARD_H
|
|
|
|
#define _GRAPHICS_CARD_H
|
|
|
|
|
2009-08-27 16:35:43 +04:00
|
|
|
|
2002-10-23 17:54:44 +04:00
|
|
|
#include <GraphicsDefs.h>
|
|
|
|
|
|
|
|
|
2009-08-27 16:35:43 +04:00
|
|
|
/* #pragma mark - command constants */
|
2002-10-23 17:54:44 +04:00
|
|
|
enum {
|
|
|
|
B_OPEN_GRAPHICS_CARD,
|
|
|
|
B_CLOSE_GRAPHICS_CARD,
|
|
|
|
B_GET_GRAPHICS_CARD_INFO,
|
|
|
|
B_GET_GRAPHICS_CARD_HOOKS,
|
|
|
|
B_SET_INDEXED_COLOR,
|
|
|
|
B_GET_SCREEN_SPACES,
|
|
|
|
B_CONFIG_GRAPHICS_CARD,
|
|
|
|
B_GET_REFRESH_RATES,
|
|
|
|
B_SET_SCREEN_GAMMA,
|
2009-08-27 16:35:43 +04:00
|
|
|
|
2002-10-23 17:54:44 +04:00
|
|
|
B_GET_INFO_FOR_CLONE_SIZE,
|
|
|
|
B_GET_INFO_FOR_CLONE,
|
|
|
|
B_SET_CLONED_GRAPHICS_CARD,
|
2009-08-27 16:35:43 +04:00
|
|
|
B_CLOSE_CLONED_GRAPHICS_CARD,
|
2002-10-23 17:54:44 +04:00
|
|
|
B_PROPOSE_FRAME_BUFFER,
|
|
|
|
B_SET_FRAME_BUFFER,
|
|
|
|
B_SET_DISPLAY_AREA,
|
2009-08-27 16:35:43 +04:00
|
|
|
B_MOVE_DISPLAY_AREA
|
|
|
|
};
|
2002-10-23 17:54:44 +04:00
|
|
|
|
2009-08-27 16:35:43 +04:00
|
|
|
/* #pragma mark - optional flags */
|
2002-10-23 17:54:44 +04:00
|
|
|
enum {
|
2009-08-27 16:35:43 +04:00
|
|
|
B_CRT_CONTROL = 0x0001,
|
|
|
|
B_GAMMA_CONTROL = 0x0002,
|
|
|
|
B_FRAME_BUFFER_CONTROL = 0x0004,
|
|
|
|
B_PARALLEL_BUFFER_ACCESS = 0x0008,
|
|
|
|
B_LAME_ASS_CARD = 0x0010
|
2002-10-23 17:54:44 +04:00
|
|
|
};
|
|
|
|
|
2009-08-27 16:35:43 +04:00
|
|
|
|
|
|
|
/* #pragma mark - structures */
|
|
|
|
|
2002-10-23 17:54:44 +04:00
|
|
|
|
|
|
|
typedef struct {
|
2009-08-27 16:35:43 +04:00
|
|
|
int16 version;
|
|
|
|
int16 id;
|
|
|
|
void* frame_buffer;
|
|
|
|
char rgba_order[4];
|
|
|
|
int16 flags;
|
2002-10-23 17:54:44 +04:00
|
|
|
int16 bits_per_pixel;
|
2009-08-27 16:35:43 +04:00
|
|
|
int16 bytes_per_row;
|
2002-10-23 17:54:44 +04:00
|
|
|
int16 width;
|
|
|
|
int16 height;
|
|
|
|
} graphics_card_info;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
2009-08-27 16:35:43 +04:00
|
|
|
int32 index;
|
|
|
|
rgb_color color;
|
2002-10-23 17:54:44 +04:00
|
|
|
} indexed_color;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
2009-08-27 16:35:43 +04:00
|
|
|
uint32 space;
|
|
|
|
float refresh_rate;
|
|
|
|
uchar h_position;
|
|
|
|
uchar v_position;
|
|
|
|
uchar h_size;
|
|
|
|
uchar v_size;
|
2002-10-23 17:54:44 +04:00
|
|
|
} graphics_card_config;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
2009-08-27 16:35:43 +04:00
|
|
|
float min;
|
|
|
|
float max;
|
|
|
|
float current;
|
2002-10-23 17:54:44 +04:00
|
|
|
} refresh_rate_info;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
2009-08-27 16:35:43 +04:00
|
|
|
void* screen_base;
|
|
|
|
void* io_base;
|
|
|
|
uint32 vendor_id;
|
|
|
|
uint32 device_id;
|
|
|
|
uint32 _reserved1_;
|
|
|
|
uint32 _reserved2_;
|
2002-10-23 17:54:44 +04:00
|
|
|
} graphics_card_spec;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
2009-08-27 16:35:43 +04:00
|
|
|
int16 x1;
|
|
|
|
int16 y1;
|
|
|
|
int16 x2;
|
|
|
|
int16 y2;
|
|
|
|
rgb_color color;
|
2002-10-23 17:54:44 +04:00
|
|
|
} rgb_color_line;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
2009-08-27 16:35:43 +04:00
|
|
|
int16 x1;
|
|
|
|
int16 y1;
|
|
|
|
int16 x2;
|
|
|
|
int16 y2;
|
|
|
|
uchar color;
|
2002-10-23 17:54:44 +04:00
|
|
|
} indexed_color_line;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
2009-08-27 16:35:43 +04:00
|
|
|
int16 bits_per_pixel;
|
|
|
|
int16 bytes_per_row;
|
|
|
|
int16 width;
|
|
|
|
int16 height;
|
|
|
|
int16 display_width;
|
|
|
|
int16 display_height;
|
|
|
|
int16 display_x;
|
|
|
|
int16 display_y;
|
2002-10-23 17:54:44 +04:00
|
|
|
} frame_buffer_info;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
2009-08-27 16:35:43 +04:00
|
|
|
uchar red[256];
|
|
|
|
uchar green[256];
|
|
|
|
uchar blue[256];
|
2002-10-23 17:54:44 +04:00
|
|
|
} screen_gamma;
|
|
|
|
|
|
|
|
|
2009-08-27 16:35:43 +04:00
|
|
|
/* #pragma mark - hook function */
|
|
|
|
|
2002-10-23 17:54:44 +04:00
|
|
|
|
|
|
|
typedef void (*graphics_card_hook) ();
|
|
|
|
|
|
|
|
#define B_GRAPHICS_HOOK_COUNT 48
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2009-08-27 16:35:43 +04:00
|
|
|
int32 control_graphics_card(uint32, void*);
|
2002-10-23 17:54:44 +04:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2009-08-27 16:35:43 +04:00
|
|
|
/* #pragma mark - debugging functions */
|
|
|
|
|
2002-10-23 17:54:44 +04:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2009-08-27 16:35:43 +04:00
|
|
|
void dprintf(const char *format, ...);
|
|
|
|
bool set_dprintf_enabled(bool);
|
|
|
|
/* returns old enable flag */
|
2002-10-23 17:54:44 +04:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2009-08-27 16:35:43 +04:00
|
|
|
/* #pragma mark - deprecated */
|
2002-10-23 17:54:44 +04:00
|
|
|
#define B_HOOK_COUNT B_GRAPHICS_HOOK_COUNT
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* _GRAPHICS_CARD_H */
|