- Timestamp:
- Aug 7, 2007 12:59:44 PM (17 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Display/dd.c
r4028 r4061 78 78 memset(&pHalInfo->ddCaps, 0, sizeof(DDNTCORECAPS)); 79 79 pHalInfo->ddCaps.dwSize = sizeof(DDNTCORECAPS); 80 pHalInfo->ddCaps.dwVidMemTotal = pDev-> cScreenSize - pDev->cFrameBufferSize;80 pHalInfo->ddCaps.dwVidMemTotal = pDev->layout.cbDDRAWHeap; 81 81 pHalInfo->ddCaps.dwVidMemFree = pHalInfo->ddCaps.dwVidMemTotal; 82 82 … … 124 124 125 125 /* Do we have sufficient videomemory to create an off-screen heap for DDraw? */ 126 if (pDev-> cScreenSize > pDev->cFrameBufferSize)126 if (pDev->layout.cbDDRAWHeap > 0) 127 127 { 128 128 bDefineDDrawHeap = TRUE; … … 152 152 { 153 153 pVm->dwFlags = VIDMEM_ISLINEAR ; 154 pVm->fpStart = pDev-> cFrameBufferSize;155 pVm->fpEnd = pDev-> cScreenSize;154 pVm->fpStart = pDev->layout.offDDRAWHeap; 155 pVm->fpEnd = pDev->layout.offDDRAWHeap + pDev->layout.cbDDRAWHeap; 156 156 157 157 pVm->ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; -
trunk/src/VBox/Additions/WINNT/Graphics/Display/driver.h
r4027 r4061 50 50 BYTE *pBuffer; /* Buffer where screen bits are saved. */ 51 51 } SSB; 52 53 /* VRAM 54 * | | | | | 55 * 0+framebuffer+VBVA buffer+ddraw heap+displayinfo=cScreenSize 56 */ 57 typedef struct _VRAMLAYOUT 58 { 59 ULONG cbVRAM; 60 61 ULONG offFrameBuffer; 62 ULONG cbFrameBuffer; 63 64 ULONG offVBVABuffer; 65 ULONG cbVBVABuffer; 66 67 ULONG offDDRAWHeap; 68 ULONG cbDDRAWHeap; 69 70 ULONG offDisplayInformation; 71 ULONG cbDisplayInformation; 72 } VRAMLAYOUT; 52 73 53 74 struct _PDEV … … 68 89 ULONG ulMode; // Mode the mini-port driver is in. 69 90 LONG lDeltaScreen; // Distance from one scan to the next. 70 ULONG cScreenSize; // size of video memory, including 71 // offscreen memory. 72 ULONG cFrameBufferSize; // size of screen video memory 91 73 92 PVOID pOffscreenList; // linked list of DCI offscreen surfaces. 74 93 FLONG flRed; // For bitfields device, Red Mask … … 98 117 99 118 VBOXDISPLAYINFO *pInfo; 119 BOOLEAN bVBoxVideoSupported; 100 120 ULONG iDevice; 101 ULONG cbDisplayInformation; 121 VRAMLAYOUT layout; 122 102 123 #ifdef VBOX_WITH_DDRAW 103 124 BOOL bDdExclusiveMode; -
trunk/src/VBox/Additions/WINNT/Graphics/Display/screen.c
r4027 r4061 38 38 }; 39 39 40 static void vboxInitVBoxVideo (PPDEV ppdev, const VIDEO_MEMORY_INFORMATION *pMemoryInformation) 41 { 42 ULONG cbAvailable = 0; 43 44 DWORD returnedDataLength; 45 46 QUERYDISPLAYINFORESULT DispInfo; 47 RtlZeroMemory(&DispInfo, sizeof (DispInfo)); 48 49 ppdev->bVBoxVideoSupported = !EngDeviceIoControl(ppdev->hDriver, 50 IOCTL_VIDEO_QUERY_DISPLAY_INFO, 51 NULL, 52 0, 53 &DispInfo, 54 sizeof(DispInfo), 55 &returnedDataLength); 56 57 if (ppdev->bVBoxVideoSupported) 58 { 59 ppdev->iDevice = DispInfo.iDevice; 60 61 ppdev->layout.cbVRAM = pMemoryInformation->VideoRamLength; 62 63 ppdev->layout.offFrameBuffer = 0; 64 ppdev->layout.cbFrameBuffer = RT_ALIGN_32(pMemoryInformation->FrameBufferLength, 0x1000); 65 66 cbAvailable = ppdev->layout.cbVRAM - ppdev->layout.cbFrameBuffer; 67 68 if (cbAvailable <= DispInfo.u32DisplayInfoSize) 69 { 70 ppdev->bVBoxVideoSupported = FALSE; 71 } 72 else 73 { 74 ppdev->layout.offDisplayInformation = ppdev->layout.cbVRAM - DispInfo.u32DisplayInfoSize; 75 ppdev->layout.cbDisplayInformation = DispInfo.u32DisplayInfoSize; 76 77 cbAvailable -= ppdev->layout.cbDisplayInformation; 78 79 /* Use minimum 64K and maximum the cbFrameBuffer for the VBVA buffer. */ 80 for (ppdev->layout.cbVBVABuffer = ppdev->layout.cbFrameBuffer; 81 ppdev->layout.cbVBVABuffer >= 0x10000; 82 ppdev->layout.cbVBVABuffer /= 2) 83 { 84 if (ppdev->layout.cbVBVABuffer < cbAvailable) 85 { 86 break; 87 } 88 } 89 90 if (ppdev->layout.cbVBVABuffer >= cbAvailable) 91 { 92 ppdev->bVBoxVideoSupported = FALSE; 93 } 94 else 95 { 96 ppdev->layout.offVBVABuffer = ppdev->layout.offFrameBuffer + ppdev->layout.cbFrameBuffer; 97 98 cbAvailable -= ppdev->layout.cbVBVABuffer; 99 100 ppdev->layout.offDDRAWHeap = ppdev->layout.offVBVABuffer + ppdev->layout.cbVBVABuffer; 101 ppdev->layout.cbDDRAWHeap = cbAvailable; 102 } 103 } 104 } 105 106 if (!ppdev->bVBoxVideoSupported) 107 { 108 ppdev->iDevice = 0; 109 110 /* Setup a layout without both the VBVA buffer and the display information. */ 111 ppdev->layout.cbVRAM = pMemoryInformation->VideoRamLength; 112 113 ppdev->layout.offFrameBuffer = 0; 114 ppdev->layout.cbFrameBuffer = RT_ALIGN_32(pMemoryInformation->FrameBufferLength, 0x1000); 115 116 ppdev->layout.offVBVABuffer = ppdev->layout.offFrameBuffer + ppdev->layout.cbFrameBuffer; 117 ppdev->layout.cbVBVABuffer = 0; 118 119 ppdev->layout.offDDRAWHeap = ppdev->layout.offVBVABuffer + ppdev->layout.cbVBVABuffer; 120 ppdev->layout.cbDDRAWHeap = ppdev->layout.cbVRAM - ppdev->layout.offDDRAWHeap; 121 122 ppdev->layout.offDisplayInformation = ppdev->layout.offDDRAWHeap + ppdev->layout.cbDDRAWHeap; 123 ppdev->layout.cbDisplayInformation = 0; 124 } 125 126 DISPDBG((0, "vboxInitVBoxVideo:\n" 127 " cbVRAM = 0x%X\n" 128 " offFrameBuffer = 0x%X\n" 129 " cbFrameBuffer = 0x%X\n" 130 " offVBVABuffer = 0x%X\n" 131 " cbVBVABuffer = 0x%X\n" 132 " offDDRAWHeap = 0x%X\n" 133 " cbDDRAWHeap = 0x%X\n" 134 " offDisplayInformation = 0x%X\n" 135 " cbDisplayInformation = 0x%X\n", 136 ppdev->layout.cbVRAM, 137 ppdev->layout.offFrameBuffer, 138 ppdev->layout.cbFrameBuffer, 139 ppdev->layout.offVBVABuffer, 140 ppdev->layout.cbVBVABuffer, 141 ppdev->layout.offDDRAWHeap, 142 ppdev->layout.cbDDRAWHeap, 143 ppdev->layout.offDisplayInformation, 144 ppdev->layout.cbDisplayInformation 145 )); 146 } 147 40 148 /* Setup display information after remapping. */ 41 149 static void vboxSetupDisplayInfo (PPDEV ppdev, VIDEO_MEMORY_INFORMATION *pMemoryInformation) … … 44 152 uint8_t *pu8; 45 153 46 DWORD returnedDataLength; 47 QUERYDISPLAYINFORESULT DispInfo; 48 RtlZeroMemory(&DispInfo, sizeof (DispInfo)); 49 if (EngDeviceIoControl(ppdev->hDriver, 50 IOCTL_VIDEO_QUERY_DISPLAY_INFO, 51 NULL, 52 0, 53 &DispInfo, 54 sizeof(DispInfo), 55 &returnedDataLength)) 56 { 57 DISPDBG((1, "DISP bInitSURF failed IOCTL_VIDEO_QUERY_DISPLAY_INFO\n")); 58 ppdev->pInfo = NULL; 59 return; 60 } 61 62 if (returnedDataLength != sizeof (QUERYDISPLAYINFORESULT) 63 || DispInfo.u32DisplayInfoSize >= pMemoryInformation->VideoRamLength) 64 { 65 DISPDBG((1, "DISP bInitSURF failed DispInfo.u32DisplayInfoSize 0x%x >= pMemoryInformation->VideoRamLength 0x%x\n", 66 DispInfo.u32DisplayInfoSize, pMemoryInformation->VideoRamLength)); 67 ppdev->pInfo = NULL; 68 ppdev->cbDisplayInformation = 0; 69 return; 70 } 71 72 ppdev->iDevice = DispInfo.iDevice; 73 ppdev->cbDisplayInformation = DispInfo.u32DisplayInfoSize; 74 75 pu8 = (uint8_t *)pMemoryInformation->VideoRamBase; 76 pu8 += pMemoryInformation->VideoRamLength - DispInfo.u32DisplayInfoSize; 154 pu8 = (uint8_t *)ppdev->pjScreen + ppdev->layout.offDisplayInformation; 77 155 78 156 pInfo = (VBOXDISPLAYINFO *)pu8; … … 243 321 ppdev->pPointerAttributes->Row = 0; 244 322 ppdev->pPointerAttributes->Enable = 0; 245 246 /* Setup the display information. */247 vboxSetupDisplayInfo (ppdev, &videoMemoryInformation);248 323 249 ppdev->cScreenSize = videoMemoryInformation.VideoRamLength - ppdev->cbDisplayInformation; 250 ppdev->cFrameBufferSize = videoMemoryInformation.FrameBufferLength; 324 vboxInitVBoxVideo (ppdev, &videoMemoryInformation); 325 326 if (ppdev->bVBoxVideoSupported) 327 { 328 /* Setup the display information. */ 329 vboxSetupDisplayInfo (ppdev, &videoMemoryInformation); 330 } 251 331 } 252 332 -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.cpp
r4053 r4061 810 810 p->hdrEnd.u16Length = 0; 811 811 812 /* Inform the host about the display configuration. */812 /* Let the host to process the commands. */ 813 813 VideoPortWritePortUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_VBOX_VIDEO); 814 814 VideoPortWritePortUlong((PULONG)VBE_DISPI_IOPORT_DATA, VBOX_VIDEO_INTERPRET_ADAPTER_MEMORY);
Note:
See TracChangeset
for help on using the changeset viewer.