Changeset 33048 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Display
- Timestamp:
- Oct 11, 2010 8:57:20 PM (14 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Display
- Files:
-
- 7 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 */
Note:
See TracChangeset
for help on using the changeset viewer.