VirtualBox

Ignore:
Timestamp:
Oct 11, 2017 4:24:38 PM (7 years ago)
Author:
vboxsync
Message:

DevVGA+VGABIOS: eliminate defines (VBE_NEW_DYN_LIST and VRAM_SIZE_FIX) which are always there, since the other path is long obsolete

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/BIOS/vbe.c

    r67813 r69047  
    3838 * of the LGPL is applied is otherwise unspecified.
    3939 */
    40 
    41 // Use VBE new dynamic mode list.  Note that without this option, no
    42 // checks are currently done to make sure that modes fit into the
    43 // framebuffer!
    44 #define VBE_NEW_DYN_LIST
    4540
    4641#include <inttypes.h>
     
    169164}
    170165
    171 #ifdef VBE_NEW_DYN_LIST
    172166uint8_t in_byte(uint16_t port, uint16_t addr)
    173167{
     
    175169    return inb(port);
    176170}
    177 #endif
    178171
    179172/* Display "chip" identification helpers. */
     
    207200
    208201/* Find the offset of the desired mode, given its number. */
    209 #ifdef VBE_NEW_DYN_LIST
    210202static uint16_t mode_info_find_mode(uint16_t mode, Boolean using_lfb)
    211203{
     
    246238    return 0;
    247239}
    248 #else
    249 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             else
    262                 cur_info++;
    263         } else
    264             cur_info++;
    265     }
    266     return 0;
    267 }
    268 #endif
    269240
    270241#ifndef VBOX
     
    303274    uint16_t            cur_mode = 0;
    304275    uint16_t            cur_ptr=34;
    305 #ifdef VBE_NEW_DYN_LIST
    306276    uint16_t            cur_info_ofs;
    307277    uint16_t            sig, vmode;
    308 #else
    309     ModeInfoListItem    *cur_info = &mode_info_list;
    310 #endif
    311278    uint16_t            max_bpp = dispi_get_max_bpp();
    312279    VbeInfoBlock __far  *info_block;
     
    314281    info_block = ES :> (VbeInfoBlock *)DI;
    315282
    316 #ifdef VBE_NEW_DYN_LIST
    317283    /* Read VBE Extra Data signature */
    318284    sig = in_word(VBE_EXTRA_PORT, 0);
     
    326292    }
    327293    cur_info_ofs = sizeof(VBEHeader);
    328 #endif
    329294    status = *AX;
    330295
     
    384349    }
    385350
    386 #ifdef VBE_NEW_DYN_LIST
    387351    do
    388352    {
     
    406370    // Add vesa mode list terminator
    407371    write_word(ES, DI + cur_ptr, vmode);
    408 #else
    409     do
    410     {
    411         if (cur_info->info.BitsPerPixel <= max_bpp) {
    412 #ifdef VGA_DEBUG
    413             printf("VBE found mode %x => %x\n", cur_info->mode,cur_mode);
    414 #endif
    415             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 terminator
    423     write_word(ES, DI + cur_ptr, cur_info->mode);
    424 #endif // VBE_NEW_DYN_LIST
    425372    *AX = 0x004F;
    426373}
     
    439386{
    440387    uint16_t            result = 0x0100;
    441 #ifdef VBE_NEW_DYN_LIST
    442388    uint16_t            cur_info_ofs;
    443 #else
    444     ModeInfoListItem    *cur_info;
    445 #endif
    446389    Boolean             using_lfb;
    447390    uint8_t             win_attr;
     
    454397    CX = (CX & 0x1ff);
    455398
    456 #ifdef VBE_NEW_DYN_LIST
    457399    cur_info_ofs = mode_info_find_mode(CX, using_lfb);
    458400
    459401    if (cur_info_ofs) {
    460402        uint16_t    i;
    461 #else
    462     cur_info = mode_info_find_mode(CX, using_lfb);
    463 
    464     if (cur_info != 0) {
    465 #endif
    466403#ifdef VGA_DEBUG
    467404        printf("VBE found mode %x\n",CX);
    468405#endif
    469406        memsetb(ES, DI, 0, 256);    // The mode info size is fixed
    470 #ifdef VBE_NEW_DYN_LIST
    471407        for (i = 0; i < sizeof(ModeInfoBlockCompact); i++) {
    472408            uint8_t b;
     
    475411            write_byte(ES, DI + i, b);
    476412        }
    477 #else
    478         memcpyb(ES, DI, 0xc000, &(cur_info->info), sizeof(ModeInfoBlockCompact));
    479 #endif
    480413        win_attr = read_byte(ES, DI + offsetof(ModeInfoBlock, WinAAttributes));
    481414        if (win_attr & VBE_WINDOW_ATTRIBUTE_RELOCATABLE) {
     
    512445{
    513446    uint16_t            result;
    514 #ifdef VBE_NEW_DYN_LIST
    515447    uint16_t            cur_info_ofs;
    516 #else
    517     ModeInfoListItem    *cur_info;
    518 #endif
    519448    Boolean             using_lfb;
    520449    uint8_t             no_clear;
     
    541470    }
    542471
    543 #ifdef VBE_NEW_DYN_LIST
    544472    cur_info_ofs = mode_info_find_mode(BX, using_lfb);
    545473
     
    557485        printf("\txres%x yres%x bpp%x\n", xres, yres, bpp);
    558486#endif
    559 #else
    560     cur_info = mode_info_find_mode(BX, using_lfb);
    561 
    562     if (cur_info != 0)
    563     {
    564 #ifdef VGA_DEBUG
    565         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 #endif
    571 #endif // VBE_NEW_DYN_LIST
    572487
    573488        // first disable current mode (when switching between vesa modi)
    574489        dispi_set_enable(VBE_DISPI_DISABLED);
    575490
    576 #ifdef VBE_NEW_DYN_LIST
    577491        if (bpp == 4)
    578 #else
    579         if (cur_info->info.BitsPerPixel == 4)
    580 #endif
    581492        {
    582493            biosfn_set_video_mode(0x6a);
    583494        }
    584495
    585 #ifdef VBE_NEW_DYN_LIST
    586496        dispi_set_bpp(bpp);
    587497        dispi_set_xres(xres);
    588498        dispi_set_yres(yres);
    589 #else
    590         dispi_set_bpp(cur_info->info.BitsPerPixel);
    591         dispi_set_xres(cur_info->info.XResolution);
    592         dispi_set_yres(cur_info->info.YResolution);
    593 #endif
    594499        dispi_set_bank(0);
    595500        dispi_set_enable(VBE_DISPI_ENABLED | no_clear | lfb_flag);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette