Changeset 43408 in vbox for trunk/src/VBox/Additions/haiku/VBoxVideo/accelerant
- Timestamp:
- Sep 22, 2012 4:53:18 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 80894
- Location:
- trunk/src/VBox/Additions/haiku/VBoxVideo/accelerant
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/haiku/VBoxVideo/accelerant/accelerant.cpp
r43364 r43408 45 45 */ 46 46 47 /******************************************************************************* 48 * Header Files * 49 *******************************************************************************/ 47 50 #include <Accelerant.h> 48 51 #include "accelerant.h" … … 51 54 #include <errno.h> 52 55 53 #define TRACE(x...) do { FILE* logfile = fopen("/var/log/vboxvideo.accelerant.log", "a"); fprintf(logfile, x); fflush(logfile); fsync(fileno(logfile)); fclose(logfile); sync(); } while(0) 56 /******************************************************************************* 57 * Global Variables * 58 *******************************************************************************/ 59 AccelerantInfo gInfo; 60 static engine_token sEngineToken = { 1, 0 /*B_2D_ACCELERATION*/, NULL }; 61 62 /** @todo r=ramshankar: get rid of this and replace with IPRT logging. */ 63 #define TRACE(x...) do { \ 64 FILE* logfile = fopen("/var/log/vboxvideo.accelerant.log", "a"); \ 65 fprintf(logfile, x); \ 66 fflush(logfile); \ 67 fsync(fileno(logfile)); \ 68 fclose(logfile); \ 69 sync(); \ 70 } while(0) 54 71 55 72 class AreaCloner 56 73 { 57 74 public: 58 AreaCloner() : fArea(-1) { } 75 AreaCloner() 76 : fArea(-1) 77 { 78 } 79 59 80 ~AreaCloner() 60 81 { … … 69 90 } 70 91 71 status_t InitCheck() { return fArea < B_OK ? (status_t)fArea : B_OK; } 72 void Keep() { fArea = -1; } 92 status_t InitCheck() 93 { 94 return fArea < B_OK ? (status_t)fArea : B_OK; 95 } 96 97 void Keep() 98 { 99 fArea = -1; 100 } 73 101 74 102 private: 75 area_id 103 area_id fArea; 76 104 }; 77 78 AccelerantInfo gInfo;79 80 static engine_token sEngineToken = { 1, 0 /*B_2D_ACCELERATION*/, NULL };81 105 82 106 extern "C" … … 86 110 switch (feature) 87 111 { 88 /* general */112 /* General */ 89 113 case B_INIT_ACCELERANT: 90 114 return (void *)vboxvideo_init_accelerant; … … 102 126 return (void *)vboxvideo_accelerant_retrace_semaphore; 103 127 104 /* mode configuration */128 /* Mode configuration */ 105 129 case B_ACCELERANT_MODE_COUNT: 106 130 return (void *)vboxvideo_accelerant_mode_count; … … 118 142 return (void *)vboxvideo_get_pixel_clock_limits; 119 143 144 #if 0 120 145 /* cursor managment */ 121 /*case B_SET_CURSOR_SHAPE:146 case B_SET_CURSOR_SHAPE: 122 147 return (void*)vboxvideo_set_cursor_shape; 123 148 case B_MOVE_CURSOR: 124 149 return (void*)vboxvideo_move_cursor; 125 150 case B_SHOW_CURSOR: 126 return (void*)vboxvideo_show_cursor;*/ 127 128 /* engine/synchronization */ 151 return (void*)vboxvideo_show_cursor; 152 #endif 153 154 /* Engine/synchronization */ 129 155 case B_ACCELERANT_ENGINE_COUNT: 130 156 return (void *)vboxvideo_accelerant_engine_count; … … 162 188 163 189 AreaCloner sharedCloner; 164 gInfo.sharedInfoArea = sharedCloner.Clone("vboxvideo shared info", 165 (void **)&gInfo.sharedInfo, B_ANY_ADDRESS, 190 gInfo.sharedInfoArea = sharedCloner.Clone("vboxvideo shared info", (void **)&gInfo.sharedInfo, B_ANY_ADDRESS, 166 191 B_READ_AREA | B_WRITE_AREA, sharedArea); 167 192 status_t status = sharedCloner.InitCheck(); … … 176 201 } 177 202 203 178 204 status_t vboxvideo_init_accelerant(int fd) 179 205 { … … 181 207 } 182 208 209 183 210 ssize_t vboxvideo_accelerant_clone_info_size(void) 184 211 { … … 187 214 } 188 215 216 189 217 void vboxvideo_get_accelerant_clone_info(void *data) 190 218 { … … 193 221 } 194 222 223 195 224 status_t vboxvideo_clone_accelerant(void *data) 196 225 { 197 226 TRACE("%s\n", __FUNCTION__); 198 227 199 / / create full device name228 /* Create full device name */ 200 229 char path[MAXPATHLEN]; 201 230 strcpy(path, "/dev/"); … … 209 238 } 210 239 240 211 241 void vboxvideo_uninit_accelerant(void) 212 242 { … … 220 250 TRACE("%s\n", __FUNCTION__); 221 251 } 252 222 253 223 254 status_t vboxvideo_get_accelerant_device_info(accelerant_device_info *adi) … … 231 262 } 232 263 264 233 265 sem_id vboxvideo_accelerant_retrace_semaphore(void) 234 266 { … … 236 268 return -1; 237 269 } 270 238 271 239 272 // modes & constraints … … 244 277 } 245 278 279 246 280 status_t vboxvideo_get_mode_list(display_mode *dm) 247 281 { … … 250 284 return vboxvideo_get_display_mode(dm); 251 285 } 286 252 287 253 288 status_t vboxvideo_set_display_mode(display_mode *modeToSet) … … 258 293 } 259 294 295 260 296 status_t vboxvideo_get_display_mode(display_mode *currentMode) 261 297 { … … 266 302 } 267 303 304 268 305 status_t vboxvideo_get_edid_info(void *info, size_t size, uint32 *_version) 269 306 { 270 307 TRACE("%s\n", __FUNCTION__); 271 308 272 / / copied from the X11 implementation:309 /* Copied from the X11 implementation: */ 273 310 static const uint8 edid_data[128] = { 274 311 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, /* header */ … … 307 344 return B_BUFFER_OVERFLOW; 308 345 309 *_version = 1; /* EDID_VERSION_1*/346 *_version = 1; /* EDID_VERSION_1 */ 310 347 memcpy(info, edid_data, 128); 311 348 return B_OK; 312 349 } 350 313 351 314 352 status_t vboxvideo_get_frame_buffer_config(frame_buffer_config *config) … … 322 360 } 323 361 362 324 363 status_t vboxvideo_get_pixel_clock_limits(display_mode *dm, uint32 *low, uint32 *high) 325 364 { … … 331 370 } 332 371 333 // cursor 372 373 /* Cursor */ 334 374 status_t vboxvideo_set_cursor_shape(uint16 width, uint16 height, uint16 hotX, uint16 hotY, uint8 *andMask, uint8 *xorMask) 335 375 { … … 339 379 } 340 380 381 341 382 void vboxvideo_move_cursor(uint16 x, uint16 y) 342 383 { … … 344 385 } 345 386 387 346 388 void vboxvideo_show_cursor(bool is_visible) 347 389 { … … 349 391 } 350 392 351 // accelerant engine 393 394 /* Accelerant engine */ 352 395 uint32 vboxvideo_accelerant_engine_count(void) 353 396 { … … 362 405 return B_OK; 363 406 } 407 364 408 365 409 status_t vboxvideo_release_engine(engine_token *et, sync_token *st) … … 372 416 } 373 417 418 374 419 void vboxvideo_wait_engine_idle(void) 375 420 { … … 377 422 } 378 423 424 379 425 status_t vboxvideo_get_sync_token(engine_token *et, sync_token *st) 380 426 { … … 383 429 } 384 430 431 385 432 status_t vboxvideo_sync_to_token(sync_token *st) 386 433 { … … 389 436 } 390 437 391 // 2D acceleration 438 439 /* 2D acceleration */ 392 440 void vboxvideo_screen_to_screen_blit(engine_token *et, blit_params *list, uint32 count) 393 441 { … … 395 443 } 396 444 445 397 446 void vboxvideo_fill_rectangle(engine_token *et, uint32 color, fill_rect_params *list, uint32 count) 398 447 { … … 400 449 } 401 450 451 402 452 void vboxvideo_invert_rectangle(engine_token *et, fill_rect_params *list, uint32 count) 403 453 { … … 405 455 } 406 456 457 407 458 void vboxvideo_fill_span(engine_token *et, uint32 color, uint16 *list, uint32 count) 408 459 { -
trunk/src/VBox/Additions/haiku/VBoxVideo/accelerant/accelerant.h
r43364 r43408 45 45 */ 46 46 47 #ifndef _ ACCELERANT_H48 #define _ ACCELERANT_H47 #ifndef ___VBOX_ACCELERANT_H 48 #define ___VBOX_ACCELERANT_H 49 49 50 50 #include <Accelerant.h> … … 53 53 struct AccelerantInfo 54 54 { 55 int deviceFD; 56 bool isClone; 55 /** @todo doxygen document these fields */ 56 int deviceFD; 57 bool isClone; 57 58 58 59 59 SharedInfo *sharedInfo; 60 area_id sharedInfoArea; 60 61 }; 61 62 extern AccelerantInfo gInfo; 62 63 63 / / general64 /* General */ 64 65 status_t vboxvideo_init_accelerant(int fd); 65 66 ssize_t vboxvideo_accelerant_clone_info_size(void); … … 70 71 sem_id vboxvideo_accelerant_retrace_semaphore(void); 71 72 72 / / modes & constraints73 /* Modes & constraints */ 73 74 uint32 vboxvideo_accelerant_mode_count(void); 74 75 status_t vboxvideo_get_mode_list(display_mode *dm); … … 79 80 status_t vboxvideo_get_pixel_clock_limits(display_mode *dm, uint32 *low, uint32 *high); 80 81 81 / / cursor82 /* Cursor */ 82 83 status_t vboxvideo_set_cursor_shape(uint16 width, uint16 height, uint16 hotX, uint16 hotY, uint8 *andMask, uint8 *xorMask); 83 84 void vboxvideo_move_cursor(uint16 x, uint16 y); 84 85 void vboxvideo_show_cursor(bool is_visible); 85 86 86 / / accelerant engine87 /* Accelerant engine */ 87 88 uint32 vboxvideo_accelerant_engine_count(void); 88 89 status_t vboxvideo_acquire_engine(uint32 capabilities, uint32 maxWait, sync_token *st, engine_token **et); … … 92 93 status_t vboxvideo_sync_to_token(sync_token *st); 93 94 94 / / 2D acceleration95 /* 2D acceleration */ 95 96 void vboxvideo_screen_to_screen_blit(engine_token *et, blit_params *list, uint32 count); 96 97 void vboxvideo_fill_rectangle(engine_token *et, uint32 color, fill_rect_params *list, uint32 count); … … 98 99 void vboxvideo_fill_span(engine_token *et, uint32 color, uint16 *list, uint32 count); 99 100 100 #endif /* _ACCELERANT_PROTOS_H */ 101 #endif /* ___VBOX_ACCELERANT_H */ 102
Note:
See TracChangeset
for help on using the changeset viewer.