Changeset 69047 in vbox for trunk/src/VBox/Devices/Graphics/BIOS
- Timestamp:
- Oct 11, 2017 4:24:38 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/BIOS/vbe.c
r67813 r69047 38 38 * of the LGPL is applied is otherwise unspecified. 39 39 */ 40 41 // Use VBE new dynamic mode list. Note that without this option, no42 // checks are currently done to make sure that modes fit into the43 // framebuffer!44 #define VBE_NEW_DYN_LIST45 40 46 41 #include <inttypes.h> … … 169 164 } 170 165 171 #ifdef VBE_NEW_DYN_LIST172 166 uint8_t in_byte(uint16_t port, uint16_t addr) 173 167 { … … 175 169 return inb(port); 176 170 } 177 #endif178 171 179 172 /* Display "chip" identification helpers. */ … … 207 200 208 201 /* Find the offset of the desired mode, given its number. */ 209 #ifdef VBE_NEW_DYN_LIST210 202 static uint16_t mode_info_find_mode(uint16_t mode, Boolean using_lfb) 211 203 { … … 246 238 return 0; 247 239 } 248 #else249 static ModeInfoListItem* mode_info_find_mode(uint16_t mode, Boolean using_lfb)250 {251 ModeInfoListItem *cur_info = &mode_info_list;252 253 while (cur_info->mode != VBE_VESA_MODE_END_OF_LIST)254 {255 if (cur_info->mode == mode)256 {257 if (!using_lfb)258 return cur_info;259 else if (cur_info->info.ModeAttributes & VBE_MODE_ATTRIBUTE_LINEAR_FRAME_BUFFER_MODE)260 return cur_info;261 else262 cur_info++;263 } else264 cur_info++;265 }266 return 0;267 }268 #endif269 240 270 241 #ifndef VBOX … … 303 274 uint16_t cur_mode = 0; 304 275 uint16_t cur_ptr=34; 305 #ifdef VBE_NEW_DYN_LIST306 276 uint16_t cur_info_ofs; 307 277 uint16_t sig, vmode; 308 #else309 ModeInfoListItem *cur_info = &mode_info_list;310 #endif311 278 uint16_t max_bpp = dispi_get_max_bpp(); 312 279 VbeInfoBlock __far *info_block; … … 314 281 info_block = ES :> (VbeInfoBlock *)DI; 315 282 316 #ifdef VBE_NEW_DYN_LIST317 283 /* Read VBE Extra Data signature */ 318 284 sig = in_word(VBE_EXTRA_PORT, 0); … … 326 292 } 327 293 cur_info_ofs = sizeof(VBEHeader); 328 #endif329 294 status = *AX; 330 295 … … 384 349 } 385 350 386 #ifdef VBE_NEW_DYN_LIST387 351 do 388 352 { … … 406 370 // Add vesa mode list terminator 407 371 write_word(ES, DI + cur_ptr, vmode); 408 #else409 do410 {411 if (cur_info->info.BitsPerPixel <= max_bpp) {412 #ifdef VGA_DEBUG413 printf("VBE found mode %x => %x\n", cur_info->mode,cur_mode);414 #endif415 write_word(ES, DI + cur_ptr, cur_info->mode);416 cur_mode++;417 cur_ptr += 2;418 }419 cur_info++;420 } while (cur_info->mode != VBE_VESA_MODE_END_OF_LIST);421 422 // Add vesa mode list terminator423 write_word(ES, DI + cur_ptr, cur_info->mode);424 #endif // VBE_NEW_DYN_LIST425 372 *AX = 0x004F; 426 373 } … … 439 386 { 440 387 uint16_t result = 0x0100; 441 #ifdef VBE_NEW_DYN_LIST442 388 uint16_t cur_info_ofs; 443 #else444 ModeInfoListItem *cur_info;445 #endif446 389 Boolean using_lfb; 447 390 uint8_t win_attr; … … 454 397 CX = (CX & 0x1ff); 455 398 456 #ifdef VBE_NEW_DYN_LIST457 399 cur_info_ofs = mode_info_find_mode(CX, using_lfb); 458 400 459 401 if (cur_info_ofs) { 460 402 uint16_t i; 461 #else462 cur_info = mode_info_find_mode(CX, using_lfb);463 464 if (cur_info != 0) {465 #endif466 403 #ifdef VGA_DEBUG 467 404 printf("VBE found mode %x\n",CX); 468 405 #endif 469 406 memsetb(ES, DI, 0, 256); // The mode info size is fixed 470 #ifdef VBE_NEW_DYN_LIST471 407 for (i = 0; i < sizeof(ModeInfoBlockCompact); i++) { 472 408 uint8_t b; … … 475 411 write_byte(ES, DI + i, b); 476 412 } 477 #else478 memcpyb(ES, DI, 0xc000, &(cur_info->info), sizeof(ModeInfoBlockCompact));479 #endif480 413 win_attr = read_byte(ES, DI + offsetof(ModeInfoBlock, WinAAttributes)); 481 414 if (win_attr & VBE_WINDOW_ATTRIBUTE_RELOCATABLE) { … … 512 445 { 513 446 uint16_t result; 514 #ifdef VBE_NEW_DYN_LIST515 447 uint16_t cur_info_ofs; 516 #else517 ModeInfoListItem *cur_info;518 #endif519 448 Boolean using_lfb; 520 449 uint8_t no_clear; … … 541 470 } 542 471 543 #ifdef VBE_NEW_DYN_LIST544 472 cur_info_ofs = mode_info_find_mode(BX, using_lfb); 545 473 … … 557 485 printf("\txres%x yres%x bpp%x\n", xres, yres, bpp); 558 486 #endif 559 #else560 cur_info = mode_info_find_mode(BX, using_lfb);561 562 if (cur_info != 0)563 {564 #ifdef VGA_DEBUG565 printf("VBE found mode %x, setting:\n", BX);566 printf("\txres%x yres%x bpp%x\n",567 cur_info->info.XResolution,568 cur_info->info.YResolution,569 cur_info->info.BitsPerPixel);570 #endif571 #endif // VBE_NEW_DYN_LIST572 487 573 488 // first disable current mode (when switching between vesa modi) 574 489 dispi_set_enable(VBE_DISPI_DISABLED); 575 490 576 #ifdef VBE_NEW_DYN_LIST577 491 if (bpp == 4) 578 #else579 if (cur_info->info.BitsPerPixel == 4)580 #endif581 492 { 582 493 biosfn_set_video_mode(0x6a); 583 494 } 584 495 585 #ifdef VBE_NEW_DYN_LIST586 496 dispi_set_bpp(bpp); 587 497 dispi_set_xres(xres); 588 498 dispi_set_yres(yres); 589 #else590 dispi_set_bpp(cur_info->info.BitsPerPixel);591 dispi_set_xres(cur_info->info.XResolution);592 dispi_set_yres(cur_info->info.YResolution);593 #endif594 499 dispi_set_bank(0); 595 500 dispi_set_enable(VBE_DISPI_ENABLED | no_clear | lfb_flag);
Note:
See TracChangeset
for help on using the changeset viewer.