1*a69c16feSStephan Aßmus /* 2*a69c16feSStephan Aßmus * Copyright 2009, Haiku, Inc. All rights reserved. 3*a69c16feSStephan Aßmus * Distributed under the terms of the MIT License. 4*a69c16feSStephan Aßmus */ 5d734a8ceSbeveloper #ifndef _GRAPHICS_CARD_H 6d734a8ceSbeveloper #define _GRAPHICS_CARD_H 7d734a8ceSbeveloper 8*a69c16feSStephan Aßmus 9d734a8ceSbeveloper #include <GraphicsDefs.h> 10d734a8ceSbeveloper 11d734a8ceSbeveloper 12*a69c16feSStephan Aßmus /* #pragma mark - command constants */ 13d734a8ceSbeveloper enum { 14d734a8ceSbeveloper B_OPEN_GRAPHICS_CARD, 15d734a8ceSbeveloper B_CLOSE_GRAPHICS_CARD, 16d734a8ceSbeveloper B_GET_GRAPHICS_CARD_INFO, 17d734a8ceSbeveloper B_GET_GRAPHICS_CARD_HOOKS, 18d734a8ceSbeveloper B_SET_INDEXED_COLOR, 19d734a8ceSbeveloper B_GET_SCREEN_SPACES, 20d734a8ceSbeveloper B_CONFIG_GRAPHICS_CARD, 21d734a8ceSbeveloper B_GET_REFRESH_RATES, 22d734a8ceSbeveloper B_SET_SCREEN_GAMMA, 23d734a8ceSbeveloper 24d734a8ceSbeveloper B_GET_INFO_FOR_CLONE_SIZE, 25d734a8ceSbeveloper B_GET_INFO_FOR_CLONE, 26d734a8ceSbeveloper B_SET_CLONED_GRAPHICS_CARD, 27d734a8ceSbeveloper B_CLOSE_CLONED_GRAPHICS_CARD, 28d734a8ceSbeveloper B_PROPOSE_FRAME_BUFFER, 29d734a8ceSbeveloper B_SET_FRAME_BUFFER, 30d734a8ceSbeveloper B_SET_DISPLAY_AREA, 31*a69c16feSStephan Aßmus B_MOVE_DISPLAY_AREA 32*a69c16feSStephan Aßmus }; 33d734a8ceSbeveloper 34*a69c16feSStephan Aßmus /* #pragma mark - optional flags */ 35d734a8ceSbeveloper enum { 36d734a8ceSbeveloper B_CRT_CONTROL = 0x0001, 37d734a8ceSbeveloper B_GAMMA_CONTROL = 0x0002, 38d734a8ceSbeveloper B_FRAME_BUFFER_CONTROL = 0x0004, 39d734a8ceSbeveloper B_PARALLEL_BUFFER_ACCESS = 0x0008, 40d734a8ceSbeveloper B_LAME_ASS_CARD = 0x0010 41d734a8ceSbeveloper }; 42d734a8ceSbeveloper 43*a69c16feSStephan Aßmus 44*a69c16feSStephan Aßmus /* #pragma mark - structures */ 45*a69c16feSStephan Aßmus 46d734a8ceSbeveloper 47d734a8ceSbeveloper typedef struct { 48d734a8ceSbeveloper int16 version; 49d734a8ceSbeveloper int16 id; 50d734a8ceSbeveloper void* frame_buffer; 51d734a8ceSbeveloper char rgba_order[4]; 52d734a8ceSbeveloper int16 flags; 53d734a8ceSbeveloper int16 bits_per_pixel; 54d734a8ceSbeveloper int16 bytes_per_row; 55d734a8ceSbeveloper int16 width; 56d734a8ceSbeveloper int16 height; 57d734a8ceSbeveloper } graphics_card_info; 58d734a8ceSbeveloper 59d734a8ceSbeveloper 60d734a8ceSbeveloper typedef struct { 61d734a8ceSbeveloper int32 index; 62d734a8ceSbeveloper rgb_color color; 63d734a8ceSbeveloper } indexed_color; 64d734a8ceSbeveloper 65d734a8ceSbeveloper 66d734a8ceSbeveloper typedef struct { 67d734a8ceSbeveloper uint32 space; 68d734a8ceSbeveloper float refresh_rate; 69d734a8ceSbeveloper uchar h_position; 70d734a8ceSbeveloper uchar v_position; 71d734a8ceSbeveloper uchar h_size; 72d734a8ceSbeveloper uchar v_size; 73d734a8ceSbeveloper } graphics_card_config; 74d734a8ceSbeveloper 75d734a8ceSbeveloper 76d734a8ceSbeveloper typedef struct { 77d734a8ceSbeveloper float min; 78d734a8ceSbeveloper float max; 79d734a8ceSbeveloper float current; 80d734a8ceSbeveloper } refresh_rate_info; 81d734a8ceSbeveloper 82d734a8ceSbeveloper 83d734a8ceSbeveloper typedef struct { 84d734a8ceSbeveloper void* screen_base; 85d734a8ceSbeveloper void* io_base; 86d734a8ceSbeveloper uint32 vendor_id; 87d734a8ceSbeveloper uint32 device_id; 88d734a8ceSbeveloper uint32 _reserved1_; 89d734a8ceSbeveloper uint32 _reserved2_; 90d734a8ceSbeveloper } graphics_card_spec; 91d734a8ceSbeveloper 92d734a8ceSbeveloper 93d734a8ceSbeveloper typedef struct { 94d734a8ceSbeveloper int16 x1; 95d734a8ceSbeveloper int16 y1; 96d734a8ceSbeveloper int16 x2; 97d734a8ceSbeveloper int16 y2; 98d734a8ceSbeveloper rgb_color color; 99d734a8ceSbeveloper } rgb_color_line; 100d734a8ceSbeveloper 101d734a8ceSbeveloper 102d734a8ceSbeveloper typedef struct { 103d734a8ceSbeveloper int16 x1; 104d734a8ceSbeveloper int16 y1; 105d734a8ceSbeveloper int16 x2; 106d734a8ceSbeveloper int16 y2; 107d734a8ceSbeveloper uchar color; 108d734a8ceSbeveloper } indexed_color_line; 109d734a8ceSbeveloper 110d734a8ceSbeveloper 111d734a8ceSbeveloper typedef struct { 112d734a8ceSbeveloper int16 bits_per_pixel; 113d734a8ceSbeveloper int16 bytes_per_row; 114d734a8ceSbeveloper int16 width; 115d734a8ceSbeveloper int16 height; 116d734a8ceSbeveloper int16 display_width; 117d734a8ceSbeveloper int16 display_height; 118d734a8ceSbeveloper int16 display_x; 119d734a8ceSbeveloper int16 display_y; 120d734a8ceSbeveloper } frame_buffer_info; 121d734a8ceSbeveloper 122d734a8ceSbeveloper 123d734a8ceSbeveloper typedef struct { 124d734a8ceSbeveloper uchar red[256]; 125d734a8ceSbeveloper uchar green[256]; 126d734a8ceSbeveloper uchar blue[256]; 127d734a8ceSbeveloper } screen_gamma; 128d734a8ceSbeveloper 129d734a8ceSbeveloper 130*a69c16feSStephan Aßmus /* #pragma mark - hook function */ 131*a69c16feSStephan Aßmus 132d734a8ceSbeveloper 133d734a8ceSbeveloper typedef void (*graphics_card_hook) (); 134d734a8ceSbeveloper 135d734a8ceSbeveloper #define B_GRAPHICS_HOOK_COUNT 48 136d734a8ceSbeveloper 137d734a8ceSbeveloper 138d734a8ceSbeveloper #ifdef __cplusplus 139d734a8ceSbeveloper extern "C" { 140d734a8ceSbeveloper #endif 141d734a8ceSbeveloper 142f6e4cbb9SAxel Dörfler int32 control_graphics_card(uint32, void*); 143d734a8ceSbeveloper 144d734a8ceSbeveloper #ifdef __cplusplus 145d734a8ceSbeveloper } 146d734a8ceSbeveloper #endif 147d734a8ceSbeveloper 148d734a8ceSbeveloper 149*a69c16feSStephan Aßmus /* #pragma mark - deprecated */ 150d734a8ceSbeveloper #define B_HOOK_COUNT B_GRAPHICS_HOOK_COUNT 151d734a8ceSbeveloper 152d734a8ceSbeveloper 153d734a8ceSbeveloper #endif /* _GRAPHICS_CARD_H */ 154