VirtualBox

Changeset 27891 in vbox for trunk/src/VBox/Devices/VMMDev


Ignore:
Timestamp:
Mar 31, 2010 1:02:04 PM (15 years ago)
Author:
vboxsync
Message:

VMMDev: separately process video mode hints for different guest displays (xTracker 4655)

Location:
trunk/src/VBox/Devices/VMMDev
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/VMMDev/VMMDev.cpp

    r27797 r27891  
    872872                VMMDevDisplayChangeRequest *displayChangeRequest = (VMMDevDisplayChangeRequest*)pRequestHeader;
    873873
     874                DISPLAYCHANGEREQUEST *pRequest = &pThis->displayChangeData.aRequests[0];
     875
    874876                if (displayChangeRequest->eventAck == VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST)
    875877                {
     878                    /* Current request has been read at least once. */
     879                    pRequest->fPending = false;
     880
     881                    /* Check if there are more pending requests. */
     882                    int i;
     883                    for (i = 1; i < RT_ELEMENTS(pThis->displayChangeData.aRequests); i++)
     884                    {
     885                        if (pThis->displayChangeData.aRequests[i].fPending)
     886                        {
     887                            VMMDevNotifyGuest (pThis, VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST);
     888                            break;
     889                        }
     890                    }
     891
    876892                    /* Remember which resolution the client has queried, subsequent reads
    877893                     * will return the same values. */
    878                     pThis->lastReadDisplayChangeRequest = pThis->displayChangeRequest;
    879                     pThis->fGuestSentChangeEventAck = true;
    880                 }
    881 
    882                 if (pThis->fGuestSentChangeEventAck)
    883                 {
    884                     displayChangeRequest->xres = pThis->lastReadDisplayChangeRequest.xres;
    885                     displayChangeRequest->yres = pThis->lastReadDisplayChangeRequest.yres;
    886                     displayChangeRequest->bpp  = pThis->lastReadDisplayChangeRequest.bpp;
     894                    pRequest->lastReadDisplayChangeRequest = pRequest->displayChangeRequest;
     895                    pThis->displayChangeData.fGuestSentChangeEventAck = true;
     896                }
     897
     898                if (pThis->displayChangeData.fGuestSentChangeEventAck)
     899                {
     900                    displayChangeRequest->xres = pRequest->lastReadDisplayChangeRequest.xres;
     901                    displayChangeRequest->yres = pRequest->lastReadDisplayChangeRequest.yres;
     902                    displayChangeRequest->bpp  = pRequest->lastReadDisplayChangeRequest.bpp;
    887903                }
    888904                else
     
    891907                     * read the last valid video mode hint. This happens when the guest X server
    892908                     * determines the initial mode. */
    893                     displayChangeRequest->xres = pThis->displayChangeRequest.xres;
    894                     displayChangeRequest->yres = pThis->displayChangeRequest.yres;
    895                     displayChangeRequest->bpp = pThis->displayChangeRequest.bpp;
     909                    displayChangeRequest->xres = pRequest->displayChangeRequest.xres;
     910                    displayChangeRequest->yres = pRequest->displayChangeRequest.yres;
     911                    displayChangeRequest->bpp = pRequest->displayChangeRequest.bpp;
    896912                }
    897913                Log(("VMMDev: returning display change request xres = %d, yres = %d, bpp = %d\n",
     
    913929                VMMDevDisplayChangeRequest2 *displayChangeRequest = (VMMDevDisplayChangeRequest2*)pRequestHeader;
    914930
     931                DISPLAYCHANGEREQUEST *pRequest = NULL;
     932
    915933                if (displayChangeRequest->eventAck == VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST)
    916934                {
    917                     /* Remember which resolution the client has queried, subsequent reads
    918                      * will return the same values. */
    919                     pThis->lastReadDisplayChangeRequest = pThis->displayChangeRequest;
    920                     pThis->fGuestSentChangeEventAck = true;
    921                 }
    922 
    923                 if (pThis->fGuestSentChangeEventAck)
    924                 {
    925                     displayChangeRequest->xres    = pThis->lastReadDisplayChangeRequest.xres;
    926                     displayChangeRequest->yres    = pThis->lastReadDisplayChangeRequest.yres;
    927                     displayChangeRequest->bpp     = pThis->lastReadDisplayChangeRequest.bpp;
    928                     displayChangeRequest->display = pThis->lastReadDisplayChangeRequest.display;
     935                    /* Select a pending request to report. */
     936                    int i;
     937                    for (i = 0; i < RT_ELEMENTS(pThis->displayChangeData.aRequests); i++)
     938                    {
     939                        pRequest = &pThis->displayChangeData.aRequests[i];
     940                        if (pRequest->fPending)
     941                        {
     942                            /* Remember which request should be reported. */
     943                            pThis->displayChangeData.iCurrentMonitor = i;
     944                            Log3(("VMMDev: will report pending request for %d\n",
     945                                  i));
     946                            break;
     947                        }
     948                    }
     949
     950                    /* Check if there are more pending requests. */
     951                    i++;
     952                    for (; i < RT_ELEMENTS(pThis->displayChangeData.aRequests); i++)
     953                    {
     954                        if (pThis->displayChangeData.aRequests[i].fPending)
     955                        {
     956                            VMMDevNotifyGuest (pThis, VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST);
     957                            Log3(("VMMDev: another pending at %d\n",
     958                                  i));
     959                            break;
     960                        }
     961                    }
     962
     963                    if (pRequest)
     964                    {
     965                        /* Current request has been read at least once. */
     966                        pRequest->fPending = false;
     967
     968                        /* Remember which resolution the client has queried, subsequent reads
     969                         * will return the same values. */
     970                        pRequest->lastReadDisplayChangeRequest = pRequest->displayChangeRequest;
     971                        pThis->displayChangeData.fGuestSentChangeEventAck = true;
     972                    }
     973                    else
     974                    {
     975                         Log3(("VMMDev: no pending request!!!\n"));
     976                    }
     977                }
     978
     979                if (!pRequest)
     980                {
     981                    Log3(("VMMDev: default to %d\n",
     982                          pThis->displayChangeData.iCurrentMonitor));
     983                    pRequest = &pThis->displayChangeData.aRequests[pThis->displayChangeData.iCurrentMonitor];
     984                }
     985
     986                if (pThis->displayChangeData.fGuestSentChangeEventAck)
     987                {
     988                    displayChangeRequest->xres    = pRequest->lastReadDisplayChangeRequest.xres;
     989                    displayChangeRequest->yres    = pRequest->lastReadDisplayChangeRequest.yres;
     990                    displayChangeRequest->bpp     = pRequest->lastReadDisplayChangeRequest.bpp;
     991                    displayChangeRequest->display = pRequest->lastReadDisplayChangeRequest.display;
    929992                }
    930993                else
     
    933996                     * read the last valid video mode hint. This happens when the guest X server
    934997                     * determines the initial video mode. */
    935                     displayChangeRequest->xres    = pThis->displayChangeRequest.xres;
    936                     displayChangeRequest->yres    = pThis->displayChangeRequest.yres;
    937                     displayChangeRequest->bpp     = pThis->displayChangeRequest.bpp;
    938                     displayChangeRequest->display = pThis->displayChangeRequest.display;
     998                    displayChangeRequest->xres    = pRequest->displayChangeRequest.xres;
     999                    displayChangeRequest->yres    = pRequest->displayChangeRequest.yres;
     1000                    displayChangeRequest->bpp     = pRequest->displayChangeRequest.bpp;
     1001                    displayChangeRequest->display = pRequest->displayChangeRequest.display;
    9391002                }
    9401003                Log(("VMMDev: returning display change request xres = %d, yres = %d, bpp = %d at %d\n",
     
    19702033{
    19712034    VMMDevState *pThis = IVMMDEVPORT_2_VMMDEVSTATE(pInterface);
     2035
     2036    if (display >= RT_ELEMENTS(pThis->displayChangeData.aRequests))
     2037    {
     2038        return VERR_INVALID_PARAMETER;
     2039    }
     2040
    19722041    PDMCritSectEnter(&pThis->CritSect, VERR_SEM_BUSY);
    19732042
     2043    DISPLAYCHANGEREQUEST *pRequest = &pThis->displayChangeData.aRequests[display];
     2044
    19742045    /* Verify that the new resolution is different and that guest does not yet know about it. */
    1975     bool fSameResolution = (!xres || (pThis->lastReadDisplayChangeRequest.xres == xres)) &&
    1976                            (!yres || (pThis->lastReadDisplayChangeRequest.yres == yres)) &&
    1977                            (!bpp || (pThis->lastReadDisplayChangeRequest.bpp == bpp)) &&
    1978                            pThis->lastReadDisplayChangeRequest.display == display;
     2046    bool fSameResolution = (!xres || (pRequest->lastReadDisplayChangeRequest.xres == xres)) &&
     2047                           (!yres || (pRequest->lastReadDisplayChangeRequest.yres == yres)) &&
     2048                           (!bpp || (pRequest->lastReadDisplayChangeRequest.bpp == bpp)) &&
     2049                           pRequest->lastReadDisplayChangeRequest.display == display;
    19792050
    19802051    if (!xres && !yres && !bpp)
     
    19852056
    19862057    Log3(("vmmdevRequestDisplayChange: same=%d. new: xres=%d, yres=%d, bpp=%d, display=%d. old: xres=%d, yres=%d, bpp=%d, display=%d.\n",
    1987           fSameResolution, xres, yres, bpp, display, pThis->lastReadDisplayChangeRequest.xres, pThis->lastReadDisplayChangeRequest.yres, pThis->lastReadDisplayChangeRequest.bpp, pThis->lastReadDisplayChangeRequest.display));
     2058          fSameResolution, xres, yres, bpp, display, pRequest->lastReadDisplayChangeRequest.xres, pRequest->lastReadDisplayChangeRequest.yres, pRequest->lastReadDisplayChangeRequest.bpp, pRequest->lastReadDisplayChangeRequest.display));
    19882059
    19892060    if (!fSameResolution)
     
    19932064
    19942065        /* we could validate the information here but hey, the guest can do that as well! */
    1995         pThis->displayChangeRequest.xres    = xres;
    1996         pThis->displayChangeRequest.yres    = yres;
    1997         pThis->displayChangeRequest.bpp     = bpp;
    1998         pThis->displayChangeRequest.display = display;
     2066        pRequest->displayChangeRequest.xres    = xres;
     2067        pRequest->displayChangeRequest.yres    = yres;
     2068        pRequest->displayChangeRequest.bpp     = bpp;
     2069        pRequest->displayChangeRequest.display = display;
     2070        pRequest->fPending = true;
    19992071
    20002072        /* IRQ so the guest knows what's going on */
     
    22572329    SSMR3PutU32(pSSM, pThis->fu32AdditionsOk);
    22582330    SSMR3PutU32(pSSM, pThis->u32VideoAccelEnabled);
    2259     SSMR3PutBool(pSSM, pThis->fGuestSentChangeEventAck);
     2331    SSMR3PutBool(pSSM, pThis->displayChangeData.fGuestSentChangeEventAck);
    22602332
    22612333    SSMR3PutU32(pSSM, pThis->guestCaps);
     
    23282400    SSMR3GetU32(pSSM, &pThis->u32VideoAccelEnabled);
    23292401    if (uVersion > 10)
    2330         SSMR3GetBool(pSSM, &pThis->fGuestSentChangeEventAck);
     2402        SSMR3GetBool(pSSM, &pThis->displayChangeData.fGuestSentChangeEventAck);
    23312403
    23322404    rc = SSMR3GetU32(pSSM, &pThis->guestCaps);
     
    24752547
    24762548    /* clear pending display change request. */
    2477     memset (&pThis->lastReadDisplayChangeRequest, 0, sizeof (pThis->lastReadDisplayChangeRequest));
    2478     pThis->fGuestSentChangeEventAck = false;
     2549    int i;
     2550    for (i = 0; i < RT_ELEMENTS(pThis->displayChangeData.aRequests); i++)
     2551    {
     2552        DISPLAYCHANGEREQUEST *pRequest = &pThis->displayChangeData.aRequests[i];
     2553        memset (&pRequest->lastReadDisplayChangeRequest, 0, sizeof (pRequest->lastReadDisplayChangeRequest));
     2554    }
     2555    pThis->displayChangeData.iCurrentMonitor = 0;
     2556    pThis->displayChangeData.fGuestSentChangeEventAck = false;
    24792557
    24802558    /* disable seamless mode */
  • trunk/src/VBox/Devices/VMMDev/VMMDevState.h

    r27049 r27891  
    2828
    2929#define TIMESYNC_BACKDOOR
     30
     31typedef struct DISPLAYCHANGEINFO
     32{
     33    uint32_t xres;
     34    uint32_t yres;
     35    uint32_t bpp;
     36    uint32_t display;
     37} DISPLAYCHANGEINFO;
     38
     39typedef struct DISPLAYCHANGEREQUEST
     40{
     41    bool fPending;
     42    DISPLAYCHANGEINFO displayChangeRequest;
     43    DISPLAYCHANGEINFO lastReadDisplayChangeRequest;
     44} DISPLAYCHANGEREQUEST;
     45
     46typedef struct DISPLAYCHANGEDATA
     47{
     48    /* Which monitor is being reported to the guest. */
     49    int iCurrentMonitor;
     50
     51    /** true if the guest responded to VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST at least once */
     52    bool fGuestSentChangeEventAck;
     53
     54    DISPLAYCHANGEREQUEST aRequests[64]; // @todo maxMonitors
     55} DISPLAYCHANGEDATA;
     56
    3057
    3158/** device structure containing all state information */
     
    117144    uint32_t u32VideoAccelEnabled;
    118145
    119     /** true if the guest responded to VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST at least once */
    120     bool fGuestSentChangeEventAck;
    121 
    122     /** resolution change request */
    123     struct
    124     {
    125         uint32_t xres;
    126         uint32_t yres;
    127         uint32_t bpp;
    128         uint32_t display;
    129     } displayChangeRequest,
    130       lastReadDisplayChangeRequest;
     146    DISPLAYCHANGEDATA displayChangeData;
    131147
    132148    /** credentials for guest logon purposes */
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