Changeset 22444 in vbox for trunk/src/VBox/Additions/WINNT
- Timestamp:
- Aug 25, 2009 5:03:25 PM (15 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Miniport
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.cpp
r22414 r22444 1206 1206 VBoxBiosString, 1207 1207 sizeof(VBoxBiosString)); 1208 #if defined(VBOX_WITH_HGSMI) && defined(VBOX_WITH_VIDEOHWACCEL) 1209 VIDEO_ACCESS_RANGE tmpRanges[1]; 1210 ULONG slot; 1211 1212 /* need to call VideoPortGetAccessRanges to ensure interrupt info in ConfigInfo gets set up */ 1213 VP_STATUS status = VideoPortGetAccessRanges(HwDeviceExtension, 1214 0, 1215 NULL, 1216 1, 1217 tmpRanges, 1218 NULL, 1219 NULL, 1220 (PULONG) &slot); 1221 Assert(status == NO_ERROR ); 1222 // Assert(AccessRanges[0].RangeStart.QuadPart == tmpRanges[0].RangeStart.QuadPart); 1223 // Assert(AccessRanges[0].RangeLength == tmpRanges[0].RangeLength); 1224 // Assert(AccessRanges[0].RangeInIoSpace == tmpRanges[0].RangeInIoSpace); 1225 // Assert(AccessRanges[0].RangeVisible == tmpRanges[0].RangeVisible); 1226 // Assert(AccessRanges[0].RangeShareable == tmpRanges[0].RangeShareable); 1227 // Assert(AccessRanges[0].RangePassive == tmpRanges[0].RangePassive); 1228 1229 /* no matter what we get with VideoPortGetAccessRanges, we assert the default ranges */ 1230 #endif 1208 #ifdef VBOX_WITH_HGSMI 1209 if (VBoxHGSMIIsSupported ((PDEVICE_EXTENSION)HwDeviceExtension)) 1210 { 1211 dprintf(("VBoxVideo::VBoxVideoFindAdapter: calling VideoPortGetAccessRanges\n")); 1212 1213 /* Ports not yet found. */ 1214 ((PDEVICE_EXTENSION)HwDeviceExtension)->u.primary.IOPortHost = 0; 1215 ((PDEVICE_EXTENSION)HwDeviceExtension)->u.primary.IOPortGuest = 0; 1216 1217 VIDEO_ACCESS_RANGE tmpRanges[2]; 1218 ULONG slot; 1219 1220 /* need to call VideoPortGetAccessRanges to ensure interrupt info in ConfigInfo gets set up */ 1221 VP_STATUS status = VideoPortGetAccessRanges(HwDeviceExtension, 1222 0, 1223 NULL, 1224 sizeof (tmpRanges)/sizeof (tmpRanges[0]), 1225 tmpRanges, 1226 NULL, 1227 NULL, 1228 (PULONG) &slot); 1229 if (status == NO_ERROR) 1230 { 1231 ULONG iRange = 0; 1232 for (; iRange < sizeof (tmpRanges)/sizeof (tmpRanges[0]); iRange++) 1233 { 1234 dprintf(("VBoxVideo::VBoxVideoFindAdapter: range[%i]:\n" 1235 " RangeStart = 0x%llx\n" 1236 " RangeLength = %d\n" 1237 " RangeInIoSpace = %d\n" 1238 " RangeVisible = %d\n" 1239 " RangeShareable = %d\n" 1240 " RangePassive = %d\n", 1241 iRange, 1242 tmpRanges[iRange].RangeStart.QuadPart, 1243 tmpRanges[iRange].RangeLength, 1244 tmpRanges[iRange].RangeInIoSpace, 1245 tmpRanges[iRange].RangeVisible, 1246 tmpRanges[iRange].RangeShareable, 1247 tmpRanges[iRange].RangePassive)); 1248 if (tmpRanges[iRange].RangeInIoSpace) 1249 { 1250 PVOID ioBase = VideoPortGetDeviceBase(HwDeviceExtension, tmpRanges[iRange].RangeStart, 8, VIDEO_MEMORY_SPACE_IO); 1251 dprintf (("ioBase %p\n", ioBase)); 1252 1253 ((PDEVICE_EXTENSION)HwDeviceExtension)->u.primary.IOPortHost = (RTIOPORT)ioBase + VGA_PORT_OFF_HGSMI_HOST; 1254 ((PDEVICE_EXTENSION)HwDeviceExtension)->u.primary.IOPortGuest = (RTIOPORT)ioBase + VGA_PORT_OFF_HGSMI_GUEST; 1255 } 1256 } 1257 } 1258 1259 /* no matter what we get with VideoPortGetAccessRanges, we assert the default ranges */ 1260 } 1261 #endif /* VBOX_WITH_HGSMI */ 1231 1262 rc = VideoPortVerifyAccessRanges(HwDeviceExtension, 1, AccessRanges); 1232 1263 dprintf(("VBoxVideo::VBoxVideoFindAdapter: VideoPortVerifyAccessRanges returned 0x%x\n", rc)); … … 1777 1808 VideoPortWritePortUlong((PULONG)VBE_DISPI_IOPORT_DATA, VBOX_VIDEO_INTERPRET_DISPLAY_MEMORY_BASE + pDevExt->iDevice); 1778 1809 #else 1779 VBoxVideo HostWriteUlong(((PDEVICE_EXTENSION)HwDeviceExtension)->pPrimary, VBE_DISPI_INDEX_VBOX_VIDEO, VBOX_VIDEO_INTERPRET_DISPLAY_MEMORY_BASE + pDevExt->iDevice);1810 VBoxVideoVBEWriteUlong(((PDEVICE_EXTENSION)HwDeviceExtension)->pPrimary, VBE_DISPI_INDEX_VBOX_VIDEO, VBOX_VIDEO_INTERPRET_DISPLAY_MEMORY_BASE + pDevExt->iDevice); 1780 1811 #endif 1781 1812 } … … 2044 2075 VideoPortWritePortUshort((PUSHORT)VBE_DISPI_IOPORT_DATA, VBE_DISPI_DISABLED); 2045 2076 #else 2046 VBoxVideo HostWriteUshort(((PDEVICE_EXTENSION)HwDeviceExtension)->pPrimary, VBE_DISPI_INDEX_ENABLE, VBE_DISPI_DISABLED);2077 VBoxVideoVBEWriteUshort(((PDEVICE_EXTENSION)HwDeviceExtension)->pPrimary, VBE_DISPI_INDEX_ENABLE, VBE_DISPI_DISABLED); 2047 2078 #endif 2048 2079 … … 2159 2190 /** @todo read from the port to see if the mode switch was successful */ 2160 2191 #else 2161 VBoxVideo HostWriteUshort(DeviceExtension->pPrimary, VBE_DISPI_INDEX_XRES, (USHORT)ModeInfo->VisScreenWidth);2162 VBoxVideo HostWriteUshort(DeviceExtension->pPrimary, VBE_DISPI_INDEX_YRES, (USHORT)ModeInfo->VisScreenHeight);2163 VBoxVideo HostWriteUshort(DeviceExtension->pPrimary, VBE_DISPI_INDEX_BPP, (USHORT)ModeInfo->BitsPerPlane);2164 VBoxVideo HostWriteUshort(DeviceExtension->pPrimary, VBE_DISPI_INDEX_ENABLE, VBE_DISPI_ENABLED | VBE_DISPI_LFB_ENABLED);2192 VBoxVideoVBEWriteUshort(DeviceExtension->pPrimary, VBE_DISPI_INDEX_XRES, (USHORT)ModeInfo->VisScreenWidth); 2193 VBoxVideoVBEWriteUshort(DeviceExtension->pPrimary, VBE_DISPI_INDEX_YRES, (USHORT)ModeInfo->VisScreenHeight); 2194 VBoxVideoVBEWriteUshort(DeviceExtension->pPrimary, VBE_DISPI_INDEX_BPP, (USHORT)ModeInfo->BitsPerPlane); 2195 VBoxVideoVBEWriteUshort(DeviceExtension->pPrimary, VBE_DISPI_INDEX_ENABLE, VBE_DISPI_ENABLED | VBE_DISPI_LFB_ENABLED); 2165 2196 #endif 2166 2197 -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.h
r22136 r22444 51 51 #define VBE_DISPI_INDEX_VIRT_HEIGHT 0x7 52 52 #define VBE_DISPI_INDEX_VBOX_VIDEO 0xa 53 #ifdef VBOX_WITH_HGSMI54 #define VBE_DISPI_INDEX_VBVA_HOST 0xb55 #define VBE_DISPI_INDEX_VBVA_GUEST 0xc56 #endif /* VBOX_WITH_HGSMI */57 53 58 54 #define VBE_DISPI_ID2 0xB0C2 … … 70 66 #define VBE_DISPI_TOTAL_VIDEO_MEMORY_BYTES (VBE_DISPI_TOTAL_VIDEO_MEMORY_KB * 1024) 71 67 68 #ifdef VBOX_WITH_HGSMI 69 #define VGA_PORT_OFF_HGSMI_HOST 0 70 #define VGA_PORT_OFF_HGSMI_GUEST 4 71 #endif /* VBOX_WITH_HGSMI */ 72 72 73 typedef struct _DEVICE_EXTENSION 73 74 { … … 142 143 143 144 PSPIN_LOCK pGHRWLock; /* lock for making guest->host read/writes atomic */ 145 146 /* The IO Port Number for host commands. */ 147 RTIOPORT IOPortHost; 148 149 /* The IO Port Number for guest commands. */ 150 RTIOPORT IOPortGuest; 144 151 #endif /* VBOX_WITH_HGSMI */ 145 152 } primary; … … 256 263 #ifdef VBOX_WITH_HGSMI 257 264 258 DECLINLINE(void) VBoxVideo HostWriteUlongLocked(USHORT dataType, ULONG data)265 DECLINLINE(void) VBoxVideoVBEWriteUlongLocked(USHORT dataType, ULONG data) 259 266 { 260 267 VideoPortWritePortUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, dataType); … … 262 269 } 263 270 264 DECLINLINE(void) VBoxVideo HostWriteUshortLocked(USHORT dataType, USHORT data)271 DECLINLINE(void) VBoxVideoVBEWriteUshortLocked(USHORT dataType, USHORT data) 265 272 { 266 273 VideoPortWritePortUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, dataType); … … 268 275 } 269 276 270 DECLINLINE(ULONG) VBoxVideo HostReadUlongLocked (USHORT dataType)277 DECLINLINE(ULONG) VBoxVideoVBEReadUlongLocked (USHORT dataType) 271 278 { 272 279 VideoPortWritePortUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, dataType); … … 274 281 } 275 282 276 DECLINLINE(void) VBoxVideo HostWriteUlong(PDEVICE_EXTENSION PrimaryExtension, USHORT dataType, ULONG data)283 DECLINLINE(void) VBoxVideoVBEWriteUlong(PDEVICE_EXTENSION PrimaryExtension, USHORT dataType, ULONG data) 277 284 { 278 285 UCHAR oldIrql; … … 280 287 PrimaryExtension->u.primary.pGHRWLock, 281 288 &oldIrql); 282 VBoxVideo HostWriteUlongLocked(dataType, data);289 VBoxVideoVBEWriteUlongLocked(dataType, data); 283 290 VideoPortReleaseSpinLock(PrimaryExtension, 284 291 PrimaryExtension->u.primary.pGHRWLock, … … 286 293 } 287 294 288 DECLINLINE(void) VBoxVideo HostWriteUshort(PDEVICE_EXTENSION PrimaryExtension, USHORT dataType, USHORT data)295 DECLINLINE(void) VBoxVideoVBEWriteUshort(PDEVICE_EXTENSION PrimaryExtension, USHORT dataType, USHORT data) 289 296 { 290 297 UCHAR oldIrql; … … 292 299 PrimaryExtension->u.primary.pGHRWLock, 293 300 &oldIrql); 294 VBoxVideo HostWriteUshortLocked(dataType, data);301 VBoxVideoVBEWriteUshortLocked(dataType, data); 295 302 VideoPortReleaseSpinLock(PrimaryExtension, 296 303 PrimaryExtension->u.primary.pGHRWLock, … … 298 305 } 299 306 300 DECLINLINE(ULONG) VBoxVideo HostReadUlong(PDEVICE_EXTENSION PrimaryExtension, USHORT dataType)301 { 302 307 DECLINLINE(ULONG) VBoxVideoVBEReadUlong(PDEVICE_EXTENSION PrimaryExtension, USHORT dataType) 308 { 309 ULONG data; 303 310 UCHAR oldIrql; 304 311 VideoPortAcquireSpinLock(PrimaryExtension, 305 312 PrimaryExtension->u.primary.pGHRWLock, 306 313 &oldIrql); 307 data = VBoxVideoHostReadUlongLocked(dataType);314 data = VBoxVideoVBEReadUlongLocked(dataType); 308 315 VideoPortReleaseSpinLock(PrimaryExtension, 309 316 PrimaryExtension->u.primary.pGHRWLock, 310 317 oldIrql); 311 318 return data; 319 } 320 321 /* 322 * Host and Guest port IO helpers. 323 */ 324 DECLINLINE(void) VBoxHGSMIHostWrite(PDEVICE_EXTENSION PrimaryExtension, ULONG data) 325 { 326 VideoPortWritePortUlong((PULONG)PrimaryExtension->pPrimary->u.primary.IOPortHost, data); 327 } 328 329 DECLINLINE(ULONG) VBoxHGSMIHostRead(PDEVICE_EXTENSION PrimaryExtension) 330 { 331 return VideoPortReadPortUlong((PULONG)PrimaryExtension->pPrimary->u.primary.IOPortHost); 332 } 333 334 DECLINLINE(void) VBoxHGSMIGuestWrite(PDEVICE_EXTENSION PrimaryExtension, ULONG data) 335 { 336 VideoPortWritePortUlong((PULONG)PrimaryExtension->pPrimary->u.primary.IOPortGuest, data); 337 } 338 339 DECLINLINE(ULONG) VBoxHGSMIGuestRead(PDEVICE_EXTENSION PrimaryExtension) 340 { 341 return VideoPortReadPortUlong((PULONG)PrimaryExtension->pPrimary->u.primary.IOPortGuest); 312 342 } 313 343
Note:
See TracChangeset
for help on using the changeset viewer.