VirtualBox

Changeset 45037 in vbox


Ignore:
Timestamp:
Mar 14, 2013 11:29:33 AM (12 years ago)
Author:
vboxsync
Message:

VBoxVideo: multimonitor resize fixes.

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  
    6464    /** Context information needed to submit commands to the host. */
    6565    HGSMIGUESTCOMMANDCONTEXT guestCtx;
     66
     67    BOOLEAN fAnyX;                      /* Unrestricted horizontal resolution flag. */
    6668} VBOXMP_COMMON, *PVBOXMP_COMMON;
    6769
     
    8385   ULONG ulFrameBufferOffset;                  /* The framebuffer position in the VRAM. */
    8486   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;
    8592#endif /*VBOX_XPDM_MINIPORT*/
    8693
     
    177184
    178185   HGSMIAREA areaDisplay;                      /* Entire VRAM chunk for this display device. */
    179    BOOLEAN fAnyX;                              /* Unrestricted horizontal resolution flag. */
    180186} VBOXMP_DEVEXT, *PVBOXMP_DEVEXT;
    181187
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPVidModes.cpp

    r44529 r45037  
    3636/* Standart video modes list.
    3737 * 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 last custom mode.
     38 * The custom video mode index is alternating for each mode set and 2 indexes are needed for each custom mode.
    3939 */
    40 static VIDEO_MODE_INFORMATION g_VideoModes[VBOXMP_MAX_VIDEO_MODES + VBOX_VIDEO_MAX_SCREENS + 2] = { 0 };
     40static VIDEO_MODE_INFORMATION g_VideoModes[VBOXMP_MAX_VIDEO_MODES + VBOX_VIDEO_MAX_SCREENS * 2] = { 0 };
    4141
    4242/* Number of available video modes, set by VBoxMPCmnBuildVideoModesTable. */
     
    420420
    421421        /* round down width to be a multiple of 8 if necessary */
    422         if (!pExt->fAnyX)
     422        if (!VBoxCommonFromDeviceExt(pExt)->fAnyX)
    423423        {
    424424            xres &= 0xFFF8;
     
    574574
    575575    /* Round down width to be a multiple of 8 if necessary */
    576     if (!pExt->fAnyX)
     576    if (!VBoxCommonFromDeviceExt(pExt)->fAnyX)
    577577    {
    578578        xres &= 0xFFF8;
     
    740740    VIDEO_MODE_INFORMATION specialMode;
    741741
    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);
    744747
    745748    /* Add custom modes for all displays to the table */
    746749    cCustomModes = VBoxCommonFromDeviceExt(pExt)->cDisplays;
     750    PVBOXMP_DEVEXT pDisplayExt = pExt->pPrimary; /* Corresponds to the display number in the loop. */
    747751    for (uint32_t i=0; i<cCustomModes; i++)
    748752    {
    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));
    751793    }
    752794
     
    754796    bPending = VBoxMPCheckPendingVideoMode(pExt, &specialMode);
    755797    bHaveSpecial = bPending && (pExt->iDevice == specialMode.ModeIndex);
     798    LOG(("bPending %d, pExt->iDevice %d, specialMode.ModeIndex %d",
     799          bPending, pExt->iDevice, specialMode.ModeIndex));
    756800
    757801    /* Check the startup case */
     
    759803    {
    760804        uint32_t xres=0, yres=0, bpp=0;
     805        LOG(("Startup for screen %d", pExt->iDevice));
    761806        /* Check if we could make valid mode from values stored to registry */
    762807        if (VBoxMPValidateVideoModeParams(pExt, pExt->iDevice, xres, yres, bpp))
    763808        {
     809            LOG(("Startup for screen %d validated %dx%d %d", pExt->iDevice, xres, yres, bpp));
    764810            VBoxFillVidModeInfo(&specialMode, xres, yres, bpp, 0, 0);
    765811            bHaveSpecial = TRUE;
     
    767813    }
    768814
    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)
    783819    {
    784820        /* We need to alternate mode index entry for a pending mode change,
     
    787823         * regardless of conditions always add 2 entries to the table.
    788824         */
    789         static int s_InvocationCounter=0;
    790825        BOOLEAN bAlternativeIndex = FALSE;
    791826
    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
    798835        if (bChanged)
    799836        {
    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;
    817840        }
    818841
     
    822845            if (bChanged)
    823846            {
    824                 s_InvocationCounter++;
    825             }
    826 
    827             if (s_InvocationCounter % 2)
     847                pExt->iInvocationCounter++;
     848            }
     849
     850            if (pExt->iInvocationCounter % 2)
    828851            {
    829852                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, bAlretnativeIndex=%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,
    838861             pExt->iDevice, bChanged, bAlternativeIndex));
    839862
     
    841864         * Note: Y offset isn't used for a host-supplied modes
    842865         */
    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));
    846868
    847869        /* Save special mode in the custom modes table */
    848870        memcpy(&g_CustomVideoModes[pExt->iDevice], &specialMode, sizeof(VIDEO_MODE_INFORMATION));
    849871
    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;
    864875
    865876        /* Save special mode info to registry */
     
    11851196        AssertRelease(RT_ELEMENTS(pModes->aModes) > pModes->cModes); /* if not - the driver state is screwed up, @todo: better do KeBugCheckEx here */
    11861197
    1187         if (!pExt->fAnyX)
     1198        if (!VBoxCommonFromDeviceExt(pExt)->fAnyX)
    11881199        {
    11891200            paAddlModes[i].VisScreenWidth &= 0xFFF8;
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp

    r44529 r45037  
    11551155                    VBoxWddmInvalidateAllVideoModesInfos(pDevExt);
    11561156
    1157                     pDevExt->fAnyX = VBoxVideoAnyWidthAllowed();
     1157                    VBoxCommonFromDeviceExt(pDevExt)->fAnyX = VBoxVideoAnyWidthAllowed();
    11581158#if 0
    11591159                    vboxShRcTreeInit(pDevExt);
     
    43194319
    43204320                PVBOXDISPIFESCAPE_ISANYX pIsAnyX = (PVBOXDISPIFESCAPE_ISANYX)pEscapeHdr;
    4321                 pIsAnyX->u32IsAnyX = pDevExt->fAnyX;
     4321                pIsAnyX->u32IsAnyX = VBoxCommonFromDeviceExt(pDevExt)->fAnyX;
    43224322                Status = STATUS_SUCCESS;
    43234323                break;
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/xpdm/VBoxMPDriver.cpp

    r44529 r45037  
    148148    VBoxSetupDisplaysHGSMI(&pExt->u.primary.commonInfo, phVRAM, ulApertureSize, cbVRAM, 0);
    149149
     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
    150162    if (pExt->u.primary.commonInfo.bHGSMI)
    151163    {
     
    167179{
    168180    PVBOXMP_DEVEXT pExt = (PVBOXMP_DEVEXT) HwDeviceExtension;
    169     USHORT DispiId;
    170181
    171182    PAGED_CODE();
     
    174185    /* Initialize the request pointer. */
    175186    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     else
    185         pExt->fAnyX = FALSE;
    186187
    187188    VBoxMPCmnInitCustomVideoModes(pExt);
     
    539540        {
    540541            STARTIO_OUT(uint32_t, pu32AnyX);
    541             *pu32AnyX = pExt->fAnyX;
     542            *pu32AnyX = VBoxCommonFromDeviceExt(pExt)->fAnyX;
    542543            pStatus->Information = sizeof (uint32_t);
    543544            bResult = TRUE;
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/xpdm/VBoxMPIOCTL.cpp

    r44529 r45037  
    200200    }
    201201
    202     LOG(("width %d, height %d, bpp %d",
    203          pModeInfo->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));
    204204
    205205    /* Update device info */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette