VirtualBox

Changeset 13401 in vbox


Ignore:
Timestamp:
Oct 20, 2008 3:46:38 PM (16 years ago)
Author:
vboxsync
Message:

Cleaned up

Location:
trunk/src/VBox/Devices/Graphics
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/DevVGA.cpp

    r12978 r13401  
    349349    AssertMsg(offVRAM < pThis->vram_size, ("offVRAM = %p, pThis->vram_size = %p\n", offVRAM, pThis->vram_size));
    350350    ASMBitSet(&pThis->au32DirtyBitmap[0], offVRAM >> PAGE_SHIFT);
    351     pThis->fHaveDirtyBits = true;
     351    pThis->fHasDirtyBits = true;
    352352}
    353353
     
    684684#endif
    685685        s->sr[s->sr_index] = val & sr_mask[s->sr_index];
     686
     687#ifndef IN_GC
     688        /* The VGA region is (could be) affected by this change; reset all aliases we've created. */
     689        if (    s->sr_index == 4 /* mode */
     690            ||  s->sr_index == 2 /* plane mask */)
     691        {
     692            if (s->fRemappedVGA)
     693            {
     694                IOMMMIOResetRegion(PDMDevHlpGetVM(s->CTX_SUFF(pDevIns)), 0x000a0000);
     695                s->fRemappedVGA = false;
     696            }
     697        }
     698#endif
    686699        break;
    687700    case 0x3c7:
     
    711724#endif
    712725        s->gr[s->gr_index] = val & gr_mask[s->gr_index];
     726
     727#ifndef IN_GC
     728        /* The VGA region is (could be) affected by this change; reset all aliases we've created. */
     729        if (s->gr_index == 6 /* memory map mode */)
     730        {
     731            if (s->fRemappedVGA)
     732            {
     733                IOMMMIOResetRegion(PDMDevHlpGetVM(s->CTX_SUFF(pDevIns)), 0x000a0000);
     734                s->fRemappedVGA = false;
     735            }
     736        }
     737#endif
    713738        break;
     739
    714740    case 0x3b4:
    715741    case 0x3d4:
     
    880906            s->vbe_regs[s->vbe_index] = val;
    881907            s->bank_offset = (val << 16);
    882             break;
     908
     909#ifndef IN_GC
     910            /* The VGA region is (could be) affected by this change; reset all aliases we've created. */
     911            if (s->fRemappedVGA)
     912            {
     913                IOMMMIOResetRegion(PDMDevHlpGetVM(s->CTX_SUFF(pDevIns)), 0x000a0000);
     914                s->fRemappedVGA = false;
     915            }
     916#endif
     917            break;
     918
    883919        case VBE_DISPI_INDEX_ENABLE:
    884920#ifndef IN_RING3
     
    10011037             */
    10021038            s->pDrv->pfnLFBModeChange(s->pDrv, (val & VBE_DISPI_ENABLED) != 0);
     1039
     1040            /* The VGA region is (could be) affected by this change; reset all aliases we've created. */
     1041            if (s->fRemappedVGA)
     1042            {
     1043                IOMMMIOResetRegion(PDMDevHlpGetVM(s->CTX_SUFF(pDevIns)), 0x000a0000);
     1044                s->fRemappedVGA = false;
     1045            }
    10031046            break;
    10041047#endif /* IN_RING3 */
     
    10811124    /* convert to VGA memory offset */
    10821125    memory_map_mode = (s->gr[6] >> 2) & 3;
     1126#ifdef VBOX
     1127    RTGCPHYS GCPhys = addr; /* save original address */
     1128#endif
    10831129    addr &= 0x1ffff;
    10841130    switch(memory_map_mode) {
     
    11141160#else /* VBOX */
    11151161        ret = s->CTX_SUFF(vram_ptr)[addr];
     1162# ifdef IN_RING0
     1163        /* If all planes are accessible, then map the page to the frame buffer and make it writable. */
     1164        if ((s->sr[2] & 3) == 3)
     1165        {
     1166            IOMMMIOModifyPage(PDMDevHlpGetVM(s->CTX_SUFF(pDevIns)), GCPhys, s->GCPhysVRAM + addr, X86_PTE_RW | X86_PTE_P);
     1167            s->fRemappedVGA = true;
     1168        }
     1169# endif /* IN_RING0 */
    11161170#endif /* VBOX */
    11171171    } else if (!(s->sr[4] & 0x04)) {    /* Host access is controlled by SR4, not GR5! */
     
    11971251    /* convert to VGA memory offset */
    11981252    memory_map_mode = (s->gr[6] >> 2) & 3;
     1253#ifdef VBOX
     1254    RTGCPHYS GCPhys = addr; /* save original address */
     1255#endif
    11991256    addr &= 0x1ffff;
    12001257    switch(memory_map_mode) {
     
    12271284            s->vram_ptr[addr] = val;
    12281285#else /* VBOX */
    1229 #ifdef IN_GC
     1286# ifdef IN_GC
    12301287            if (addr >= VGA_MAPPING_SIZE)
    12311288                return VINF_IOM_HC_MMIO_WRITE;
    1232 #else
     1289# else
    12331290            if (addr >= s->vram_size)
    12341291            {
     
    12371294                return VINF_SUCCESS;
    12381295            }
    1239 #endif
     1296# endif
    12401297            s->CTX_SUFF(vram_ptr)[addr] = val;
     1298
     1299# ifdef IN_RING0
     1300            /* If all planes are accessible, then map the page to the frame buffer and make it writable. */
     1301            if ((s->sr[2] & 3) == 3)
     1302            {
     1303                IOMMMIOModifyPage(PDMDevHlpGetVM(s->CTX_SUFF(pDevIns)), GCPhys, s->GCPhysVRAM + addr, X86_PTE_RW | X86_PTE_P);
     1304                s->fRemappedVGA = true;
     1305            }
     1306# endif /* IN_RING0 */
     1307
    12411308#endif /* VBOX */
    12421309#ifdef DEBUG_VGA_MEM
     
    43264393    PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface);
    43274394    PDMDEV_ASSERT_EMT(VGASTATE2DEVINS(pThis));
     4395    PPDMDEVINS pDevIns = pThis->CTX_SUFF(pDevIns);
    43284396
    43294397#ifdef DEBUG_sunlover
     
    43374405        return rc;
    43384406
    4339     if (pThis->fHaveDirtyBits && pThis->GCPhysVRAM && pThis->GCPhysVRAM != NIL_RTGCPHYS32)
    4340     {
    4341         PPDMDEVINS pDevIns = pThis->CTX_SUFF(pDevIns);
     4407    if (    pThis->fHasDirtyBits
     4408        &&  pThis->GCPhysVRAM
     4409        &&  pThis->GCPhysVRAM != NIL_RTGCPHYS32)
     4410    {
    43424411        PGMHandlerPhysicalReset(PDMDevHlpGetVM(pDevIns), pThis->GCPhysVRAM);
    4343         pThis->fHaveDirtyBits = false;
     4412        pThis->fHasDirtyBits = false;
     4413    }
     4414    if (pThis->fRemappedVGA)
     4415    {
     4416        IOMMMIOResetRegion(PDMDevHlpGetVM(pDevIns), 0x000a0000);
     4417        pThis->fRemappedVGA = false;
    43444418    }
    43454419
     
    43584432    PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface);
    43594433    PDMDEV_ASSERT_EMT(VGASTATE2DEVINS(pThis));
     4434    PPDMDEVINS pDevIns = pThis->CTX_SUFF(pDevIns);
    43604435
    43614436    /* This is called both in VBVA mode and normal modes. */
     
    43704445
    43714446    /* The dirty bits array has been just cleared, reset handlers as well. */
    4372     if (pThis->GCPhysVRAM && pThis->GCPhysVRAM != NIL_RTGCPHYS32)
    4373     {
    4374         PPDMDEVINS pDevIns = pThis->CTX_SUFF(pDevIns);
     4447    if (    pThis->GCPhysVRAM
     4448        &&  pThis->GCPhysVRAM != NIL_RTGCPHYS32)
     4449    {
    43754450        PGMHandlerPhysicalReset(PDMDevHlpGetVM(pDevIns), pThis->GCPhysVRAM);
     4451    }
     4452    if (pThis->fRemappedVGA)
     4453    {
     4454        IOMMMIOResetRegion(PDMDevHlpGetVM(pDevIns), 0x000a0000);
     4455        pThis->fRemappedVGA = false;
    43764456    }
    43774457
     
    49855065        int rc = PGMHandlerPhysicalReset(PDMDevHlpGetVM(pDevIns), pThis->GCPhysVRAM);
    49865066        AssertRC(rc);
     5067    }
     5068    if (pThis->fRemappedVGA)
     5069    {
     5070        IOMMMIOResetRegion(PDMDevHlpGetVM(pDevIns), 0x000a0000);
     5071        pThis->fRemappedVGA = false;
    49875072    }
    49885073
  • trunk/src/VBox/Devices/Graphics/DevVGA.h

    r11166 r13401  
    261261    bool                        fR0Enabled;
    262262    /** Flag indicating that there are dirty bits. This is used to optimize the handler resetting. */
    263     bool                        fHaveDirtyBits;
     263    bool                        fHasDirtyBits;
     264    /** Flag indicating that the VGA memory in the 0xa0000-0xbffff region has been remapped to allow direct access. */
     265    bool                        fRemappedVGA;
     266    bool                        padding9[3];
     267
    264268    /** Pointer to vgaGCLFBAccessHandler(). */
    265269    RTRCPTR                     RCPtrLFBHandler;
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