Changeset 44334 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Jan 23, 2013 1:35:15 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 83287
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Video/mp
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPVidModes.cpp
r44149 r44334 505 505 } 506 506 507 #ifdef VBOX_WDDM_MINIPORT 508 static const uint32_t g_aVBoxVidModesSupportedBpps[] = { 509 32 510 #ifndef VBOX_WITHOUT_24BPP_MODES 511 , 24 512 #endif 513 , 16 514 #ifdef VBOX_WITH_8BPP_MODES 515 , 8 516 #endif 517 }; 518 DECLINLINE(BOOLEAN) VBoxMPIsSupportedBpp(uint32_t bpp) 519 { 520 for (int i = 0; i < RT_ELEMENTS(g_aVBoxVidModesSupportedBpps); ++i) 521 { 522 if (bpp == g_aVBoxVidModesSupportedBpps[i]) 523 return TRUE; 524 } 525 return FALSE; 526 } 527 528 DECLINLINE(uint32_t) VBoxMPAdjustBpp(uint32_t bpp) 529 { 530 if (VBoxMPIsSupportedBpp(bpp)) 531 return bpp; 532 Assert(g_aVBoxVidModesSupportedBpps[0] == 32); 533 return g_aVBoxVidModesSupportedBpps[0]; 534 } 535 #endif 507 536 /* Updates missing video mode params with current values, 508 537 * Checks if resulting mode is liked by the host and fits into VRAM. … … 533 562 xres = xres ? xres:pAllocData->SurfDesc.width; 534 563 yres = yres ? yres:pAllocData->SurfDesc.height; 535 bpp = bpp ? bpp :pAllocData->SurfDesc.bpp; 564 /* VBox WDDM driver does not allow 24 modes since OS could choose the 24bit mode as default in that case, 565 * the pExt->aSources[iDisplay].AllocData.SurfDesc.bpp could be initially 24 though, 566 * i.e. when driver occurs the current mode on driver load via DxgkCbAcquirePostDisplayOwnership 567 * and until driver reports the supported modes 568 * This is true for Win8 Display-Only driver currently since DxgkCbAcquirePostDisplayOwnership is only used by it 569 * 570 * This is why we need to adjust the current mode bpp to the value we actually report as supported */ 571 bpp = bpp ? bpp : VBoxMPAdjustBpp(pAllocData->SurfDesc.bpp); 536 572 #endif 537 573 } … … 551 587 if (!VBoxMPValidateVideoModeParamsGuest(pExt, iDisplay, xres, yres, bpp)) 552 588 { 553 WARN _NOBP(("GUEST does not like special mode %dx%d:%d for display %d", xres, yres, bpp, iDisplay));589 WARN(("GUEST does not like special mode %dx%d:%d for display %d", xres, yres, bpp, iDisplay)); 554 590 return FALSE; 555 591 } … … 976 1012 if (pModes->cModes < RT_ELEMENTS(pModes->aModes)) 977 1013 { 978 int foundIdx; 979 VBoxFillVidModeInfo(&pModes->aModes[pModes->cModes], pAllocData->SurfDesc.width, pAllocData->SurfDesc.height, pAllocData->SurfDesc.bpp, 1/*index*/, 0); 980 if ((foundIdx=VBoxMPFindVideoMode(pModes->aModes, pModes->cModes, &pModes->aModes[pModes->cModes]))>=0) 981 { 982 pModes->iPreferredMode = foundIdx; 983 } 984 else 985 { 986 pModes->iPreferredMode = pModes->cModes; 987 ++pModes->cModes; 988 } 1014 /* VBox WDDM driver does not allow 24 modes since OS could choose the 24bit mode as default in that case, 1015 * the pExt->aSources[iDisplay].AllocData.SurfDesc.bpp could be initially 24 though, 1016 * i.e. when driver occurs the current mode on driver load via DxgkCbAcquirePostDisplayOwnership 1017 * and until driver reports the supported modes 1018 * This is true for Win8 Display-Only driver currently since DxgkCbAcquirePostDisplayOwnership is only used by it 1019 * 1020 * This is why we check the bpp to be supported here and add the current mode to the list only in that case */ 1021 if (VBoxMPIsSupportedBpp(pAllocData->SurfDesc.bpp)) 1022 { 1023 int foundIdx; 1024 VBoxFillVidModeInfo(&pModes->aModes[pModes->cModes], pAllocData->SurfDesc.width, pAllocData->SurfDesc.height, pAllocData->SurfDesc.bpp, 1/*index*/, 0); 1025 if ((foundIdx=VBoxMPFindVideoMode(pModes->aModes, pModes->cModes, &pModes->aModes[pModes->cModes]))>=0) 1026 { 1027 pModes->iPreferredMode = foundIdx; 1028 } 1029 else 1030 { 1031 pModes->iPreferredMode = pModes->cModes; 1032 ++pModes->cModes; 1033 } 989 1034 990 1035 #ifdef VBOX_WITH_8BPP_MODES 991 int bytesPerPixel=1;1036 int bytesPerPixel=1; 992 1037 #else 993 int bytesPerPixel=2; 994 #endif 995 for (; bytesPerPixel<=4; bytesPerPixel++) 996 { 997 int bpp = 8*bytesPerPixel; 998 999 if (bpp == pAllocData->SurfDesc.bpp) 1000 continue; 1001 1002 if (!VBoxMPValidateVideoModeParamsGuest(pExt, VidPnTargetId, 1003 pAllocData->SurfDesc.width, pAllocData->SurfDesc.height, 1004 bpp)) 1005 continue; 1006 1007 if (pModes->cModes >= RT_ELEMENTS(pModes->aModes)) 1038 int bytesPerPixel=2; 1039 #endif 1040 for (; bytesPerPixel<=4; bytesPerPixel++) 1008 1041 { 1009 WARN(("ran out of video modes 2")); 1010 break; 1011 } 1012 1013 VBoxFillVidModeInfo(&pModes->aModes[pModes->cModes], 1014 pAllocData->SurfDesc.width, pAllocData->SurfDesc.height, 1015 bpp, pModes->cModes, 0); 1016 if (VBoxMPFindVideoMode(pModes->aModes, pModes->cModes, &pModes->aModes[pModes->cModes]) < 0) 1017 { 1018 ++pModes->cModes; 1042 int bpp = 8*bytesPerPixel; 1043 1044 if (bpp == pAllocData->SurfDesc.bpp) 1045 continue; 1046 1047 if (!VBoxMPValidateVideoModeParamsGuest(pExt, VidPnTargetId, 1048 pAllocData->SurfDesc.width, pAllocData->SurfDesc.height, 1049 bpp)) 1050 continue; 1051 1052 if (pModes->cModes >= RT_ELEMENTS(pModes->aModes)) 1053 { 1054 WARN(("ran out of video modes 2")); 1055 break; 1056 } 1057 1058 VBoxFillVidModeInfo(&pModes->aModes[pModes->cModes], 1059 pAllocData->SurfDesc.width, pAllocData->SurfDesc.height, 1060 bpp, pModes->cModes, 0); 1061 if (VBoxMPFindVideoMode(pModes->aModes, pModes->cModes, &pModes->aModes[pModes->cModes]) < 0) 1062 { 1063 ++pModes->cModes; 1064 } 1019 1065 } 1020 1066 } … … 1227 1273 /* @todo: this info should go from the target actually */ 1228 1274 PVBOXWDDM_SOURCE pSource = &pExt->aSources[pMode->Mode.Id]; 1275 1276 UINT newWidth = pMode->Mode.Width; 1277 UINT newHeight = pMode->Mode.Height; 1278 UINT newBpp = pMode->Mode.BitsPerPixel; 1279 1280 if (!VBoxMPValidateVideoModeParams(pExt, pMode->Mode.Id, newWidth, newHeight, newBpp)) 1281 { 1282 PVBOXWDDM_SOURCE pSource = &pExt->aSources[pMode->Mode.Id]; 1283 pMode->fFlags |= VBOXWDDM_ADJUSTVIDEOMODE_F_UNSUPPORTED; 1284 } 1285 1286 if (pMode->Mode.Width != newWidth 1287 || pMode->Mode.Height != newHeight 1288 || pMode->Mode.BitsPerPixel != newBpp) 1289 { 1290 pMode->fFlags |= VBOXWDDM_ADJUSTVIDEOMODE_F_ADJUSTED; 1291 pMode->Mode.Width = newWidth; 1292 pMode->Mode.Height = newHeight; 1293 pMode->Mode.BitsPerPixel = newBpp; 1294 } 1295 1229 1296 if (pTarget->HeightVisible /* <- active */ 1230 1297 && pSource->AllocData.SurfDesc.width == pMode->Mode.Width … … 1232 1299 && pSource->AllocData.SurfDesc.bpp == pMode->Mode.BitsPerPixel) 1233 1300 { 1234 pMode->fFlags = VBOXWDDM_ADJUSTVIDEOMODE_F_CURRENT;1235 return;1236 }1237 1238 UINT newWidth = pMode->Mode.Width;1239 UINT newHeight = pMode->Mode.Height;1240 UINT newBpp = pMode->Mode.BitsPerPixel;1241 1242 if (!VBoxMPValidateVideoModeParams(pExt, pMode->Mode.Id, newWidth, newHeight, newBpp))1243 {1244 PVBOXWDDM_SOURCE pSource = &pExt->aSources[pMode->Mode.Id];1245 pMode->fFlags = VBOXWDDM_ADJUSTVIDEOMODE_F_UNSUPPORTED;1246 }1247 1248 if (pMode->Mode.Width != newWidth1249 || pMode->Mode.Height != newHeight1250 || pMode->Mode.BitsPerPixel != newBpp)1251 {1252 pMode->fFlags |= VBOXWDDM_ADJUSTVIDEOMODE_F_ADJUSTED;1253 pMode->Mode.Width = newWidth;1254 pMode->Mode.Height = newHeight;1255 pMode->Mode.BitsPerPixel = newBpp;1256 }1257 1258 if (pTarget->HeightVisible /* <- active */1259 && pSource->AllocData.SurfDesc.width == pMode->Mode.Width1260 && pSource->AllocData.SurfDesc.height == pMode->Mode.Height1261 && pSource->AllocData.SurfDesc.bpp == pMode->Mode.BitsPerPixel)1262 {1263 1301 pMode->fFlags |= VBOXWDDM_ADJUSTVIDEOMODE_F_CURRENT; 1264 1302 if (pMode->fFlags & VBOXWDDM_ADJUSTVIDEOMODE_F_UNSUPPORTED) 1265 1303 { 1266 WARN(("current mode is reported as unsupported, cleaning the unsupported flag")); 1267 pMode->fFlags &= ~VBOXWDDM_ADJUSTVIDEOMODE_F_UNSUPPORTED; 1304 WARN(("current mode is reported as unsupported")); 1268 1305 } 1269 1306 } -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp
r44331 r44334 4248 4248 VBoxWddmAdjustModes(pDevExt, cModes, pPodesInfo->aScreenInfos); 4249 4249 Status = STATUS_SUCCESS; 4250 break; 4250 4251 } 4251 4252 case VBOXESC_SHRC_ADDREF:
Note:
See TracChangeset
for help on using the changeset viewer.