Changeset 20478 in vbox for trunk/src/VBox
- Timestamp:
- Jun 11, 2009 4:54:19 PM (16 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Display/Makefile.kmk
r19464 r20478 53 53 VBoxDisp.def \ 54 54 VBoxDisp.rc 55 56 ifdef VBOX_WITH_VIDEOHWACCEL 57 VBoxDisp_SOURCES += vhwa.c 58 endif 55 59 VBoxDisp_LDFLAGS.x86 = /Entry:DrvEnableDriver@12 56 60 VBoxDisp_LDFLAGS.amd64 = /Entry:DrvEnableDriver -
trunk/src/VBox/Additions/WINNT/Graphics/Display/dd.c
r19515 r20478 42 42 43 43 #ifdef VBOX_WITH_VIDEOHWACCEL 44 void getDDHALInfo(PPDEV pDev, DD_HALINFO* pHALInfo); 44 #define VBOXVHWA_CAP(_pdev, _cap) ((_pdev)->vhwaInfo.caps & (_cap)) 45 static bool getDDHALInfo(PPDEV pDev, DD_HALINFO* pHALInfo); 45 46 #endif 46 47 … … 98 99 { 99 100 #ifdef VBOX_WITH_VIDEOHWACCEL 101 vboxVHWAInit(); 102 100 103 memset(pHalInfo, 0, sizeof(DD_HALINFO)); 101 104 pHalInfo->dwSize = sizeof(DD_HALINFO); 105 106 vboxVHWAInitHostInfo1(pDev); 102 107 #else 103 108 memset(&pHalInfo->ddCaps, 0, sizeof(DDNTCORECAPS)); … … 149 154 150 155 #ifdef VBOX_WITH_VIDEOHWACCEL 151 pHalInfo->vmiData.dwOverlayAlign = 4; 152 153 #if 1 154 /* teesting */ 155 pDev->bVHWAEnabled = TRUE; 156 #endif 157 if(pDev->bVHWAEnabled) 156 if(pDev->vhwaInfo.bVHWAEnabled) 158 157 { 159 getDDHALInfo(pDev, pHalInfo); 158 pHalInfo->vmiData.dwOverlayAlign = 4; 159 160 pDev->vhwaInfo.bVHWAEnabled = getDDHALInfo(pDev, pHalInfo); 160 161 } 161 162 #endif … … 205 206 206 207 #ifdef VBOX_WITH_VIDEOHWACCEL 207 if(pDev-> bVHWAEnabled)208 { 209 // TODO: filter out hw-unsupported fourccs210 #define FOURCC_YUV422 (MAKEFOURCC('Y','U','Y','2'))211 #define FOURCC_YUV411 (MAKEFOURCC('Y','4','1','1'))212 213 static DWORD fourCC[] = { FOURCC_YUV422, FOURCC_YUV411 }; // The FourCC's we support214 215 *pdwNumFourCCCodes = sizeof( fourCC ) / sizeof( fourCC[0] );216 217 if (pdwFourCC )208 if(pDev->vhwaInfo.bVHWAEnabled) 209 { 210 // // TODO: filter out hw-unsupported fourccs 211 //#define FOURCC_YUV422 (MAKEFOURCC('Y','U','Y','2')) 212 //#define FOURCC_YUV411 (MAKEFOURCC('Y','4','1','1')) 213 // 214 // static DWORD fourCC[] = { FOURCC_YUV422, FOURCC_YUV411 }; // The FourCC's we support 215 216 *pdwNumFourCCCodes = pDev->vhwaInfo.numFourCC; 217 218 if (pdwFourCC && pDev->vhwaInfo.numFourCC) 218 219 { 219 memcpy(pdwFourCC, fourCC, sizeof(fourCC)); 220 int rc = vboxVHWAInitHostInfo2(pDev, pdwFourCC); 221 if(RT_FAILURE(rc)) 222 { 223 *pdwNumFourCCCodes = 0; 224 pDev->vhwaInfo.numFourCC = 0; 225 } 220 226 } 221 227 } … … 311 317 312 318 #ifdef VBOX_WITH_VIDEOHWACCEL 313 if(pDev-> bVHWAEnabled)319 if(pDev->vhwaInfo.bVHWAEnabled) 314 320 { 315 321 //TODO: filter out those we do not need in case not supported by hw … … 333 339 ; 334 340 335 pSurfaceCallBacks->UpdateOverlay = DdUpdateOverlay; // Now supporting overlays. 336 pSurfaceCallBacks->SetOverlayPosition = DdSetOverlayPosition; 337 pSurfaceCallBacks->dwFlags |= 338 DDHAL_SURFCB32_UPDATEOVERLAY | // Now supporting 339 DDHAL_SURFCB32_SETOVERLAYPOSITION ; // overlays. 341 if(pDev->vhwaInfo.caps & VBOXVHWA_CAPS_OVERLAY) 342 { 343 pSurfaceCallBacks->UpdateOverlay = DdUpdateOverlay; // Now supporting overlays. 344 pSurfaceCallBacks->SetOverlayPosition = DdSetOverlayPosition; 345 pSurfaceCallBacks->dwFlags |= 346 DDHAL_SURFCB32_UPDATEOVERLAY | // Now supporting 347 DDHAL_SURFCB32_SETOVERLAYPOSITION ; // overlays. 348 } 340 349 } 341 350 #endif … … 625 634 lpSurfaceDesc->dwFlags |= DDSD_PITCH; 626 635 636 #ifdef VBOX_WITH_VIDEOHWACCEL 637 vboxVHWASurfCreate(pDev, lpCreateSurface); 638 #endif 627 639 628 640 return DDHAL_DRIVER_NOTHANDLED; … … 675 687 return DDHAL_DRIVER_HANDLED; 676 688 } 689 lpCanCreateSurface->ddRVal = DD_OK; 677 690 #else 678 /* TODO: filter out unsupported formats */ 679 #endif 680 681 lpCanCreateSurface->ddRVal = DD_OK; 691 vboxVHWASurfCanCreate(pDev, lpCanCreateSurface); 692 #endif 693 682 694 return DDHAL_DRIVER_HANDLED; 683 695 } … … 955 967 DISPDBG((0, "%s: %p\n", __FUNCTION__, pDev)); 956 968 969 #ifdef VBOX_WITH_VIDEOHWACCEL 970 vboxVHWASurfDestroy(pDev, lpDestroySurface); 971 #else 957 972 lpDestroySurface->ddRVal = DD_OK; 973 #endif 958 974 return DDHAL_DRIVER_HANDLED; 959 975 } … … 1184 1200 { 1185 1201 SRCCOPY >> 16 1186 // 1202 // WHITENESS >> 16, 1187 1203 // BLACKNESS >> 16 1188 1204 }; … … 1190 1206 static DWORD rops[DD_ROP_SPACE] = { 0 }; 1191 1207 1192 void 1208 bool 1193 1209 getDDHALInfo( 1194 1210 PPDEV pDev, … … 1196 1212 { 1197 1213 int i; 1198 1199 /* TODO: only enable features supported by the host backend & host hw 1200 * for now this just combines all caps we might use */ 1201 1202 // Setup the ROPS we do. 1203 setupRops( ropListNT, 1204 rops, 1205 sizeof(ropListNT)/sizeof(ropListNT[0])); 1206 1207 // The most basic DirectDraw functionality 1208 pHALInfo->ddCaps.dwCaps |= DDCAPS_BLT 1209 | DDCAPS_BLTQUEUE 1210 | DDCAPS_BLTCOLORFILL 1214 if(!VBOXVHWA_CAP(pDev, VBOXVHWA_CAPS_BLT) && !VBOXVHWA_CAP(pDev, VBOXVHWA_CAPS_OVERLAY)) 1215 return false; 1216 1217 if(VBOXVHWA_CAP(pDev, VBOXVHWA_CAPS_BLT)) 1218 { 1219 // Setup the ROPS we do. 1220 //TODO: hardcoded for now 1221 setupRops( ropListNT, 1222 rops, 1223 sizeof(ropListNT)/sizeof(ropListNT[0])); 1224 1225 // The most basic DirectDraw functionality 1226 pHALInfo->ddCaps.dwCaps |= DDCAPS_BLT 1227 | DDCAPS_BLTQUEUE; 1228 if(VBOXVHWA_CAP(pDev, VBOXVHWA_CAPS_BLTCOLORFILL)) 1229 { 1230 pHALInfo->ddCaps.dwCaps |= DDCAPS_BLTCOLORFILL; 1231 } 1232 } 1233 1211 1234 // | DDCAPS_READSCANLINE 1212 ; 1235 1213 1236 1214 1237 pHALInfo->ddCaps.ddsCaps.dwCaps |= DDSCAPS_OFFSCREENPLAIN 1215 | DDSCAPS_PRIMARYSURFACE 1216 | DDSCAPS_FLIP; 1217 1218 pHALInfo->ddCaps.dwCaps |= DDCAPS_3D | 1219 DDCAPS_BLTDEPTHFILL; 1220 1221 pHALInfo->ddCaps.ddsCaps.dwCaps |= DDSCAPS_3DDEVICE | 1222 DDSCAPS_ZBUFFER | 1223 DDSCAPS_ALPHA; 1238 | DDSCAPS_PRIMARYSURFACE; 1239 if(pDev->vhwaInfo.surfaceCaps & VBOXVHWA_SCAPS_FLIP) 1240 { 1241 pHALInfo->ddCaps.ddsCaps.dwCaps |= DDSCAPS_FLIP; 1242 } 1243 //disabled 1244 // pHALInfo->ddCaps.dwCaps |= DDCAPS_3D | 1245 // DDCAPS_BLTDEPTHFILL; 1246 // 1247 // pHALInfo->ddCaps.ddsCaps.dwCaps |= DDSCAPS_3DDEVICE | 1248 // DDSCAPS_ZBUFFER | 1249 // DDSCAPS_ALPHA; 1224 1250 pHALInfo->ddCaps.dwCaps2 = 0; 1225 1251 … … 1261 1287 // 3. Mirroring in X and Y 1262 1288 // 4. ColorKeying from a source color and a source color space 1263 pHALInfo->ddCaps.dwCaps |= DDCAPS_BLTSTRETCH 1264 | DDCAPS_BLTFOURCC 1265 | DDCAPS_COLORKEY 1289 if(VBOXVHWA_CAP(pDev, VBOXVHWA_CAPS_BLT) 1290 && VBOXVHWA_CAP(pDev, VBOXVHWA_CAPS_BLTSTRETCH)) 1291 { 1292 pHALInfo->ddCaps.dwCaps |= DDCAPS_BLTSTRETCH; 1293 1294 // Special effects caps 1295 //TODO: filter them out 1296 pHALInfo->ddCaps.dwFXCaps |= DDFXCAPS_BLTSTRETCHY | 1297 DDFXCAPS_BLTSTRETCHX | 1298 DDFXCAPS_BLTSTRETCHYN | 1299 DDFXCAPS_BLTSTRETCHXN | 1300 DDFXCAPS_BLTSHRINKY | 1301 DDFXCAPS_BLTSHRINKX | 1302 DDFXCAPS_BLTSHRINKYN | 1303 DDFXCAPS_BLTSHRINKXN; 1304 1305 1306 //mirroring with blitting 1307 pHALInfo->ddCaps.dwFXCaps |= DDFXCAPS_BLTMIRRORUPDOWN 1308 | DDFXCAPS_BLTMIRRORLEFTRIGHT; 1309 1310 } 1311 1312 if(VBOXVHWA_CAP(pDev, VBOXVHWA_CAPS_BLT) 1313 && VBOXVHWA_CAP(pDev, VBOXVHWA_CAPS_BLTFOURCC)) 1314 { 1315 pHALInfo->ddCaps.dwCaps |= DDCAPS_BLTFOURCC; 1316 1317 // Enable copy blts between Four CC formats for DShow acceleration 1318 pHALInfo->ddCaps.dwCaps2 |= DDCAPS2_COPYFOURCC; 1319 } 1320 1321 if(VBOXVHWA_CAP(pDev, VBOXVHWA_CAPS_BLT) 1322 && VBOXVHWA_CAP(pDev, VBOXVHWA_CAPS_COLORKEY)) 1323 { 1324 pHALInfo->ddCaps.dwCaps |= DDCAPS_COLORKEY; 1266 1325 // | DDCAPS_CANBLTSYSMEM 1267 ; 1268 1269 // Special effects caps 1270 pHALInfo->ddCaps.dwFXCaps |= DDFXCAPS_BLTSTRETCHY | 1271 DDFXCAPS_BLTSTRETCHX | 1272 DDFXCAPS_BLTSTRETCHYN | 1273 DDFXCAPS_BLTSTRETCHXN | 1274 DDFXCAPS_BLTSHRINKY | 1275 DDFXCAPS_BLTSHRINKX | 1276 DDFXCAPS_BLTSHRINKYN | 1277 DDFXCAPS_BLTSHRINKXN; 1278 1279 // ColorKey caps 1280 pHALInfo->ddCaps.dwCKeyCaps |= DDCKEYCAPS_SRCBLT | 1281 DDCKEYCAPS_SRCBLTCLRSPACE | 1282 DDCKEYCAPS_DESTBLT | 1283 DDCKEYCAPS_DESTBLTCLRSPACE; 1284 1326 1327 // ColorKey caps 1328 //TODO: filter them out 1329 pHALInfo->ddCaps.dwCKeyCaps |= DDCKEYCAPS_SRCBLT | 1330 DDCKEYCAPS_SRCBLTCLRSPACE | 1331 DDCKEYCAPS_DESTBLT | 1332 DDCKEYCAPS_DESTBLTCLRSPACE; 1333 1334 pHALInfo->ddCaps.dwCKeyCaps |= DDCKEYCAPS_SRCBLTCLRSPACEYUV 1335 | DDCKEYCAPS_DESTBLTCLRSPACEYUV; 1336 1337 #if 0 1338 DDCKEYCAPS_DESTBLT Supports transparent blitting with a color key that identifies the replaceable bits of the destination surface for RGB colors. 1339 DDCKEYCAPS_DESTBLTCLRSPACE Supports transparent blitting with a color space that identifies the replaceable bits of the destination surface for RGB colors. 1340 DDCKEYCAPS_DESTBLTCLRSPACEYUV Supports transparent blitting with a color space that identifies the replaceable bits of the destination surface for YUV colors. 1341 DDCKEYCAPS_DESTBLTYUV Supports transparent blitting with a color key that identifies the replaceable bits of the destination surface for YUV colors. 1342 1343 DDCKEYCAPS_SRCBLT Supports transparent blitting using the color key for the source with this surface for RGB colors. 1344 DDCKEYCAPS_SRCBLTCLRSPACE Supports transparent blitting using a color space for the source with this surface for RGB colors. 1345 DDCKEYCAPS_SRCBLTCLRSPACEYUV Supports transparent blitting using a color space for the source with this surface for YUV colors. 1346 DDCKEYCAPS_SRCBLTYUV Supports transparent blitting using the color key for the source with this surface for YUV colors. 1347 #endif 1348 1349 } 1350 1351 if(VBOXVHWA_CAP(pDev, VBOXVHWA_CAPS_OVERLAY) 1352 && VBOXVHWA_CAP(pDev, VBOXVHWA_CAPS_COLORKEY)) 1353 { 1354 #if 0 1355 DDCKEYCAPS_DESTOVERLAY Supports overlaying with color keying of the replaceable bits of the destination surface being overlaid for RGB colors. 1356 DDCKEYCAPS_DESTOVERLAYCLRSPACE Supports a color space as the color key for the destination of RGB colors. 1357 DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV Supports a color space as the color key for the destination of YUV colors. 1358 DDCKEYCAPS_DESTOVERLAYONEACTIVE Supports only one active destination color key value for visible overlay surfaces. 1359 DDCKEYCAPS_DESTOVERLAYYUV Supports overlaying using color keying of the replaceable bits of the destination surface being overlaid for YUV colors. 1360 DDCKEYCAPS_NOCOSTOVERLAY Indicates that there are no bandwidth tradeoffs for using the color key with an overlay. 1361 1362 DDCKEYCAPS_SRCOVERLAY Supports overlaying using the color key for the source with this overlay surface for RGB colors. 1363 DDCKEYCAPS_SRCOVERLAYCLRSPACE Supports overlaying using a color space as the source color key for the overlay surface for RGB colors. 1364 DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV Supports overlaying using a color space as the source color key for the overlay surface for YUV colors. 1365 DDCKEYCAPS_SRCOVERLAYONEACTIVE Supports only one active source color key value for visible overlay surfaces. 1366 DDCKEYCAPS_SRCOVERLAYYUV Supports overlaying using the color key for the source with this overlay surface for YUV colors. 1367 #endif 1368 } 1285 1369 // pHALInfo->ddCaps.dwSVBCaps = DDCAPS_BLT; 1286 1370 … … 1296 1380 // } 1297 1381 1298 //mirroring with blitting 1299 pHALInfo->ddCaps.dwFXCaps |= DDFXCAPS_BLTMIRRORUPDOWN | 1300 DDFXCAPS_BLTMIRRORLEFTRIGHT; 1301 1302 pHALInfo->ddCaps.dwCKeyCaps |= DDCKEYCAPS_SRCBLTCLRSPACEYUV; 1303 1304 pHALInfo->ddCaps.ddsCaps.dwCaps |= DDSCAPS_TEXTURE; 1382 1383 1384 //disabled 1385 // pHALInfo->ddCaps.ddsCaps.dwCaps |= DDSCAPS_TEXTURE; 1305 1386 1306 1387 //#if DX7_STEREO … … 1329 1410 //#endif // SUPPORT_VIDEOPORT 1330 1411 1331 1412 if(VBOXVHWA_CAP(pDev, VBOXVHWA_CAPS_OVERLAY)) /* no overlay support for now */ 1332 1413 { 1333 1414 // Overlay is free to use. 1334 pHALInfo->ddCaps.dwMaxVisibleOverlays = 1;1415 pHALInfo->ddCaps.dwMaxVisibleOverlays = pDev->vhwaInfo.numOverlays; 1335 1416 pHALInfo->ddCaps.dwCurrVisibleOverlays = 0; 1336 1417 … … 1375 1456 pHALInfo->ddCaps.dwCaps2 |= DDCAPS2_WIDESURFACES; 1376 1457 1377 // Enable copy blts betweemn Four CC formats for DShow acceleration1378 pHALInfo->ddCaps.dwCaps2 |= DDCAPS2_COPYFOURCC;1379 1458 1380 1459 // Won't do Video-Sys mem Blits. … … 1410 1489 // DDBD_8; 1411 1490 1412 // No alpha blending for overlays, so I'm not sure what these should be. 1413 // Because we support 32bpp overlays, it's just that you can't use the 1414 // alpha bits for blending. Pass. 1415 pHALInfo->ddCaps.dwAlphaBltConstBitDepths = DDBD_2 | 1416 DDBD_4 | 1417 DDBD_8; 1418 1419 pHALInfo->ddCaps.dwAlphaBltPixelBitDepths = DDBD_1 | 1420 DDBD_8; 1421 1422 pHALInfo->ddCaps.dwAlphaBltSurfaceBitDepths = DDBD_1 | 1423 DDBD_2 | 1424 DDBD_4 | 1425 DDBD_8; 1491 //disabled 1492 // // No alpha blending for overlays, so I'm not sure what these should be. 1493 // // Because we support 32bpp overlays, it's just that you can't use the 1494 // // alpha bits for blending. Pass. 1495 // pHALInfo->ddCaps.dwAlphaBltConstBitDepths = DDBD_2 | 1496 // DDBD_4 | 1497 // DDBD_8; 1498 // 1499 // pHALInfo->ddCaps.dwAlphaBltPixelBitDepths = DDBD_1 | 1500 // DDBD_8; 1501 // 1502 // pHALInfo->ddCaps.dwAlphaBltSurfaceBitDepths = DDBD_1 | 1503 // DDBD_2 | 1504 // DDBD_4 | 1505 // DDBD_8; 1426 1506 1427 1507 // … … 1443 1523 //#endif DX8_DDI 1444 1524 1445 1525 return true; 1446 1526 } // getDDHALInfo 1447 1527 -
trunk/src/VBox/Additions/WINNT/Graphics/Display/debug.h
r18246 r20478 39 39 40 40 #define DISPDBG(arg) DebugPrint arg 41 #define VHWADBG(arg) 41 42 #define RIP(x) { DebugPrint(0, x); } 42 43 #else 43 44 #define DISPDBG(arg) 45 #define VHWADBG(arg) 44 46 #define RIP(x) 45 47 #endif 46 48 47 49 // #if DBG 48 // 50 // 49 51 // VOID 50 52 // DebugPrint( … … 53 55 // ... 54 56 // ); 55 // 57 // 56 58 // #define DISPDBG(arg) DebugPrint arg 57 59 // #define RIP(x) { DebugPrint(0, x); EngDebugBreak();} 58 // 60 // 59 61 // #else 60 // 62 // 61 63 // #define DISPDBG(arg) 62 64 // #define RIP(x) 63 // 65 // 64 66 // #endif 65 67 -
trunk/src/VBox/Additions/WINNT/Graphics/Display/driver.h
r20009 r20478 94 94 } VBOXSURF, *PVBOXSURF; 95 95 96 #ifdef VBOX_WITH_VIDEOHWACCEL 97 typedef struct _VBOXVHWASURFDESC 98 { 99 VBOXVHWA_SURFHANDLE hHostHandle; 100 }VBOXVHWASURFDESC, *PVBOXVHWASURFDESC; 101 typedef struct _VBOXVHWAINFO 102 { 103 uint32_t caps; 104 uint32_t colorKeyCaps; 105 uint32_t stretchCaps; 106 uint32_t surfaceCaps; 107 uint32_t numOverlays; 108 uint32_t numFourCC; 109 HGSMIOFFSET FourCC; 110 BOOLEAN bVHWAEnabled; 111 } VBOXVHWAINFO; 112 #endif 113 96 114 struct _PDEV 97 115 { … … 167 185 HVBOXVIDEOHGSMI hMpHGSMI; /* context handler passed to miniport HGSMI callbacks */ 168 186 PFNVBOXVIDEOHGSMICOMPLETION pfnHGSMICommandComplete; /* called to complete the command we receive from the miniport */ 187 PFNVBOXVIDEOHGSMICOMMANDS pfnHGSMIRequestCommands; /* called to requests the commands posted to us from the host */ 169 188 #endif /* VBOX_WITH_HGSMI */ 170 189 171 190 #ifdef VBOX_WITH_VIDEOHWACCEL 172 BOOLEAN bVHWAEnabled;191 VBOXVHWAINFO vhwaInfo; 173 192 #endif 174 193 }; … … 253 272 254 273 #ifdef VBOX_WITH_HGSMI 255 DECLCALLBACK(int) vboxVBVAHostCommandHanlder(void *pvHandler, uint16_t u16ChannelInfo, void *pvBuffer, HGSMISIZE cbBuffer); 256 void vboxVBVAHostCommandComplete(PPDEV ppdev, void *pvBuffer); 274 void vboxVBVAHostCommandComplete(PPDEV ppdev, VBVAHOSTCMD * pCmd); 257 275 258 276 #ifdef VBOX_WITH_VIDEOHWACCEL … … 264 282 void vboxVHWACommandFree (PPDEV ppdev, VBOXVHWACMD* pCmd); 265 283 BOOL vboxVHWACommandSubmit (PPDEV ppdev, VBOXVHWACMD* pCmd); 266 void vboxVHWACommandSubmitAssynch (PPDEV ppdev, VBOXVHWACMD* pCmd, PFNVBOXVHWACMDCOMPLETION pfnCompletion, void * pContext); 284 void vboxVHWACommandSubmitAsynch (PPDEV ppdev, VBOXVHWACMD* pCmd, PFNVBOXVHWACMDCOMPLETION pfnCompletion, void * pContext); 285 void vboxVHWACommandSubmitAsynchByEvent (PPDEV ppdev, VBOXVHWACMD* pCmd, PEVENT pEvent); 286 void vboxVHWACommandCheckHostCmds(PPDEV ppdev); 287 288 int vboxVHWAInitHostInfo1(PPDEV ppdev); 289 int vboxVHWAInitHostInfo2(PPDEV ppdev, DWORD *pFourCC); 290 291 VBOXVHWACMD_QUERYINFO1* vboxVHWAQueryHostInfo1(PPDEV ppdev); 292 void vboxVHWAFreeHostInfo1(PPDEV ppdev, VBOXVHWACMD_QUERYINFO1* pInfo); 293 VBOXVHWACMD_QUERYINFO2* vboxVHWAQueryHostInfo2(PPDEV ppdev, uint32_t numFourCC); 294 void vboxVHWAFreeHostInfo2(PPDEV ppdev, VBOXVHWACMD_QUERYINFO2* pInfo); 295 296 void vboxVHWAInit(); 297 void vboxVHWATerm(); 298 void vboxVHWASurfCanCreate(PPDEV ppdev, PDD_CANCREATESURFACEDATA lpCanCreateSurface); 299 void vboxVHWASurfCreate(PPDEV ppdev, PDD_CREATESURFACEDATA lpCreateSurface); 300 void vboxVHWASurfDestroy(PPDEV ppdev, PDD_DESTROYSURFACEDATA lpDestroySurface); 267 301 #endif 268 302 #endif -
trunk/src/VBox/Additions/WINNT/Graphics/Display/screen.c
r20009 r20478 119 119 if(!err) 120 120 { 121 HGSMIHANDLER REGISTERHandlerReg;121 HGSMIHANDLERENABLE HandlerReg; 122 122 RtlZeroMemory(&HandlerReg, sizeof(HandlerReg)); 123 123 124 124 ppdev->hMpHGSMI = Callbacks.hContext; 125 125 ppdev->pfnHGSMICommandComplete = Callbacks.pfnCompletionHandler; 126 HandlerReg.pfnHandler = vboxVBVAHostCommandHanlder;127 HandlerReg.pvHandler = ppdev; 126 ppdev->pfnHGSMIRequestCommands = Callbacks.pfnRequestCommandsHandler; 127 128 128 HandlerReg.u8Channel = HGSMI_CH_VBVA; 129 129 err = EngDeviceIoControl(ppdev->hDriver, 130 IOCTL_VIDEO_HGSMI_HANDLER_ REGISTER,130 IOCTL_VIDEO_HGSMI_HANDLER_ENABLE, 131 131 &HandlerReg, 132 132 sizeof(HandlerReg), -
trunk/src/VBox/Additions/WINNT/Graphics/Display/vbox.c
r20242 r20478 695 695 { 696 696 VBOXVHWACMD* pHdr = (VBOXVHWACMD*)HGSMIHeapAlloc (&ppdev->hgsmiDisplayHeap, 697 cbCmd ,697 cbCmd + VBOXVHWACMD_HEADSIZE(), 698 698 HGSMI_CH_VBVA, 699 699 VBVA_VHWA_CMD); … … 703 703 } 704 704 705 /* temporary hack */ 706 vboxVHWACommandCheckHostCmds(ppdev); 707 705 708 return pHdr; 706 709 } … … 718 721 } 719 722 723 static int vboxVHWAHanldeVHWACmdCompletion(PPDEV ppdev, VBVAHOSTCMD * pHostCmd) 724 { 725 VBVAHOSTCMDVHWACMDCOMPLETE * pComplete = VBVAHOSTCMD_BODY(pHostCmd, VBVAHOSTCMDVHWACMDCOMPLETE); 726 VBOXVHWACMD* pComplCmd = (VBOXVHWACMD*)HGSMIOffsetToPointer (&ppdev->hgsmiDisplayHeap.area, pComplete->offCmd); 727 PFNVBOXVHWACMDCOMPLETION pfnCompletion = (PFNVBOXVHWACMDCOMPLETION)pComplCmd->GuestVBVAReserved1; 728 void * pContext = (void *)pComplCmd->GuestVBVAReserved2; 729 730 pfnCompletion(ppdev, pComplCmd, pContext); 731 732 vboxVBVAHostCommandComplete(ppdev, pHostCmd); 733 734 return 0; 735 } 736 737 static void vboxVBVAHostCommandHanlder(PPDEV ppdev, VBVAHOSTCMD * pCmd) 738 { 739 int rc = VINF_SUCCESS; 740 switch(pCmd->customOpCode) 741 { 742 # ifdef VBOX_WITH_VIDEOHWACCEL 743 case VBVAHG_DCUSTOM_VHWA_CMDCOMPLETE: 744 { 745 vboxVHWAHanldeVHWACmdCompletion(ppdev, pCmd); 746 break; 747 } 748 # endif 749 default: 750 { 751 vboxVBVAHostCommandComplete(ppdev, pCmd); 752 } 753 } 754 } 755 756 void vboxVHWACommandCheckHostCmds(PPDEV ppdev) 757 { 758 VBVAHOSTCMD * pCmd; 759 int rc = ppdev->pfnHGSMIRequestCommands(ppdev->hMpHGSMI, HGSMI_CH_VBVA, &pCmd); 760 if(RT_SUCCESS(rc)) 761 { 762 for(; pCmd; pCmd = pCmd->u.pNext) 763 { 764 vboxVBVAHostCommandHanlder(ppdev, pCmd); 765 } 766 } 767 } 768 769 void vboxVHWACommandSubmitAsynchByEvent (PPDEV ppdev, VBOXVHWACMD* pCmd, PEVENT pEvent) 770 { 771 // Assert(0); 772 pCmd->GuestVBVAReserved1 = (uintptr_t)pEvent; 773 pCmd->GuestVBVAReserved2 = 0; 774 775 /* complete it asynchronously by setting event */ 776 pCmd->Flags = VBOXVHWACMD_FLAG_ASYNCH_EVENT; 777 vboxHGSMIBufferSubmit (ppdev, pCmd); 778 779 if(!(ASMAtomicReadU32((volatile uint32_t *)&pCmd->Flags) & VBOXVHWACMD_FLAG_ASYNCH)) 780 { 781 /* the command is completed */ 782 EngSetEvent(pEvent); 783 } 784 } 785 720 786 BOOL vboxVHWACommandSubmit (PPDEV ppdev, VBOXVHWACMD* pCmd) 721 787 { … … 723 789 BOOL brc = EngCreateEvent(&pEvent); 724 790 Assert(brc); 791 725 792 if(brc) 726 793 { 727 vboxVHWACommandSubmitAs synch (ppdev, pCmd, vboxVHWACommandCompletionCallbackEvent, pEvent);794 vboxVHWACommandSubmitAsynchByEvent (ppdev, pCmd, pEvent); 728 795 729 796 brc = EngWaitForSingleObject(pEvent, … … 740 807 741 808 /* do not wait for completion */ 742 void vboxVHWACommandSubmitAssynch (PPDEV ppdev, VBOXVHWACMD* pCmd, PFNVBOXVHWACMDCOMPLETION pfnCompletion, void * pContext) 743 { 809 void vboxVHWACommandSubmitAsynch (PPDEV ppdev, VBOXVHWACMD* pCmd, PFNVBOXVHWACMDCOMPLETION pfnCompletion, void * pContext) 810 { 811 // Assert(0); 744 812 pCmd->GuestVBVAReserved1 = (uintptr_t)pfnCompletion; 745 813 pCmd->GuestVBVAReserved2 = (uintptr_t)pContext; 746 814 815 pCmd->Flags = 0; 747 816 vboxHGSMIBufferSubmit (ppdev, pCmd); 748 817 749 if( pCmd->rc != VINF_VHWA_CMD_PENDING)818 if(!(pCmd->Flags & VBOXVHWACMD_FLAG_ASYNCH)) 750 819 { 751 820 /* the command is completed */ 752 821 pfnCompletion(ppdev, pCmd, pContext); 753 822 } 754 755 } 756 757 static int vboxVHWAHanldeVHWACmdCompletion(PPDEV ppdev, void *pvBuffer, HGSMISIZE cbBuffer) 758 { 759 VBOXVHWACMD* pCmd = (VBOXVHWACMD*)pvBuffer; 760 PFNVBOXVHWACMDCOMPLETION pfnCompletion = (PFNVBOXVHWACMDCOMPLETION)pCmd->GuestVBVAReserved1; 761 void * pContext = (void *)pCmd->GuestVBVAReserved2; 762 763 pfnCompletion(ppdev, pCmd, pContext); 764 return 0; 765 } 823 } 824 825 void vboxVHWAFreeHostInfo1(PPDEV ppdev, VBOXVHWACMD_QUERYINFO1* pInfo) 826 { 827 VBOXVHWACMD* pCmd = VBOXVHWACMD_HEAD(pInfo); 828 vboxVHWACommandFree (ppdev, pCmd); 829 } 830 831 void vboxVHWAFreeHostInfo2(PPDEV ppdev, VBOXVHWACMD_QUERYINFO2* pInfo) 832 { 833 VBOXVHWACMD* pCmd = VBOXVHWACMD_HEAD(pInfo); 834 vboxVHWACommandFree (ppdev, pCmd); 835 } 836 837 VBOXVHWACMD_QUERYINFO1* vboxVHWAQueryHostInfo1(PPDEV ppdev) 838 { 839 VBOXVHWACMD* pCmd = vboxVHWACommandCreate (ppdev, sizeof(VBOXVHWACMD_QUERYINFO1)); 840 if (!pCmd) 841 { 842 DISPDBG((0, "VBoxDISP::vboxVHWAQueryHostInfo1: vboxVHWACommandCreate failed\n")); 843 return NULL; 844 } 845 846 pCmd->enmCmd = VBOXVHWACMD_TYPE_QUERY_INFO1; 847 if(vboxVHWACommandSubmit (ppdev, pCmd)) 848 { 849 if(RT_SUCCESS(pCmd->rc)) 850 { 851 return VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_QUERYINFO1); 852 } 853 } 854 855 vboxVHWACommandFree (ppdev, pCmd); 856 return NULL; 857 } 858 859 VBOXVHWACMD_QUERYINFO2* vboxVHWAQueryHostInfo2(PPDEV ppdev, uint32_t numFourCC) 860 { 861 VBOXVHWACMD* pCmd = vboxVHWACommandCreate (ppdev, sizeof(VBOXVHWACMD_QUERYINFO2)); 862 VBOXVHWACMD_QUERYINFO2 *pInfo2; 863 if (!pCmd) 864 { 865 DISPDBG((0, "VBoxDISP::vboxVHWAQueryHostInfo1: vboxVHWACommandCreate failed\n")); 866 return NULL; 867 } 868 869 pCmd->enmCmd = VBOXVHWACMD_TYPE_QUERY_INFO2; 870 pInfo2 = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_QUERYINFO2); 871 pInfo2->numFourCC = numFourCC; 872 873 if(vboxVHWACommandSubmit (ppdev, pCmd)) 874 { 875 if(RT_SUCCESS(pCmd->rc)) 876 { 877 if(pInfo2->numFourCC == numFourCC) 878 { 879 return pInfo2; 880 } 881 } 882 } 883 884 vboxVHWACommandFree (ppdev, pCmd); 885 return NULL; 886 } 887 888 int vboxVHWAInitHostInfo1(PPDEV ppdev) 889 { 890 VBOXVHWACMD_QUERYINFO1* pInfo = vboxVHWAQueryHostInfo1(ppdev); 891 if(!pInfo) 892 { 893 ppdev->vhwaInfo.bVHWAEnabled = false; 894 return VERR_OUT_OF_RESOURCES; 895 } 896 897 ppdev->vhwaInfo.caps = pInfo->caps; 898 ppdev->vhwaInfo.colorKeyCaps = pInfo->colorKeyCaps; 899 ppdev->vhwaInfo.stretchCaps = pInfo->stretchCaps; 900 ppdev->vhwaInfo.surfaceCaps = pInfo->surfaceCaps; 901 ppdev->vhwaInfo.numOverlays = pInfo->numOverlays; 902 ppdev->vhwaInfo.numFourCC = pInfo->numFourCC; 903 ppdev->vhwaInfo.bVHWAEnabled = (pInfo->cfgFlags & VBOXVHWA_CFG_ENABLED); 904 905 vboxVHWAFreeHostInfo1(ppdev, pInfo); 906 return VINF_SUCCESS; 907 } 908 909 int vboxVHWAInitHostInfo2(PPDEV ppdev, DWORD *pFourCC) 910 { 911 VBOXVHWACMD_QUERYINFO2* pInfo = vboxVHWAQueryHostInfo2(ppdev, ppdev->vhwaInfo.numFourCC); 912 int rc = VINF_SUCCESS; 913 914 if(pInfo) 915 return VERR_OUT_OF_RESOURCES; 916 917 if(ppdev->vhwaInfo.numFourCC) 918 { 919 memcpy(pFourCC, pInfo->FourCC, ppdev->vhwaInfo.numFourCC * sizeof(pFourCC[0])); 920 } 921 else 922 { 923 Assert(0); 924 rc = VERR_GENERAL_FAILURE; 925 } 926 927 vboxVHWAFreeHostInfo2(ppdev, pInfo); 928 929 return rc; 930 } 931 766 932 767 933 # endif 768 934 769 void vboxVBVAHostCommandComplete(PPDEV ppdev, void *pvBuffer) 770 { 771 ppdev->pfnHGSMICommandComplete(ppdev->hMpHGSMI, pvBuffer); 772 } 773 774 DECLCALLBACK(int) vboxVBVAHostCommandHanlder(void *pvHandler, uint16_t u16ChannelInfo, void *pvBuffer, HGSMISIZE cbBuffer) 775 { 776 int rc = VINF_SUCCESS; 777 PPDEV ppdev = (PPDEV)pvHandler; 778 779 switch(u16ChannelInfo) 780 { 781 # ifdef VBOX_WITH_VIDEOHWACCEL 782 case VBVAHG_VHWA_CMDCOMPLETE: 783 { 784 vboxVHWAHanldeVHWACmdCompletion(ppdev, pvBuffer, cbBuffer); 785 break; 786 } 787 # endif 788 default: 789 { 790 vboxVBVAHostCommandComplete(ppdev, pvBuffer); 791 } 792 } 793 return rc; 935 void vboxVBVAHostCommandComplete(PPDEV ppdev, VBVAHOSTCMD * pCmd) 936 { 937 ppdev->pfnHGSMICommandComplete(ppdev->hMpHGSMI, pCmd); 794 938 } 795 939 -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.cpp
r19844 r20478 1895 1895 HGSMIQUERYCALLBACKS *pInfo = (HGSMIQUERYCALLBACKS *)RequestPacket->OutputBuffer; 1896 1896 1897 pInfo->hContext = pDevExt->pPrimary; 1898 pInfo->pfnCompletionHandler = hgsmiHostCmdHandlerComplete; 1897 pInfo->hContext = pDevExt; 1898 pInfo->pfnCompletionHandler = hgsmiHostCmdComplete; 1899 pInfo->pfnRequestCommandsHandler = hgsmiHostCmdRequest; 1899 1900 1900 1901 RequestPacket->StatusBlock->Information = sizeof(HGSMIQUERYCALLBACKS); … … 1902 1903 break; 1903 1904 } 1904 case IOCTL_VIDEO_HGSMI_HANDLER_ REGISTER:1905 { 1906 dprintf(("VBoxVideo::VBoxVideoStartIO: IOCTL_VIDEO_HGSMI_HANDLER_ REGISTER\n"));1907 1908 if (RequestPacket->InputBufferLength< sizeof(HGSMIHANDLER REGISTER))1905 case IOCTL_VIDEO_HGSMI_HANDLER_ENABLE: 1906 { 1907 dprintf(("VBoxVideo::VBoxVideoStartIO: IOCTL_VIDEO_HGSMI_HANDLER_ENABLE\n")); 1908 1909 if (RequestPacket->InputBufferLength< sizeof(HGSMIHANDLERENABLE)) 1909 1910 { 1910 1911 dprintf(("VBoxVideo::VBoxVideoStartIO: Output buffer too small: %d needed: %d!!!\n", 1911 RequestPacket->InputBufferLength, sizeof(HGSMIHANDLER REGISTER)));1912 RequestPacket->InputBufferLength, sizeof(HGSMIHANDLERENABLE))); 1912 1913 RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER; 1913 1914 return FALSE; … … 1920 1921 } 1921 1922 1922 HGSMIHANDLERREGISTER *pInfo = (HGSMIHANDLERREGISTER *)RequestPacket->InputBuffer; 1923 1924 int rc = vboxHGSMIChannelDisplayRegister (pDevExt->pPrimary, 1925 pDevExt->iDevice, /* negative would mean this is a miniport handler */ 1926 pInfo->u8Channel, 1927 pInfo->pfnHandler, 1928 pInfo->pvHandler); 1923 HGSMIHANDLERENABLE *pInfo = (HGSMIHANDLERENABLE *)RequestPacket->InputBuffer; 1924 1925 int rc = vboxVBVAChannelDisplayEnable(pDevExt->pPrimary, 1926 pDevExt->iDevice, 1927 pInfo->u8Channel); 1929 1928 if(RT_FAILURE(rc)) 1930 1929 { … … 1934 1933 break; 1935 1934 } 1936 case IOCTL_VIDEO_HGSMI_HANDLER_D EREGISTER:1935 case IOCTL_VIDEO_HGSMI_HANDLER_DISABLE: 1937 1936 { 1938 1937 /* TODO: implement */ -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.h
r20374 r20478 258 258 uint32_t cbLength); 259 259 260 DECLCALLBACK(void) hgsmiHostCmdHandlerComplete (HVBOXVIDEOHGSMI hHGSMI, void * pvMem); 261 262 int vboxHGSMIChannelDisplayRegister (PDEVICE_EXTENSION PrimaryExtension, 260 DECLCALLBACK(void) hgsmiHostCmdComplete (HVBOXVIDEOHGSMI hHGSMI, struct _VBVAHOSTCMD * pCmd); 261 DECLCALLBACK(int) hgsmiHostCmdRequest (HVBOXVIDEOHGSMI hHGSMI, uint8_t u8Channel, struct _VBVAHOSTCMD ** ppCmd); 262 263 264 int vboxVBVAChannelDisplayEnable(PDEVICE_EXTENSION PrimaryExtension, 263 265 int iDisplay, /* negative would mean this is a miniport handler */ 264 uint8_t u8Channel, 265 PFNHGSMICHANNELHANDLER pfnChannelHandler, 266 void *pvChannelHandler); 266 uint8_t u8Channel); 267 267 #endif /* VBOX_WITH_HGSMI */ 268 268 } /* extern "C" */ -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/vboxioctl.h
r19844 r20478 53 53 CTL_CODE(FILE_DEVICE_VIDEO, 0x431, METHOD_BUFFERED, FILE_ANY_ACCESS) 54 54 55 #define IOCTL_VIDEO_HGSMI_HANDLER_ REGISTER\55 #define IOCTL_VIDEO_HGSMI_HANDLER_ENABLE \ 56 56 CTL_CODE(FILE_DEVICE_VIDEO, 0x432, METHOD_BUFFERED, FILE_ANY_ACCESS) 57 57 58 #define IOCTL_VIDEO_HGSMI_HANDLER_D EREGISTER\58 #define IOCTL_VIDEO_HGSMI_HANDLER_DISABLE \ 59 59 CTL_CODE(FILE_DEVICE_VIDEO, 0x433, METHOD_BUFFERED, FILE_ANY_ACCESS) 60 60 … … 129 129 HVBOXVIDEOHGSMI hContext; 130 130 PFNVBOXVIDEOHGSMICOMPLETION pfnCompletionHandler; 131 PFNVBOXVIDEOHGSMICOMMANDS pfnRequestCommandsHandler; 131 132 } HGSMIQUERYCALLBACKS; 132 133 133 134 /** 134 * Data returned by IOCTL_VIDEO_HGSMI_HANDLER_ REGISTER.135 * Data returned by IOCTL_VIDEO_HGSMI_HANDLER_ENABLE. 135 136 * 136 137 */ 137 typedef struct _HGSMIHANDLER REGISTER138 typedef struct _HGSMIHANDLERENABLE 138 139 { 139 PFNHGSMICHANNELHANDLER pfnHandler;140 void * pvHandler;141 140 uint8_t u8Channel; 142 } HGSMIHANDLER REGISTER;141 } HGSMIHANDLERENABLE; 143 142 144 143 /** 145 * Data passed by IOCTL_VIDEO_HGSMI_HANDLER_D EREGISTER.144 * Data passed by IOCTL_VIDEO_HGSMI_HANDLER_DISABLE. 146 145 * 147 146 */ 148 typedef struct _HGSMIHANDLERD EREGISTER147 typedef struct _HGSMIHANDLERDISABLE 149 148 { 150 PFNHGSMICHANNELHANDLER pfnHandler;151 149 uint8_t u8Channel; 152 } HGSMIHANDLERD EREGISTER;150 } HGSMIHANDLERDISABLE; 153 151 154 152 #endif /* VBOX_WITH_HGSMI */ -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxFrameBuffer.h
r20349 r20478 495 495 void vboxResizeEvent (VBoxResizeEvent *re); 496 496 497 VBoxVHWASurfacePrimary * vboxGetSurface() { return pDisplay; } 497 498 protected: 498 499 // void resizeGL (int height, int width); … … 547 548 private: 548 549 #ifdef VBOX_WITH_VIDEOHWACCEL 550 int vhwaSurfaceCanCreate(struct _VBOXVHWACMD_SURF_CANCREATE *pCmd); 549 551 int vhwaSurfaceCreate(struct _VBOXVHWACMD_SURF_CREATE *pCmd); 550 552 int vhwaSurfaceDestroy(struct _VBOXVHWACMD_SURF_DESTROY *pCmd); … … 552 554 int vhwaSurfaceUnlock(struct _VBOXVHWACMD_SURF_UNLOCK *pCmd); 553 555 int vhwaSurfaceBlt(struct _VBOXVHWACMD_SURF_BLT *pCmd); 556 int vhwaQueryInfo1(struct _VBOXVHWACMD_QUERYINFO1 *pCmd); 557 int vhwaQueryInfo2(struct _VBOXVHWACMD_QUERYINFO2 *pCmd); 554 558 #endif 555 559 void vboxMakeCurrent();
Note:
See TracChangeset
for help on using the changeset viewer.