VirtualBox

Ignore:
Timestamp:
Nov 12, 2013 12:33:30 PM (11 years ago)
Author:
vboxsync
Message:

Additions/WINNT/Graphics/Video/mp/common/VBoxMPCommon.h,VBoxMPDevExt.h, VBoxMPVidModes.cpp and Additions/WINNT/Graphics/Video/mp/common/xpdm/VBoxMPDriver.cpp, VBoxMPIOCTL.cpp: resolution for the bug (XTracker: 7081) : wherein laptop LCD can be set to wrong resolution if connected to secondary display monitor. Use of global video resolution table has been replaced with separate table for each secondary monitor.

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/VBoxMPCommon.h

    r48070 r49450  
    3030
    3131/* Video modes related */
    32 #define VBOXMP_MAX_VIDEO_MODES 128
    3332void VBoxMPCmnInitCustomVideoModes(PVBOXMP_DEVEXT pExt);
    3433VIDEO_MODE_INFORMATION* VBoxMPCmnGetCustomVideoModeInfo(ULONG ulIndex);
    3534
    3635#ifdef VBOX_XPDM_MINIPORT
    37 VIDEO_MODE_INFORMATION* VBoxMPCmnGetVideoModeInfo(ULONG ulIndex);
     36VIDEO_MODE_INFORMATION* VBoxMPCmnGetVideoModeInfo(PVBOXMP_DEVEXT pExt, ULONG ulIndex);
    3837VIDEO_MODE_INFORMATION* VBoxMPXpdmCurrentVideoMode(PVBOXMP_DEVEXT pExt);
    39 ULONG VBoxMPXpdmGetVideoModesCount();
     38ULONG VBoxMPXpdmGetVideoModesCount(PVBOXMP_DEVEXT pExt);
    4039void VBoxMPXpdmBuildVideoModesTable(PVBOXMP_DEVEXT pExt);
    4140#endif
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPDevExt.h

    r49332 r49450  
    2828# include <video.h>
    2929# include "common/xpdm/VBoxVideoPortAPI.h"
     30#include <VBox/Hardware/VBoxVideoVBE.h>
    3031#endif
    3132
     
    3738#endif
    3839
     40#define VBOXMP_MAX_VIDEO_MODES 128
    3941typedef struct VBOXMP_COMMON
    4042{
     
    7779
    7880   ULONG iDevice;                              /* Device index: 0 for primary, otherwise a secondary device. */
    79 
     81   /* Standart video modes list.
     82    * Additional space is reserved for custom video modes for VBOX_VIDEO_MAX_SCREENS guest monitors.
     83    * The custom video mode index is alternating for each mode set and 2 indexes are needed for each custom mode.
     84    */
     85   VIDEO_MODE_INFORMATION aVideoModes[VBOXMP_MAX_VIDEO_MODES + VBOX_VIDEO_MAX_SCREENS * 2];
     86   /* Number of available video modes, set by VBoxMPCmnBuildVideoModesTable. */
     87   uint32_t cVideoModes;
    8088   ULONG CurrentMode;                          /* Saved information about video modes */
    8189   ULONG CurrentModeWidth;
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPVidModes.cpp

    r49273 r49450  
    3232/* Custom video modes which are being read from registry at driver startup. */
    3333static VIDEO_MODE_INFORMATION g_CustomVideoModes[VBOX_VIDEO_MAX_SCREENS] = { 0 };
    34 
    35 #ifdef VBOX_XPDM_MINIPORT
    36 /* Standart video modes list.
    37  * Additional space is reserved for custom video modes for VBOX_VIDEO_MAX_SCREENS guest monitors.
    38  * The custom video mode index is alternating for each mode set and 2 indexes are needed for each custom mode.
    39  */
    40 static VIDEO_MODE_INFORMATION g_VideoModes[VBOXMP_MAX_VIDEO_MODES + VBOX_VIDEO_MAX_SCREENS * 2] = { 0 };
    41 
    42 /* Number of available video modes, set by VBoxMPCmnBuildVideoModesTable. */
    43 static uint32_t g_NumVideoModes = 0;
    44 #endif
    4534
    4635static BOOLEAN
     
    218207
    219208#ifdef VBOX_XPDM_MINIPORT
    220 VIDEO_MODE_INFORMATION* VBoxMPCmnGetVideoModeInfo(ULONG ulIndex)
    221 {
    222     return (ulIndex<RT_ELEMENTS(g_VideoModes)) ? &g_VideoModes[ulIndex] : NULL;
     209VIDEO_MODE_INFORMATION* VBoxMPCmnGetVideoModeInfo(PVBOXMP_DEVEXT pExt, ULONG ulIndex)
     210{
     211    return (ulIndex<RT_ELEMENTS(pExt->aVideoModes)) ? &pExt->aVideoModes[ulIndex] : NULL;
    223212}
    224213#endif
     
    728717VIDEO_MODE_INFORMATION* VBoxMPXpdmCurrentVideoMode(PVBOXMP_DEVEXT pExt)
    729718{
    730     return VBoxMPCmnGetVideoModeInfo(pExt->CurrentMode - 1);
    731 }
    732 
    733 ULONG VBoxMPXpdmGetVideoModesCount()
    734 {
    735     return g_NumVideoModes;
     719    return VBoxMPCmnGetVideoModeInfo(pExt, pExt->CurrentMode - 1);
     720}
     721
     722ULONG VBoxMPXpdmGetVideoModesCount(PVBOXMP_DEVEXT pExt)
     723{
     724    return pExt->cVideoModes;
    736725}
    737726
     
    752741     * for custom mode alternating indexes.
    753742     */
    754     cStandartModes = VBoxMPFillModesTable(pExt, pExt->iDevice, g_VideoModes, VBOXMP_MAX_VIDEO_MODES, NULL);
     743    cStandartModes = VBoxMPFillModesTable(pExt, pExt->iDevice, pExt->aVideoModes, VBOXMP_MAX_VIDEO_MODES, NULL);
    755744
    756745    /* Add custom modes for all displays to the table */
     
    772761
    773762            /* Fill the special mode. */
    774             memcpy(&g_VideoModes[iSpecialMode], &g_CustomVideoModes[i], sizeof(VIDEO_MODE_INFORMATION));
    775             g_VideoModes[iSpecialMode].ModeIndex = iSpecialMode + 1;
     763            memcpy(&pDisplayExt->aVideoModes[iSpecialMode], &g_CustomVideoModes[i], sizeof(VIDEO_MODE_INFORMATION));
     764            pDisplayExt->aVideoModes[iSpecialMode].ModeIndex = iSpecialMode + 1;
    776765
    777766            /* Wipe the other entry so it is not selected. */
    778             memcpy(&g_VideoModes[iStandardMode], &g_VideoModes[3], sizeof(VIDEO_MODE_INFORMATION));
    779             g_VideoModes[iStandardMode].ModeIndex = iStandardMode + 1;
     767            memcpy(&pDisplayExt->aVideoModes[iStandardMode], &pDisplayExt->aVideoModes[3], sizeof(VIDEO_MODE_INFORMATION));
     768            pDisplayExt->aVideoModes[iStandardMode].ModeIndex = iStandardMode + 1;
    780769
    781770            pDisplayExt = pDisplayExt->pNext;
     
    784773        {
    785774            /* Should not happen, but better to fallback than to crash. */
    786             memcpy(&g_VideoModes[iModeBase], &g_CustomVideoModes[i], sizeof(VIDEO_MODE_INFORMATION));
    787             g_VideoModes[iModeBase].ModeIndex = iModeBase + 1;
    788 
    789             g_VideoModes[iModeBase + 1] = g_VideoModes[iModeBase];
    790             g_VideoModes[iModeBase + 1].ModeIndex += 1;
     775            memcpy(&pExt->aVideoModes[iModeBase], &g_CustomVideoModes[i], sizeof(VIDEO_MODE_INFORMATION));
     776            pExt->aVideoModes[iModeBase].ModeIndex = iModeBase + 1;
     777
     778            pExt->aVideoModes[iModeBase + 1] = pExt->aVideoModes[iModeBase];
     779            pExt->aVideoModes[iModeBase + 1].ModeIndex += 1;
    791780
    792781            iSpecialMode = iModeBase;
     
    795784        LOG(("added special mode[%d] %dx%d:%d for display %d\n",
    796785             iSpecialMode,
    797              g_VideoModes[iSpecialMode].VisScreenWidth,
    798              g_VideoModes[iSpecialMode].VisScreenHeight,
    799              g_VideoModes[iSpecialMode].BitsPerPlane,
     786             pExt->aVideoModes[iSpecialMode].VisScreenWidth,
     787             pExt->aVideoModes[iSpecialMode].VisScreenHeight,
     788             pExt->aVideoModes[iSpecialMode].BitsPerPlane,
    800789             i));
    801790    }
     
    822811
    823812    /* Update number of modes. Each display has 2 entries for alternating custom mode index. */
    824     g_NumVideoModes = cStandartModes + cCustomModes * 2;
     813    pExt->cVideoModes = cStandartModes + cCustomModes * 2;
    825814
    826815    if (bHaveSpecial)
     
    873862         */
    874863        specialMode.ModeIndex = iSpecialModeElement + 1;
    875         memcpy(&g_VideoModes[iSpecialModeElement], &specialMode, sizeof(VIDEO_MODE_INFORMATION));
     864        memcpy(&pExt->aVideoModes[iSpecialModeElement], &specialMode, sizeof(VIDEO_MODE_INFORMATION));
    876865
    877866        /* Save special mode in the custom modes table */
     
    879868
    880869        /* Wipe the old entry so the special mode will be found in the new positions. */
    881         memcpy(&g_VideoModes[iSpecialModeElementOld], &g_VideoModes[3], sizeof(VIDEO_MODE_INFORMATION));
    882         g_VideoModes[iSpecialModeElementOld].ModeIndex = iSpecialModeElementOld + 1;
     870        memcpy(&pExt->aVideoModes[iSpecialModeElementOld], &pExt->aVideoModes[3], sizeof(VIDEO_MODE_INFORMATION));
     871        pExt->aVideoModes[iSpecialModeElementOld].ModeIndex = iSpecialModeElementOld + 1;
    883872
    884873        /* Save special mode info to registry */
     
    889878    do
    890879    {
    891         LOG(("Filled %d modes", g_NumVideoModes));
    892 
    893         for (uint32_t i=0; i<g_NumVideoModes; ++i)
     880        LOG(("Filled %d modes", pExt->cVideoModes));
     881
     882        for (uint32_t i=0; i < pExt->cVideoModes; ++i)
    894883        {
    895884            LOG(("Mode[%2d]: %4dx%4d:%2d (idx=%d)",
    896                 i, g_VideoModes[i].VisScreenWidth, g_VideoModes[i].VisScreenHeight,
    897                 g_VideoModes[i].BitsPerPlane, g_VideoModes[i].ModeIndex));
     885                 i, pExt->aVideoModes[i].VisScreenWidth, pExt->aVideoModes[i].VisScreenHeight,
     886                 pExt->aVideoModes[i].BitsPerPlane, pExt->aVideoModes[i].ModeIndex));
    898887        }
    899888    } while (0);
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/xpdm/VBoxMPDriver.cpp

    r48944 r49450  
    310310            PVIDEO_MODE_INFORMATION pModes = (PVIDEO_MODE_INFORMATION) RequestPacket->OutputBuffer;
    311311
    312             if (RequestPacket->OutputBufferLength < VBoxMPXpdmGetVideoModesCount()*sizeof(VIDEO_MODE_INFORMATION))
     312            if (RequestPacket->OutputBufferLength < VBoxMPXpdmGetVideoModesCount(pExt)*sizeof(VIDEO_MODE_INFORMATION))
    313313            {
    314314                pStatus->Status = ERROR_INSUFFICIENT_BUFFER;
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/xpdm/VBoxMPIOCTL.cpp

    r48944 r49450  
    193193    }
    194194
    195     pModeInfo = VBoxMPCmnGetVideoModeInfo(RequestedMode-1);
     195    pModeInfo = VBoxMPCmnGetVideoModeInfo(pExt, RequestedMode-1);
    196196    if (!pModeInfo)
    197197    {
     
    250250    VBoxMPXpdmBuildVideoModesTable(pExt);
    251251
    252     pNumModes->NumModes = VBoxMPXpdmGetVideoModesCount();
     252    pNumModes->NumModes = VBoxMPXpdmGetVideoModesCount(pExt);
    253253    pNumModes->ModeInformationLength = sizeof(VIDEO_MODE_INFORMATION);
    254254    pStatus->Information = sizeof(VIDEO_NUM_MODES);
     
    265265    LOGF_ENTER();
    266266
    267     ULONG ulSize = VBoxMPXpdmGetVideoModesCount()*sizeof(VIDEO_MODE_INFORMATION);
     267    ULONG ulSize = VBoxMPXpdmGetVideoModesCount(pExt)*sizeof(VIDEO_MODE_INFORMATION);
    268268    pStatus->Information = ulSize;
    269     VideoPortMoveMemory(pModes, VBoxMPCmnGetVideoModeInfo(0), ulSize);
     269    VideoPortMoveMemory(pModes, VBoxMPCmnGetVideoModeInfo(pExt, 0), ulSize);
    270270
    271271    LOGF_LEAVE();
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