Changeset 82074 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Nov 21, 2019 11:07:10 AM (5 years ago)
- Location:
- trunk/src/VBox/Devices/Graphics
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA.cpp
r82072 r82074 50 50 * across different .cpp files !!! 51 51 */ 52 /** The size of the VGA GC mapping.53 * This is supposed to be all the VGA memory accessible to the guest.54 * The initial value was 256KB but NTAllInOne.iso appears to access more55 * thus the limit was upped to 512KB.56 *57 * @todo Someone with some VGA knowhow should make a better guess at this value.58 */59 #define VGA_MAPPING_SIZE _512K60 52 61 53 #ifdef VBOX_WITH_HGSMI … … 5671 5663 * @callback_method_impl{FNPCIIOREGIONMAP, Mapping/unmapping the VRAM MMI2 region} 5672 5664 */ 5673 static DECLCALLBACK(int) vgaR3 IORegionMap(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion,5674 RTGCPHYS GCPhysAddress, RTGCPHYS cb, PCIADDRESSSPACE enmType)5665 static DECLCALLBACK(int) vgaR3PciIORegionVRamMapUnmap(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, 5666 RTGCPHYS GCPhysAddress, RTGCPHYS cb, PCIADDRESSSPACE enmType) 5675 5667 { 5676 5668 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 5677 RT_NOREF(cb);5678 Log(("vgaR3IORegionMap: iRegion=%d GCPhysAddress=%RGp cb=%RGp enmType=%d\n", iRegion, GCPhysAddress, cb, enmType));5669 Log(("vgaR3PciIORegionVRamMapUnmap: iRegion=%d GCPhysAddress=%RGp cb=%RGp enmType=%d\n", iRegion, GCPhysAddress, cb, enmType)); 5670 RT_NOREF(pPciDev, cb); 5679 5671 5680 5672 AssertReturn(iRegion == pThis->pciRegions.iVRAM && enmType == PCI_ADDRESS_SPACE_MEM_PREFETCH, VERR_INTERNAL_ERROR); … … 5689 5681 * Mapping the VRAM. 5690 5682 */ 5691 rc = PDMDevHlpM MIOExMap(pDevIns, pPciDev, iRegion, GCPhysAddress);5692 Assert RC(rc);5683 rc = PDMDevHlpMmio2Map(pDevIns, pThis->hMmio2VRam, GCPhysAddress); 5684 AssertLogRelRC(rc); 5693 5685 if (RT_SUCCESS(rc)) 5694 5686 { … … 5696 5688 pThis->hLfbAccessHandlerType, pThis, pDevIns->pvInstanceDataR0, 5697 5689 pDevIns->pvInstanceDataRC, "VGA LFB"); 5698 Assert RC(rc);5690 AssertLogRelRC(rc); 5699 5691 if (RT_SUCCESS(rc)) 5700 5692 { … … 5702 5694 pThis->vbe_regs[VBE_DISPI_INDEX_FB_BASE_HI] = GCPhysAddress >> 16; 5703 5695 } 5696 rc = VINF_PCI_MAPPING_DONE; /* caller doesn't care about any other status, so no problem overwriting error here */ 5704 5697 } 5705 5698 } … … 5707 5700 { 5708 5701 /* 5709 * Unmapping of the VRAM in progress .5702 * Unmapping of the VRAM in progress (caller will do that). 5710 5703 * Deregister the access handler so PGM doesn't get upset. 5711 5704 */ 5712 5705 Assert(pThis->GCPhysVRAM); 5713 # ifdef VBOX_WITH_VMSVGA5706 # ifdef VBOX_WITH_VMSVGA 5714 5707 Assert(!pThis->svga.fEnabled || !pThis->svga.fVRAMTracking); 5715 5708 if ( !pThis->svga.fEnabled … … 5718 5711 ) 5719 5712 ) 5713 # endif 5720 5714 { 5721 #endif5722 5715 rc = PGMHandlerPhysicalDeregister(PDMDevHlpGetVM(pDevIns), pThis->GCPhysVRAM); 5723 5716 AssertRC(rc); 5724 #ifdef VBOX_WITH_VMSVGA 5725 } 5717 } 5718 # ifdef VBOX_WITH_VMSVGA 5726 5719 else 5727 5720 rc = VINF_SUCCESS; 5728 # endif5721 # endif 5729 5722 pThis->GCPhysVRAM = 0; 5730 5723 /* NB: VBE_DISPI_INDEX_FB_BASE_HI is left unchanged here. */ … … 6647 6640 AssertRCReturn(rc, rc); 6648 6641 6649 rc = PDMDevHlpPCIIORegionRegister(pDevIns, pThis->pciRegions.iVRAM, pThis->vram_size,6650 PCI_ADDRESS_SPACE_MEM_PREFETCH, vgaR3IORegionMap);6651 if (RT_FAILURE(rc))6652 return rc;6653 6642 rc = PDMDevHlpPCIIORegionRegister(pDevIns, pThis->pciRegions.iFIFO, pThis->svga.cbFIFO, 6654 6643 PCI_ADDRESS_SPACE_MEM_PREFETCH, vmsvgaR3IORegionMap); 6655 if (RT_FAILURE(rc)) 6656 return rc; 6644 AssertRCReturn(rc, rc); 6657 6645 pPciDev->pfnRegionLoadChangeHookR3 = vgaR3PciRegionLoadChangeHook; 6658 6646 } 6659 else6660 6647 #endif /* VBOX_WITH_VMSVGA */ 6661 {6662 rc = PDMDevHlpPCIIORegionRegister(pDevIns, pThis->pciRegions.iVRAM, pThis->vram_size,6663 PCI_ADDRESS_SPACE_MEM_PREFETCH, vgaR3IORegionMap);6664 if (RT_FAILURE(rc))6665 return rc;6666 }6667 6648 6668 6649 /* 6669 * Allocate the VRAM and map the first 512KB of it into GC so we can speed up VGA support. 6650 * Allocate VRAM and create a PCI region for it. 6651 */ 6652 rc = PDMDevHlpPCIIORegionCreateMmio2Ex(pDevIns, pThis->pciRegions.iVRAM, pThis->vram_size, 6653 PCI_ADDRESS_SPACE_MEM_PREFETCH, 0 /*fFlags*/, vgaR3PciIORegionVRamMapUnmap, 6654 "VRam", (void **)&pThis->vram_ptrR3, &pThis->hMmio2VRam); 6655 AssertLogRelRCReturn(rc, PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, 6656 N_("Failed to allocate %u bytes of VRAM"), pThis->vram_size)); 6657 pThis->vram_ptrR0 = (RTR0PTR)pThis->vram_ptrR3; /** @todo @bugref{1865} Map parts into R0 or just use PGM access (Mac only). */ 6658 6659 /* 6660 * Register access handler types for tracking dirty VRAM pages. 6661 */ 6662 rc = PGMR3HandlerPhysicalTypeRegister(pVM, PGMPHYSHANDLERKIND_WRITE, 6663 vgaLFBAccessHandler, 6664 g_DeviceVga.pszR0Mod, "vgaLFBAccessHandler", "vgaLbfAccessPfHandler", 6665 g_DeviceVga.pszRCMod, "vgaLFBAccessHandler", "vgaLbfAccessPfHandler", 6666 "VGA LFB", &pThis->hLfbAccessHandlerType); 6667 AssertRCReturn(rc, rc); 6668 6669 /* 6670 * Allocate VMSVGA FIFO. 6670 6671 */ 6671 6672 #ifdef VBOX_WITH_VMSVGA … … 6681 6682 N_("Failed to allocate %u bytes of memory for the VMSVGA device"), pThis->svga.cbFIFO); 6682 6683 pThis->svga.pFIFOR0 = (RTR0PTR)pThis->svga.pFIFOR3; 6683 } 6684 #endif 6685 rc = PDMDevHlpMMIO2Register(pDevIns, pPciDev, pThis->pciRegions.iVRAM, pThis->vram_size, 0, (void **)&pThis->vram_ptrR3, "VRam"); 6686 AssertLogRelMsgRCReturn(rc, ("PDMDevHlpMMIO2Register(%#x,) -> %Rrc\n", pThis->vram_size, rc), rc); 6687 pThis->vram_ptrR0 = (RTR0PTR)pThis->vram_ptrR3; /** @todo @bugref{1865} Map parts into R0 or just use PGM access (Mac only). */ 6688 6689 #ifdef VBOX_WITH_RAW_MODE_KEEP 6690 if (pDevIns->fRCEnabled) 6691 { 6692 RTRCPTR pRCMapping = 0; 6693 rc = PDMDevHlpMMHyperMapMMIO2(pDevIns, pPciDev, pThis->pciRegions.iVRAM, 0 /* off */, VGA_MAPPING_SIZE, 6694 "VGA VRam", &pRCMapping); 6695 AssertLogRelMsgRCReturn(rc, ("PDMDevHlpMMHyperMapMMIO2(%#x,) -> %Rrc\n", VGA_MAPPING_SIZE, rc), rc); 6696 pThis->vram_ptrRC = pRCMapping; 6697 # ifdef VBOX_WITH_VMSVGA 6684 6685 # ifdef VBOX_WITH_RAW_MODE_KEEP 6698 6686 /* Don't need a mapping in RC */ 6699 6687 # endif 6700 } 6701 #endif 6702 6703 #if defined(VBOX_WITH_2X_4GB_ADDR_SPACE) 6704 if (pDevIns->fR0Enabled) 6705 { 6706 RTR0PTR pR0Mapping = 0; 6707 rc = PDMDevHlpMMIO2MapKernel(pDevIns, iPCIRegionVRAM, 0 /* off */, VGA_MAPPING_SIZE, "VGA VRam", &pR0Mapping); 6708 AssertLogRelMsgRCReturn(rc, ("PDMDevHlpMapMMIO2IntoR0(%#x,) -> %Rrc\n", VGA_MAPPING_SIZE, rc), rc); 6709 pThis->vram_ptrR0 = pR0Mapping; 6710 # ifdef VBOX_WITH_VMSVGA 6711 if (pThis->fVMSVGAEnabled) 6688 # if defined(VBOX_WITH_2X_4GB_ADDR_SPACE) 6689 if (pDevIns->fR0Enabled) 6712 6690 { 6713 6691 RTR0PTR pR0Mapping = 0; … … 6719 6697 } 6720 6698 #endif 6721 6722 /*6723 * Register access handler types.6724 */6725 rc = PGMR3HandlerPhysicalTypeRegister(pVM, PGMPHYSHANDLERKIND_WRITE,6726 vgaLFBAccessHandler,6727 g_DeviceVga.pszR0Mod, "vgaLFBAccessHandler", "vgaLbfAccessPfHandler",6728 g_DeviceVga.pszRCMod, "vgaLFBAccessHandler", "vgaLbfAccessPfHandler",6729 "VGA LFB", &pThis->hLfbAccessHandlerType);6730 AssertRCReturn(rc, rc);6731 6732 6699 6733 6700 /* … … 7436 7403 AssertRCReturn(rc, rc); 7437 7404 } 7405 # endif 7406 7407 /* 7408 * Map the start of the VRAM into this context. 7409 */ 7410 # if defined(VBOX_WITH_2X_4GB_ADDR_SPACE) 7411 rc = PDMDevHlpMmio2SetUpContext(pDevIns, pThis->hMmio2VRam, 0 /* off */, VGA_MAPPING_SIZE, (void **)&pThis->CTX_SUFF(vram_ptr)); 7412 AssertLogRelMsgRCReturn(rc, ("PDMDevHlpMmio2SetUpContext(,VRAM,0,%#x,) -> %Rrc\n", VGA_MAPPING_SIZE, rc), rc); 7438 7413 # endif 7439 7414 -
trunk/src/VBox/Devices/Graphics/DevVGA.h
r82072 r82074 47 47 #endif 48 48 49 #include <VBoxVideoVBE.h> 50 #include <VBoxVideoVBEPrivate.h> 51 52 #ifdef VBOX_WITH_HGSMI 53 # include "HGSMI/HGSMIHost.h" 54 #endif /* VBOX_WITH_HGSMI */ 55 #include "DevVGASavedState.h" 56 57 #ifdef VBOX_WITH_VMSVGA 58 # include "DevVGA-SVGA.h" 59 #endif 60 61 #include <iprt/list.h> 62 63 49 64 /** Use VBE bytewise I/O. Only needed for Windows Longhorn/Vista betas and backwards compatibility. */ 50 65 #define VBE_BYTEWISE_IO … … 59 74 #endif 60 75 61 #include <VBoxVideoVBE.h> 62 #include <VBoxVideoVBEPrivate.h> 63 64 #ifdef VBOX_WITH_HGSMI 65 # include "HGSMI/HGSMIHost.h" 66 #endif /* VBOX_WITH_HGSMI */ 67 #include "DevVGASavedState.h" 68 69 #ifdef VBOX_WITH_VMSVGA 70 # include "DevVGA-SVGA.h" 71 #endif 72 73 #include <iprt/list.h> 76 /** The size of the VGA GC mapping. 77 * This is supposed to be all the VGA memory accessible to the guest. 78 * The initial value was 256KB but NTAllInOne.iso appears to access more 79 * thus the limit was upped to 512KB. 80 * 81 * @todo Someone with some VGA knowhow should make a better guess at this value. 82 */ 83 #define VGA_MAPPING_SIZE _512K 84 74 85 75 86 #define MSR_COLOR_EMULATION 0x01 … … 544 555 IOMIOPORTHANDLE hIoPortVmSvga; 545 556 # endif 546 557 /** The MMIO2 handle of the VRAM. */ 558 PGMMMIO2HANDLE hMmio2VRam; 547 559 #endif /* VBOX */ 548 560 } VGAState;
Note:
See TracChangeset
for help on using the changeset viewer.