Changeset 33048 in vbox for trunk/src/VBox/Additions/WINNT/Graphics
- Timestamp:
- Oct 11, 2010 8:57:20 PM (14 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Display/Makefile.kmk
r32889 r33048 57 57 VBoxDisp_LIBS = \ 58 58 $(PATH_SDK_W2K3DDK_LIB)/win32k.lib \ 59 $(VBOX_LIB_IPRT_GUEST_R0) 60 61 ifdef VBOX_WITH_HGSMI 62 VBoxDisp_LIBS += \ 59 $(VBOX_LIB_IPRT_GUEST_R0) \ 63 60 $(VBOX_PATH_ADDITIONS_LIB)/HGSMIGuestR0Lib$(VBOX_SUFF_LIB) 64 VBoxDisp_DEFS += VBOX_WITH_HGSMI65 endif66 61 67 62 ifdef VBOX_WITH_WDDM -
trunk/src/VBox/Additions/WINNT/Graphics/Display/dd.c
r28800 r33048 1245 1245 DISPDBG((0, "%d,%d %dx%d\n", pDev->ddLock.rArea.left, pDev->ddLock.rArea.top, pDev->ddLock.rArea.right - pDev->ddLock.rArea.left, pDev->ddLock.rArea.bottom - pDev->ddLock.rArea.top)); 1246 1246 1247 #ifndef VBOX_WITH_HGSMI1248 if (pDev->pInfo && vboxHwBufferBeginUpdate (pDev))1249 {1250 vbvaReportDirtyRect (pDev, &pDev->ddLock.rArea);1251 1252 if ( pDev->pInfo->hostEvents.fu32Events1253 & VBOX_VIDEO_INFO_HOST_EVENTS_F_VRDP_RESET)1254 {1255 vrdpReset (pDev);1256 1257 pDev->pInfo->hostEvents.fu32Events &=1258 ~VBOX_VIDEO_INFO_HOST_EVENTS_F_VRDP_RESET;1259 }1260 1261 if (pDev->vbva.pVbvaMemory->fu32ModeFlags1262 & VBVA_F_MODE_VRDP)1263 {1264 vrdpReportDirtyRect (pDev, &pDev->ddLock.rArea);1265 }1266 1267 vboxHwBufferEndUpdate (pDev);1268 }1269 #else1270 1247 if (pDev->bHGSMISupported && vboxHwBufferBeginUpdate (pDev)) 1271 1248 { … … 1289 1266 vboxHwBufferEndUpdate (pDev); 1290 1267 } 1291 #endif /* VBOX_WITH_HGSMI */1292 1268 1293 1269 pDev->ddLock.bLocked = FALSE; -
trunk/src/VBox/Additions/WINNT/Graphics/Display/driver.h
r28800 r33048 168 168 FLONG flHooks; 169 169 170 #ifndef VBOX_WITH_HGSMI171 VBVAENABLERESULT vbva;172 uint32_t u32VRDPResetFlag;173 #endif /* !VBOX_WITH_HGSMI */174 170 BOOL fHwBufferOverflow; 175 171 VBVARECORD *pRecord; … … 179 175 SSB aSSB[4]; // LIFO type stack for saved screen areas. 180 176 181 #ifndef VBOX_WITH_HGSMI182 VBOXDISPLAYINFO *pInfo;183 BOOLEAN bVBoxVideoSupported;184 #endif /* !VBOX_WITH_HGSMI */185 177 ULONG iDevice; 186 178 VRAMLAYOUT layout; … … 199 191 #endif /* VBOX_WITH_DDRAW */ 200 192 201 #ifdef VBOX_WITH_HGSMI202 193 BOOLEAN bHGSMISupported; 203 194 HGSMIHEAP hgsmiDisplayHeap; … … 212 203 PVOID pVideoPortContext; 213 204 VBOXVIDEOPORTPROCS VideoPortProcs; 214 #endif /* VBOX_WITH_HGSMI */215 205 216 206 #ifdef VBOX_WITH_VIDEOHWACCEL … … 228 218 #endif 229 219 230 #ifndef VBOX_WITH_HGSMI231 /* The global semaphore handle for all driver instances. */232 extern HSEMAPHORE ghsemHwBuffer;233 #endif /* !VBOX_WITH_HGSMI */234 220 235 221 … … 291 277 void drvLoadEng (void); 292 278 293 #ifdef VBOX_WITH_HGSMI294 279 void vboxVBVAHostCommandComplete(PPDEV ppdev, VBVAHOSTCMD * pCmd); 295 280 296 281 #ifdef VBOX_WITH_VIDEOHWACCEL 297 282 298 283 DECLINLINE(uint64_t) vboxVHWAVramOffsetFromPDEV(PPDEV pDev, ULONG_PTR offPdev) … … 397 382 int vboxVHWADisable(PPDEV ppdev); 398 383 399 #endif400 384 #endif 401 385 -
trunk/src/VBox/Additions/WINNT/Graphics/Display/drv.c
r33003 r33048 101 101 } 102 102 103 #ifndef VBOX_WITH_HGSMI104 #define VBVA_OPERATION(__psoDest, __fn, __a) do { \105 if (bIsScreenSurface(__psoDest)) \106 { \107 PPDEV ppdev = (PPDEV)__psoDest->dhpdev; \108 \109 if (ppdev->pInfo && vboxHwBufferBeginUpdate (ppdev)) \110 { \111 vbva##__fn __a; \112 \113 if ( ppdev->pInfo->hostEvents.fu32Events \114 & VBOX_VIDEO_INFO_HOST_EVENTS_F_VRDP_RESET) \115 { \116 vrdpReset (ppdev); \117 \118 ppdev->pInfo->hostEvents.fu32Events &= \119 ~VBOX_VIDEO_INFO_HOST_EVENTS_F_VRDP_RESET; \120 } \121 \122 if (ppdev->vbva.pVbvaMemory->fu32ModeFlags \123 & VBVA_F_MODE_VRDP) \124 { \125 vrdp##__fn __a; \126 } \127 \128 vboxHwBufferEndUpdate (ppdev); \129 } \130 } \131 } while (0)132 #else133 103 #define VBVA_OPERATION(__psoDest, __fn, __a) do { \ 134 104 if (bIsScreenSurface(__psoDest)) \ … … 159 129 } \ 160 130 } while (0) 161 #endif /* VBOX_WITH_HGSMI */162 131 163 132 //#undef VBVA_OPERATION … … 351 320 PPDEV ppdev = (PPDEV)psoDest->dhpdev; 352 321 353 #ifndef VBOX_WITH_HGSMI354 VBVAMEMORY *pVbvaMemory = ppdev->vbva.pVbvaMemory;355 356 DISPDBG((1, "offscreen->screen\n"));357 358 if ( pVbvaMemory359 && (pVbvaMemory->fu32ModeFlags & VBVA_F_MODE_ENABLED))360 #else361 322 DISPDBG((1, "offscreen->screen\n")); 362 323 363 324 if ( ppdev->pVBVA 364 325 && (ppdev->pVBVA->hostFlags.u32HostEvents & VBVA_F_MODE_ENABLED)) 365 #endif /* VBOX_WITH_HGSMI */366 326 { 367 327 if ( (psoSrc->fjBitmap & BMF_DONTCACHE) != 0 … … 769 729 PPDEV ppdev = (PPDEV)psoTarget->dhpdev; 770 730 771 #ifndef VBOX_WITH_HGSMI772 if ( ppdev->vbva.pVbvaMemory773 && (ppdev->vbva.pVbvaMemory->fu32ModeFlags & VBVA_F_MODE_ENABLED))774 {775 if (ppdev->vbva.pVbvaMemory->fu32ModeFlags776 & VBVA_F_MODE_VRDP_RESET)777 {778 vrdpReset (ppdev);779 780 ppdev->vbva.pVbvaMemory->fu32ModeFlags &=781 ~VBVA_F_MODE_VRDP_RESET;782 }783 784 if (ppdev->vbva.pVbvaMemory->fu32ModeFlags785 & VBVA_F_MODE_VRDP)786 {787 bRc = vrdpRealizeBrush (pbo, psoTarget, psoPattern, psoMask, pxlo, iHatch);788 }789 }790 #else791 731 if ( ppdev->pVBVA 792 732 && (ppdev->pVBVA->hostFlags.u32HostEvents & VBVA_F_MODE_ENABLED)) … … 807 747 } 808 748 } 809 #endif /* VBOX_WITH_HGSMI */810 749 } 811 750 -
trunk/src/VBox/Additions/WINNT/Graphics/Display/enable.c
r28800 r33048 126 126 ULONG ret = 0; 127 127 128 #ifndef VBOX_WITH_HGSMI 129 if (ppdev && ppdev->pInfo && vboxHwBufferBeginUpdate (ppdev)) 130 { 131 if (ppdev->vbva.pVbvaMemory->fu32ModeFlags 132 & VBVA_F_MODE_VRDP) 128 if (ppdev && ppdev->pVBVA) 129 { 130 if (ppdev->pVBVA->hostFlags.u32HostEvents & VBVA_F_MODE_VRDP) 133 131 { 134 132 ret = 1; 135 133 } 136 DISPDBG((0, "VBOXESC_ISVRDPACTIVE -> %d (%x)\n", ret, ppdev->vbva.pVbvaMemory->fu32ModeFlags)); 137 vboxHwBufferEndUpdate (ppdev); 134 DISPDBG((0, "VBOXESC_ISVRDPACTIVE -> %d (%x)\n", ret, ppdev->pVBVA->hostFlags.u32HostEvents)); 138 135 } 139 136 else 140 137 DISPDBG((0, "VBOXESC_ISVRDPACTIVE -> 0\n")); 141 #else142 if (ppdev && ppdev->pVBVA)143 {144 if (ppdev->pVBVA->hostFlags.u32HostEvents & VBVA_F_MODE_VRDP)145 {146 ret = 1;147 }148 DISPDBG((0, "VBOXESC_ISVRDPACTIVE -> %d (%x)\n", ret, ppdev->pVBVA->hostFlags.u32HostEvents));149 }150 else151 DISPDBG((0, "VBOXESC_ISVRDPACTIVE -> 0\n"));152 #endif /* VBOX_WITH_HGSMI */153 138 return ret; 154 139 } … … 326 311 #define HOOKS_BMF32BPP gflHooks 327 312 328 #ifndef VBOX_WITH_HGSMI329 HSEMAPHORE ghsemHwBuffer = 0;330 #endif /* !VBOX_WITH_HGSMI */331 313 332 314 /******************************Public*Routine******************************\ … … 379 361 DDI_DRIVER_VERSION_NT4; 380 362 381 #ifndef VBOX_WITH_HGSMI382 if (!ghsemHwBuffer)383 {384 ghsemHwBuffer = EngCreateSemaphore ();385 }386 #endif /* !VBOX_WITH_HGSMI */387 363 388 364 return(TRUE); … … 401 377 DISPDBG((0, "VBoxDisp::DrvDisableDriver called.\n")); 402 378 403 #ifndef VBOX_WITH_HGSMI404 if (ghsemHwBuffer)405 {406 EngDeleteSemaphore (ghsemHwBuffer);407 ghsemHwBuffer = NULL;408 }409 #endif /* !VBOX_WITH_HGSMI */410 379 411 380 return; … … 939 908 #endif 940 909 941 #ifdef VBOX_WITH_HGSMI942 910 /* Free the driver's VBVA resources. */ 943 911 vboxVbvaDisable ((PPDEV) dhpdev); 944 #endif945 912 946 913 // … … 1141 1108 { 1142 1109 case DN_DEVICE_ORIGIN: 1143 #ifndef VBOX_WITH_HGSMI1144 ppdev->ptlDevOrg = *(PPOINTL)pvData;1145 DISPDBG((3, "DN_DEVICE_ORIGIN: %d, %d (PSO = %p, pInfo = %p)\n", ppdev->ptlDevOrg.x,1146 ppdev->ptlDevOrg.y, pso, ppdev->pInfo));1147 if (ppdev->pInfo)1148 {1149 ppdev->pInfo->screen.xOrigin = ppdev->ptlDevOrg.x;1150 ppdev->pInfo->screen.yOrigin = ppdev->ptlDevOrg.y;1151 VBoxProcessDisplayInfo(ppdev);1152 }1153 break;1154 #else1155 1110 { 1156 1111 POINTL ptlDevOrg = *(PPOINTL)pvData; … … 1163 1118 } 1164 1119 } break; 1165 #endif /* VBOX_WITH_HGSMI */1166 1120 case DN_DRAWING_BEGIN: 1167 1121 DISPDBG((3, "DN_DRAWING_BEGIN (PSO = %p)\n", pso)); -
trunk/src/VBox/Additions/WINNT/Graphics/Display/screen.c
r28800 r33048 27 27 #include "driver.h" 28 28 29 #ifdef VBOX_WITH_HGSMI30 29 #include <iprt/asm.h> 31 30 #include <VBox/log.h> 32 31 #include <VBox/HGSMI/HGSMI.h> 33 32 #include <VBox/HGSMI/HGSMIChSetup.h> 34 #endif35 33 36 34 #define SYSTM_LOGFONT {16,7,0,0,700,0,0,0,ANSI_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,VARIABLE_PITCH | FF_DONTCARE,L"System"} … … 68 66 uint32_t u32MinVBVABufferSize; 69 67 70 #ifndef VBOX_WITH_HGSMI71 QUERYDISPLAYINFORESULT DispInfo;72 RtlZeroMemory(&DispInfo, sizeof (DispInfo));73 74 ppdev->bVBoxVideoSupported = !EngDeviceIoControl(ppdev->hDriver,75 IOCTL_VIDEO_QUERY_DISPLAY_INFO,76 NULL,77 0,78 &DispInfo,79 sizeof(DispInfo),80 &returnedDataLength);81 if (ppdev->bVBoxVideoSupported)82 {83 iDevice = DispInfo.iDevice;84 u32DisplayInfoSize = DispInfo.u32DisplayInfoSize;85 u32MinVBVABufferSize = 0; /* In old mode the buffer is not used at all. */86 }87 #else88 68 QUERYHGSMIRESULT info; 89 69 RtlZeroMemory(&info, sizeof (info)); … … 166 146 } 167 147 } 168 #endif /* VBOX_WITH_HGSMI */ 169 170 #ifndef VBOX_WITH_HGSMI 171 if (ppdev->bVBoxVideoSupported) 172 { 173 #else 148 174 149 if (ppdev->bHGSMISupported) 175 150 { 176 #endif /* VBOX_WITH_HGSMI */177 151 ppdev->iDevice = iDevice; 178 152 … … 186 160 if (cbAvailable <= u32DisplayInfoSize) 187 161 { 188 #ifndef VBOX_WITH_HGSMI189 ppdev->bVBoxVideoSupported = FALSE;190 #else191 162 ppdev->bHGSMISupported = FALSE; 192 #endif /* VBOX_WITH_HGSMI */193 163 } 194 164 else … … 201 171 /* Use minimum 64K and maximum the cbFrameBuffer for the VBVA buffer. */ 202 172 for (ppdev->layout.cbVBVABuffer = ppdev->layout.cbFrameBuffer; 203 #ifndef VBOX_WITH_HGSMI204 ppdev->layout.cbVBVABuffer >= 0x10000;205 #else206 173 ppdev->layout.cbVBVABuffer >= u32MinVBVABufferSize; 207 #endif /* VBOX_WITH_HGSMI */208 174 ppdev->layout.cbVBVABuffer /= 2) 209 175 { … … 216 182 if (ppdev->layout.cbVBVABuffer >= cbAvailable) 217 183 { 218 #ifndef VBOX_WITH_HGSMI219 ppdev->bVBoxVideoSupported = FALSE;220 #else221 184 ppdev->bHGSMISupported = FALSE; 222 #endif /* VBOX_WITH_HGSMI */223 185 } 224 186 else … … 235 197 } 236 198 237 #ifndef VBOX_WITH_HGSMI238 if (!ppdev->bVBoxVideoSupported)239 #else240 199 if (!ppdev->bHGSMISupported) 241 #endif /* VBOX_WITH_HGSMI */242 200 { 243 201 ppdev->iDevice = 0; … … 258 216 ppdev->layout.cbDisplayInformation = 0; 259 217 } 260 #ifdef VBOX_WITH_HGSMI261 218 else 262 219 { … … 285 242 } 286 243 } 287 #endif /* VBOX_WITH_HGSMI */288 244 289 245 DISPDBG((0, "vboxInitVBoxVideo:\n" … … 310 266 311 267 312 #ifndef VBOX_WITH_HGSMI313 /* Setup display information after remapping. */314 static void vboxSetupDisplayInfo (PPDEV ppdev, VIDEO_MEMORY_INFORMATION *pMemoryInformation)315 {316 VBOXDISPLAYINFO *pInfo;317 uint8_t *pu8;318 319 pu8 = (uint8_t *)ppdev->pjScreen + ppdev->layout.offDisplayInformation;320 321 pInfo = (VBOXDISPLAYINFO *)pu8;322 pu8 += sizeof (VBOXDISPLAYINFO);323 324 pInfo->hdrLink.u8Type = VBOX_VIDEO_INFO_TYPE_LINK;325 pInfo->hdrLink.u8Reserved = 0;326 pInfo->hdrLink.u16Length = sizeof (VBOXVIDEOINFOLINK);327 pInfo->link.i32Offset = 0;328 329 pInfo->hdrScreen.u8Type = VBOX_VIDEO_INFO_TYPE_SCREEN;330 pInfo->hdrScreen.u8Reserved = 0;331 pInfo->hdrScreen.u16Length = sizeof (VBOXVIDEOINFOSCREEN);332 DISPDBG((1, "Setup: %d,%d\n", ppdev->ptlDevOrg.x, ppdev->ptlDevOrg.y));333 pInfo->screen.xOrigin = ppdev->ptlDevOrg.x;334 pInfo->screen.yOrigin = ppdev->ptlDevOrg.y;335 pInfo->screen.u32LineSize = 0;336 pInfo->screen.u16Width = 0;337 pInfo->screen.u16Height = 0;338 pInfo->screen.bitsPerPixel = 0;339 pInfo->screen.u8Flags = VBOX_VIDEO_INFO_SCREEN_F_NONE;340 341 pInfo->hdrHostEvents.u8Type = VBOX_VIDEO_INFO_TYPE_HOST_EVENTS;342 pInfo->hdrHostEvents.u8Reserved = 0;343 pInfo->hdrHostEvents.u16Length = sizeof (VBOXVIDEOINFOHOSTEVENTS);344 pInfo->hostEvents.fu32Events = VBOX_VIDEO_INFO_HOST_EVENTS_F_NONE;345 346 pInfo->hdrEnd.u8Type = VBOX_VIDEO_INFO_TYPE_END;347 pInfo->hdrEnd.u8Reserved = 0;348 pInfo->hdrEnd.u16Length = 0;349 350 ppdev->pInfo = pInfo;351 }352 353 354 static void vboxUpdateDisplayInfo (PPDEV ppdev)355 {356 if (ppdev->pInfo)357 {358 ppdev->pInfo->screen.u32LineSize = ppdev->lDeltaScreen;359 ppdev->pInfo->screen.u16Width = (uint16_t)ppdev->cxScreen;360 ppdev->pInfo->screen.u16Height = (uint16_t)ppdev->cyScreen;361 ppdev->pInfo->screen.bitsPerPixel = (uint8_t)ppdev->ulBitCount;362 ppdev->pInfo->screen.u8Flags = VBOX_VIDEO_INFO_SCREEN_F_ACTIVE;363 364 DISPDBG((1, "Update: %d,%d\n", ppdev->ptlDevOrg.x, ppdev->ptlDevOrg.y));365 VBoxProcessDisplayInfo(ppdev);366 }367 }368 #endif /* !VBOX_WITH_HGSMI */369 268 370 269 … … 494 393 vboxInitVBoxVideo (ppdev, &videoMemoryInformation); 495 394 496 #ifndef VBOX_WITH_HGSMI497 if (ppdev->bVBoxVideoSupported)498 {499 /* Setup the display information. */500 vboxSetupDisplayInfo (ppdev, &videoMemoryInformation);501 }502 #endif /* !VBOX_WITH_HGSMI */503 395 } 504 396 … … 510 402 || ppdev->ulBitCount == 32) 511 403 { 512 #ifndef VBOX_WITH_HGSMI513 if (ppdev->pInfo) /* Do not use VBVA on old hosts. */514 {515 /* Enable VBVA for this video mode. */516 vboxVbvaEnable (ppdev);517 }518 #else519 404 if (ppdev->bHGSMISupported) 520 405 { … … 523 408 LogRel(("VBoxDisp[%d]: VBVA %senabled\n", ppdev->iDevice, ppdev->bHGSMISupported? "": "not ")); 524 409 } 525 #endif /* VBOX_WITH_HGSMI */526 410 } 527 411 528 412 DISPDBG((1, "DISP bInitSURF success\n")); 529 413 530 #ifndef VBOX_WITH_HGSMI531 /* Update the display information. */532 vboxUpdateDisplayInfo (ppdev);533 #else534 414 /* Inform the host about this screen layout. */ 535 415 DISPDBG((1, "bInitSURF: %d,%d\n", ppdev->ptlDevOrg.x, ppdev->ptlDevOrg.y)); 536 416 VBoxProcessDisplayInfo (ppdev); 537 #endif /* VBOX_WITH_HGSMI */538 417 539 418 #ifdef VBOX_WITH_VIDEOHWACCEL -
trunk/src/VBox/Additions/WINNT/Graphics/Display/vbox.c
r29260 r33048 41 41 static BOOL vboxHwBufferWrite (PPDEV ppdev, const void *p, uint32_t cb); 42 42 43 #ifndef VBOX_WITH_HGSMI44 /*45 * Public hardware buffer methods.46 */47 BOOL vboxVbvaEnable (PPDEV ppdev)48 {49 BOOL bRc = FALSE;50 51 ULONG returnedDataLength;52 ULONG ulEnable = TRUE;53 54 DISPDBG((1, "VBoxDisp::vboxVbvaEnable called\n"));55 56 if (!ghsemHwBuffer)57 {58 return FALSE;59 }60 61 if (EngDeviceIoControl(ppdev->hDriver,62 IOCTL_VIDEO_VBVA_ENABLE,63 &ulEnable,64 sizeof (ulEnable),65 &ppdev->vbva,66 sizeof (ppdev->vbva),67 &returnedDataLength) == 0)68 {69 DISPDBG((1, "VBoxDisp::vboxVbvaEnable: vbva: pVbvaMemory = %p, pfnFlush = %p, pvFlush = %p.\n",70 ppdev->vbva.pVbvaMemory, ppdev->vbva.pfnFlush, ppdev->vbva.pvFlush));71 72 if (ppdev->vbva.pVbvaMemory73 && ppdev->vbva.pfnFlush74 && ppdev->vbva.pvFlush)75 {76 ppdev->fHwBufferOverflow = FALSE;77 ppdev->pRecord = NULL;78 79 /* All have been initialized. */80 bRc = TRUE;81 }82 }83 84 if (!bRc)85 {86 vboxVbvaDisable (ppdev);87 }88 89 return bRc;90 }91 92 void vboxVbvaDisable (PPDEV ppdev)93 {94 DISPDBG((1, "VBoxDisp::vbvaDisable called.\n"));95 96 RtlZeroMemory (&ppdev->vbva, sizeof (ppdev->vbva));97 98 ppdev->fHwBufferOverflow = FALSE;99 ppdev->pRecord = NULL;100 101 return;102 }103 104 BOOL vboxHwBufferBeginUpdate (PPDEV ppdev)105 {106 BOOL bRc = FALSE;107 108 VBVAMEMORY *pVbvaMemory = ppdev->vbva.pVbvaMemory;109 110 DISPDBG((1, "VBoxDisp::vboxHwBufferBeginUpdate called flags = 0x%08X\n", pVbvaMemory? pVbvaMemory->fu32ModeFlags: -1));111 112 if ( pVbvaMemory113 && (pVbvaMemory->fu32ModeFlags & VBVA_F_MODE_ENABLED))114 {115 uint32_t indexRecordNext;116 117 EngAcquireSemaphore (ghsemHwBuffer);118 119 VBVA_ASSERT (!ppdev->fHwBufferOverflow);120 VBVA_ASSERT (ppdev->pRecord == NULL);121 122 indexRecordNext = (pVbvaMemory->indexRecordFree + 1) % VBVA_MAX_RECORDS;123 124 if (indexRecordNext == pVbvaMemory->indexRecordFirst)125 {126 /* All slots in the records queue are used. */127 vboxHwBufferFlush (ppdev);128 }129 130 if (indexRecordNext == pVbvaMemory->indexRecordFirst)131 {132 /* Even after flush there is no place. Fail the request. */133 DISPDBG((1, "VBoxDisp::vboxHwBufferBeginUpdate no space in the queue of records!!! first %d, last %d\n",134 pVbvaMemory->indexRecordFirst, pVbvaMemory->indexRecordFree));135 EngReleaseSemaphore (ghsemHwBuffer);136 }137 else138 {139 /* Initialize the record. */140 VBVARECORD *pRecord = &pVbvaMemory->aRecords[pVbvaMemory->indexRecordFree];141 142 pRecord->cbRecord = VBVA_F_RECORD_PARTIAL;143 144 pVbvaMemory->indexRecordFree = indexRecordNext;145 146 DISPDBG((1, "VBoxDisp::vboxHwBufferBeginUpdate indexRecordNext = %d\n", indexRecordNext));147 148 /* Remember which record we are using. */149 ppdev->pRecord = pRecord;150 151 bRc = TRUE;152 }153 }154 155 return bRc;156 }157 158 void vboxHwBufferEndUpdate (PPDEV ppdev)159 {160 VBVAMEMORY *pVbvaMemory;161 VBVARECORD *pRecord;162 163 DISPDBG((1, "VBoxDisp::vboxHwBufferEndUpdate called\n"));164 165 pVbvaMemory = ppdev->vbva.pVbvaMemory;166 VBVA_ASSERT(pVbvaMemory);167 168 pRecord = ppdev->pRecord;169 VBVA_ASSERT (pRecord && (pRecord->cbRecord & VBVA_F_RECORD_PARTIAL));170 171 /* Mark the record completed. */172 pRecord->cbRecord &= ~VBVA_F_RECORD_PARTIAL;173 174 ppdev->fHwBufferOverflow = FALSE;175 ppdev->pRecord = NULL;176 177 EngReleaseSemaphore (ghsemHwBuffer);178 179 return;180 }181 182 /*183 * Private operations.184 */185 static uint32_t vboxHwBufferAvail (VBVAMEMORY *pVbvaMemory)186 {187 int32_t i32Diff = pVbvaMemory->off32Data - pVbvaMemory->off32Free;188 189 return i32Diff > 0? i32Diff: VBVA_RING_BUFFER_SIZE + i32Diff;190 }191 192 static void vboxHwBufferFlush (PPDEV ppdev)193 {194 VBVAMEMORY *pVbvaMemory = ppdev->vbva.pVbvaMemory;195 196 VBVA_ASSERT (pVbvaMemory);197 198 ppdev->vbva.pfnFlush (ppdev->vbva.pvFlush);199 200 return;201 }202 203 static void vboxHwBufferPlaceDataAt (PPDEV ppdev, void *p, uint32_t cb, uint32_t offset)204 {205 VBVAMEMORY *pVbvaMemory = ppdev->vbva.pVbvaMemory;206 207 uint32_t u32BytesTillBoundary = VBVA_RING_BUFFER_SIZE - offset;208 uint8_t *dst = &pVbvaMemory->au8RingBuffer[offset];209 int32_t i32Diff = cb - u32BytesTillBoundary;210 211 if (i32Diff <= 0)212 {213 /* Chunk will not cross buffer boundary. */214 memcpy (dst, p, cb);215 }216 else217 {218 /* Chunk crosses buffer boundary. */219 memcpy (dst, p, u32BytesTillBoundary);220 memcpy (&pVbvaMemory->au8RingBuffer[0], (uint8_t *)p + u32BytesTillBoundary, i32Diff);221 }222 223 return;224 }225 226 static BOOL vboxHwBufferWrite (PPDEV ppdev, const void *p, uint32_t cb)227 {228 VBVAMEMORY *pVbvaMemory;229 VBVARECORD *pRecord;230 uint32_t cbHwBufferAvail;231 232 uint32_t cbWritten = 0;233 234 VBVA_ASSERT(ppdev);235 236 if (ppdev->fHwBufferOverflow)237 {238 return FALSE;239 }240 241 pVbvaMemory = ppdev->vbva.pVbvaMemory;242 VBVA_ASSERT (pVbvaMemory->indexRecordFirst != pVbvaMemory->indexRecordFree);243 244 pRecord = ppdev->pRecord;245 VBVA_ASSERT (pRecord && (pRecord->cbRecord & VBVA_F_RECORD_PARTIAL));246 247 DISPDBG((1, "VW %d\n", cb));248 249 cbHwBufferAvail = vboxHwBufferAvail (pVbvaMemory);250 251 while (cb > 0)252 {253 uint32_t cbChunk = cb;254 255 // DISPDBG((1, "VBoxDisp::vboxHwBufferWrite pVbvaMemory->off32Free %d, pRecord->cbRecord 0x%08X, cbHwBufferAvail %d, cb %d, cbWritten %d\n", pVbvaMemory->off32Free, pRecord->cbRecord, cbHwBufferAvail, cb, cbWritten));256 257 if (cbChunk >= cbHwBufferAvail)258 {259 DISPDBG((1, "VBoxDisp::vboxHwBufferWrite 1) avail %d, chunk %d\n", cbHwBufferAvail, cbChunk));260 261 vboxHwBufferFlush (ppdev);262 263 cbHwBufferAvail = vboxHwBufferAvail (pVbvaMemory);264 265 if (cbChunk >= cbHwBufferAvail)266 {267 DISPDBG((1, "VBoxDisp::vboxHwBufferWrite: no place for %d bytes. Only %d bytes available after flush. Going to partial writes.\n", cb, cbHwBufferAvail));268 269 if (cbHwBufferAvail <= VBVA_RING_BUFFER_THRESHOLD)270 {271 DISPDBG((1, "VBoxDisp::vboxHwBufferWrite: Buffer overflow!!!\n"));272 ppdev->fHwBufferOverflow = TRUE;273 VBVA_ASSERT(FALSE);274 return FALSE;275 }276 277 cbChunk = cbHwBufferAvail - VBVA_RING_BUFFER_THRESHOLD;278 }279 }280 281 VBVA_ASSERT(cbChunk <= cb);282 VBVA_ASSERT(cbChunk <= vboxHwBufferAvail (pVbvaMemory));283 284 vboxHwBufferPlaceDataAt (ppdev, (uint8_t *)p + cbWritten, cbChunk, pVbvaMemory->off32Free);285 286 pVbvaMemory->off32Free = (pVbvaMemory->off32Free + cbChunk) % VBVA_RING_BUFFER_SIZE;287 pRecord->cbRecord += cbChunk;288 cbHwBufferAvail -= cbChunk;289 290 cb -= cbChunk;291 cbWritten += cbChunk;292 }293 294 return TRUE;295 }296 297 /*298 * Public writer to hardware buffer.299 */300 BOOL vboxWrite (PPDEV ppdev, const void *pv, uint32_t cb)301 {302 return vboxHwBufferWrite (ppdev, pv, cb);303 }304 305 BOOL vboxOrderSupported (PPDEV ppdev, unsigned code)306 {307 VBVAMEMORY *pVbvaMemory;308 309 pVbvaMemory = ppdev->vbva.pVbvaMemory;310 311 if (pVbvaMemory->fu32ModeFlags & VBVA_F_MODE_VRDP_ORDER_MASK)312 {313 /* Order masking enabled. */314 if (pVbvaMemory->fu32SupportedOrders & (1 << code))315 {316 return TRUE;317 }318 }319 320 return FALSE;321 }322 323 void VBoxProcessDisplayInfo(PPDEV ppdev)324 {325 DWORD returnedDataLength;326 327 DISPDBG((1, "Process: %d,%d\n", ppdev->ptlDevOrg.x, ppdev->ptlDevOrg.y));328 329 EngDeviceIoControl(ppdev->hDriver,330 IOCTL_VIDEO_INTERPRET_DISPLAY_MEMORY,331 NULL,332 0,333 NULL,334 0,335 &returnedDataLength);336 }337 338 #else /* VBOX_WITH_HGSMI */339 43 340 44 static void vboxHGSMIBufferSubmit (PPDEV ppdev, void *p) … … 700 404 } 701 405 702 # 406 #ifdef VBOX_WITH_VIDEOHWACCEL 703 407 704 408 VBOXVHWACMD* vboxVHWACommandCreate (PPDEV ppdev, VBOXVHWACMD_TYPE enmCmd, VBOXVHWACMD_LENGTH cbCmd) … … 758 462 switch(pCmd->customOpCode) 759 463 { 760 # ifdef VBOX_WITH_VIDEOHWACCEL 464 # ifdef VBOX_WITH_VIDEOHWACCEL /** @todo why is this ifdef nested within itself? */ 761 465 case VBVAHG_DCUSTOM_VHWA_CMDCOMPLETE: 762 466 { … … 1087 791 } 1088 792 1089 # 793 #endif 1090 794 1091 795 void vboxVBVAHostCommandComplete(PPDEV ppdev, VBVAHOSTCMD * pCmd) … … 1094 798 } 1095 799 1096 #endif /* VBOX_WITH_HGSMI */ -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/Helper.cpp
r32831 r33048 321 321 } 322 322 323 #ifndef VBOX_WITH_HGSMI324 /**325 * Sends the pointer shape to the VMMDev326 *327 * @returns success indicator328 * @param pointerAttr pointer description329 */330 BOOLEAN vboxUpdatePointerShape(PVIDEO_POINTER_ATTRIBUTES pointerAttr, uint32_t cbLength)331 {332 uint32_t cbData = 0;333 334 if (pointerAttr->Enable & VBOX_MOUSE_POINTER_SHAPE)335 {336 cbData = ((((pointerAttr->Width + 7) / 8) * pointerAttr->Height + 3) & ~3)337 + pointerAttr->Width * 4 * pointerAttr->Height;338 }339 340 if (cbData > cbLength - sizeof(VIDEO_POINTER_ATTRIBUTES))341 {342 dprintf(("vboxUpdatePointerShape: calculated pointer data size is too big (%d bytes, limit %d)\n",343 cbData, cbLength - sizeof(VIDEO_POINTER_ATTRIBUTES)));344 return FALSE;345 }346 347 BOOLEAN bRC = FALSE;348 349 VMMDevReqMousePointer *req = NULL;350 351 int rc = VbglGRAlloc ((VMMDevRequestHeader **)&req, sizeof (VMMDevReqMousePointer) + cbData, VMMDevReq_SetPointerShape);352 353 if (RT_FAILURE(rc))354 {355 dprintf(("VBoxVideo::vboxUpdatePointerShape: ERROR allocating request, rc = %Rrc\n", rc));356 }357 else358 {359 /* Activate next line only when really needed; floods the log very quickly! */360 /*dprintf(("VBoxVideo::vboxUpdatePointerShape: req->u32Version = %08X\n", req->header.version));*/361 362 /* We have our custom flags in the field */363 req->fFlags = pointerAttr->Enable & 0xFFFF;364 365 /* Even if pointer is invisible, we have to pass following data,366 * so host could create the pointer with initial status - invisible367 */368 req->xHot = (pointerAttr->Enable >> 16) & 0xFF;369 req->yHot = (pointerAttr->Enable >> 24) & 0xFF;370 req->width = pointerAttr->Width;371 req->height = pointerAttr->Height;372 373 if (req->fFlags & VBOX_MOUSE_POINTER_SHAPE)374 {375 /* copy the actual pointer data */376 memcpy (req->pointerData, pointerAttr->Pixels, cbData);377 }378 379 rc = VbglGRPerform (&req->header);380 381 if (RT_SUCCESS(rc))382 {383 bRC = TRUE;384 }385 else386 {387 dprintf(("VBoxVideo::vboxUpdatePointerShape: ERROR querying mouse capabilities from VMMDev. "388 "rc = %Rrc\n", rc));389 }390 391 dprintf(("VBoxVideo::vboxUpdatePointerShape: req->u32Version = %08X\n", req->header.version));392 393 VbglGRFree (&req->header);394 }395 396 return bRC;397 }398 #endif /* VBOX_WITH_HGSMI */ -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/Helper.h
r28800 r33048 37 37 BOOLEAN vboxQueryHostWantsAbsolute(); 38 38 winVersion_t vboxQueryWinVersion(); 39 #ifndef VBOX_WITH_HGSMI40 BOOLEAN vboxUpdatePointerShape(PVIDEO_POINTER_ATTRIBUTES pointerAttr, uint32_t cbLength);41 #endif /* !VBOX_WITH_HGSMI */42 39 43 40 #include "vboxioctl.h" … … 48 45 49 46 /* debug printf */ 50 # 47 #define OSDBGPRINT(a) DbgPrint a 51 48 52 49 /* dprintf */ -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/Makefile.kmk
r32889 r33048 32 32 endif 33 33 VBoxVideo_DEFS = LOG_TO_BACKDOOR VBOX_WITH_8BPP_MODES 34 ifdef VBOX_WITH_HGSMI35 VBoxVideo_DEFS += VBOX_WITH_HGSMI36 endif37 34 ifdef VBOX_WITH_VIDEOHWACCEL 38 35 VBoxVideo_DEFS += VBOX_WITH_VIDEOHWACCEL … … 47 44 Helper.cpp \ 48 45 VBoxVideo.def \ 49 VBoxVideo.rc 50 ifdef VBOX_WITH_HGSMI 51 VBoxVideo_SOURCES += \ 46 VBoxVideo.rc \ 52 47 VBoxVideoHGSMI.cpp 53 endif54 48 VBoxVideo_LIBS.x86 = \ 55 49 $(PATH_SDK_W2K3DDK_LIB)/exsup.lib … … 59 53 $(PATH_SDK_W2K3DDK_LIB)/hal.lib \ 60 54 $(VBOX_LIB_VBGL_R0) \ 61 $(VBOX_LIB_IPRT_GUEST_R0_NT4) 62 ifdef VBOX_WITH_HGSMI 63 VBoxVideo_LIBS += \ 55 $(VBOX_LIB_IPRT_GUEST_R0_NT4) \ 64 56 $(VBOX_PATH_ADDITIONS_LIB)/HGSMIGuestR0Lib$(VBOX_SUFF_LIB) 65 endif66 57 67 58 … … 79 70 VBoxVideoWddm_SDKS=WINDDKWLH 80 71 VBoxVideoWddm_DEFS += VBOX_WITH_8BPP_MODES 81 VBoxVideoWddm_DEFS += VBOX_WITH_ HGSMI VBOX_WITH_WDDM72 VBoxVideoWddm_DEFS += VBOX_WITH_WDDM 82 73 ifdef VBOX_WITH_VIDEOHWACCEL 83 74 VBoxVideoWddm_DEFS += VBOX_WITH_VIDEOHWACCEL -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.cpp
r33022 r33048 70 70 InitData.HwFindAdapter = VBoxVideoFindAdapter; 71 71 InitData.HwInitialize = VBoxVideoInitialize; 72 #if defined(VBOX_WITH_HGSMI) && defined(VBOX_WITH_VIDEOHWACCEL)72 #ifdef VBOX_WITH_VIDEOHWACCEL 73 73 InitData.HwInterrupt = VBoxVideoInterrupt; 74 74 #else … … 1341 1341 void VBoxComputeFrameBufferSizes (PDEVICE_EXTENSION PrimaryExtension) 1342 1342 { 1343 #ifndef VBOX_WITH_HGSMI1344 ULONG ulAvailable = commonFromDeviceExt(PrimaryExtension)->cbVRAM1345 - commonFromDeviceExt(PrimaryExtension)->cbMiniportHeap1346 - VBOX_VIDEO_ADAPTER_INFORMATION_SIZE;1347 #else1348 1343 ULONG ulAvailable = commonFromDeviceExt(PrimaryExtension)->cbVRAM 1349 1344 - commonFromDeviceExt(PrimaryExtension)->cbMiniportHeap 1350 1345 - VBVA_ADAPTER_INFORMATION_SIZE; 1351 #endif /* VBOX_WITH_HGSMI */1352 1346 1353 1347 /* Size of a framebuffer. */ … … 1363 1357 ulAvailable - ulSize * PrimaryExtension->u.primary.cDisplays)); 1364 1358 1365 #ifndef VBOX_WITH_HGSMI1366 if (ulSize > VBOX_VIDEO_DISPLAY_INFORMATION_SIZE)1367 {1368 /* Compute the size of the framebuffer. */1369 ulSize -= VBOX_VIDEO_DISPLAY_INFORMATION_SIZE;1370 }1371 else1372 {1373 /* Should not really get here. But still do it safely. */1374 ulSize = 0;1375 }1376 #endif /* !VBOX_WITH_HGSMI */1377 1359 1378 1360 /* Update the primary info. */ 1379 1361 PrimaryExtension->u.primary.ulMaxFrameBufferSize = ulSize; 1380 #ifndef VBOX_WITH_HGSMI1381 PrimaryExtension->u.primary.ulDisplayInformationSize = VBOX_VIDEO_DISPLAY_INFORMATION_SIZE;1382 #endif /* !VBOX_WITH_HGSMI */1383 1362 1384 1363 /* Update the per extension info. */ … … 1394 1373 Extension->iDevice, ulFrameBufferOffset)); 1395 1374 1396 #ifndef VBOX_WITH_HGSMI1397 ulFrameBufferOffset += PrimaryExtension->u.primary.ulMaxFrameBufferSize1398 + PrimaryExtension->u.primary.ulDisplayInformationSize;1399 #else1400 1375 ulFrameBufferOffset += PrimaryExtension->u.primary.ulMaxFrameBufferSize; 1401 #endif /* VBOX_WITH_HGSMI */1402 1376 1403 1377 Extension = Extension->pNext; … … 1509 1483 } 1510 1484 1511 #ifndef VBOX_WITH_HGSMI1512 1513 # ifdef VBOX_WITH_WDDM1514 /* sanity check */1515 # error WDDM is supported only for HGSMI-based driver1516 # endif1517 1518 static void vboxQueryConf (PDEVICE_EXTENSION PrimaryExtension, uint32_t u32Index, ULONG *pulValue)1519 {1520 dprintf(("VBoxVideo::vboxQueryConf: u32Index = %d\n", u32Index));1521 1522 typedef struct _VBOXVIDEOQCONF321523 {1524 VBOXVIDEOINFOHDR hdrQuery;1525 VBOXVIDEOINFOQUERYCONF32 query;1526 VBOXVIDEOINFOHDR hdrEnd;1527 } VBOXVIDEOQCONF32;1528 1529 VBOXVIDEOQCONF32 *p = (VBOXVIDEOQCONF32 *)commonFromDeviceExt(PrimaryExtension)->pvAdapterInformation;1530 1531 p->hdrQuery.u8Type = VBOX_VIDEO_INFO_TYPE_QUERY_CONF32;1532 p->hdrQuery.u8Reserved = 0;1533 p->hdrQuery.u16Length = sizeof (VBOXVIDEOINFOQUERYCONF32);1534 1535 p->query.u32Index = u32Index;1536 p->query.u32Value = 0;1537 1538 p->hdrEnd.u8Type = VBOX_VIDEO_INFO_TYPE_END;1539 p->hdrEnd.u8Reserved = 0;1540 p->hdrEnd.u16Length = 0;1541 1542 /* Let the host to process the commands. */1543 VideoPortWritePortUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_VBOX_VIDEO);1544 VideoPortWritePortUlong((PULONG)VBE_DISPI_IOPORT_DATA, VBOX_VIDEO_INTERPRET_ADAPTER_MEMORY);1545 1546 *pulValue = (ULONG)p->query.u32Value;1547 1548 dprintf(("VBoxVideo::vboxQueryConf: u32Value = %d\n", p->query.u32Value));1549 }1550 1551 static void vboxSetupAdapterInfo (PDEVICE_EXTENSION PrimaryExtension)1552 {1553 dprintf(("VBoxVideo::vboxSetupAdapterInfo\n"));1554 1555 VBOXVIDEOINFOHDR *pHdr;1556 1557 uint8_t *pu8 = (uint8_t *)PrimaryExtension->u.primary.pvAdapterInformation;1558 1559 PDEVICE_EXTENSION Extension = PrimaryExtension;1560 while (Extension)1561 {1562 pHdr = (VBOXVIDEOINFOHDR *)pu8;1563 pu8 += sizeof (VBOXVIDEOINFOHDR);1564 1565 pHdr->u8Type = VBOX_VIDEO_INFO_TYPE_DISPLAY;1566 pHdr->u8Reserved = 0;1567 pHdr->u16Length = sizeof (VBOXVIDEOINFODISPLAY);1568 1569 VBOXVIDEOINFODISPLAY *pDisplay = (VBOXVIDEOINFODISPLAY *)pu8;1570 pu8 += sizeof (VBOXVIDEOINFODISPLAY);1571 1572 pDisplay->u32Index = Extension->iDevice;1573 pDisplay->u32Offset = Extension->ulFrameBufferOffset;1574 pDisplay->u32FramebufferSize = PrimaryExtension->u.primary.ulMaxFrameBufferSize;1575 pDisplay->u32InformationSize = PrimaryExtension->u.primary.ulDisplayInformationSize;1576 1577 Extension = Extension->pNext;1578 }1579 1580 1581 /* The heap description. */1582 pHdr = (VBOXVIDEOINFOHDR *)pu8;1583 pu8 += sizeof (VBOXVIDEOINFOHDR);1584 1585 pHdr->u8Type = VBOX_VIDEO_INFO_TYPE_NV_HEAP;1586 pHdr->u8Reserved = 0;1587 pHdr->u16Length = sizeof (VBOXVIDEOINFONVHEAP);1588 1589 VBOXVIDEOINFONVHEAP *pHeap = (VBOXVIDEOINFONVHEAP *)pu8;1590 pu8 += sizeof (VBOXVIDEOINFONVHEAP);1591 1592 pHeap->u32HeapOffset = PrimaryExtension->u.primary.cbVRAM1593 - PrimaryExtension->u.primary.cbMiniportHeap1594 - VBOX_VIDEO_ADAPTER_INFORMATION_SIZE;1595 pHeap->u32HeapSize = PrimaryExtension->u.primary.cbMiniportHeap;1596 1597 1598 /* The END marker. */1599 pHdr = (VBOXVIDEOINFOHDR *)pu8;1600 pu8 += sizeof (VBOXVIDEOINFOHDR);1601 1602 pHdr->u8Type = VBOX_VIDEO_INFO_TYPE_END;1603 pHdr->u8Reserved = 0;1604 pHdr->u16Length = 0;1605 1606 /* Inform the host about the display configuration. */1607 VideoPortWritePortUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_VBOX_VIDEO);1608 VideoPortWritePortUlong((PULONG)VBE_DISPI_IOPORT_DATA, VBOX_VIDEO_INTERPRET_ADAPTER_MEMORY);1609 1610 dprintf(("VBoxVideo::vboxSetupAdapterInfo finished\n"));1611 }1612 1613 /**1614 * Helper function to register secondary displays (DualView). Note that this will not1615 * be available on pre-XP versions, and some editions on XP will fail because they are1616 * intentionally crippled.1617 */1618 VOID VBoxSetupDisplays(PDEVICE_EXTENSION PrimaryExtension, PVIDEO_PORT_CONFIG_INFO pConfigInfo, ULONG AdapterMemorySize)1619 {1620 VP_STATUS rc = NO_ERROR;1621 1622 dprintf(("VBoxVideo::VBoxSetupDisplays: PrimaryExtension = %p\n",1623 PrimaryExtension));1624 1625 /* Preinitialize the primary extension. */1626 PrimaryExtension->pNext = NULL;1627 PrimaryExtension->pPrimary = PrimaryExtension;1628 PrimaryExtension->iDevice = 0;1629 PrimaryExtension->ulFrameBufferOffset = 0;1630 PrimaryExtension->ulFrameBufferSize = 0;1631 PrimaryExtension->u.primary.ulVbvaEnabled = 0;1632 PrimaryExtension->u.primary.bVBoxVideoSupported = FALSE;1633 PrimaryExtension->u.primary.cDisplays = 1;1634 PrimaryExtension->u.primary.cbVRAM = AdapterMemorySize;1635 PrimaryExtension->u.primary.cbMiniportHeap = 0;1636 PrimaryExtension->u.primary.pvMiniportHeap = NULL;1637 PrimaryExtension->u.primary.pvAdapterInformation = NULL;1638 PrimaryExtension->u.primary.ulMaxFrameBufferSize = 0;1639 PrimaryExtension->u.primary.ulDisplayInformationSize = 0;1640 1641 /* Verify whether the HW supports VirtualBox extensions. */1642 VideoPortWritePortUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_ID);1643 VideoPortWritePortUshort((PUSHORT)VBE_DISPI_IOPORT_DATA, VBE_DISPI_ID_VBOX_VIDEO);1644 1645 if (VideoPortReadPortUshort((PUSHORT)VBE_DISPI_IOPORT_DATA) == VBE_DISPI_ID_VBOX_VIDEO)1646 {1647 PrimaryExtension->u.primary.bVBoxVideoSupported = TRUE;1648 }1649 1650 dprintf(("VBoxVideo::VBoxSetupDisplays: bVBoxVideoSupported = %d\n",1651 PrimaryExtension->u.primary.bVBoxVideoSupported));1652 1653 if (PrimaryExtension->u.primary.bVBoxVideoSupported)1654 {1655 /* Map the adapter information. It will be needed to query some configuration values. */1656 rc = VBoxMapAdapterMemory (PrimaryExtension,1657 &PrimaryExtension->u.primary.pvAdapterInformation,1658 PrimaryExtension->u.primary.cbVRAM - VBOX_VIDEO_ADAPTER_INFORMATION_SIZE,1659 VBOX_VIDEO_ADAPTER_INFORMATION_SIZE1660 );1661 if (rc != NO_ERROR)1662 {1663 dprintf(("VBoxVideo::VBoxSetupDisplays: VBoxMapAdapterMemory pvAdapterInfoirrmation failed rc = %d\n",1664 rc));1665 1666 PrimaryExtension->u.primary.bVBoxVideoSupported = FALSE;1667 }1668 }1669 1670 /* Setup the non-volatile heap and the adapter memory. */1671 if (PrimaryExtension->u.primary.bVBoxVideoSupported)1672 {1673 /* Query the size of the non-volatile heap. */1674 ULONG cbMiniportHeap = 0;1675 vboxQueryConf (PrimaryExtension, VBOX_VIDEO_QCI32_OFFSCREEN_HEAP_SIZE, &cbMiniportHeap);1676 1677 /* Do not allow too big heap. 50% of VRAM should be enough. */1678 ULONG cbMiniportHeapMaxSize = AdapterMemorySize / 2 - VBOX_VIDEO_ADAPTER_INFORMATION_SIZE;1679 1680 if (cbMiniportHeap > cbMiniportHeapMaxSize)1681 {1682 cbMiniportHeap = cbMiniportHeapMaxSize;1683 }1684 1685 /* Round up to 4096. */1686 PrimaryExtension->u.primary.cbMiniportHeap = (cbMiniportHeap + 0xFFF) & ~0xFFF;1687 1688 dprintf(("VBoxVideo::VBoxSetupDisplays: cbMiniportHeap = 0x%08X, PrimaryExtension->u.primary.cbMiniportHeap = 0x%08X, cbMiniportHeapMaxSize = 0x%08X\n",1689 cbMiniportHeap, PrimaryExtension->u.primary.cbMiniportHeap, cbMiniportHeapMaxSize));1690 1691 /* Map the heap region and the adapter information area.1692 *1693 * Note: the heap will be used by display drivers, possibly by a few instances1694 * in multimonitor configuration, but the memory is mapped here ones.1695 * It is assumed that all display drivers and the miniport has the SAME1696 * virtual address space.1697 *1698 */1699 rc = VBoxMapAdapterMemory (PrimaryExtension,1700 &PrimaryExtension->u.primary.pvMiniportHeap,1701 PrimaryExtension->u.primary.cbVRAM1702 - VBOX_VIDEO_ADAPTER_INFORMATION_SIZE1703 - PrimaryExtension->u.primary.cbMiniportHeap,1704 PrimaryExtension->u.primary.cbMiniportHeap1705 );1706 1707 if (rc != NO_ERROR)1708 {1709 PrimaryExtension->u.primary.cbMiniportHeap = 0;1710 PrimaryExtension->u.primary.bVBoxVideoSupported = FALSE;1711 }1712 }1713 1714 /* Check whether the guest supports multimonitors. */1715 if (PrimaryExtension->u.primary.bVBoxVideoSupported)1716 {1717 typedef VP_STATUS (*PFNCREATESECONDARYDISPLAY)(PVOID, PVOID *, ULONG);1718 PFNCREATESECONDARYDISPLAY pfnCreateSecondaryDisplay = NULL;1719 1720 /* Dynamically query the VideoPort import to be binary compatible across Windows versions */1721 if (vboxQueryWinVersion() > WINNT4)1722 {1723 /* This bluescreens on NT4, hence the above version check */1724 pfnCreateSecondaryDisplay = (PFNCREATESECONDARYDISPLAY)(pConfigInfo->VideoPortGetProcAddress)1725 (PrimaryExtension,1726 (PUCHAR)"VideoPortCreateSecondaryDisplay");1727 }1728 1729 if (pfnCreateSecondaryDisplay != NULL)1730 {1731 /* Query the configured number of displays. */1732 ULONG cDisplays = 0;1733 vboxQueryConf (PrimaryExtension, VBOX_VIDEO_QCI32_MONITOR_COUNT, &cDisplays);1734 1735 dprintf(("VBoxVideo::VBoxSetupDisplays: cDisplays = %d\n",1736 cDisplays));1737 1738 if (cDisplays == 0 || cDisplays > VBOX_VIDEO_MAX_SCREENS)1739 {1740 /* Host reported some bad value. Continue in the 1 screen mode. */1741 cDisplays = 1;1742 }1743 1744 PDEVICE_EXTENSION pPrev = PrimaryExtension;1745 1746 ULONG iDisplay;1747 for (iDisplay = 1; iDisplay < cDisplays; iDisplay++)1748 {1749 PDEVICE_EXTENSION SecondaryExtension = NULL;1750 rc = pfnCreateSecondaryDisplay (PrimaryExtension, (PVOID*)&SecondaryExtension, VIDEO_DUALVIEW_REMOVABLE);1751 1752 dprintf(("VBoxVideo::VBoxSetupDisplays: VideoPortCreateSecondaryDisplay returned %#x, SecondaryExtension = %p\n",1753 rc, SecondaryExtension));1754 1755 if (rc != NO_ERROR)1756 {1757 break;1758 }1759 1760 SecondaryExtension->pNext = NULL;1761 SecondaryExtension->pPrimary = PrimaryExtension;1762 SecondaryExtension->iDevice = iDisplay;1763 SecondaryExtension->ulFrameBufferOffset = 0;1764 SecondaryExtension->ulFrameBufferSize = 0;1765 SecondaryExtension->u.secondary.bEnabled = FALSE;1766 1767 /* Update the list pointers. */1768 pPrev->pNext = SecondaryExtension;1769 pPrev = SecondaryExtension;1770 1771 /* Take the successfully created display into account. */1772 PrimaryExtension->u.primary.cDisplays++;1773 }1774 1775 /* Failure to create secondary displays is not fatal */1776 rc = NO_ERROR;1777 }1778 }1779 1780 /* Now when the number of monitors is known and extensions are created,1781 * calculate the layout of framebuffers.1782 */1783 VBoxComputeFrameBufferSizes (PrimaryExtension);1784 1785 if (PrimaryExtension->u.primary.bVBoxVideoSupported)1786 {1787 /* Setup the information for the host. */1788 vboxSetupAdapterInfo (PrimaryExtension);1789 }1790 else1791 {1792 /* Unmap the memory if VBoxVideo is not supported. */1793 VBoxUnmapAdapterMemory (PrimaryExtension, &PrimaryExtension->u.primary.pvMiniportHeap, PrimaryExtension->u.primary.cbMiniportHeap);1794 VBoxUnmapAdapterInformation (PrimaryExtension);1795 }1796 1797 dprintf(("VBoxVideo::VBoxSetupDisplays: finished\n"));1798 }1799 #endif /* !VBOX_WITH_HGSMI */1800 1485 1801 1486 void vboxVideoInitCustomVideoModes(PDEVICE_EXTENSION pDevExt) … … 1916 1601 dprintf(("VBoxVideo::VBoxVideoFindAdapter %p\n", HwDeviceExtension)); 1917 1602 1918 #ifdef VBOX_WITH_HGSMI1919 1603 VBoxSetupVideoPortFunctions((PDEVICE_EXTENSION)HwDeviceExtension, &((PDEVICE_EXTENSION)HwDeviceExtension)->u.primary.VideoPortProcs, ConfigInfo); 1920 #endif1921 1604 1922 1605 VideoPortWritePortUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_ID); … … 1968 1651 dprintf(("VBoxVideo::VBoxVideoFindAdapter: calling VideoPortGetAccessRanges\n")); 1969 1652 1970 #ifdef VBOX_WITH_HGSMI1971 1653 /* pPrimary is not yet set */ 1972 1654 ((PDEVICE_EXTENSION)HwDeviceExtension)->u.primary.commonInfo.IOPortHost = (RTIOPORT)VGA_PORT_HGSMI_HOST; 1973 1655 ((PDEVICE_EXTENSION)HwDeviceExtension)->u.primary.commonInfo.IOPortGuest = (RTIOPORT)VGA_PORT_HGSMI_GUEST; 1974 #endif /* VBOX_WITH_HGSMI */1975 1656 1976 1657 VIDEO_ACCESS_RANGE tmpRanges[4]; … … 2014 1695 dprintf(("VBoxVideo::VBoxVideoFindAdapter: VbglInit returned 0x%x\n", rc)); 2015 1696 2016 #ifndef VBOX_WITH_HGSMI2017 /* Setup the Device Extension and if possible secondary displays. */2018 VBoxSetupDisplays((PDEVICE_EXTENSION)HwDeviceExtension, ConfigInfo, AdapterMemorySize);2019 #else2020 1697 /* Guest supports only HGSMI, the old VBVA via VMMDev is not supported. Old 2021 1698 * code will be ifdef'ed and later removed. … … 2029 1706 LogRel(("VBoxVideo: using HGSMI\n")); 2030 1707 } 2031 #endif /* VBOX_WITH_HGSMI */2032 1708 2033 1709 // pretend success to make the driver work. … … 2062 1738 } 2063 1739 2064 # if defined(VBOX_WITH_HGSMI) && defined(VBOX_WITH_VIDEOHWACCEL)1740 # ifdef VBOX_WITH_VIDEOHWACCEL 2065 1741 2066 1742 BOOLEAN VBoxVideoInterrupt(PVOID HwDeviceExtension) … … 2089 1765 return FALSE; 2090 1766 } 2091 # endif /* #if defined(VBOX_WITH_HGSMI) && defined(VBOX_WITH_VIDEOHWACCEL)*/1767 # endif /* #ifdef VBOX_WITH_VIDEOHWACCEL */ 2092 1768 #endif /* #ifndef VBOX_WITH_WDDM */ 2093 1769 /** … … 2116 1792 PointerAttributes.Enable = VBOX_MOUSE_POINTER_VISIBLE; 2117 1793 2118 #ifndef VBOX_WITH_HGSMI2119 Result = vboxUpdatePointerShape(&PointerAttributes, sizeof (PointerAttributes));2120 #else2121 1794 Result = vboxUpdatePointerShape(PrimaryExtension, &PointerAttributes, sizeof (PointerAttributes)); 2122 #endif /* VBOX_WITH_HGSMI */2123 1795 2124 1796 if (Result) … … 2368 2040 PointerAttributes.Enable = 0; 2369 2041 2370 #ifndef VBOX_WITH_HGSMI2371 Result = vboxUpdatePointerShape(&PointerAttributes, sizeof (PointerAttributes));2372 #else2373 2042 Result = vboxUpdatePointerShape((PDEVICE_EXTENSION)HwDeviceExtension, &PointerAttributes, sizeof (PointerAttributes)); 2374 #endif /* VBOX_WITH_HGSMI */2375 2043 2376 2044 if (Result) … … 2417 2085 dprintf(("\tBytes attached: %d\n", RequestPacket->InputBufferLength - sizeof(VIDEO_POINTER_ATTRIBUTES))); 2418 2086 #endif 2419 #ifndef VBOX_WITH_HGSMI2420 Result = vboxUpdatePointerShape(pPointerAttributes, RequestPacket->InputBufferLength);2421 #else2422 2087 Result = vboxUpdatePointerShape((PDEVICE_EXTENSION)HwDeviceExtension, pPointerAttributes, RequestPacket->InputBufferLength); 2423 #endif /* VBOX_WITH_HGSMI */2424 2088 if (!Result) 2425 2089 dprintf(("VBoxVideo::VBoxVideoStartIO: Could not set hardware pointer -> fallback\n")); … … 2553 2217 } 2554 2218 2555 #ifndef VBOX_WITH_HGSMI2556 case IOCTL_VIDEO_QUERY_DISPLAY_INFO:2557 {2558 dprintf(("VBoxVideo::VBoxVideoStartIO: IOCTL_VIDEO_QUERY_DISPLAY_INFO\n"));2559 2560 if (RequestPacket->OutputBufferLength < sizeof(QUERYDISPLAYINFORESULT))2561 {2562 dprintf(("VBoxVideo::VBoxVideoStartIO: Output buffer too small: %d needed: %d!!!\n",2563 RequestPacket->OutputBufferLength, sizeof(QUERYDISPLAYINFORESULT)));2564 RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER;2565 return FALSE;2566 }2567 2568 QUERYDISPLAYINFORESULT *pDispInfo = (QUERYDISPLAYINFORESULT *)RequestPacket->OutputBuffer;2569 2570 pDispInfo->iDevice = pDevExt->iDevice;2571 pDispInfo->u32DisplayInfoSize = pDevExt->pPrimary->u.primary.ulDisplayInformationSize;2572 2573 RequestPacket->StatusBlock->Information = sizeof(QUERYDISPLAYINFORESULT);2574 Result = TRUE;2575 2576 break;2577 }2578 #endif /* !VBOX_WITH_HGSMI */2579 2219 2580 2220 case IOCTL_VIDEO_VBVA_ENABLE: … … 2663 2303 } 2664 2304 2665 #ifdef VBOX_WITH_HGSMI2666 2305 case IOCTL_VIDEO_QUERY_HGSMI_INFO: 2667 2306 { … … 2818 2457 } 2819 2458 # endif 2820 #endif /* VBOX_WITH_HGSMI */2821 2459 default: 2822 2460 dprintf(("VBoxVideo::VBoxVideoStartIO: Unsupported %p, fn %d(0x%x)\n", … … 3072 2710 3073 2711 MapInformation->VideoRamBase = RequestedAddress->RequestedVirtualAddress; 3074 #ifndef VBOX_WITH_HGSMI3075 MapInformation->VideoRamLength = DeviceExtension->pPrimary->u.primary.ulMaxFrameBufferSize3076 + DeviceExtension->pPrimary->u.primary.ulDisplayInformationSize;3077 #else3078 2712 MapInformation->VideoRamLength = DeviceExtension->pPrimary->u.primary.ulMaxFrameBufferSize; 3079 #endif /* VBOX_WITH_HGSMI */3080 2713 3081 2714 Status = VideoPortMapMemory(DeviceExtension, FrameBuffer, … … 3093 2726 /* Save the new framebuffer size */ 3094 2727 DeviceExtension->ulFrameBufferSize = MapInformation->FrameBufferLength; 3095 #ifdef VBOX_WITH_HGSMI3096 2728 HGSMIAreaInitialize (&DeviceExtension->areaDisplay, 3097 2729 MapInformation->FrameBufferBase, 3098 2730 MapInformation->FrameBufferLength, 3099 2731 DeviceExtension->ulFrameBufferOffset); 3100 #endif /* VBOX_WITH_HGSMI */3101 2732 return TRUE; 3102 2733 } … … 3115 2746 { 3116 2747 dprintf(("VBoxVideo::VBoxVideoUnmapVideoMemory\n")); 3117 #ifdef VBOX_WITH_HGSMI3118 2748 HGSMIAreaClear (&DeviceExtension->areaDisplay); 3119 #endif /* VBOX_WITH_HGSMI */3120 2749 VideoPortUnmapMemory(DeviceExtension, VideoMemory->RequestedVirtualAddress, NULL); 3121 2750 return TRUE; -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.h
r33022 r33048 20 20 #include <iprt/assert.h> 21 21 22 #ifdef VBOX_WITH_HGSMI23 22 //#include <iprt/thread.h> 24 23 … … 26 25 #include <VBox/HGSMI/HGSMIChSetup.h> 27 26 #include "VBoxHGSMI.h" 28 #endif /* VBOX_WITH_HGSMI */29 27 30 28 RT_C_DECLS_BEGIN … … 89 87 /* The VBOX interface id. Indicates support for VBE_DISPI_INDEX_VBOX_VIDEO. */ 90 88 #define VBE_DISPI_ID_VBOX_VIDEO 0xBE00 91 #ifdef VBOX_WITH_HGSMI92 89 #define VBE_DISPI_ID_HGSMI 0xBE01 93 #endif /* VBOX_WITH_HGSMI */94 90 #define VBE_DISPI_DISABLED 0x00 95 91 #define VBE_DISPI_ENABLED 0x01 … … 100 96 #define VBE_DISPI_TOTAL_VIDEO_MEMORY_BYTES (VBE_DISPI_TOTAL_VIDEO_MEMORY_KB * 1024) 101 97 102 #ifdef VBOX_WITH_HGSMI103 98 #define VGA_PORT_HGSMI_HOST 0x3b0 104 99 #define VGA_PORT_HGSMI_GUEST 0x3d0 105 #endif /* VBOX_WITH_HGSMI */106 100 107 101 /* common API types */ … … 211 205 * This is mapped by miniport separately. 212 206 */ 213 #ifdef VBOX_WITH_HGSMI214 207 volatile HGSMIHOSTFLAGS * pHostFlags; /* HGSMI host flags */ 215 208 volatile bool bHostCmdProcessing; 216 209 VBOXVCMNSPIN_LOCK pSynchLock; 217 #endif218 210 219 211 PVOID pvAdapterInformation; /* The pointer to the last 4K of VRAM. … … 221 213 */ 222 214 223 #ifdef VBOX_WITH_HGSMI224 215 BOOLEAN bHGSMI; /* Whether HGSMI is enabled. */ 225 216 … … 235 226 /* The IO Port Number for guest commands. */ 236 227 RTIOPORT IOPortGuest; 237 #endif238 228 } VBOXVIDEO_COMMON, *PVBOXVIDEO_COMMON; 239 229 … … 283 273 BOOLEAN fMouseHidden; /* Has the mouse cursor been hidden by the guest? */ 284 274 285 #ifndef VBOX_WITH_HGSMI286 ULONG ulDisplayInformationSize; /* The size of the Display information, which is at offset:287 * ulFrameBufferOffset + ulMaxFrameBufferSize.288 */289 #endif /* !VBOX_WITH_HGSMI */290 275 291 276 VBOXVIDEO_COMMON commonInfo; 292 #ifdef VBOX_WITH_HGSMI 293 # ifndef VBOX_WITH_WDDM 277 #ifndef VBOX_WITH_WDDM 294 278 /* Video Port API dynamically picked up at runtime for binary backwards compatibility with older NT versions */ 295 279 VBOXVIDEOPORTPROCS VideoPortProcs; 296 # 280 #else 297 281 /* committed VidPn handle */ 298 282 D3DKMDT_HVIDPN hCommittedVidPn; 299 283 /* Display Port handle and callbacks */ 300 284 DXGKRNL_INTERFACE DxgkInterface; 301 # endif 302 #endif /* VBOX_WITH_HGSMI */ 285 #endif 303 286 } primary; 304 287 … … 309 292 } u; 310 293 311 #ifdef VBOX_WITH_HGSMI312 294 HGSMIAREA areaDisplay; /* Entire VRAM chunk for this display device. */ 313 #endif /* VBOX_WITH_HGSMI */314 295 315 296 #ifdef VBOX_WITH_WDDM … … 510 491 PVIDEO_REQUEST_PACKET RequestPacket); 511 492 512 #if defined(VBOX_WITH_HGSMI) && defined(VBOX_WITH_VIDEOHWACCEL)493 #ifdef VBOX_WITH_VIDEOHWACCEL 513 494 BOOLEAN VBoxVideoInterrupt(PVOID HwDeviceExtension); 514 495 #endif … … 863 844 void VBoxComputeFrameBufferSizes (PDEVICE_EXTENSION PrimaryExtension); 864 845 865 #ifdef VBOX_WITH_HGSMI866 846 867 847 /* … … 918 898 void HGSMIClearIrq (PVBOXVIDEO_COMMON pCommon); 919 899 920 #endif /* VBOX_WITH_HGSMI */921 900 } /* extern "C" */ 922 901 -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/vboxioctl.h
r28800 r33048 23 23 #include <VBox/VBoxGuest.h> 24 24 25 #ifdef VBOX_WITH_HGSMI26 25 #include <VBox/HGSMI/HGSMI.h> 27 26 #include "VBoxHGSMI.h" 28 #endif /* VBOX_WITH_HGSMI */29 27 30 28 #define IOCTL_VIDEO_INTERPRET_DISPLAY_MEMORY \ … … 44 42 CTL_CODE(FILE_DEVICE_VIDEO, 0x400, METHOD_BUFFERED, FILE_ANY_ACCESS) 45 43 46 #ifdef VBOX_WITH_HGSMI47 44 #define IOCTL_VIDEO_QUERY_HGSMI_INFO \ 48 45 CTL_CODE(FILE_DEVICE_VIDEO, 0x430, METHOD_BUFFERED, FILE_ANY_ACCESS) … … 63 60 CTL_CODE(FILE_DEVICE_VIDEO, 0x435, METHOD_BUFFERED, FILE_ANY_ACCESS) 64 61 65 #endif /* VBOX_WITH_HGSMI */66 62 67 63 #pragma pack(1) … … 102 98 } QUERYDISPLAYINFORESULT; 103 99 104 #ifdef VBOX_WITH_HGSMI105 100 /** 106 101 * Data returned by IOCTL_VIDEO_QUERY_HGSMI_INFO. … … 166 161 } HGSMIHANDLERDISABLE; 167 162 168 # 163 #ifdef VBOX_WITH_VIDEOHWACCEL 169 164 typedef struct _VHWAQUERYINFO 170 165 { 171 166 ULONG_PTR offVramBase; 172 167 } VHWAQUERYINFO; 173 # 168 #endif 174 169 175 #endif /* VBOX_WITH_HGSMI */176 170 #pragma pack() 177 171
Note:
See TracChangeset
for help on using the changeset viewer.