Changeset 13401 in vbox
- Timestamp:
- Oct 20, 2008 3:46:38 PM (16 years ago)
- Location:
- trunk/src/VBox/Devices/Graphics
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA.cpp
r12978 r13401 349 349 AssertMsg(offVRAM < pThis->vram_size, ("offVRAM = %p, pThis->vram_size = %p\n", offVRAM, pThis->vram_size)); 350 350 ASMBitSet(&pThis->au32DirtyBitmap[0], offVRAM >> PAGE_SHIFT); 351 pThis->fHa veDirtyBits = true;351 pThis->fHasDirtyBits = true; 352 352 } 353 353 … … 684 684 #endif 685 685 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 686 699 break; 687 700 case 0x3c7: … … 711 724 #endif 712 725 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 713 738 break; 739 714 740 case 0x3b4: 715 741 case 0x3d4: … … 880 906 s->vbe_regs[s->vbe_index] = val; 881 907 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 883 919 case VBE_DISPI_INDEX_ENABLE: 884 920 #ifndef IN_RING3 … … 1001 1037 */ 1002 1038 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 } 1003 1046 break; 1004 1047 #endif /* IN_RING3 */ … … 1081 1124 /* convert to VGA memory offset */ 1082 1125 memory_map_mode = (s->gr[6] >> 2) & 3; 1126 #ifdef VBOX 1127 RTGCPHYS GCPhys = addr; /* save original address */ 1128 #endif 1083 1129 addr &= 0x1ffff; 1084 1130 switch(memory_map_mode) { … … 1114 1160 #else /* VBOX */ 1115 1161 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 */ 1116 1170 #endif /* VBOX */ 1117 1171 } else if (!(s->sr[4] & 0x04)) { /* Host access is controlled by SR4, not GR5! */ … … 1197 1251 /* convert to VGA memory offset */ 1198 1252 memory_map_mode = (s->gr[6] >> 2) & 3; 1253 #ifdef VBOX 1254 RTGCPHYS GCPhys = addr; /* save original address */ 1255 #endif 1199 1256 addr &= 0x1ffff; 1200 1257 switch(memory_map_mode) { … … 1227 1284 s->vram_ptr[addr] = val; 1228 1285 #else /* VBOX */ 1229 # ifdef IN_GC1286 # ifdef IN_GC 1230 1287 if (addr >= VGA_MAPPING_SIZE) 1231 1288 return VINF_IOM_HC_MMIO_WRITE; 1232 # else1289 # else 1233 1290 if (addr >= s->vram_size) 1234 1291 { … … 1237 1294 return VINF_SUCCESS; 1238 1295 } 1239 # endif1296 # endif 1240 1297 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 1241 1308 #endif /* VBOX */ 1242 1309 #ifdef DEBUG_VGA_MEM … … 4326 4393 PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface); 4327 4394 PDMDEV_ASSERT_EMT(VGASTATE2DEVINS(pThis)); 4395 PPDMDEVINS pDevIns = pThis->CTX_SUFF(pDevIns); 4328 4396 4329 4397 #ifdef DEBUG_sunlover … … 4337 4405 return rc; 4338 4406 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 { 4342 4411 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; 4344 4418 } 4345 4419 … … 4358 4432 PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface); 4359 4433 PDMDEV_ASSERT_EMT(VGASTATE2DEVINS(pThis)); 4434 PPDMDEVINS pDevIns = pThis->CTX_SUFF(pDevIns); 4360 4435 4361 4436 /* This is called both in VBVA mode and normal modes. */ … … 4370 4445 4371 4446 /* 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 { 4375 4450 PGMHandlerPhysicalReset(PDMDevHlpGetVM(pDevIns), pThis->GCPhysVRAM); 4451 } 4452 if (pThis->fRemappedVGA) 4453 { 4454 IOMMMIOResetRegion(PDMDevHlpGetVM(pDevIns), 0x000a0000); 4455 pThis->fRemappedVGA = false; 4376 4456 } 4377 4457 … … 4985 5065 int rc = PGMHandlerPhysicalReset(PDMDevHlpGetVM(pDevIns), pThis->GCPhysVRAM); 4986 5066 AssertRC(rc); 5067 } 5068 if (pThis->fRemappedVGA) 5069 { 5070 IOMMMIOResetRegion(PDMDevHlpGetVM(pDevIns), 0x000a0000); 5071 pThis->fRemappedVGA = false; 4987 5072 } 4988 5073 -
trunk/src/VBox/Devices/Graphics/DevVGA.h
r11166 r13401 261 261 bool fR0Enabled; 262 262 /** 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 264 268 /** Pointer to vgaGCLFBAccessHandler(). */ 265 269 RTRCPTR RCPtrLFBHandler;
Note:
See TracChangeset
for help on using the changeset viewer.