Changeset 45037 in vbox
- Timestamp:
- Mar 14, 2013 11:29:33 AM (12 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Video/mp
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPDevExt.h
r44529 r45037 64 64 /** Context information needed to submit commands to the host. */ 65 65 HGSMIGUESTCOMMANDCONTEXT guestCtx; 66 67 BOOLEAN fAnyX; /* Unrestricted horizontal resolution flag. */ 66 68 } VBOXMP_COMMON, *PVBOXMP_COMMON; 67 69 … … 83 85 ULONG ulFrameBufferOffset; /* The framebuffer position in the VRAM. */ 84 86 ULONG ulFrameBufferSize; /* The size of the current framebuffer. */ 87 88 uint8_t iInvocationCounter; 89 uint32_t Prev_xres; 90 uint32_t Prev_yres; 91 uint32_t Prev_bpp; 85 92 #endif /*VBOX_XPDM_MINIPORT*/ 86 93 … … 177 184 178 185 HGSMIAREA areaDisplay; /* Entire VRAM chunk for this display device. */ 179 BOOLEAN fAnyX; /* Unrestricted horizontal resolution flag. */180 186 } VBOXMP_DEVEXT, *PVBOXMP_DEVEXT; 181 187 -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPVidModes.cpp
r44529 r45037 36 36 /* Standart video modes list. 37 37 * Additional space is reserved for custom video modes for VBOX_VIDEO_MAX_SCREENS guest monitors. 38 * The custom video mode index is alternating and 2 indexes are reserved for the lastcustom mode.38 * The custom video mode index is alternating for each mode set and 2 indexes are needed for each custom mode. 39 39 */ 40 static VIDEO_MODE_INFORMATION g_VideoModes[VBOXMP_MAX_VIDEO_MODES + VBOX_VIDEO_MAX_SCREENS +2] = { 0 };40 static VIDEO_MODE_INFORMATION g_VideoModes[VBOXMP_MAX_VIDEO_MODES + VBOX_VIDEO_MAX_SCREENS * 2] = { 0 }; 41 41 42 42 /* Number of available video modes, set by VBoxMPCmnBuildVideoModesTable. */ … … 420 420 421 421 /* round down width to be a multiple of 8 if necessary */ 422 if (! pExt->fAnyX)422 if (!VBoxCommonFromDeviceExt(pExt)->fAnyX) 423 423 { 424 424 xres &= 0xFFF8; … … 574 574 575 575 /* Round down width to be a multiple of 8 if necessary */ 576 if (! pExt->fAnyX)576 if (!VBoxCommonFromDeviceExt(pExt)->fAnyX) 577 577 { 578 578 xres &= 0xFFF8; … … 740 740 VIDEO_MODE_INFORMATION specialMode; 741 741 742 /* Fill table with standart modes and ones manually added to registry */ 743 cStandartModes = VBoxMPFillModesTable(pExt, pExt->iDevice, g_VideoModes, RT_ELEMENTS(g_VideoModes), NULL); 742 /* Fill table with standart modes and ones manually added to registry. 743 * Up to VBOXMP_MAX_VIDEO_MODES elements can be used, the rest is reserved 744 * for custom mode alternating indexes. 745 */ 746 cStandartModes = VBoxMPFillModesTable(pExt, pExt->iDevice, g_VideoModes, VBOXMP_MAX_VIDEO_MODES, NULL); 744 747 745 748 /* Add custom modes for all displays to the table */ 746 749 cCustomModes = VBoxCommonFromDeviceExt(pExt)->cDisplays; 750 PVBOXMP_DEVEXT pDisplayExt = pExt->pPrimary; /* Corresponds to the display number in the loop. */ 747 751 for (uint32_t i=0; i<cCustomModes; i++) 748 752 { 749 memcpy(&g_VideoModes[cStandartModes+i], &g_CustomVideoModes[i], sizeof(VIDEO_MODE_INFORMATION)); 750 g_VideoModes[cStandartModes+i].ModeIndex = cStandartModes+i+1; 753 /* Make 2 entries in the video mode table. */ 754 uint32_t iModeBase = cStandartModes + 2*i; 755 uint32_t iSpecialMode; 756 757 if (pDisplayExt) 758 { 759 /* Take the alternating index into account. */ 760 BOOLEAN bAlternativeIndex = (pDisplayExt->iInvocationCounter % 2)? TRUE: FALSE; 761 762 iSpecialMode = iModeBase + (bAlternativeIndex? 1: 0); 763 uint32_t iStandardMode = iModeBase + (bAlternativeIndex? 0: 1); 764 765 /* Fill the special mode. */ 766 memcpy(&g_VideoModes[iSpecialMode], &g_CustomVideoModes[i], sizeof(VIDEO_MODE_INFORMATION)); 767 g_VideoModes[iSpecialMode].ModeIndex = iSpecialMode + 1; 768 769 /* Wipe the other entry so it is not selected. */ 770 memcpy(&g_VideoModes[iStandardMode], &g_VideoModes[3], sizeof(VIDEO_MODE_INFORMATION)); 771 g_VideoModes[iStandardMode].ModeIndex = iStandardMode + 1; 772 773 pDisplayExt = pDisplayExt->pNext; 774 } 775 else 776 { 777 /* Should not happen, but better to fallback than to crash. */ 778 memcpy(&g_VideoModes[iModeBase], &g_CustomVideoModes[i], sizeof(VIDEO_MODE_INFORMATION)); 779 g_VideoModes[iModeBase].ModeIndex = iModeBase + 1; 780 781 g_VideoModes[iModeBase + 1] = g_VideoModes[iModeBase]; 782 g_VideoModes[iModeBase + 1].ModeIndex += 1; 783 784 iSpecialMode = iModeBase; 785 } 786 787 LOG(("added special mode[%d] %dx%d:%d for display %d\n", 788 iSpecialMode, 789 g_VideoModes[iSpecialMode].VisScreenWidth, 790 g_VideoModes[iSpecialMode].VisScreenHeight, 791 g_VideoModes[iSpecialMode].BitsPerPlane, 792 i)); 751 793 } 752 794 … … 754 796 bPending = VBoxMPCheckPendingVideoMode(pExt, &specialMode); 755 797 bHaveSpecial = bPending && (pExt->iDevice == specialMode.ModeIndex); 798 LOG(("bPending %d, pExt->iDevice %d, specialMode.ModeIndex %d", 799 bPending, pExt->iDevice, specialMode.ModeIndex)); 756 800 757 801 /* Check the startup case */ … … 759 803 { 760 804 uint32_t xres=0, yres=0, bpp=0; 805 LOG(("Startup for screen %d", pExt->iDevice)); 761 806 /* Check if we could make valid mode from values stored to registry */ 762 807 if (VBoxMPValidateVideoModeParams(pExt, pExt->iDevice, xres, yres, bpp)) 763 808 { 809 LOG(("Startup for screen %d validated %dx%d %d", pExt->iDevice, xres, yres, bpp)); 764 810 VBoxFillVidModeInfo(&specialMode, xres, yres, bpp, 0, 0); 765 811 bHaveSpecial = TRUE; … … 767 813 } 768 814 769 /* Update number of modes */ 770 g_NumVideoModes = cStandartModes + cCustomModes; 771 772 if (!bHaveSpecial) 773 { 774 /* Just add 2 dummy modes to maintain table size. */ 775 memcpy(&g_VideoModes[g_NumVideoModes], &g_VideoModes[2], sizeof(VIDEO_MODE_INFORMATION)); 776 g_VideoModes[g_NumVideoModes].ModeIndex = g_NumVideoModes+1; 777 g_NumVideoModes++; 778 memcpy(&g_VideoModes[g_NumVideoModes], &g_VideoModes[2], sizeof(VIDEO_MODE_INFORMATION)); 779 g_VideoModes[g_NumVideoModes].ModeIndex = g_NumVideoModes+1; 780 g_NumVideoModes++; 781 } 782 else 815 /* Update number of modes. Each display has 2 entries for alternating custom mode index. */ 816 g_NumVideoModes = cStandartModes + cCustomModes * 2; 817 818 if (bHaveSpecial) 783 819 { 784 820 /* We need to alternate mode index entry for a pending mode change, … … 787 823 * regardless of conditions always add 2 entries to the table. 788 824 */ 789 static int s_InvocationCounter=0;790 825 BOOLEAN bAlternativeIndex = FALSE; 791 826 792 static uint32_t s_Prev_xres=0; 793 static uint32_t s_Prev_yres=0; 794 static uint32_t s_Prev_bpp=0; 795 BOOLEAN bChanged = (s_Prev_xres!=specialMode.VisScreenWidth 796 || s_Prev_yres!=specialMode.VisScreenHeight 797 || s_Prev_bpp!=specialMode.BitsPerPlane); 827 BOOLEAN bChanged = (pExt->Prev_xres!=specialMode.VisScreenWidth 828 || pExt->Prev_yres!=specialMode.VisScreenHeight 829 || pExt->Prev_bpp!=specialMode.BitsPerPlane); 830 831 LOG(("prev %dx%dx%d, special %dx%dx%d", 832 pExt->Prev_xres, pExt->Prev_yres, pExt->Prev_bpp, 833 specialMode.VisScreenWidth, specialMode.VisScreenHeight, specialMode.BitsPerPlane)); 834 798 835 if (bChanged) 799 836 { 800 s_Prev_xres = specialMode.VisScreenWidth; 801 s_Prev_yres = specialMode.VisScreenHeight; 802 s_Prev_bpp = specialMode.BitsPerPlane; 803 } 804 805 /* Make sure there's no other mode in the table with same parameters, 806 * because we need windows to pick up a new video mode index otherwise 807 * actual mode change wouldn't happen. 808 */ 809 int iFoundIdx; 810 uint32_t uiStart=0; 811 812 while (0 <= (iFoundIdx = VBoxMPFindVideoMode(&g_VideoModes[uiStart], g_NumVideoModes-uiStart, &specialMode))) 813 { 814 memcpy(&g_VideoModes[uiStart+iFoundIdx], &g_VideoModes[2], sizeof(VIDEO_MODE_INFORMATION)); 815 g_VideoModes[uiStart+iFoundIdx].ModeIndex = uiStart+iFoundIdx+1; 816 uiStart += iFoundIdx+1; 837 pExt->Prev_xres = specialMode.VisScreenWidth; 838 pExt->Prev_yres = specialMode.VisScreenHeight; 839 pExt->Prev_bpp = specialMode.BitsPerPlane; 817 840 } 818 841 … … 822 845 if (bChanged) 823 846 { 824 s_InvocationCounter++;825 } 826 827 if ( s_InvocationCounter % 2)847 pExt->iInvocationCounter++; 848 } 849 850 if (pExt->iInvocationCounter % 2) 828 851 { 829 852 bAlternativeIndex = TRUE; 830 memcpy(&g_VideoModes[g_NumVideoModes], &g_VideoModes[2], sizeof(VIDEO_MODE_INFORMATION));831 g_VideoModes[g_NumVideoModes].ModeIndex = g_NumVideoModes+1;832 ++g_NumVideoModes; 833 }834 }835 836 LOG(("add special mode[%d] %dx%d:%d for display %d (bChanged=%d, bAl retnativeIndex=%d)",837 g_NumVideoModes, specialMode.VisScreenWidth, specialMode.VisScreenHeight, specialMode.BitsPerPlane,853 } 854 } 855 856 uint32_t iSpecialModeElement = cStandartModes + 2 * pExt->iDevice + (bAlternativeIndex? 1: 0); 857 uint32_t iSpecialModeElementOld = cStandartModes + 2 * pExt->iDevice + (bAlternativeIndex? 0: 1); 858 859 LOG(("add special mode[%d] %dx%d:%d for display %d (bChanged=%d, bAlternativeIndex=%d)", 860 iSpecialModeElement, specialMode.VisScreenWidth, specialMode.VisScreenHeight, specialMode.BitsPerPlane, 838 861 pExt->iDevice, bChanged, bAlternativeIndex)); 839 862 … … 841 864 * Note: Y offset isn't used for a host-supplied modes 842 865 */ 843 specialMode.ModeIndex = g_NumVideoModes+1; 844 memcpy(&g_VideoModes[g_NumVideoModes], &specialMode, sizeof(VIDEO_MODE_INFORMATION)); 845 ++g_NumVideoModes; 866 specialMode.ModeIndex = iSpecialModeElement + 1; 867 memcpy(&g_VideoModes[iSpecialModeElement], &specialMode, sizeof(VIDEO_MODE_INFORMATION)); 846 868 847 869 /* Save special mode in the custom modes table */ 848 870 memcpy(&g_CustomVideoModes[pExt->iDevice], &specialMode, sizeof(VIDEO_MODE_INFORMATION)); 849 871 850 851 /* Make sure we've added 2nd mode if necessary to maintain table size */ 852 if (VBoxMPIsStartingUp(pExt, pExt->iDevice)) 853 { 854 memcpy(&g_VideoModes[g_NumVideoModes], &g_VideoModes[g_NumVideoModes-1], sizeof(VIDEO_MODE_INFORMATION)); 855 g_VideoModes[g_NumVideoModes].ModeIndex = g_NumVideoModes+1; 856 ++g_NumVideoModes; 857 } 858 else if (!bAlternativeIndex) 859 { 860 memcpy(&g_VideoModes[g_NumVideoModes], &g_VideoModes[2], sizeof(VIDEO_MODE_INFORMATION)); 861 g_VideoModes[g_NumVideoModes].ModeIndex = g_NumVideoModes+1; 862 ++g_NumVideoModes; 863 } 872 /* Wipe the old entry so the special mode will be found in the new positions. */ 873 memcpy(&g_VideoModes[iSpecialModeElementOld], &g_VideoModes[3], sizeof(VIDEO_MODE_INFORMATION)); 874 g_VideoModes[iSpecialModeElementOld].ModeIndex = iSpecialModeElementOld + 1; 864 875 865 876 /* Save special mode info to registry */ … … 1185 1196 AssertRelease(RT_ELEMENTS(pModes->aModes) > pModes->cModes); /* if not - the driver state is screwed up, @todo: better do KeBugCheckEx here */ 1186 1197 1187 if (! pExt->fAnyX)1198 if (!VBoxCommonFromDeviceExt(pExt)->fAnyX) 1188 1199 { 1189 1200 paAddlModes[i].VisScreenWidth &= 0xFFF8; -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp
r44529 r45037 1155 1155 VBoxWddmInvalidateAllVideoModesInfos(pDevExt); 1156 1156 1157 pDevExt->fAnyX = VBoxVideoAnyWidthAllowed();1157 VBoxCommonFromDeviceExt(pDevExt)->fAnyX = VBoxVideoAnyWidthAllowed(); 1158 1158 #if 0 1159 1159 vboxShRcTreeInit(pDevExt); … … 4319 4319 4320 4320 PVBOXDISPIFESCAPE_ISANYX pIsAnyX = (PVBOXDISPIFESCAPE_ISANYX)pEscapeHdr; 4321 pIsAnyX->u32IsAnyX = pDevExt->fAnyX;4321 pIsAnyX->u32IsAnyX = VBoxCommonFromDeviceExt(pDevExt)->fAnyX; 4322 4322 Status = STATUS_SUCCESS; 4323 4323 break; -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/xpdm/VBoxMPDriver.cpp
r44529 r45037 148 148 VBoxSetupDisplaysHGSMI(&pExt->u.primary.commonInfo, phVRAM, ulApertureSize, cbVRAM, 0); 149 149 150 /* Check if the chip restricts horizontal resolution or not. 151 * Must be done after VBoxSetupDisplaysHGSMI, because it initializes the common structure. 152 */ 153 VideoPortWritePortUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_ID); 154 VideoPortWritePortUshort((PUSHORT)VBE_DISPI_IOPORT_DATA, VBE_DISPI_ID_ANYX); 155 DispiId = VideoPortReadPortUshort((PUSHORT)VBE_DISPI_IOPORT_DATA); 156 157 if (DispiId == VBE_DISPI_ID_ANYX) 158 VBoxCommonFromDeviceExt(pExt)->fAnyX = TRUE; 159 else 160 VBoxCommonFromDeviceExt(pExt)->fAnyX = FALSE; 161 150 162 if (pExt->u.primary.commonInfo.bHGSMI) 151 163 { … … 167 179 { 168 180 PVBOXMP_DEVEXT pExt = (PVBOXMP_DEVEXT) HwDeviceExtension; 169 USHORT DispiId;170 181 171 182 PAGED_CODE(); … … 174 185 /* Initialize the request pointer. */ 175 186 pExt->u.primary.pvReqFlush = NULL; 176 177 /* Check if the chip restricts horizontal resolution or not. */178 VideoPortWritePortUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_ID);179 VideoPortWritePortUshort((PUSHORT)VBE_DISPI_IOPORT_DATA, VBE_DISPI_ID_ANYX);180 DispiId = VideoPortReadPortUshort((PUSHORT)VBE_DISPI_IOPORT_DATA);181 182 if (DispiId == VBE_DISPI_ID_ANYX)183 pExt->fAnyX = TRUE;184 else185 pExt->fAnyX = FALSE;186 187 187 188 VBoxMPCmnInitCustomVideoModes(pExt); … … 539 540 { 540 541 STARTIO_OUT(uint32_t, pu32AnyX); 541 *pu32AnyX = pExt->fAnyX;542 *pu32AnyX = VBoxCommonFromDeviceExt(pExt)->fAnyX; 542 543 pStatus->Information = sizeof (uint32_t); 543 544 bResult = TRUE; -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/xpdm/VBoxMPIOCTL.cpp
r44529 r45037 200 200 } 201 201 202 LOG((" width %d, height %d, bpp %d",203 p ModeInfo->VisScreenWidth, pModeInfo->VisScreenHeight, pModeInfo->BitsPerPlane));202 LOG(("screen [%d] mode %d width %d, height %d, bpp %d", 203 pExt->iDevice, pModeInfo->ModeIndex, pModeInfo->VisScreenWidth, pModeInfo->VisScreenHeight, pModeInfo->BitsPerPlane)); 204 204 205 205 /* Update device info */
Note:
See TracChangeset
for help on using the changeset viewer.