Changeset 4053 in vbox
- Timestamp:
- Aug 7, 2007 8:40:02 AM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 23489
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/VBoxVideo.h
r4027 r4053 92 92 #define VBOX_VIDEO_INTERPRET_DISPLAY_MEMORY_BASE 0x00010000 93 93 94 /* The value for port IO to read the number of monitors.95 */96 #define VBOX_VIDEO_QUERY_MONITOR_COUNT 0x0002000097 98 /* The value for port IO to read the offscreen heap size value.99 */100 #define VBOX_VIDEO_QUERY_OFFSCREEN_HEAP_SIZE 0x00020001101 94 102 95 /* The end of the information. */ … … 112 105 /* Information about non-volatile guest VRAM heap. */ 113 106 #define VBOX_VIDEO_INFO_TYPE_NV_HEAP 5 107 /* VBVA enable/disable. */ 108 #define VBOX_VIDEO_INFO_TYPE_VBVA_STATUS 6 109 /* VBVA flush. */ 110 #define VBOX_VIDEO_INFO_TYPE_VBVA_FLUSH 7 111 /* Query configuration value. */ 112 #define VBOX_VIDEO_INFO_TYPE_QUERY_CONF32 8 114 113 115 114 … … 201 200 202 201 } VBOXVIDEOINFONVHEAP; 202 203 /* Display information area. */ 204 typedef struct _VBOXVIDEOINFOVBVASTATUS 205 { 206 /* Absolute offset in VRAM of the start of the VBVA QUEUE. 0 to disable VBVA. */ 207 uint32_t u32QueueOffset; 208 209 /* The size of the VBVA QUEUE. 0 to disable VBVA. */ 210 uint32_t u32QueueSize; 211 212 } VBOXVIDEOINFOVBVASTATUS; 213 214 typedef struct _VBOXVIDEOINFOVBVAFLUSH 215 { 216 uint32_t u32DataStart; 217 218 uint32_t u32DataEnd; 219 220 } VBOXVIDEOINFOVBVAFLUSH; 221 222 #define VBOX_VIDEO_QCI32_MONITOR_COUNT 0 223 #define VBOX_VIDEO_QCI32_OFFSCREEN_HEAP_SIZE 1 224 225 typedef struct _VBOXVIDEOINFOQUERYCONF32 226 { 227 uint32_t u32Index; 228 229 uint32_t u32Value; 230 231 } VBOXVIDEOINFOQUERYCONF32; 203 232 #pragma pack() 204 233 -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.cpp
r4027 r4053 740 740 741 741 dprintf(("VBoxVideo::vboxComputeFrameBufferSizes: [%d] ulFrameBufferOffset 0x%08X\n", 742 ulFrameBufferOffset));742 Extension->iDevice, ulFrameBufferOffset)); 743 743 744 744 ulFrameBufferOffset += PrimaryExtension->u.primary.ulMaxFrameBufferSize … … 749 749 } 750 750 751 static int vboxMapAdapterMemory (PDEVICE_EXTENSION PrimaryExtension )752 { 753 dprintf(("VBoxVideo::vboxMapAdapterMemory \n"));751 static int vboxMapAdapterMemory (PDEVICE_EXTENSION PrimaryExtension, void **ppv, ULONG ulOffset, ULONG ulSize) 752 { 753 dprintf(("VBoxVideo::vboxMapAdapterMemory 0x%08X[0x%X]\n", ulOffset, ulSize)); 754 754 755 755 PHYSICAL_ADDRESS FrameBuffer; 756 FrameBuffer.QuadPart = VBE_DISPI_LFB_PHYSICAL_ADDRESS 757 + PrimaryExtension->u.primary.cbVRAM 758 - PrimaryExtension->u.primary.cbMiniportHeap 759 - VBOX_VIDEO_ADAPTER_INFORMATION_SIZE; 756 FrameBuffer.QuadPart = VBE_DISPI_LFB_PHYSICAL_ADDRESS + ulOffset; 760 757 761 758 PVOID VideoRamBase = NULL; 762 759 ULONG inIoSpace = 0; 763 ULONG VideoRamLength = PrimaryExtension->u.primary.cbMiniportHeap 764 + VBOX_VIDEO_ADAPTER_INFORMATION_SIZE; 760 ULONG VideoRamLength = ulSize; 765 761 766 762 VP_STATUS Status = VideoPortMapMemory (PrimaryExtension, FrameBuffer, … … 770 766 if (Status == NO_ERROR) 771 767 { 772 PrimaryExtension->u.primary.pvMiniportHeap = VideoRamBase; 773 PrimaryExtension->u.primary.pvAdapterInformation = (uint8_t *)VideoRamBase 774 + PrimaryExtension->u.primary.cbMiniportHeap; 768 *ppv = VideoRamBase; 775 769 } 776 770 … … 780 774 } 781 775 782 static void vboxUnmapAdapterMemory (PDEVICE_EXTENSION PrimaryExtension )776 static void vboxUnmapAdapterMemory (PDEVICE_EXTENSION PrimaryExtension, void **ppv) 783 777 { 784 778 dprintf(("VBoxVideo::vboxMapAdapterMemory\n")); 785 779 786 if (PrimaryExtension->u.primary.pvMiniportHeap) 787 { 788 VideoPortUnmapMemory(PrimaryExtension, PrimaryExtension->u.primary.pvMiniportHeap, NULL); 789 } 790 791 PrimaryExtension->u.primary.pvMiniportHeap = NULL; 792 PrimaryExtension->u.primary.pvAdapterInformation = NULL; 780 if (*ppv) 781 { 782 VideoPortUnmapMemory(PrimaryExtension, *ppv, NULL); 783 } 784 785 *ppv = NULL; 786 } 787 788 static void vboxQueryConf (PDEVICE_EXTENSION PrimaryExtension, uint32_t u32Index, ULONG *pulValue) 789 { 790 dprintf(("VBoxVideo::vboxQueryConf: u32Index = %d\n", u32Index)); 791 792 typedef struct _VBOXVIDEOQCONF32 793 { 794 VBOXVIDEOINFOHDR hdrQuery; 795 VBOXVIDEOINFOQUERYCONF32 query; 796 VBOXVIDEOINFOHDR hdrEnd; 797 } VBOXVIDEOQCONF32; 798 799 VBOXVIDEOQCONF32 *p = (VBOXVIDEOQCONF32 *)PrimaryExtension->u.primary.pvAdapterInformation; 800 801 p->hdrQuery.u8Type = VBOX_VIDEO_INFO_TYPE_QUERY_CONF32; 802 p->hdrQuery.u8Reserved = 0; 803 p->hdrQuery.u16Length = sizeof (VBOXVIDEOINFOQUERYCONF32); 804 805 p->query.u32Index = u32Index; 806 p->query.u32Value = 0; 807 808 p->hdrEnd.u8Type = VBOX_VIDEO_INFO_TYPE_END; 809 p->hdrEnd.u8Reserved = 0; 810 p->hdrEnd.u16Length = 0; 811 812 /* Inform the host about the display configuration. */ 813 VideoPortWritePortUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_VBOX_VIDEO); 814 VideoPortWritePortUlong((PULONG)VBE_DISPI_IOPORT_DATA, VBOX_VIDEO_INTERPRET_ADAPTER_MEMORY); 815 816 *pulValue = (ULONG)p->query.u32Value; 817 818 dprintf(("VBoxVideo::vboxQueryConf: u32Value = %d\n", p->query.u32Value)); 793 819 } 794 820 … … 883 909 PrimaryExtension->u.primary.ulDisplayInformationSize = 0; 884 910 885 886 911 /* Verify whether the HW supports VirtualBox extensions. */ 887 912 VideoPortWritePortUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_ID); … … 896 921 PrimaryExtension->u.primary.bVBoxVideoSupported)); 897 922 923 if (PrimaryExtension->u.primary.bVBoxVideoSupported) 924 { 925 /* Map the adapter information. It will be needed to query some configuration values. */ 926 rc = vboxMapAdapterMemory (PrimaryExtension, 927 &PrimaryExtension->u.primary.pvAdapterInformation, 928 PrimaryExtension->u.primary.cbVRAM - VBOX_VIDEO_ADAPTER_INFORMATION_SIZE, 929 VBOX_VIDEO_ADAPTER_INFORMATION_SIZE 930 ); 931 if (rc != NO_ERROR) 932 { 933 dprintf(("VBoxVideo::VBoxSetupDisplays: vboxMapAdapterMemory pvAdapterInfoirrmation failed rc = %d\n", 934 rc)); 935 936 PrimaryExtension->u.primary.bVBoxVideoSupported = FALSE; 937 } 938 } 939 898 940 /* Setup the non-volatile heap and the adapter memory. */ 899 941 if (PrimaryExtension->u.primary.bVBoxVideoSupported) 900 942 { 901 943 /* Query the size of the non-volatile heap. */ 902 VideoPortWritePortUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_VBOX_VIDEO); 903 VideoPortWritePortUlong((PULONG)VBE_DISPI_IOPORT_DATA, VBOX_VIDEO_QUERY_OFFSCREEN_HEAP_SIZE); 904 905 ULONG cbMiniportHeap = VideoPortReadPortUlong((PULONG)VBE_DISPI_IOPORT_DATA); 944 ULONG cbMiniportHeap = 0; 945 vboxQueryConf (PrimaryExtension, VBOX_VIDEO_QCI32_OFFSCREEN_HEAP_SIZE, &cbMiniportHeap); 906 946 907 947 /* Do not allow too big heap. 50% of VRAM should be enough. */ … … 927 967 * 928 968 */ 929 rc = vboxMapAdapterMemory (PrimaryExtension); 969 rc = vboxMapAdapterMemory (PrimaryExtension, 970 &PrimaryExtension->u.primary.pvMiniportHeap, 971 PrimaryExtension->u.primary.cbVRAM 972 - VBOX_VIDEO_ADAPTER_INFORMATION_SIZE 973 - PrimaryExtension->u.primary.cbMiniportHeap, 974 PrimaryExtension->u.primary.cbMiniportHeap 975 ); 930 976 931 977 if (rc != NO_ERROR) … … 954 1000 { 955 1001 /* Query the configured number of displays. */ 956 VideoPortWritePortUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_VBOX_VIDEO);957 int cDisplays = VideoPortReadPortUshort((PUSHORT)VBE_DISPI_IOPORT_DATA);958 1002 ULONG cDisplays = 0; 1003 vboxQueryConf (PrimaryExtension, VBOX_VIDEO_QCI32_MONITOR_COUNT, &cDisplays); 1004 959 1005 dprintf(("VBoxVideo::VBoxSetupDisplays: cDisplays = %d\n", 960 1006 cDisplays)); … … 968 1014 PDEVICE_EXTENSION pPrev = PrimaryExtension; 969 1015 970 intiDisplay;1016 ULONG iDisplay; 971 1017 for (iDisplay = 1; iDisplay < cDisplays; iDisplay++) 972 1018 { … … 1011 1057 /* Setup the information for the host. */ 1012 1058 vboxSetupAdapterInfo (PrimaryExtension); 1059 } 1060 else 1061 { 1062 /* Unmap the memory if VBoxVideo is not supported. */ 1063 vboxUnmapAdapterMemory (PrimaryExtension, &PrimaryExtension->u.primary.pvMiniportHeap); 1064 vboxUnmapAdapterMemory (PrimaryExtension, &PrimaryExtension->u.primary.pvAdapterInformation); 1013 1065 } 1014 1066 … … 1667 1719 VbglTerminate (); 1668 1720 1669 vboxUnmapAdapterMemory (pDevExt); 1721 vboxUnmapAdapterMemory (pDevExt, &pDevExt->u.primary.pvMiniportHeap); 1722 vboxUnmapAdapterMemory (pDevExt, &pDevExt->u.primary.pvAdapterInformation); 1670 1723 1671 1724 return TRUE; -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.h
r4027 r4053 94 94 */ 95 95 PVOID pvMiniportHeap; /* The pointer to the miniport heap VRAM. 96 * This is mapped by miniport as one block together with adapter info.97 */ 98 99 PVOID pvAdapterInformation; /* The pointer to the last 4K of VRAM. Calculated as100 * (uint8_t *)pvMiniportHeap + cbMiniportHeap96 * This is mapped by miniport separately. 97 */ 98 99 PVOID pvAdapterInformation; /* The pointer to the last 4K of VRAM. 100 * This is mapped by miniport separately. 101 101 */ 102 102 -
trunk/src/VBox/Devices/Graphics/DevVGA.cpp
r4027 r4053 56 56 /** The minimum amount of VRAM. */ 57 57 #define VGA_VRAM_MIN (_1M) 58 /** The maximum number of monitors. */59 #define VGA_MONITORS_MAX 6460 58 61 59 /** The size of the VGA GC mapping. … … 583 581 } 584 582 } else if (s->vbe_index == VBE_DISPI_INDEX_VBOX_VIDEO) { 585 switch (s->vbox_video_command) 586 { 587 case VBOX_VIDEO_QUERY_MONITOR_COUNT: 588 val = s->monitor_count; 589 break; 590 case VBOX_VIDEO_QUERY_OFFSCREEN_HEAP_SIZE: 591 val = _1M; /* @todo make configurable */ 592 break; 593 } 594 Log(("VBE: s->vbox_video_command = 0x%x, s->monitor_count = %d read index=0x%x val=0x%x\n", s->monitor_count, s->vbe_index, val)); 583 /* Reading from the port yields nothing. */ 584 val = 0; 595 585 } else { 596 586 val = s->vbe_regs[s->vbe_index]; … … 859 849 s->pDrv->pfnProcessDisplayData(s->pDrv, s->CTXSUFF(vram_ptr), val & 0xFFFF); 860 850 } 861 s->vbox_video_command = val;862 851 #endif /* IN_RING3 */ 863 852 #endif /* VBOX */ … … 2898 2887 if (cb == 2) 2899 2888 { 2900 /* Reading 16 bit value always reads the count of monitor.2901 * That is for compatibility with old additions.2902 */2903 VGAState *s = PDMINS2DATA(pDevIns, PVGASTATE);2904 if (s->vbe_index == VBE_DISPI_INDEX_VBOX_VIDEO)2905 {2906 s->vbox_video_command = VBOX_VIDEO_QUERY_MONITOR_COUNT;2907 }2908 2889 *pu32 = vbe_ioport_read_data(PDMINS2DATA(pDevIns, PVGASTATE), Port); 2909 2890 return VINF_SUCCESS; … … 2912 2893 { 2913 2894 VGAState *s = PDMINS2DATA(pDevIns, PVGASTATE); 2914 if (s->vbe_index == VBE_DISPI_INDEX_VBOX_VIDEO) 2915 { 2916 *pu32 = vbe_ioport_read_data(PDMINS2DATA(pDevIns, PVGASTATE), Port); 2917 } 2918 else 2919 { 2920 /* Quick hack for getting the vram size. */ 2921 *pu32 = s->vram_size; 2922 } 2895 /* Quick hack for getting the vram size. */ 2896 *pu32 = s->vram_size; 2923 2897 return VINF_SUCCESS; 2924 2898 } … … 4345 4319 #ifdef CONFIG_BOCHS_VBE 4346 4320 pData->vbe_regs[VBE_DISPI_INDEX_ID] = VBE_DISPI_ID0; 4347 pData->vbe_regs[VBE_DISPI_INDEX_VBOX_VIDEO] = pData->monitor_count;4321 pData->vbe_regs[VBE_DISPI_INDEX_VBOX_VIDEO] = 0; 4348 4322 pData->vbe_bank_mask = ((pData->vram_size >> 16) - 1); 4349 4323 #endif /* CONFIG_BOCHS_VBE */ … … 4531 4505 */ 4532 4506 if (!CFGMR3AreValuesValid(pCfgHandle, "VRamSize\0" 4533 "MonitorCount\0"4534 4507 "GCEnabled\0" 4535 4508 "R0Enabled\0" … … 4572 4545 } 4573 4546 Log(("VGA: VRamSize=%#x\n", pData->vram_size)); 4574 4575 rc = CFGMR3QueryU32(pCfgHandle, "MonitorCount", &pData->monitor_count);4576 if (VBOX_FAILURE(rc) || !pData->monitor_count)4577 pData->monitor_count = 1;4578 else if (pData->monitor_count > VGA_MONITORS_MAX)4579 {4580 AssertMsgFailed(("monitor_count=%d max=%d\n", pData->monitor_count, VGA_MONITORS_MAX));4581 pData->monitor_count = 1;4582 }4583 pData->vbe_regs[VBE_DISPI_INDEX_VBOX_VIDEO] = pData->monitor_count;4584 Log(("VGA: MonitorCount=%d\n", pData->monitor_count));4585 4547 4586 4548 pData->fGCEnabled = true; -
trunk/src/VBox/Devices/Graphics/DevVGA.h
r4027 r4053 282 282 uint32_t cMilliesRefreshInterval; 283 283 284 /** Number of virtual monitors */285 uint32_t monitor_count;286 /** The VBoxVideo extension command issued by guest. */287 uint32_t vbox_video_command;288 289 284 /** Whether to render the guest VRAM to the framebuffer memory. False only for some LFB modes. */ 290 285 uint32_t fRenderVRAM; -
trunk/src/VBox/Main/ConsoleImpl.cpp
r4041 r4053 4835 4835 BSTR str = NULL; 4836 4836 ULONG cRamMBs; 4837 ULONG cMonitors;4838 4837 unsigned i; 4839 4838 … … 5235 5234 hrc = pMachine->COMGETTER(VRAMSize)(&cRamMBs); H(); 5236 5235 rc = CFGMR3InsertInteger(pCfg, "VRamSize", cRamMBs * _1M); RC_CHECK(); 5237 hrc = pMachine->COMGETTER(MonitorCount)(&cMonitors); H();5238 rc = CFGMR3InsertInteger(pCfg, "MonitorCount", cMonitors); RC_CHECK();5239 5236 5240 5237 /* Custom VESA mode list */ -
trunk/src/VBox/Main/DisplayImpl.cpp
r4027 r4053 2197 2197 2198 2198 LogFlow(("VBOX_VIDEO_INFO_TYPE_DISPLAY: %d: at 0x%08X, size 0x%08X, info 0x%08X\n", pDisplay->u32Index, pDisplay->u32Offset, pDisplay->u32FramebufferSize, pDisplay->u32InformationSize)); 2199 } 2200 else if (pHdr->u8Type == VBOX_VIDEO_INFO_TYPE_QUERY_CONF32) 2201 { 2202 if (pHdr->u16Length != sizeof (VBOXVIDEOINFOQUERYCONF32)) 2203 { 2204 LogRel(("VBoxVideo: Guest adapter information %s invalid length %d!!!\n", "CONF32", pHdr->u16Length)); 2205 break; 2206 } 2207 2208 VBOXVIDEOINFOQUERYCONF32 *pConf32 = (VBOXVIDEOINFOQUERYCONF32 *)pu8; 2209 2210 switch (pConf32->u32Index) 2211 { 2212 case VBOX_VIDEO_QCI32_MONITOR_COUNT: 2213 { 2214 pConf32->u32Value = pDrv->pDisplay->mcMonitors; 2215 } break; 2216 2217 case VBOX_VIDEO_QCI32_OFFSCREEN_HEAP_SIZE: 2218 { 2219 /* @todo make configurable. */ 2220 pConf32->u32Value = _1M; 2221 } break; 2222 2223 default: 2224 LogRel(("VBoxVideo: CONF32 %d not supported!!! Skipping.\n", pConf32->u32Index)); 2225 } 2199 2226 } 2200 2227 else if (pHdr->u8Type == VBOX_VIDEO_INFO_TYPE_END)
Note:
See TracChangeset
for help on using the changeset viewer.